8 lines
231 B
Mathematica
8 lines
231 B
Mathematica
|
function alpha = backtracking(f, xk, alpha_bar, pk, rho, c)
|
||
|
alpha = alpha_bar;
|
||
|
gf = gradient(f);
|
||
|
while at(f, xk + alpha * pk) > at(f, xk) - c * alpha * dot(at(gf, xk), pk)
|
||
|
alpha = alpha * rho
|
||
|
end
|
||
|
end
|
||
|
|