00001 // This file is part of the imaging2 class library. 00002 // 00003 // University of Innsbruck, Infmath Imaging, 2009. 00004 // http://infmath.uibk.ac.at 00005 // 00006 // All rights reserved. 00007 00008 00009 #ifndef MINIMIZE_NLCG_H 00010 #define MINIMIZE_NLCG_H 00011 00012 #include <minimize/DifferentiableEnergyInterface.hpp> 00013 #include <minimize/MinimizerInterface.hpp> 00014 00015 namespace imaging 00016 { 00017 00023 class NlCg : public MinimizerInterface 00024 { 00025 DifferentiableEnergyInterface & _energy; 00026 00027 float_t _convergence_constant; 00028 int _method; 00029 ublas::vector<double> _d; 00030 ublas::vector<double> _g_old; 00031 ublas::vector<double> _w; 00032 int _iflag; 00033 int _finish; 00034 bool _terminated; 00035 00036 public: 00037 00038 enum methods { 00039 FLETCHER_REEVES , 00040 POLAK_RIBIERE , 00041 POSITIVE_POLAK_RIBIERE 00042 }; 00043 00045 NlCg(DifferentiableEnergyInterface & energy, float_t convergence_constant, size_t method = FLETCHER_REEVES); 00046 00047 bool minimize(size_t n_max_steps, size_t & n_steps); 00048 }; 00049 00050 } 00051 00052 #endif