1 function alpha = step_length_positive_definite(g, Q, p)
3 % Find the minimizer alpha of,
5 % phi(alpha) = f(x + alpha*p)
7 % where ``p`` is a descent direction,
9 % f(x) = (1/2)<Qx,x> - <b,x>
11 % and ``Q`` is positive-definite.
13 % The closed-form solution to this problem is given in Nocedal and
18 % - ``g`` -- The gradient of f at x.
20 % - ``Q`` -- The positive-definite matrix in the definition of
23 % - ``p`` -- The direction in which ``f`` decreases. The line
24 % along which we minimize f(x + alpha*p).
28 % - ``alpha`` -- The value which causes ``f`` to decrease the
33 % All vectors are assumed to be *column* vectors.
37 % denom is non-negative, since it's a Q-norm. No need to abs() it.
39 % Catch divide-by-zeros. If denom is effectively zero, set it to
40 % something tiny instead. This trick is also used in the PCGM.
44 alpha = -(g' * p)/denom;