00001 // NLLSMinimizable.cpp: implementation of the NLLSMinimizable class. 00002 // 00004 00005 #include "NLLSMinimizable.h" 00006 00008 // Construction/Destruction 00010 00011 NLLSMinimizable::NLLSMinimizable() 00012 { 00013 00014 } 00015 00016 NLLSMinimizable::~NLLSMinimizable() 00017 { 00018 delete [] residuals; 00019 } 00020 00021 void NLLSMinimizable::Allocate(int nResiduals) 00022 { 00023 SetNResiduals(nResiduals); 00024 residuals = new double[nResiduals]; 00025 } 00026 00027 double NLLSMinimizable::ObjectiveFunction(double *parameters) 00028 { 00029 double objFuncVal = 0.0; 00030 objFuncVal = ComputeResiduals(parameters); 00031 return objFuncVal; 00032 } 00033 00034 double NLLSMinimizable::ComputeES(double *parameters, double T) 00035 { 00036 double objFuncVal = 0.0; 00037 objFuncVal = ComputeResiduals(parameters); 00038 return objFuncVal; 00039 } 00040 00041 double NLLSMinimizable::SumOfSquares() 00042 { 00043 double sum = 0.0; 00044 for(int i = 0; i < nResiduals; i++) 00045 { 00046 sum += residuals[i]*residuals[i]; 00047 } 00048 return sum; 00049 } 00050 00051