Line data Source code
1 : /** 2 : Bojan Nikolic <bojan@bnikolic.co.uk> 3 : Initial version 2003 4 : 5 : This file is part of BNMin1 and is licensed under GNU General 6 : Public License version 2. 7 : 8 : \file lmmin.hxx 9 : Renamed to lmmin.h 10 : 11 : The Lavenburg-Marquant minimisation algorithm interface 12 : */ 13 : 14 : #ifndef _BNMIN_LMMIN_HXX__ 15 : #define _BNMIN_LMMIN_HXX__ 16 : 17 : #define BNMIN1_NO_PDA 18 : 19 : #include "minim.h" 20 : 21 : namespace Minim { 22 : 23 : /** \brief Implemnation of the Lavenburg-Marquant minimisation 24 : algorithm 25 : 26 : See file f77/pda_lmdiff.f for more details. 27 : */ 28 : class LMMin: 29 : public Minimiser 30 : { 31 : 32 : public: 33 : 34 : // ---------- Public data ----------------------- 35 : 36 : 37 : /** Termination occurs when both the actual and predicted relative 38 : reductions in the sum of squares are at most ftol. therefore, 39 : ftol measures the relative error desired in the sum of squares 40 : */ 41 : double ftol; 42 : 43 : /** 44 : Termination occurs when the relative error between two 45 : consecutive iterates is at most xtol. therefore, xtol measures 46 : the relative error desired in the approximate solution. 47 : */ 48 : double xtol; 49 : 50 : /** 51 : Termination occurs when the cosine of the angle between fvec 52 : and any column of the jacobian is at most gtol in absolute 53 : value. therefore, gtol measures the orthogonality desired 54 : between the function vector and the columns of the jacobian. 55 : */ 56 : double gtol; 57 : 58 : /** 59 : Termination occurs when the number of calls to fcn is at least 60 : maxfev by the end of an iteration. 61 : */ 62 : int maxfev; 63 : 64 : /** 65 : This approximation assumes that the relative errors in the 66 : functions are of the order of epsfcn. if epsfcn is less than 67 : the machine precision, it is assumed that the relative errors 68 : in the functions are of the order of the machine precision. 69 : */ 70 : double epsfcn; 71 : 72 : 73 : // These together contain all of the information needed to 74 : // calculate the covariance matrix. 75 : std::vector<double> fjac; 76 : int ldfjac ; 77 : std::vector<int > ipvt; 78 : 79 : // ---------- Construction / Destruction -------------- 80 : 81 : /// Tolerances are initialised to some normal defaults 82 : LMMin(Minimisable &pm) ; 83 : 84 0 : virtual ~LMMin(void) 85 0 : {}; 86 : 87 : // ------------------ Inherited from Minimiser ------------- 88 : virtual void solve(void); 89 : 90 : }; 91 : 92 : 93 : } 94 : 95 : #endif