IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Num.ScalarFunctionOneParametric Class Reference

Base class for one parametric families of scalar functions with affine transformation of co-ordinates. Parameters that completely define the function out of parametric family of functions can be queried or set. Affine transformation of coordinates is included: the reference function evaluation must be defined while the actual function is defined as that reference function of transformed coordinates. If transformation is not specified then function reduces to the reference one. More...

+ Inheritance diagram for IG.Num.ScalarFunctionOneParametric:
+ Collaboration diagram for IG.Num.ScalarFunctionOneParametric:

Public Member Functions

 ScalarFunctionOneParametric (double parameter)
 Constructor. Does not define affine transformation of the function. More...
 
 ScalarFunctionOneParametric (double parameter, IAffineTransformation transformation)
 Constructor. Creates a new parametric scalar function with the specified parameter and transformation of coordinates. More...
 
 ScalarFunctionOneParametric (IVector parameters)
 Constructor. Does not define affine transformation of the function. More...
 
 ScalarFunctionOneParametric (IVector parameters, IAffineTransformation transformation)
 Cobnstructor. Creates a new parametric scalar function with the specified parameters and transformation of coordinates. More...
 
override double[] GetParameters ()
 Returns parameters of the current parametric function as an array. Since this class is for one parametric family of functions, an array of length 1 is always returned. More...
 
override void SetParameters (double[] parameters)
 Sets parameters of the current parametric functions, where parameters are specified as array. More...
 
override double GetParameter (int which)
 Returns value of the specified parameter of the parameterized function. More...
 
override void SetParameter (int which, double value)
 Sets the specific parameters of the parameterized function. More...
 
- Public Member Functions inherited from IG.Num.ScalarFunctionParametricBase
 ScalarFunctionParametricBase (IVector parameters)
 Constructor. Does not define affine transformation of the function. More...
 
 ScalarFunctionParametricBase (IVector parameters, IAffineTransformation transformation)
 Cobnstructor. Creates a new parametric scalar function with the specified parameters and transformation of coordinates. More...
 
- Public Member Functions inherited from IG.Num.ScalarFunctionBase
 ScalarFunctionBase (IAffineTransformation transf)
 Constructs a scalar function that is identical to some reference funciton acting on affine transformed parameters. More...
 
abstract double ReferenceValue (IVector parameters)
 Returns the value of this function at the specified parameter in the reference coordinate system. More...
 
abstract void ReferenceGradientPlain (IVector parameters, IVector gradient)
 Calculates the first derivative (gradient) of this function at the specified parameter in the reference coordinate system. More...
 
abstract void ReferenceHessianPlain (IVector parameters, IMatrix hessian)
 Calculates the second derivative (Hessian) of this function at the specified parameters in the reference coordinate system. More...
 
override double Value (IVector x)
 Returns the value of this function at the specified parameter. More...
 
override void GradientPlain (IVector x, IVector gradient)
 Returns the first derivative of this function at the specified parameter. More...
 
override void HessianPlain (IVector x, IMatrix hessian)
 Returns the second derivative (Hessian) of this function at the specified arameter. More...
 
- Public Member Functions inherited from IG.Num.ScalarFunctionUntransformedBase
virtual void Evaluate (IScalarFunctionResults data)
 Evaluates whatever needs to be evaluated and stores the results on the specified storage object. More...
 
virtual void Gradient (IVector parameters, ref IVector gradient)
 Calculates first order derivatives (gradient) of this function at the specified parameters. More...
 
virtual void Hessian (IVector parameters, ref IMatrix hessian)
 Calculates the second derivative (Hessian matrix) of this function at the specified parameters. More...
 
virtual void NumericalGradientForwardPlain (IVector x, IVector stepSizes, IVector gradient)
 Calculates numerical derivatives (gradient) of this function. Forward difference formula is normally used. More...
 
void NumericalGradientForward (IVector x, IVector stepSizes, ref IVector gradient)
 Calculates numerical derivatives (gradient) of this function. Forward difference formula is normally used. More...
 
void NumericalGradientForward (IVector x, double stepSize, ref IVector gradient)
 Calculates numerical derivatives (gradient) of this function. Forward difference formula is used. More...
 
virtual void NumericalGradientCentralPlain (IVector x, IVector stepSizes, IVector gradient)
 Calculates numerical derivatives (gradient) of this function. Forward difference formula is normally used. More...
 
void NumericalGradientCentral (IVector x, IVector stepSizes, ref IVector gradient)
 Calculates numerical derivatives (gradient) of this function. Forward difference formula is normally used. More...
 
void NumericalGradientCentral (IVector x, double stepSize, ref IVector gradient)
 Calculates numerical derivatives (gradient) of this function. Forward difference formula is normally used. More...
 
