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

IG::Num::Func2dBase Class Reference

Base class for scalar functions of 2 variables (base for implementation of IFunc2d interface). Beside the IFunc2dinterface, this class also implements the IScalarFunctioninterface. This does not affect efficiency but adds the functionality for using objects as general (untransformed) scalar functions. More...

Inheritance diagram for IG::Num::Func2dBase:
Collaboration diagram for IG::Num::Func2dBase:

List of all members.

Public Member Functions

 Func2dBase ()
abstract double Value (double x, double y)
 Calculates and returns value of the current 2D scalar function.
virtual double Value (vec2 parameters)
 Calculates and returns value of the current 2D scalar function.
abstract void Gradient (double x, double y, out double gradx, out double grady)
 Calculates gradient of the current 2D scalar function and returns its components through the specified output variables.
virtual vec2 Gradient (vec2 parameters)
 Calculates and returns gradient of the current 2D scalar function.
abstract void Hessian (double x, double y, out double dxx, out double dyy, out double dxy)
 Calculates Hessian of the current 2D scalar function and returns its component through the specified output variables.
virtual mat2 Hessian (vec2 parameters)
 Calculates and returns Hessian of the current 2D scalar function and returns it (in the form of a mat2 struct).
override double Value (IVector parameters)
 Returns the value of the current function at the specified parameters.
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 void Example ()
 Example of use of a 2D function.

Static Protected Member Functions

static void TestFunction (IFunc2d f)
 Demonstrates use of a 2D function by printing to the console 5 values and gradients of the function on the line connecting the two points (0, 0, 0) and (1, 1, 1).
static void TestFunction (IFunc2d f, double xmin, double xmax, double ymin, double ymax, int numPoints)
 Demonstrates use of a 2D function by printing to the console some values and gradients of the function on the line connecting the two specified points.

Properties

override bool ValueDefined [get, set]
 Whether calculation of function value is defined. Defaulet is true.
override bool GradientDefined [get, set]
 Whether calculation of functio ngradient is defined. Default is false.
override bool HessianDefined [get, set]
 Whether calculation of function Hessian is defined. Default is false.
int NumParam [get]
 Gets number of parameters.

Private Attributes

bool _valueDefined = true
bool _gradientDefined = false
bool _hessianDefined = false

Detailed Description

Base class for scalar functions of 2 variables (base for implementation of IFunc2d interface).

Beside the IFunc2d

interface, this class also implements the IScalarFunction

interface. This does not affect efficiency but adds the functionality for using objects as general (untransformed) scalar functions.

$A Igor Apr09;


Constructor & Destructor Documentation

IG::Num::Func2dBase::Func2dBase ( ) [inline]

Member Function Documentation

virtual double IG::Num::Func2dBase::Value ( vec2  parameters) [inline, virtual]

Calculates and returns value of the current 2D scalar function.

Parameters:
parametersVector of function parameters (in form of the Value) struct.
Returns:
Function value.

Implements IG::Num::IFunc2d.

Reimplemented in IG::Num::Func2dVectorFormBase, IG::Num::Func2dLinear, and IG::Num::Func2dQuadratic.

abstract void IG::Num::Func2dBase::Gradient ( double  x,
double  y,
out double  gradx,
out double  grady 
) [pure virtual]

Calculates gradient of the current 2D scalar function and returns its components through the specified output variables.

Parameters:
xFirst parameter.
ySecond parameter.
zThird parameter.
gradxFirst component of the returned gradient.
gradySecond component of the returned gradient.
gradzThird component of the returned gradient.

Implements IG::Num::IFunc2d.

Implemented in IG::Num::Func2dBaseNoGradient, IG::Num::Func2dVectorFormBase, IG::Num::Func2dExamples::Func2dXY, IG::Num::Func3d2dBase::ComponentFunction1, IG::Num::Func3d2dBase::ComponentFunction2, IG::Num::Func3d2dBase::ComponentFunction3, IG::Neural::Func2dFromApproximator, IG::Num::Func2dFromScalarFunction, IG::Gr3d::VtkPlotBase::Func2dX, IG::Gr3d::VtkPlotBase::Func2dY, IG::Gr3d::VtkPlotBase::Func2dZero, IG::Gr3d::VtkPlotBase::ExampleFunc2dXY, IG::Gr3d::VtkPlotBase::ExampleFunc2dLinear, IG::Gr3d::VtkPlotBase::ExampleFunc2dSquare, and IG::Gr3d::VtkPlotBase::ExampleFuncDiff.

virtual vec2 IG::Num::Func2dBase::Gradient ( vec2  parameters) [inline, virtual]

Calculates and returns gradient of the current 2D scalar function.

Parameters:
parametersVector of parameters (in form of the vec2 struct)

<returnreturns>Gradient of the current 2D scalar function (in form of the vec2 struct)</returnreturns>

Implements IG::Num::IFunc2d.

Reimplemented in IG::Num::Func2dVectorFormBase, IG::Num::Func2dLinear, and IG::Num::Func2dQuadratic.

abstract void IG::Num::Func2dBase::Hessian ( double  x,
double  y,
out double  dxx,
out double  dyy,
out double  dxy 
) [pure virtual]

Calculates Hessian of the current 2D scalar function and returns its component through the specified output variables.

Parameters:
xFirst parameter.
ySecond parameter.
zThird parameter.
dxxComponent 1-1 of the calculated Hessian.
dyyComponent 2-2 of the calculated Hessian.
dzzComponent 3-3 of the calculated Hessian.
dxyComponent 1-2 of the calculated Hessian.
dxzComponent 1-3 of the calculated Hessian.
dyzComponent 2-3 of the calculated Hessian.

Implements IG::Num::IFunc2d.

Implemented in IG::Num::Func2dBaseNoHessian, IG::Num::Func2dBaseNoGradient, IG::Num::Func2dVectorFormBase, IG::Num::Func3d2dBase::ComponentFunction1, IG::Num::Func3d2dBase::ComponentFunction2, IG::Num::Func3d2dBase::ComponentFunction3, IG::Neural::Func2dFromApproximator, and IG::Num::Func2dFromScalarFunction.

virtual mat2 IG::Num::Func2dBase::Hessian ( vec2  parameters) [inline, virtual]

Calculates and returns Hessian of the current 2D scalar function and returns it (in the form of a mat2 struct).

Implements IG::Num::IFunc2d.

Reimplemented in IG::Num::Func2dVectorFormBase, IG::Num::Func2dLinear, and IG::Num::Func2dQuadratic.

override double IG::Num::Func2dBase::Value ( IVector  parameters) [inline]

Returns the value of the current function at the specified parameters.

Parameters:
parametersVector of parameters for which value is evaluated. Its dimension must be equal to 2.

Implements IG::Num::IScalarFunctionUntransformed.

override void IG::Num::Func2dBase::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:
parametersVector of parameters where derivatives are evaluated.
gradientVector where first order derivatives (the gradient) are stored.

Implements IG::Num::IScalarFunctionUntransformed.

override void IG::Num::Func2dBase::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:
parametersVector of parameters where derivatives are evaluated.
hessianMatrix where second derivatives (Hessian matrix) are stored.

Implements IG::Num::IScalarFunctionUntransformed.

static void IG::Num::Func2dBase::TestFunction ( IFunc2d  f) [inline, static, protected]

Demonstrates use of a 2D function by printing to the console 5 values and gradients of the function on the line connecting the two points (0, 0, 0) and (1, 1, 1).

Parameters:
fFunction whose values and gradients are evaluated and printed.
static void IG::Num::Func2dBase::TestFunction ( IFunc2d  f,
double  xmin,
double  xmax,
double  ymin,
double  ymax,
int  numPoints 
) [inline, static, protected]

Demonstrates use of a 2D function by printing to the console some values and gradients of the function on the line connecting the two specified points.

Parameters:
fFunction whose values and gradients are evaluated and printed.
xminMin. x.
xmaxMax. x.
yminMin. y.
ymaxMax. y.
numPointsNumber of points in which function values and gradients are printed.
static void IG::Num::Func2dBase::Example ( ) [inline, static]

Example of use of a 2D function.


Member Data Documentation

bool IG::Num::Func2dBase::_valueDefined = true [private]
bool IG::Num::Func2dBase::_gradientDefined = false [private]
bool IG::Num::Func2dBase::_hessianDefined = false [private]

Property Documentation

override bool IG::Num::Func2dBase::ValueDefined [get, set]

Whether calculation of function value is defined. Defaulet is true.

Implements IG::Num::IScalarFunctionUntransformed.

override bool IG::Num::Func2dBase::GradientDefined [get, set]

Whether calculation of functio ngradient is defined. Default is false.

Implements IG::Num::IScalarFunctionUntransformed.

override bool IG::Num::Func2dBase::HessianDefined [get, set]

Whether calculation of function Hessian is defined. Default is false.

Implements IG::Num::IScalarFunctionUntransformed.

int IG::Num::Func2dBase::NumParam [get]

Gets number of parameters.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties Events