X-Git-Url: http://gitweb.michael.orlitzky.com/?p=octave.git;a=blobdiff_plain;f=optimization%2Fstep_length_positive_definite.m;fp=optimization%2Fstep_length_positive_definite.m;h=b1e5c4802ec96ba749375c44337f9d91d7219e1d;hp=0000000000000000000000000000000000000000;hb=69d4adf22828f26858e89de560078e1b5ed1714a;hpb=2b94bdc2496c384cd7cdb9d11aa7815e63c61f4a diff --git a/optimization/step_length_positive_definite.m b/optimization/step_length_positive_definite.m new file mode 100644 index 0000000..b1e5c48 --- /dev/null +++ b/optimization/step_length_positive_definite.m @@ -0,0 +1,36 @@ +function alpha = step_length_positive_definite(g, Q, p) + ## + ## Find the minimizer alpha of, + ## + ## phi(alpha) = f(x + alpha*p) + ## + ## where ``p`` is a descent direction, + ## + ## f(x) = (1/2) - + ## + ## and ``Q`` is positive-definite. + ## + ## The closed-form solution to this problem is given in Nocedal and + ## Wright, (3.55). + ## + ## INPUT: + ## + ## - ``g`` -- The gradient of f. + ## + ## - ``Q`` -- The positive-definite matrix in the definition of + ## ``f`` above. + ## + ## - ``p`` -- The direction in which ``f`` decreases. The line + ## along which we minimize f(x + alpha*p). + ## + ## OUTPUT: + ## + ## - ``alpha`` -- The value which causes ``f`` to decrease the + ## most. + ## + ## NOTES: + ## + ## All vectors are assumed to be *column* vectors. + ## + alpha = -(g' * p)/(p' * Q * p) +end