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.
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.
35 alpha = -(g' * p)/(p' * Q * p);