Open CASCADE Technology Reference Manual 8.0.2
Loading...
Searching...
No Matches
MathUtils::VectorLambda< Lambda > Class Template Reference

Lambda wrapper for N-D objective functions (value only). Wraps a lambda/callable into a functor with Value() method. More...

#include <MathUtils_FunctorVector.hxx>

Public Member Functions

 VectorLambda (Lambda theLambda)
 Constructor from lambda/callable.
bool Value (const math_Vector &theX, double &theY) const
 Evaluates the function at theX.

Detailed Description

template<typename Lambda>
class MathUtils::VectorLambda< Lambda >

Lambda wrapper for N-D objective functions (value only). Wraps a lambda/callable into a functor with Value() method.

Usage:

auto aFunc = VectorLambda([](const math_Vector& x, double& y) {
y = x(1)*x(1) + x(2)*x(2); // Sphere function
return true;
});
auto aResult = MathOpt::Powell(aFunc, aStartPoint);
GLint GLint GLint GLint GLint x
Definition OpenGl_glext.h:125
GLint GLint GLint GLint GLint GLint y
Definition OpenGl_glext.h:126
VectorLambda(Lambda theLambda)
Constructor from lambda/callable.
Definition MathUtils_FunctorVector.hxx:53
math_VectorBase< double > math_Vector
Definition math_Recipes.hxx:25
VectorResult Powell(Function &theFunc, const math_Vector &theStartingPoint, const Config &theConfig=Config())
Powell's conjugate direction method for N-dimensional minimization. A gradient-free optimization algo...
Definition MathOpt_Powell.hxx:52
Template Parameters
Lambdacallable type with signature bool(const math_Vector&, double&)

Constructor & Destructor Documentation

◆ VectorLambda()

template<typename Lambda>
MathUtils::VectorLambda< Lambda >::VectorLambda ( Lambda theLambda)
inlineexplicit

Constructor from lambda/callable.

Parameters
theLambdacallable with signature bool(const math_Vector&, double&)

Member Function Documentation

◆ Value()

template<typename Lambda>
bool MathUtils::VectorLambda< Lambda >::Value ( const math_Vector & theX,
double & theY ) const
inline

Evaluates the function at theX.

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

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