00001 #ifndef __F_PR_CgNonLS_H__ 00002 #define __F_PR_CgNonLS_H__ 00003 00004 00054 #include <stdio.h> 00055 #include "F_IterativeNonLS.hpp" 00056 00057 00058 class F_PR_CgNonLS : public F_IterativeNonLS 00059 { 00060 private: 00061 00062 double alpha; 00063 double beta; 00064 00065 FloatVector* r; 00066 FloatVector* d; 00067 00068 bool precondFlag; 00069 FloatVector* s; // used if Hessian Preconditioning is asked 00070 00071 double delta0; 00072 double deltaNew; 00073 double deltaOld; 00074 00075 protected: 00076 00077 virtual FloatVector* singleSolve(AbsFObjectiveFn* fn, FloatVector* x=0); 00078 00079 public: 00080 F_PR_CgNonLS(int maxIterations, double epsilon=1.0e-4):F_IterativeNonLS(maxIterations, epsilon) 00081 { r=d=s= 0; precondFlag=true;} 00082 virtual ~F_PR_CgNonLS(){} 00083 00084 virtual FloatVector* solve(AbsFObjectiveFn* fn, FloatVector* x=0); 00085 }; 00086 00087 #endif 00088