virtual void NumericalHessianForwardPlain (IVector x, IVector stepSizes, IVector aux, IMatrix hessian)
 Calculates numerical second derivatives (Hessian) of this function. Forward difference formula is normally used. WARNING: Dimensions of vector arguments must match. This function does not check for consistency of argument dimensions. REMARK: Vector x is changed during operation, but is set to initial value before function returns (unless an exception is thrown). More...
 
virtual void NumericalHessianForward (IVector x, IVector stepSizes, ref IVector aux, ref IMatrix hessian)
 Calculates numerical second derivatives (Hessian) of this function. Forward difference formula is normally used. REMARK: if auxiliary vector or result matrix don't have correct dimensions or they are not allocated, then allocation is performed first. REMARK: Vector x is changed during operation, but is set to initial value before function returns (unless an exception is thrown). More...
 
virtual void NumericalHessianForward (IVector x, double stepSize, ref IVector aux, ref IMatrix hessian)
 Calculates numerical second derivatives (Hessian) of this function. Forward difference formula is normally used. REMARK: if auxiliary vector or result matrix don't have correct dimensions or they are not allocated, then allocation is performed first. REMARK: Vector x is changed during operation, but is set to initial value before function returns (unless an exception is thrown). More...
 
virtual void NumericalHessianCentralPlain (IVector x, IVector stepSizes, IVector aux1, IVector aux2, IMatrix hessian)
 Calculates numerical second derivatives (Hessian) of this function. Forward difference formula is normally used. WARNING: Dimensions of vector arguments must match. This function does not check for consistency of argument dimensions. REMARK: Vector x is changed during operation, but is set to initial value before function returns (unless an exception is thrown). More...
 
virtual void NumericalHessianCentral (IVector x, IVector stepSizes, ref IVector aux1, ref IVector aux2, ref IMatrix hessian)
 Calculates numerical second derivatives (Hessian) of this function. Forward difference formula is normally used. REMARK: if auxiliary vector or result matrix don't have correct dimensions or they are not allocated, then allocation is performed first. REMARK: Vector x is changed during operation, but is set to initial value before function returns (unless an exception is thrown). More...
 
virtual void NumericalHessianCentral (IVector x, double stepSize, ref IVector aux1, ref IVector aux2, ref IMatrix hessian)
 Calculates numerical second derivatives (Hessian) of this function. Forward difference formula is normally used. REMARK: if auxiliary vector or result matrix don't have correct dimensions or they are not allocated, then allocation is performed first. REMARK: Vector x is changed during operation, but is set to initial value before function returns (unless an exception is thrown). More...
 
virtual void NumericalHessianCentralPlain (IVector x, IVector stepSizes, IVector aux1, IVector aux2, IMatrix hessian, bool useAnalyticalGradient)
 Calculates numerical second derivatives (Hessian) of this function by the central difference formula. WARNING: Dimensions of vector arguments must match. This function does not check for consistency of argument dimensions. REMARK: Vector x is changed during operation, but is set to initial value before function returns (unless an exception is thrown). More...
 
virtual void NumericalHessianCentral (IVector x, IVector stepSizes, ref IVector aux1, ref IVector aux2, ref IMatrix hessian, bool useAnalyticalGradient)
 Calculates numerical second derivatives (Hessian) of this function by the central difference formula. REMARK: if auxiliary vector or result matrix don't have correct dimensions or they are not allocated, then allocation is performed first. REMARK: Vector x is changed during operation, but is set to initial value before function returns (unless an exception is thrown). More...
 
virtual void NumericalHessianCentral (IVector x, double stepSize, ref IVector aux1, ref IVector aux2, ref IMatrix hessian, bool useAnalyticalGradient)
 Calculates numerical second derivatives (Hessian) of this function. Forward difference formula is normally used. REMARK: if auxiliary vector or result matrix don't have correct dimensions or they are not allocated, then allocation is performed first. REMARK: Vector x is changed during operation, but is set to initial value before function returns (unless an exception is thrown). More...
 
void TestSpeed (IVector parameters, int numEvaluations, bool randomPerturbations, double relativePerturbationSize, bool calcValue, bool calcGradient, bool calcHessian, bool writeLastResult)
 Tests speed of evaluation of the current scalar function and writes results to the console. More...
 
void TestGradient (IVector parameters, IVector stepSizes, int stepReductionFactor, int numStepReductions, bool checkNumerical, bool writeErrorComponents, bool writeGradientComponents)
 Tests the calculation of gradients of the current scalar function. More...
 
void TestGradient (IVector parameters, IVector stepSizes, int stepReductionFactor, int numStepReductions, bool checkNumerical, bool writeErrorComponents, bool writeGradientComponents, bool useCentralDifference)
 Tests the calculation of gradients of the current scalar function. More...
 
