This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
OM/Claudio_Maggioni_midterm/cauchy.m

13 lines
210 B
Mathematica
Raw Normal View History

2021-05-03 14:32:30 +00:00
function pk = cauchy(B, g, deltak)
gbg = (g' * B * g);
if gbg <= 0
tau = 1;
else
tau = min(norm(g, 2)^3 / (deltak * gbg), 1);
end
pk = -tau * deltak / norm(g, 2) * g;
end