]> gitweb.michael.orlitzky.com - octave.git/commitdiff
Add performance notes to steepest descent stuff.
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 19 Mar 2013 13:27:56 +0000 (09:27 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Tue, 19 Mar 2013 13:27:56 +0000 (09:27 -0400)
optimization/steepest_descent.m
optimization/step_size_positive_definite.m

index 32aad711457ec2d04aa5d0985cd4286769bb79cc..c5bf0bca611d2d83747568ecbbc9c67506684650 100644 (file)
@@ -35,6 +35,12 @@ function [x, k] = steepest_descent(g, x0, step_size, tolerance, max_iterations)
   %
   %   * ``k`` - the value of k when we stop; i.e. the number of
   %   iterations.
   %
   %   * ``k`` - the value of k when we stop; i.e. the number of
   %   iterations.
+  %
+  % NOTES:
+  %
+  % A specialized implementation for solving e.g. Qx=b can avoid one
+  % matrix-vector multiplication below.
+  %
 
   % The initial gradient at x_{0} is not supplied, so we compute it
   % here and begin the loop at k=1.
 
   % The initial gradient at x_{0} is not supplied, so we compute it
   % here and begin the loop at k=1.
index 3e991a3fd97a9f126f238932c406dc721a3d4754..e32229cc52dbfbbb7cf17b6d1ab449cac4cc2940 100644 (file)
@@ -21,6 +21,13 @@ function alpha = step_size_positive_definite(Q, b, x)
   %   - ``alpha`` -- the optimal step size in the negative gradient
   %     direction.
   %
   %   - ``alpha`` -- the optimal step size in the negative gradient
   %     direction.
   %
+  % NOTES:
+  %
+  % It is possible to save one matrix-vector multiplication here, by
+  % taking d_k as a parameter. In fact, if the caller is specialized to
+  % our problem (1), we can avoid both matrix-vector multiplications here
+  % at the expense of some added roundoff error.
+  %
 
   % The gradient of f(x) is Qx - b, and d_k is the negative gradient
   % direction.
 
   % The gradient of f(x) is Qx - b, and d_k is the negative gradient
   % direction.