void TestHessian (IVector parameters, IVector stepSizes, int stepReductionFactor, int numStepReductions, bool checkNumerical, bool writeErrorComponents, bool writeHessianComponents)
 Tests the calculation of Hessians of the current scalar function. More...
 
void TestHessian (IVector parameters, IVector stepSizes, int stepReductionFactor, int numStepReductions, bool checkNumerical, bool writeErrorComponents, bool writeHessianComponents, bool useCentralDifference)
 Tests the calculation of Hessians of the current scalar function. More...
 
void Test (IVector from, IVector to, int numProbes, IVector stepSizes, double tolerance, bool testDerivatives, bool testSecondDerivatives, bool printDifferences, bool printResults)
 Performs numerical tests on the function, with output written to the console. Derivatives and second derivatives are tested and compared to numerical derivatives. More...
 
void Test (IVector from, IVector to, int numProbes, IVector stepSizes, double tolerance)
 Performs numerical tests on the function, with output written to the console. Derivatives and second derivatives are tested and compared to numerical derivatives. This method tests first and second order derivatives, prints differences between analytical and numerical values to the console, and prints reports where absolute differences exceed rolerance. More...
 
void Test (IVector from, IVector to, int numProbes, double stepSize, double tolerance, bool testDerivatives, bool testSecondDerivatives, bool printDifferences, bool printResults)
 Performs numerical tests on the function, with output written to the console. Derivatives and second derivatives are tested and compared to numerical derivatives. More...
 
void Test (IVector from, IVector to, int numProbes, double stepSize, double tolerance)
 Performs numerical tests on the function, with output written to the console. Derivatives and second derivatives are tested and compared to numerical derivatives. More...
 

Static Protected Attributes

static Vector _parAux = new Vector(1)
 Auxiliary vector whose only function is to enable calling base constructors with parameters specified as vector. More...
 

Properties

override IVector Parameters [get, set]
 Gets or sets parameters that define the specific function out of parametric familiy of scalar functions. More...
 
virtual double Parameter [get, set]
 Gets or sets the (only) parameter that defines the current function out of parametric family of functions. More...
 
override int NumParameters [get]
 Gets number of parameters that define the current function out of parametric family of scalar functions. Always evaluates to 1 because this is a one parametric family of functions. More...
 
- Properties inherited from IG.Num.ScalarFunctionParametricBase
abstract IVector Parameters [get, set]
 Gets or sets parameters that define the specific function out of parametric familiy of scalar functions. Usually a reference is set or returned. More...
 
virtual int NumParameters [get]
 Gets number of parameters that define the current function out of parametric family of scalar functions. More...
 
- Properties inherited from IG.Num.ScalarFunctionBase
virtual IAffineTransformation Transformation [get, set]
 Transformation of parameters. Actual function is evaluated as some reference function evaluated at inverse affine-transformed parameters. More...
 
- Properties inherited from IG.Num.ScalarFunctionUntransformedBase
virtual string Name [get, set]
 Returns a short name of thecurrent function. More...
 
virtual string Description [get, set]
 Returns a short description of the current function. More...
 
abstract bool ValueDefined [get, protected set]
 Tells whether value of the function is defined by implementation. More...
 
abstract bool GradientDefined [get, protected set]
 Tells whether the first derivative is defined for this function (by implementation, not mathematically) More...
 
abstract bool HessianDefined [get, protected set]
 Tells whether the second derivative is defined for this function (by implementation, not mathematically) More...
 
- Properties inherited from IG.Num.IScalarFunctionUntransformed
string Name [get]
 Returns a short name of the function. More...
 
string Description [get]
 Returns a short description of the function. More...
 
bool ValueDefined [get]
 Tells whether value of the function is defined by implementation. More...
 
bool GradientDefined [get]
 Tells whether the first derivative is defined for this function (by implementation, not mathematically) More...
 
bool HessianDefined [get]
 Tells whether the second derivative is defined for this function (by implementation, not mathematically) More...
 
- Properties inherited from IG.Num.IScalarFunction
IAffineTransformation Transformation [get, set]
 Affine transformation of parameters. Actual function is evaluated as reference function evaluated at inverse affine transformed parameters. More...
 
- Properties inherited from IG.Num.IScalarFunctionParametric
IVector Parameters [get, set]
 Parameters that define the specific function out of parametric familiy of scalar functions. More...
 
int NumParameters [get]
 Gets number of parameters that define the specific function out of parametric family of scalar functions. More...
 

Private Member Functions

 ScalarFunctionOneParametric ()
 Default constructor is inaccessible because it has no meaning. More...
 

