#if !defined(AFX_ENERGYMINIMIZER_H__697B6B5B_44F4_48CC_9437_7AD27D63B563__INCLUDED_) #define AFX_ENERGYMINIMIZER_H__697B6B5B_44F4_48CC_9437_7AD27D63B563__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "Energy.h" #include "math.h" class EnergyMinimizer { public: Energy* energy; float *pcom; float *xicom; int ncom; public: void mnbrak(float *ax, float *bx, float *cx, float *fa, float *fb, float *fc); float f1dim(float x); void dfunc(float p[], float d[]); void frprmn(float p[], int n, float ftol, int *iter, float *fret); EnergyMinimizer(); virtual ~EnergyMinimizer(); void free_vector(float *v); float *vector(long n); void nrerror(char error_text[]); void dlinmin(float p[], float xi[], int n, float *fret); private: float df1dim(float x); float dbrent(float ax, float bx, float cx, float tol, float *xmin); float func(float p[]); static inline float FMAX(float a, float b){ float maxarg1 = a; float maxarg2 = b; return (maxarg1) > (maxarg2) ? (maxarg1) : (maxarg2); } static inline float SIGN(float a, float b){ return (float)((b) >= 0.0 ? fabs(a) : -fabs(a)); } }; #endif // !defined(AFX_ENERGYMINIMIZER_H__697B6B5B_44F4_48CC_9437_7AD27D63B563__INCLUDED_)