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