Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions
MathUtils::QuadraticForm Class Reference

Quadratic form functor: f(x) = x^T A x + b^T x + c. Commonly used for testing optimization algorithms. More...

#include <MathUtils_FunctorVector.hxx>

Public Member Functions

 QuadraticForm (const math_Matrix &theA, const math_Vector &theB, double theC)
 Constructor from matrix, vector, and constant.
 
bool Value (const math_Vector &theX, double &theY) const
 Evaluates the quadratic form f(x) = x^T A x + b^T x + c.
 
bool Gradient (const math_Vector &theX, math_Vector &theG) const
 Evaluates the gradient: g = 2*A*x + b.
 
bool Values (const math_Vector &theX, double &theY, math_Vector &theG) const
 Evaluates both value and gradient.
 

Detailed Description

Quadratic form functor: f(x) = x^T A x + b^T x + c. Commonly used for testing optimization algorithms.

Usage:

math_Matrix A(1, 2, 1, 2);
A(1,1) = 2.0; A(1,2) = 0.0;
A(2,1) = 0.0; A(2,2) = 2.0;
math_Vector b(1, 2);
b(1) = -4.0; b(2) = -4.0;
QuadraticForm aFunc(A, b, 8.0); // f(x) = 2*x1^2 + 2*x2^2 - 4*x1 - 4*x2 + 8
// Minimum at (1, 1) with value 4
GLboolean GLboolean GLboolean b
Definition OpenGl_glext.h:1455
Quadratic form functor: f(x) = x^T A x + b^T x + c. Commonly used for testing optimization algorithms...
Definition MathUtils_FunctorVector.hxx:169
STL input iterator that wraps an OCCT More()/Next() iterator.
Definition NCollection_ForwardRange.hxx:142
This class implements the real matrix abstract data type. Matrixes can have an arbitrary range which ...
Definition math_Matrix.hxx:75

Constructor & Destructor Documentation

◆ QuadraticForm()

MathUtils::QuadraticForm::QuadraticForm ( const math_Matrix & theA,
const math_Vector & theB,
double theC )
inline

Constructor from matrix, vector, and constant.

Parameters
theAquadratic coefficient matrix (must be square)
theBlinear coefficient vector
theCconstant term

Member Function Documentation

◆ Gradient()

bool MathUtils::QuadraticForm::Gradient ( const math_Vector & theX,
math_Vector & theG ) const
inline

Evaluates the gradient: g = 2*A*x + b.

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

◆ Value()

bool MathUtils::QuadraticForm::Value ( const math_Vector & theX,
double & theY ) const
inline

Evaluates the quadratic form f(x) = x^T A x + b^T x + c.

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

◆ Values()

bool MathUtils::QuadraticForm::Values ( const math_Vector & theX,
double & theY,
math_Vector & theG ) const
inline

Evaluates both value and gradient.

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: