40 #ifndef __MO_MATH_NUMERICAL_ANALYSIS_H__
41 #define __MO_MATH_NUMERICAL_ANALYSIS_H__
50 typedef Real (*Function)(Real,
void*);
53 void* pvUserData = 0) {
58 aafRom =
new Real*[2];
59 for (
int i = 0; i < 2; i++) aafRom[i] =
new Real[iOrder];
63 aafRom[0][0] = ((Real)0.5)*fH*(oF(fA,pvUserData)+oF(fB,pvUserData));
64 for (
int i0=2, iP0=1; i0 <= iOrder; i0++, iP0 *= 2, fH *= (Real)0.5)
67 Real fSum = (Real)0.0;
69 for (i1 = 1; i1 <= iP0; i1++)
71 fSum += oF(fA + fH*(i1-((Real)0.5)),pvUserData);
75 aafRom[1][0] = ((Real)0.5)*(aafRom[0][0] + fH*fSum);
76 for (
int i2 = 1, iP2 = 4; i2 < i0; i2++, iP2 *= 4)
78 aafRom[1][i2] = (iP2*aafRom[1][i2-1] - aafRom[0][i2-1])/(iP2-1);
81 for (i1 = 0; i1 < i0; i1++)
83 aafRom[0][i1] = aafRom[1][i1];
87 Real fResult = aafRom[0][iOrder-1];
89 for (
int i = 0; i < 2; i++)
delete[] aafRom[i];
95 static Real GaussianQuadrature (Real fA, Real fB, Function oF,
96 void* pvUserData = 0);
98 static Real TrapezoidRule (
int iNumSamples, Real fA, Real fB,
99 Function oF,
void* pvUserData = 0);
118 template <
class Real>
122 typedef Real (*Function)(Real,
void*);
124 moMinimize1 (Function oFunction,
int iMaxLevel,
int iMaxBracket,
131 void GetMinimum (Real fT0, Real fT1, Real fTInitial, Real& rfTMin,
135 Function m_oFunction;
136 int m_iMaxLevel, m_iMaxBracket;
137 Real m_fTMin, m_fFMin;
140 void GetMinimum (Real fT0, Real fF0, Real fT1, Real fF1,
int iLevel);
142 void GetMinimum (Real fT0, Real fF0, Real fTm, Real fFm, Real fT1,
143 Real fF1,
int iLevel);
145 void GetBracketedMinimum (Real fT0, Real fF0, Real fTm,
146 Real fFm, Real fT1, Real fF1,
int iLevel);
moMinimize1< MOfloat > moMinimize1f
static Real RombergIntegral(int iOrder, Real fA, Real fB, Function oF, void *pvUserData=0)
moMinimize1< MOdouble > moMinimize1d
Clase base abstracta de donde deben derivar los objetos [virtual pura].
moIntegrate1< MOfloat > moIntegrate1f
moIntegrate1< MOdouble > moIntegrate1d