#include <math_Gauss.hxx>
#include <math_Jacobi.hxx>
-//============================================================================
-math_NewtonMinimum::math_NewtonMinimum(math_MultipleVarFunctionWithHessian& F,
- const math_Vector& StartingPoint,
- const Standard_Real Tolerance,
- const Standard_Integer NbIterations,
- const Standard_Real Convexity,
- const Standard_Boolean WithSingularity)
-//============================================================================
- : TheLocation(1, F.NbVariables()),
- TheGradient(1, F.NbVariables()),
- TheStep(1, F.NbVariables(), 10*Tolerance),
- TheHessian(1, F.NbVariables(), 1, F.NbVariables() )
+//=======================================================================
+//function : math_NewtonMinimum
+//purpose : Constructor
+//=======================================================================
+math_NewtonMinimum::math_NewtonMinimum(
+ const math_MultipleVarFunctionWithHessian& theFunction,
+ const Standard_Real theTolerance,
+ const Standard_Integer theNbIterations,
+ const Standard_Real theConvexity,
+ const Standard_Boolean theWithSingularity
+ )
+: TheStatus (math_NotBracketed),
+ TheLocation(1, theFunction.NbVariables()),
+ TheGradient(1, theFunction.NbVariables()),
+ TheStep (1, theFunction.NbVariables(), 10.0 * theTolerance),
+ TheHessian (1, theFunction.NbVariables(), 1, theFunction.NbVariables()),
+ PreviousMinimum (0.0),
+ TheMinimum (0.0),
+ MinEigenValue (0.0),
+ XTol (theTolerance),
+ CTol (theConvexity),
+ nbiter (0),
+ NoConvexTreatement(theWithSingularity),
+ Convex (Standard_True),
+ Done (Standard_False),
+ Itermax (theNbIterations)
{
- XTol = Tolerance;
- CTol = Convexity;
- Itermax = NbIterations;
- NoConvexTreatement = WithSingularity;
- Convex = Standard_True;
-// Done = Standard_True;
-// TheStatus = math_OK;
- Perform ( F, StartingPoint);
}
-//============================================================================
-math_NewtonMinimum::math_NewtonMinimum(math_MultipleVarFunctionWithHessian& F,
- const Standard_Real Tolerance,
- const Standard_Integer NbIterations,
- const Standard_Real Convexity,
- const Standard_Boolean WithSingularity)
-//============================================================================
- : TheLocation(1, F.NbVariables()),
- TheGradient(1, F.NbVariables()),
- TheStep(1, F.NbVariables(), 10*Tolerance),
- TheHessian(1, F.NbVariables(), 1, F.NbVariables() )
-{
- XTol = Tolerance;
- CTol = Convexity;
- Itermax = NbIterations;
- NoConvexTreatement = WithSingularity;
- Convex = Standard_True;
- Done = Standard_False;
- TheStatus = math_NotBracketed;
-}
-//============================================================================
+//=======================================================================
+//function : ~math_NewtonMinimum
+//purpose : Destructor
+//=======================================================================
math_NewtonMinimum::~math_NewtonMinimum()
{
}
-//============================================================================
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
void math_NewtonMinimum::Perform(math_MultipleVarFunctionWithHessian& F,
- const math_Vector& StartingPoint)
-//============================================================================
+ const math_Vector& StartingPoint)
{
math_Vector Point1 (1, F.NbVariables());
Point1 = StartingPoint;
TheLocation = *precedent;
}
-//============================================================================
-Standard_Boolean math_NewtonMinimum::IsConverged() const
-//============================================================================
-{
- return ( (TheStep.Norm() <= XTol ) ||
- ( Abs(TheMinimum-PreviousMinimum) <= XTol*Abs(PreviousMinimum) ));
-}
-
-//============================================================================
+//=======================================================================
+//function : Dump
+//purpose :
+//=======================================================================
void math_NewtonMinimum::Dump(Standard_OStream& o) const
-//============================================================================
{
- o<< "math_Newton Optimisation: ";
- o << " Done =" << Done << endl;
- o << " Status = " << (Standard_Integer)TheStatus << endl;
- o <<" Location Vector = " << Location() << endl;
- o <<" Minimum value = "<< Minimum()<< endl;
- o <<" Previous value = "<< PreviousMinimum << endl;
- o <<" Number of iterations = " <<NbIterations() << endl;
- o <<" Convexity = " << Convex << endl;
- o <<" Eigen Value = " << MinEigenValue << endl;
+ o<< "math_Newton Optimisation: ";
+ o << " Done =" << Done << endl;
+ o << " Status = " << (Standard_Integer)TheStatus << endl;
+ o << " Location Vector = " << Location() << endl;
+ o << " Minimum value = "<< Minimum()<< endl;
+ o << " Previous value = "<< PreviousMinimum << endl;
+ o << " Number of iterations = " <<NbIterations() << endl;
+ o << " Convexity = " << Convex << endl;
+ o << " Eigen Value = " << MinEigenValue << endl;
}