IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.
|
Quadratic scalar function of vector variable. Function is evaluated according to q(x) = (1/2)*x^T*G*x + b^T*x + c where x is vector of parameters, G is constant Hessian matrix, b is vector of linear coefficients (gradient at x=0) and c is the scalar term (function value at x=0). More...
Public Member Functions | |
ScalarFunctionQuadratic (IMatrix hessian, IVector gradient0, double scalarTerm) | |
Creation of a quadratic scalar function. WARNING: Matrix argument is interpreted as Hessian, i.e. twice the matrix of quadratic coefficients. | |
override double | Value (IVector parameters) |
Returns the value of this function at the specified parameter. | |
override void | GradientPlain (IVector parameters, IVector gradient) |
Calculates first order derivatives (gradient) of this function at the specified parameters. WARNING: Plain function, does not check consistency of arguments. | |
override void | HessianPlain (IVector parameters, IMatrix hessian) |
Calculates the second derivative (Hessian matrix) of this function at the specified parameters. WARNING: Plain function, does not check consistency of arguments. | |
Static Public Member Functions | |
static ScalarFunctionQuadratic | ExampleFunction2d () |
Creates and returns quadratic scalar function in 2D. | |
static ScalarFunctionQuadratic | ExampleFunctionDiagonal2d () |
Creates and returns quadratic scalar function with diagonal Hessian. | |
static ScalarFunctionQuadratic | ExampleFunctionPureQuadratic2d () |
Creates and returns quadratic scalar function with only quadratic terms. | |
static ScalarFunctionQuadratic | ExampleFunctionDiagonalPureQuadratic2d () |
Creates and returns quadratic function with diagonal Hessian. | |
static int | GetNumConstants (int dim) |
Returns the number of constants that specify the quadratic function of the specified dimension. | |
Properties | |
int | NumActualConstants [get] |
Gets the number of constants that define the current function. If e.g. the matrix coefficient or the vector coefficient is not defined then the corresponding constants are not counted. | |
IMatrix | HessianMatrix [get, set] |
Twice the matrix of quadratic coefficients (Hessian matrix). | |
IVector | Gradient0 [get, set] |
Vector of linear coefficients (equal to gradient of the function at x=0). | |
double | ScalarTerm [get, set] |
Scalar additive constant. | |
override bool | ValueDefined [get, set] |
Tells whether value of the function is defined by implementation. Always true for this case. | |
override bool | GradientDefined [get, set] |
Tells whether the first derivative is defined for this function (by implementation, not mathematically) | |
override bool | HessianDefined [get, set] |
Tells whether the second derivative is defined for this function (by implementation, not mathematically) | |
Private Member Functions | |
ScalarFunctionQuadratic () | |
Private Attributes | |
IMatrix | _G |
IVector | _b |
double | _c |
Quadratic scalar function of vector variable. Function is evaluated according to q(x) = (1/2)*x^T*G*x + b^T*x + c where x is vector of parameters, G is constant Hessian matrix, b is vector of linear coefficients (gradient at x=0) and c is the scalar term (function value at x=0).
When quadratic function is created or its parameters set, the Matrix parameter of the function is interpreted as Hessian, i.e. twice the matrix of quadratic coefficients. $A Igor xx Dec10;
IG::Num::ScalarFunctionQuadratic::ScalarFunctionQuadratic | ( | ) | [inline, private] |
IG::Num::ScalarFunctionQuadratic::ScalarFunctionQuadratic | ( | IMatrix | hessian, |
IVector | gradient0, | ||
double | scalarTerm | ||
) | [inline] |
Creation of a quadratic scalar function. WARNING: Matrix argument is interpreted as Hessian, i.e. twice the matrix of quadratic coefficients.
static ScalarFunctionQuadratic IG::Num::ScalarFunctionQuadratic::ExampleFunction2d | ( | ) | [inline, static] |
Creates and returns quadratic scalar function in 2D.
static ScalarFunctionQuadratic IG::Num::ScalarFunctionQuadratic::ExampleFunctionDiagonal2d | ( | ) | [inline, static] |
Creates and returns quadratic scalar function with diagonal Hessian.
static ScalarFunctionQuadratic IG::Num::ScalarFunctionQuadratic::ExampleFunctionPureQuadratic2d | ( | ) | [inline, static] |
Creates and returns quadratic scalar function with only quadratic terms.
static ScalarFunctionQuadratic IG::Num::ScalarFunctionQuadratic::ExampleFunctionDiagonalPureQuadratic2d | ( | ) | [inline, static] |
Creates and returns quadratic function with diagonal Hessian.
static int IG::Num::ScalarFunctionQuadratic::GetNumConstants | ( | int | dim | ) | [inline, static] |
Returns the number of constants that specify the quadratic function of the specified dimension.
dim | Dimension of the space in which quadratic function is defined. |
override double IG::Num::ScalarFunctionQuadratic::Value | ( | IVector | parameters | ) | [inline] |
Returns the value of this function at the specified parameter.
Implements IG::Num::IScalarFunctionUntransformed.
override void IG::Num::ScalarFunctionQuadratic::GradientPlain | ( | IVector | parameters, |
IVector | gradient | ||
) | [inline] |
Calculates first order derivatives (gradient) of this function at the specified parameters. WARNING: Plain function, does not check consistency of arguments.
parameters | Vector of parameters where derivatives are evaluated. |
gradient | Vector where first order derivatives (the gradient) are stored. |
Implements IG::Num::IScalarFunctionUntransformed.
override void IG::Num::ScalarFunctionQuadratic::HessianPlain | ( | IVector | parameters, |
IMatrix | hessian | ||
) | [inline] |
Calculates the second derivative (Hessian matrix) of this function at the specified parameters. WARNING: Plain function, does not check consistency of arguments.
parameters | Vector of parameters where derivatives are evaluated. |
hessian | Matrix where second derivatives (Hessian matrix) are stored. |
Implements IG::Num::IScalarFunctionUntransformed.
IMatrix IG::Num::ScalarFunctionQuadratic::_G [private] |
IVector IG::Num::ScalarFunctionQuadratic::_b [private] |
double IG::Num::ScalarFunctionQuadratic::_c [private] |
int IG::Num::ScalarFunctionQuadratic::NumActualConstants [get] |
Gets the number of constants that define the current function. If e.g. the matrix coefficient or the vector coefficient is not defined then the corresponding constants are not counted.
IMatrix IG::Num::ScalarFunctionQuadratic::HessianMatrix [get, set] |
Twice the matrix of quadratic coefficients (Hessian matrix).
IVector IG::Num::ScalarFunctionQuadratic::Gradient0 [get, set] |
Vector of linear coefficients (equal to gradient of the function at x=0).
double IG::Num::ScalarFunctionQuadratic::ScalarTerm [get, set] |
Scalar additive constant.
override bool IG::Num::ScalarFunctionQuadratic::ValueDefined [get, set] |
Tells whether value of the function is defined by implementation. Always true for this case.
parameters | Vector of parameters at which derivatives are evaluated. |
Implements IG::Num::IScalarFunctionUntransformed.
override bool IG::Num::ScalarFunctionQuadratic::GradientDefined [get, set] |
Tells whether the first derivative is defined for this function (by implementation, not mathematically)
Implements IG::Num::IScalarFunctionUntransformed.
override bool IG::Num::ScalarFunctionQuadratic::HessianDefined [get, set] |
Tells whether the second derivative is defined for this function (by implementation, not mathematically)
Implements IG::Num::IScalarFunctionUntransformed.