| IGLib 1.4 The IGLib base library for development of numerical, technical and business applications.

- Main Page
- Namespaces
- Classes
- Files
- Directories

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Properties | Private Member Functions | Private Attributes

# IG::Num::ScalarFunctionQuadratic Class Reference

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...

Inheritance diagram for IG::Num::ScalarFunctionQuadratic:
[legend]
Collaboration diagram for IG::Num::ScalarFunctionQuadratic:
[legend]

List of all members.

## 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

## Detailed Description

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;

## Constructor & Destructor Documentation

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.

Parameters:

  hessian | Matrix of second derivatives (Hessian). Can be null (in this case function degrades to linear function).
  gradient0 | Vector of linear coefficients - gradient of quadratic function at x = 0. Can be null.
  scalarTerm | Constant term.

## Member Function Documentation

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.

Returns:

static ScalarFunctionQuadratic IG::Num::ScalarFunctionQuadratic::ExampleFunctionPureQuadratic2d | ( |  | ) | `[inline, static]`

Creates and returns quadratic scalar function with only quadratic terms.

Returns:

static ScalarFunctionQuadratic IG::Num::ScalarFunctionQuadratic::ExampleFunctionDiagonalPureQuadratic2d | ( |  | ) | `[inline, static]`

Creates and returns quadratic function with diagonal Hessian.

Returns:

static int IG::Num::ScalarFunctionQuadratic::GetNumConstants | ( | int | dim | ) | `[inline, static]`

Returns the number of constants that specify the quadratic function of the specified dimension.

Parameters:

  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:

  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:

  parameters | Vector of parameters where derivatives are evaluated.
  hessian | Matrix where second derivatives (Hessian matrix) are stored.

Implements IG::Num::IScalarFunctionUntransformed.

## Member Data Documentation

IMatrix IG::Num::ScalarFunctionQuadratic::_G`[private]`

IVector IG::Num::ScalarFunctionQuadratic::_b`[private]`

double IG::Num::ScalarFunctionQuadratic::_c`[private]`

## Property Documentation

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:

  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.

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

- FunctionScalarExamples.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events