From: Michael Orlitzky Date: Mon, 18 Mar 2013 02:21:04 +0000 (-0400) Subject: Add step_size_positive_definite(). X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=729b8398bcd254e774b12765909f58e4e04aa9d1;p=octave.git Add step_size_positive_definite(). --- diff --git a/optimization/step_size_positive_definite.m b/optimization/step_size_positive_definite.m new file mode 100644 index 0000000..3e991a3 --- /dev/null +++ b/optimization/step_size_positive_definite.m @@ -0,0 +1,29 @@ +function alpha = step_size_positive_definite(Q, b, x) + % Let, + % + % f(x) = (1/2) - + a (1) + % + % where Q is symmetric and positive definite. + % + % If we seek to minimize f; that is, to solve Qx = b, then we can do + % so using the method of steepest-descent. This function computes + % the optimal step size alpha for the steepest descent method, in + % the negative-gradient direction, at x. + % + % INPUT: + % + % - ``Q`` -- the positive-definite matrix in the definition of f(x). + % + % - ``b`` -- the known vector in the definition of f(x). + % + % OUTPUT: + % + % - ``alpha`` -- the optimal step size in the negative gradient + % direction. + % + + % The gradient of f(x) is Qx - b, and d_k is the negative gradient + % direction. + d_k = b - Q*x; + alpha = (d_k' * d_k) / (d_k' * Q * d_k); +end