https://github.com/kul-forbes/ForBES
Revision dc65c2366e10a76b7166228adb65acb9a20d68a0 authored by Pantelis Sopasakis on 05 March 2018, 20:56:03 UTC, committed by GitHub on 05 March 2018, 20:56:03 UTC
crash of Forbes on Matlab 2017a
Tip revision: dc65c2366e10a76b7166228adb65acb9a20d68a0 authored by Pantelis Sopasakis on 05 March 2018, 20:56:03 UTC
Merge pull request #3 from Zilleplus/master
Merge pull request #3 from Zilleplus/master
Tip revision: dc65c23
Direction_cgdyhs.m
% CG, hybrid method Dai-Yuan/Hestenes-Stiefel
function [dir, tau0, cache] = Direction_cgdyhs(prob, opt, it, restart, sk, yk, v, cache)
sk = sk(:);
yk = yk(:);
v = v(:);
if it == 1 || restart
dir = -v; % Initially use steepest descent direction
tau0 = 1.0/norm(dir, inf);
else
betaDY = (v'*v)/(sk'*yk);
betaHS = (v'*yk)/(sk'*yk);
beta = max(0.0,min(betaHS,betaDY));
dir = -v + beta*sk;
if dir'*v >= 0 % restart if not descent direction
dir = -v;
tau0 = 1.0/norm(dir, inf);
cache.cntSkip = cache.cntSkip+1;
else
tau0 = (sk'*sk)/(sk'*yk);
end
end
end
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...