Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions
MathUtils::VectorLambdaWithGradient< ValueLambda, GradLambda > Class Template Reference

Lambda wrapper for N-D objective functions with gradient. Wraps a lambda/callable into a functor with Value() and Gradient() methods. More...

#include <MathUtils_FunctorVector.hxx>

Public Member Functions

 VectorLambdaWithGradient (ValueLambda theValueLambda, GradLambda theGradLambda)
 Constructor from value and gradient lambdas.
 
bool Value (const math_Vector &theX, double &theY) const
 Evaluates the function value at theX.
 
bool Gradient (const math_Vector &theX, math_Vector &theG) const
 Evaluates the gradient at theX.
 
bool Values (const math_Vector &theX, double &theY, math_Vector &theG) const
 Evaluates both value and gradient at theX.
 

Detailed Description

template<typename ValueLambda, typename GradLambda>
class MathUtils::VectorLambdaWithGradient< ValueLambda, GradLambda >

Lambda wrapper for N-D objective functions with gradient. Wraps a lambda/callable into a functor with Value() and Gradient() methods.

Usage:

[](const math_Vector& x, double& y) {
y = x(1)*x(1) + x(2)*x(2);
return true;
},
[](const math_Vector& x, math_Vector& g) {
g(1) = 2.0 * x(1);
g(2) = 2.0 * x(2);
return true;
});
GLint GLint GLint GLint GLint x
Definition OpenGl_glext.h:125
GLboolean GLboolean g
Definition OpenGl_glext.h:1454
VectorLambdaWithGradient(ValueLambda theValueLambda, GradLambda theGradLambda)
Constructor from value and gradient lambdas.
Definition MathUtils_FunctorVector.hxx:95
STL input iterator that wraps an OCCT More()/Next() iterator.
Definition NCollection_ForwardRange.hxx:142
VectorResult BFGS(Function &theFunc, const math_Vector &theStartingPoint, const Config &theConfig=Config())
BFGS (Broyden-Fletcher-Goldfarb-Shanno) quasi-Newton method. One of the most effective algorithms for...
Definition MathOpt_BFGS.hxx:58
Template Parameters
ValueLambdacallable for value: bool(const math_Vector&, double&)
GradLambdacallable for gradient: bool(const math_Vector&, math_Vector&)

Constructor & Destructor Documentation

◆ VectorLambdaWithGradient()

MathUtils::VectorLambdaWithGradient< ValueLambda, GradLambda >::VectorLambdaWithGradient ( ValueLambda theValueLambda,
GradLambda theGradLambda )
inline

Constructor from value and gradient lambdas.

Parameters
theValueLambdacallable for value evaluation
theGradLambdacallable for gradient evaluation

Member Function Documentation

◆ Gradient()

Evaluates the gradient at theX.

Parameters
[in]theXinput vector
[out]theGgradient vector
Returns
true if evaluation succeeded

◆ Value()

Evaluates the function value at theX.

Parameters
[in]theXinput vector
[out]theYfunction value f(theX)
Returns
true if evaluation succeeded

◆ Values()

bool MathUtils::VectorLambdaWithGradient< ValueLambda, GradLambda >::Values ( const math_Vector & theX,
double & theY,
math_Vector & theG ) const
inline

Evaluates both value and gradient at theX.

Parameters
[in]theXinput vector
[out]theYfunction value
[out]theGgradient vector
Returns
true if evaluation succeeded

The documentation for this class was generated from the following file: