IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.
|
Base class for scalar functions of 3 variables (base for implementation of IFunc3d interface). Beside the IFunc3d 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. More...
Public Member Functions | |
abstract double | Value (double x, double y, double z) |
Calculates and returns value of the current 3D scalar function. | |
virtual double | Value (vec3 parameters) |
Calculates and returns value of the current 3D scalar function. | |
abstract void | Gradient (double x, double y, double z, out double gradx, out double grady, out double gradz) |
Calculates gradient of the current 3D scalar function and returns its components through the specified output variables. | |
virtual vec3 | Gradient (vec3 parameters) |
Calculates and returns gradient of the current 3D scalar function. | |
abstract void | Hessian (double x, double y, double z, out double dxx, out double dyy, out double dzz, out double dxy, out double dxz, out double dyz) |
Calculates Hessian of the current 3D scalar function and returns its component through the specified output variables. | |
virtual mat3 | Hessian (vec3 parameters) |
Calculates and returns Hessian of the current 3D scalar function and returns it (in the form of a mat3 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 3D function. | |
Protected Member Functions | |
Func3dBase () | |
Static Protected Member Functions | |
static void | TestFunction (IFunc3d f) |
Demonstrates use of a 3D 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 (IFunc3d f, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, int numPoints) |
Demonstrates use of a 3D 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 |
Base class for scalar functions of 3 variables (base for implementation of IFunc3d interface).
Beside the IFunc3d 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;
IG::Num::Func3dBase::Func3dBase | ( | ) | [inline, protected] |
abstract double IG::Num::Func3dBase::Value | ( | double | x, |
double | y, | ||
double | z | ||
) | [pure virtual] |
Calculates and returns value of the current 3D scalar function.
x | First parameter. |
y | Second parameter. |
z | Third parameter. |
Implements IG::Num::IFunc3d.
Implemented in IG::Num::Func3dVectorFormBase, IG::Num::Func3dExamples::Func3dXYZ, IG::Gr3d::ExampleValueFunctionDiff3D, IG::Num::Func3dFromScalarFunction, IG::Gr3d::VtkPlotBase::Func3dZ, IG::Gr3d::VtkPlotBase::Func3dZero, and IG::Gr3d::VtkPlotBase::ExampleValueFunctionDiff21.
virtual double IG::Num::Func3dBase::Value | ( | vec3 | parameters | ) | [inline, virtual] |
Calculates and returns value of the current 3D scalar function.
Implements IG::Num::IFunc3d.
Reimplemented in IG::Num::Func3dVectorFormBase, IG::Num::Func3dLinear, and IG::Num::Func3dQuadratic.
abstract void IG::Num::Func3dBase::Gradient | ( | double | x, |
double | y, | ||
double | z, | ||
out double | gradx, | ||
out double | grady, | ||
out double | gradz | ||
) | [pure virtual] |
Calculates gradient of the current 3D scalar function and returns its components through the specified output variables.
x | First parameter. |
y | Second parameter. |
z | Third parameter. |
gradx | First component of the returned gradient. |
grady | Second component of the returned gradient. |
gradz | Third component of the returned gradient. |
Implements IG::Num::IFunc3d.
Implemented in IG::Num::Func3dBaseNoGradient, IG::Num::Func3dVectorFormBase, IG::Num::Func3dExamples::Func3dXYZ, IG::Num::Func3dFromScalarFunction, IG::Gr3d::VtkPlotBase::Func3dZ, and IG::Gr3d::VtkPlotBase::Func3dZero.
Calculates and returns gradient of the current 3D scalar function.
<returnreturns>Gradient of the current 3D scalar function (in form of the vec3 struct)</returnreturns>
Implements IG::Num::IFunc3d.
Reimplemented in IG::Num::Func3dVectorFormBase, IG::Num::Func3dLinear, and IG::Num::Func3dQuadratic.
abstract void IG::Num::Func3dBase::Hessian | ( | double | x, |
double | y, | ||
double | z, | ||
out double | dxx, | ||
out double | dyy, | ||
out double | dzz, | ||
out double | dxy, | ||
out double | dxz, | ||
out double | dyz | ||
) | [pure virtual] |
Calculates Hessian of the current 3D scalar function and returns its component through the specified output variables.
x | First parameter. |
y | Second parameter. |
z | Third parameter. |
dxx | Component 1-1 of the calculated Hessian. |
dyy | Component 2-2 of the calculated Hessian. |
dzz | Component 3-3 of the calculated Hessian. |
dxy | Component 1-2 of the calculated Hessian. |
dxz | Component 1-3 of the calculated Hessian. |
dyz | Component 2-3 of the calculated Hessian. |
Implements IG::Num::IFunc3d.
Implemented in IG::Num::Func3dBaseNoHessian, IG::Num::Func3dBaseNoGradient, IG::Num::Func3dVectorFormBase, and IG::Num::Func3dFromScalarFunction.
Calculates and returns Hessian of the current 3D scalar function and returns it (in the form of a mat3 struct).
Implements IG::Num::IFunc3d.
Reimplemented in IG::Num::Func3dVectorFormBase, IG::Num::Func3dLinear, and IG::Num::Func3dQuadratic.
override double IG::Num::Func3dBase::Value | ( | IVector | parameters | ) | [inline] |
Returns the value of the current function at the specified parameters.
parameters | Vector of parameters for which value is evaluated. Its dimension must be equal to 3. |
Implements IG::Num::IScalarFunctionUntransformed.
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.
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.
static void IG::Num::Func3dBase::TestFunction | ( | IFunc3d | f | ) | [inline, static, protected] |
Demonstrates use of a 3D 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).
f | Function whose values and gradients are evaluated and printed. |
static void IG::Num::Func3dBase::TestFunction | ( | IFunc3d | f, |
double | xmin, | ||
double | xmax, | ||
double | ymin, | ||
double | ymax, | ||
double | zmin, | ||
double | zmax, | ||
int | numPoints | ||
) | [inline, static, protected] |
Demonstrates use of a 3D function by printing to the console some values and gradients of the function on the line connecting the two specified points.
f | Function whose values and gradients are evaluated and printed. |
xmin | Min. x. |
xmax | Max. x. |
ymin | Min. y. |
ymax | Max. y. |
zmin | Min. z. |
zmax | Max. z. |
numPoints | Number of points in which function values and gradients are printed. |
static void IG::Num::Func3dBase::Example | ( | ) | [inline, static] |
Example of use of a 3D function.
bool IG::Num::Func3dBase::_valueDefined = true [private] |
bool IG::Num::Func3dBase::_gradientDefined = false [private] |
bool IG::Num::Func3dBase::_hessianDefined = false [private] |
override bool IG::Num::Func3dBase::ValueDefined [get, set] |
Whether calculation of function value is defined. Defaulet is true.
Implements IG::Num::IScalarFunctionUntransformed.
override bool IG::Num::Func3dBase::GradientDefined [get, set] |
Whether calculation of functio ngradient is defined. Default is false.
Implements IG::Num::IScalarFunctionUntransformed.
override bool IG::Num::Func3dBase::HessianDefined [get, set] |
Whether calculation of function Hessian is defined. Default is false.
Implements IG::Num::IScalarFunctionUntransformed.
int IG::Num::Func3dBase::NumParam [get] |
Gets number of parameters.