toon-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Toon-members] TooN/optimization conjugate_gradient.h


From: Paul McIlroy
Subject: [Toon-members] TooN/optimization conjugate_gradient.h
Date: Wed, 20 May 2009 14:42:33 +0000

CVSROOT:        /sources/toon
Module name:    TooN
Changes by:     Paul McIlroy <paulmcilroy>      09/05/20 14:42:33

Modified files:
        optimization   : conjugate_gradient.h 

Log message:
        Make update_vectors take the gradient rather than a functor.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/optimization/conjugate_gradient.h?cvsroot=toon&r1=1.3&r2=1.4

Patches:
Index: conjugate_gradient.h
===================================================================
RCS file: /sources/toon/TooN/optimization/conjugate_gradient.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- conjugate_gradient.h        15 Apr 2009 15:50:35 -0000      1.3
+++ conjugate_gradient.h        20 May 2009 14:42:33 -0000      1.4
@@ -270,19 +270,20 @@
        }
        
        ///After an iteration, update the gradient and conjugate using the
-       ///Polak-Ribiere equations.  /@param deriv Functor to compute 
derivatives at
-       ///the specified point. This function updates:
+       ///Polak-Ribiere equations.
+       ///This function updates:
        ///- g
        ///- old_g
        ///- h
        ///- old_h
-       template<class Deriv> void update_vectors_PR(const Deriv& deriv)
+       ///@param The derivatives of the function at \e x
+       void update_vectors_PR(const Vector<Size>& grad)
        {
                //Update the position, gradient and conjugate directions
                old_g = g;
                old_h = h;
 
-               g = deriv(x);
+               g = grad;
                //Precision gamma = (g * g - oldg*g)/(oldg * oldg);
                Precision gamma = (g * g - old_g*g)/(old_g * old_g);
                h = g + gamma * old_h;
@@ -311,7 +312,7 @@
 
                if(!finished())
                {
-                       update_vectors_PR(deriv);
+                       update_vectors_PR(deriv(x));
                        return 1;
                }
                else




reply via email to

[Prev in Thread] Current Thread [Next in Thread]