Private Attributes

double _parameter
 

Additional Inherited Members

- Protected Member Functions inherited from IG.Num.ScalarFunctionBase
 ScalarFunctionBase ()
 Default constructor for scalar functions of affine transformed parameters. Constructs untransformed reference function. More...
 
- Protected Attributes inherited from IG.Num.ScalarFunctionBase
IVector _refParam
 
IVector _refGrad
 
IMatrix _refHess
 
- Protected Attributes inherited from IG.Num.ScalarFunctionUntransformedBase
string _name
 
string _description
 

Detailed Description

Base class for one parametric families of scalar functions with affine transformation of co-ordinates. Parameters that completely define the function out of parametric family of functions can be queried or set. Affine transformation of coordinates is included: the reference function evaluation must be defined while the actual function is defined as that reference function of transformed coordinates. If transformation is not specified then function reduces to the reference one.

This base class does not implement data containing parameters. This enables to derive base classes with different representations of parameters, e.g. with only one number for one parametric functions.

$A Igor Dec10;

Constructor & Destructor Documentation

IG.Num.ScalarFunctionOneParametric.ScalarFunctionOneParametric ( )
inlineprivate

Default constructor is inaccessible because it has no meaning.

IG.Num.ScalarFunctionOneParametric.ScalarFunctionOneParametric ( double  parameter)
inline

Constructor. Does not define affine transformation of the function.

Parameters
parameterParameter that define a specific function out of a parametric family of functions.
IG.Num.ScalarFunctionOneParametric.ScalarFunctionOneParametric ( double  parameter,
IAffineTransformation  transformation 
)
inline

Constructor. Creates a new parametric scalar function with the specified parameter and transformation of coordinates.

Parameters
parameterParameter that defines a specific function out of a parametric family of functions.
transformationAffine transformation of coordinates. Actual function is calculated as some reference function evaluated at inverse affine transformed parameters. If null then transformation is not applied.
IG.Num.ScalarFunctionOneParametric.ScalarFunctionOneParametric ( IVector  parameters)
inline

Constructor. Does not define affine transformation of the function.

Parameters
parametersVector of parameters that define a specific function out of a parametric family of functions.
IG.Num.ScalarFunctionOneParametric.ScalarFunctionOneParametric ( IVector  parameters,
IAffineTransformation  transformation 
)
inline

Cobnstructor. Creates a new parametric scalar function with the specified parameters and transformation of coordinates.

Parameters
parametersVector of parameters that define a specific function out of a parametric family of functions.
transformationAffine transformation of coordinates. Actual function is calculated as some reference function evaluated at inverse affine transformed parameters. If null then transformation is not applied.

Member Function Documentation

override double [] IG.Num.ScalarFunctionOneParametric.GetParameters ( )
inline

Returns parameters of the current parametric function as an array. Since this class is for one parametric family of functions, an array of length 1 is always returned.

Implements IG.Num.IScalarFunctionParametric.

override void IG.Num.ScalarFunctionOneParametric.SetParameters ( double[]  parameters)
inline

Sets parameters of the current parametric functions, where parameters are specified as array.

Parameters
parametersArray of parameters. Array length must be 1 because this class represents a one parametric family..

Implements IG.Num.IScalarFunctionParametric.

override double IG.Num.ScalarFunctionOneParametric.GetParameter ( int  which)
inline

Returns value of the specified parameter of the parameterized function.

Parameters
whichSpecifies which parameter is returned, must be 0 because this class represents a one parametric family of functions.

Implements IG.Num.IScalarFunctionParametric.

override void IG.Num.ScalarFunctionOneParametric.SetParameter ( int  which,
double  value 
)
inline

Sets the specific parameters of the parameterized function.

Parameters
whichSpecifies which parameter is set, must be 0 because this class represents a one parametric family of functions.
valueValue of the specified parameter.

Implements IG.Num.IScalarFunctionParametric.

Member Data Documentation

Vector IG.Num.ScalarFunctionOneParametric._parAux = new Vector(1)
staticprotected

Auxiliary vector whose only function is to enable calling base constructors with parameters specified as vector.

double IG.Num.ScalarFunctionOneParametric._parameter
private

Property Documentation

override IVector IG.Num.ScalarFunctionOneParametric.Parameters
getset

Gets or sets parameters that define the specific function out of parametric familiy of scalar functions.

virtual double IG.Num.ScalarFunctionOneParametric.Parameter
getset

Gets or sets the (only) parameter that defines the current function out of parametric family of functions.

override int IG.Num.ScalarFunctionOneParametric.NumParameters
get

Gets number of parameters that define the current function out of parametric family of scalar functions. Always evaluates to 1 because this is a one parametric family of functions.


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