IGLib
1.5
The IGLib base library for development of numerical, technical and business applications.
|
Base class for defining scalar functions without possibility of affine transformation of parameters. More...
Public Member Functions | |
virtual void | Evaluate (IScalarFunctionResults data) |
Evaluates whatever needs to be evaluated and stores the results on the specified storage object. More... | |
abstract double | Value (IVector parameters) |
Returns the value of this function at the specified parameter. More... | |
abstract 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. More... | |
virtual void | Gradient (IVector parameters, ref IVector gradient) |
Calculates first order derivatives (gradient) of this function at the specified parameters. More... | |
abstract 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. 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... | |
Protected Attributes | |
string | _name |
string | _description |
Properties | |
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... | |
![]() | |
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... | |
Base class for defining scalar functions without possibility of affine transformation of parameters.
More or less all scalar functions should derive from this class.
$A Igor xx May10 Dec10; TODO: implement ICloneable
|
inlinevirtual |
Evaluates whatever needs to be evaluated and stores the results on the specified storage object.
data | Evaluation data object where results of calculation are stored. It also contains flags taht specify what needs to be calculated, and resulting flags specifying what has been calculated. |
Implements IG.Num.IScalarFunctionUntransformed.
References IG.Num.IScalarFunctionResults.Calculated, IG.Num.IScalarFunctionResults.CalculatedGradient, IG.Num.IScalarFunctionResults.CalculatedHessian, IG.Num.IScalarFunctionResults.CalculatedValue, IG.Num.IScalarFunctionResults.ErrorCode, IG.Num.IScalarFunctionResults.ErrorString, IG.Num.IVector.GetNew(), IG.Num.IVector.GetNewMatrix(), IG.Num.IScalarFunctionResults.Gradient, IG.Num.IScalarFunctionResults.Hessian, IG.Num.IScalarFunctionResults.Parameters, IG.Num.IScalarFunctionResults.ReqGradient, IG.Num.IScalarFunctionResults.ReqHessian, IG.Num.IScalarFunctionResults.ReqValue, IG.Num.IScalarFunctionResults.SetGradientReference(), IG.Num.IScalarFunctionResults.SetHessianReference(), and IG.Num.IScalarFunctionResults.Value.
|
pure virtual |
Returns the value of this function at the specified parameter.
Implements IG.Num.IScalarFunctionUntransformed.
Implemented in IG.Num.ScalarFunctionQuadratic, IG.Num.Func3dBase, IG.Num.Func2dBase, IG.Num.ScalarFunctionLinear, IG.Num.ScalarFunctionRadialUntransformed, IG.Num.ScalarFunctionBase, and IG.Num.ScalarFunctionConstant.
|
pure virtual |
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.
Implemented in IG.Num.ScalarFunctionQuadratic, IG.Num.Func3dBase, IG.Num.ScalarFunctionLinear, IG.Num.Func2dBase, IG.Num.ScalarFunctionRadialUntransformed, IG.Num.ScalarFunctionBase, and IG.Num.ScalarFunctionConstant.
|
inlinevirtual |
Calculates first order derivatives (gradient) of this function at the specified parameters.
parameters | Vector of parameters where derivatives are evaluated. |
gradient | Vector where first order derivatives (gradient) are stored. Passed by reference. |
Implements IG.Num.IScalarFunctionUntransformed.
References IG.Num.IVector.GetNew().
Referenced by IG.Lib.ScalarFunctionLoader.Example().
|
pure virtual |
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.
Implemented in IG.Num.ScalarFunctionQuadratic, IG.Num.Func3dBase, IG.Num.ScalarFunctionLinear, IG.Num.Func2dBase, IG.Num.ScalarFunctionRadialUntransformed, IG.Num.ScalarFunctionBase, and IG.Num.ScalarFunctionConstant.
|
inlinevirtual |
Calculates the second derivative (Hessian matrix) of this function at the specified parameters.
parameters | Vector of parameters where derivatives are evaluated. |
hessian | Matrix where second derivatives (Hessian matrix) are stored. Passed by reference. |
Implements IG.Num.IScalarFunctionUntransformed.
References IG.Num.IVector.GetNewMatrix().
Referenced by IG.Lib.ScalarFunctionLoader.Example().
|
inlinevirtual |
Calculates numerical derivatives (gradient) 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).
x | Point at which derivative is calculated. |
stepSizes | Step size for numerical differentiation. |
gradient | Vector where calculated derivatives (function gradient) are stored. |
|
inline |
Calculates numerical derivatives (gradient) of this function. Forward difference formula is normally used.
If result vector doesn't have correct dimensions or it is not allocated, then allocation is performed first.
Vector x is changed during operation, but is set to initial value before function returns (unless an exception is thrown).
x | Point (vector of parameters) at which gradient is calculated. |
stepSizes | Step sizes for numerical differentiation. |
gradient | Vector where the calculated gradient is stored. |
References IG.Num.IVector.GetNew().
|
inline |
Calculates numerical derivatives (gradient) of this function. Forward difference formula is used.
Warning: This method internally allocates a new vector where step sizes are stored.
If result vector doesn't have correct dimensions or it is not allocated, then allocation is performed first.
Vector x is changed during operation, but is set to initial value before function returns (unless an exception is thrown).
x | Point (vector of parameters) at which gradient is calculated. |
stepSizes | Step size for numerical differentiation (the same in all directions). |
gradient | Vector where the calculated gradient is stored. |
TODO: When NumericalDerivativePlain is tested enough, replace this function in sulch a way that stepSize is used directly in a copy of that function (currently a vetor of step sizes is created where each component holds the same step size.)
References IG.Num.IVector.GetNew().
|
inlinevirtual |
Calculates numerical derivatives (gradient) 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).
x | Point at which derivative is calculated. |
stepSizes | Step size for numerical differentiation. |
gradient | Vector where calculated derivatives (function gradient) are stored. |
|
inline |
Calculates numerical derivatives (gradient) of this function. Forward difference formula is normally used.
If result vector doesn't have correct dimensions or it is not allocated, then allocation is performed first.
Vector x is changed during operation, but is set to initial value before function returns (unless an exception is thrown).
x | Point (vector of parameters) at which gradient is calculated. |
stepSizes | Step sizes for numerical differentiation. |
gradient | Vector where the calculated gradient is stored. |
References IG.Num.IVector.GetNew().
|
inline |
Calculates numerical derivatives (gradient) of this function. Forward difference formula is normally used.
Warning: This method internally allocates a new vector where step sizes are stored.
If the result vector doesn't have correct dimensions or it is not allocated, then allocation is performed first.
Vector x is changed during operation, but is set to initial value before function returns (unless an exception is thrown).
x | Point (vector of parameters) at which gradient is calculated. |
stepSizes | Step size for numerical differentiation (the same in all directions). |
gradient | Vector where the calculated gradient is stored. |
TODO: When NumericalDerivativePlain is tested enough, replace this function in sulch a way that stepSize is used directly in a copy of that function (currently a vetor of step sizes is created where each component holds the same step size.)
References IG.Num.IVector.GetNew().
|
inlinevirtual |
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).
x | Point (vector of parameters) at which derivative is calculated. |
aux | Auxiliary storage vector, must be of the same dimension as vector of parameters. |
stepSizes | Step size for numerical differentiation. |
hessian | Matrix where calculated second derivatives (function Hessian) are stored. |
|
inlinevirtual |
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).
x | Point (vector of parameters) at which derivative is calculated. |
aux | Auxiliary storage vector, must be of the same dimension as vector of parameters. |
stepSizes | Step size for numerical differentiation. |
hessian | Matrix where calculated second derivatives (function Hessian) are stored. |
References IG.Num.IVector.GetNew(), and IG.Num.IVector.GetNewMatrix().
|
inlinevirtual |
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).
x | Point (vector of parameters) at which derivative is calculated. |
aux | Auxiliary storage vector, must be of the same dimension as vector of parameters. |
stepSize | Step size for numerical differentiation (the same in all directions). |
hessian | Matrix where calculated second derivatives (function Hessian) are stored. |
TODO: When NumericalSecondDerivativePlain is tested enough, replace this function in sulch a way that stepSize is used directly in a copy of that function (currently a vetor of step sizes is created where each component holds the same step size.)
References IG.Num.IVector.GetNew().
|
inlinevirtual |
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).
x | Point (vector of parameters) at which derivative is calculated. |
aux1 | Auxiliary storage vector, must be of the same dimension as vector of parameters. |
stepSizes | Step size for numerical differentiation. |
hessian | Matrix where calculated second derivatives (function Hessian) are stored. |
|
inlinevirtual |
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).
x | Point (vector of parameters) at which derivative is calculated. |
aux1 | Auxiliary storage vector, must be of the same dimension as vector of parameters. |
stepSizes | Step size for numerical differentiation. |
hessian | Matrix where calculated second derivatives (function Hessian) are stored. |
References IG.Num.IVector.GetNew(), and IG.Num.IVector.GetNewMatrix().
|
inlinevirtual |
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).
x | Point (vector of parameters) at which derivative is calculated. |
stepSize | Step sizes for numerical differentiation. |
aux1 | Auxiliary storage vector, must be of the same dimension as vector of parameters. |
aux2 | The secont auxiliary storage vector, must be of the same dimension as vector of parameters. |
hessian | Matrix where calculated second derivatives (function Hessian) are stored. |
TODO: When NumericalSecondDerivativePlain is tested enough, replace this function in sulch a way that stepSize is used directly in a copy of that function (currently a vetor of step sizes is created where each component holds the same step size.)
References IG.Num.IVector.GetNew().
|
inlinevirtual |
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).
x | Point (vector of parameters) at which derivative is calculated. |
aux1 | Auxiliary storage vector, must be of the same dimension as vector of parameters. |
aux2 | Another auxiliary storage vector, must be of the same dimension as vector of parameters. |
stepSizes | Step size for numerical differentiation. |
hessian | Matrix where calculated second derivatives (function Hessian) are stored. |
useAnalyticalGradient | If true then analytical gradient are used when provided by the current function. |
|
inlinevirtual |
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).
x | Point (vector of parameters) at which derivative is calculated. |
aux1 | Auxiliary storage vector, must be of the same dimension as vector of parameters. |
aux2 | Another auxiliary storage vector, must be of the same dimension as vector of parameters. |
stepSizes | Step size for numerical differentiation. |
hessian | Matrix where calculated second derivatives (function Hessian) are stored. |
useAnalyticalGradient | If true then analytical gradient are used when provided by the current function. |
References IG.Num.IVector.GetNew(), and IG.Num.IVector.GetNewMatrix().
|
inlinevirtual |
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).
x | Point (vector of parameters) at which derivative is calculated. |
stepSize | Step sizes for numerical differentiation. |
aux1 | Auxiliary storage vector, must be of the same dimension as vector of parameters. |
aux2 | The second auxiliary storage vector, must be of the same dimension as vector of parameters. |
hessian | Matrix where calculated second derivatives (function Hessian) are stored. |
useAnalyticalGradient | If true then analytical gradient are used when provided by the current function. |
TODO: When NumericalSecondDerivativePlain is tested enough, replace this function in sulch a way that stepSize is used directly in a copy of that function (currently a vetor of step sizes is created where each component holds the same step size.)
References IG.Num.IVector.GetNew().
|
inline |
Tests speed of evaluation of the current scalar function and writes results to the console.
parameters | Central value of parameters at which function value, gradient and/or Hessian is evaluated. |
numEvaluations | Number of evaluations performed. |
randomPerturbations | Whether to use random perturbations or not. |
relativePerturbationSize | Relative size of random perturbations, when used. |
calcValue | Whether function value is calculated. |
calcGradient | Whether function gradient is calculated. |
calcHessian | Whether function Hessian is calculated. |
writeLastResult | Whether results of the last calculation are written to console. |
The specified number of function values, gradients and/or Hessians is evaluated, and time of evaluation is reported (with average time for a single evaluation also reported).
References IG.Num.RandomGenerator.Global, IG.Num.VectorBase.Multiply(), IG.Num.IRandomGenerator.NextDouble(), IG.Lib.StopWatch.Start(), IG.Num.IVector.ToString(), IG.Num.IMatrix.ToString(), IG.Lib.StopWatch.TotalCpuTime, and IG.Lib.StopWatch.TotalTime.
|
inline |
Tests the calculation of gradients of the current scalar function.
Differentiation is performed according to the central difference formula.
Calculations of numerical and analytical gradients can be verified.
Numerical gradients can be calculated at different step szes that are iteratively reduced by the specified integer factor, which gives indication of precision.
parameters | Vector of parameters at which function gradient is calculated. |
stepSizes | Vector of initial step sizes used for function differentiation. |
stepReductionFactor | Factor greater than 1 by which step size is reduced at each iteration. |
numStepReductions | Number of step size reductions. |
checkNumerical | Whether check is also made only on basis of numerical values. |
writeErrorComponents | Whether gradient errors (and differences between results at different step sizes in the case of pure numerical check) in component-wise form are also written to the console (if fallse, only norms are written). |
writeGradientComponents | Whether gradients (calculated and analytical) are written in component-wise form. |
|
inline |
Tests the calculation of gradients of the current scalar function.
Calculations of numerical and analytical gradients can be verified.
Numerical gradients can be calculated at different step szes that are iteratively reduced by the specified integer factor, which gives indication of precision.
parameters | Vector of parameters at which function gradient is calculated. |
stepSizes | Vector of initial step sizes used for function differentiation. |
stepReductionFactor | Factor greater than 1 by which step size is reduced at each iteration. |
numStepReductions | Number of step size reductions. |
checkNumerical | Whether check is also made only on basis of numerical values. |
writeErrorComponents | Whether gradient errors (and differences between results at different step sizes in the case of pure numerical check) in component-wise form are also written to the console (if fallse, only norms are written). |
writeGradientComponents | Whether gradients (calculated and analytical) are written in component-wise form. |
useCentralDifference | Whether the more precise but also more time consuming central difference scheme is used for numerical differentiation. |
References IG.Num.IVector.GetCopy(), IG.Num.VectorBase.Multiply(), IG.Num.IVector.SetConstant(), IG.Num.VectorBase.Subtract(), and IG.Num.IVector.ToString().
|
inline |
Tests the calculation of Hessians of the current scalar function.
Calculations of numerical and analytical Hessians can be verified.
Numerical Hessians can be calculated at different step szes that are iteratively reduced by the specified integer factor, which gives indication of precision.
parameters | Vector of parameters at which function Hessian is calculated. |
stepSizes | Vector of initial step sizes used for function differentiation. |
stepReductionFactor | Factor greater than 1 by which step size is reduced at each iteration. |
numStepReductions | Number of step size reductions. |
checkNumerical | Whether check is also made only on basis of numerical values. |
writeErrorComponents | Whether Hessian errors (and differences between results at different step sizes in the case of pure numerical check) in component-wise form are also written to the console (if fallse, only norms are written). |
writeHessianComponents | Whether Hessians (calculated and analytical) are written in component-wise form. |
|
inline |
Tests the calculation of Hessians of the current scalar function.
Calculations of numerical and analytical Hessians can be verified.
Numerical Hessians can be calculated at different step szes that are iteratively reduced by the specified integer factor, which gives indication of precision.
parameters | Vector of parameters at which function Hessian is calculated. |
stepSizes | Vector of initial step sizes used for function differentiation. |
stepReductionFactor | Factor greater than 1 by which step size is reduced at each iteration. |
numStepReductions | Number of step size reductions. |
checkNumerical | Whether check is also made only on basis of numerical values. |
writeErrorComponents | Whether Hessian errors (and differences between results at different step sizes in the case of pure numerical check) in component-wise form are also written to the console (if fallse, only norms are written). |
writeHessianComponents | Whether Hessians (calculated and analytical) are written in component-wise form. |
useCentralDifference | Whether the central difference formula is used for numerial differentiation. |
References IG.Num.IVector.GetCopy(), IG.Num.VectorBase.Multiply(), IG.Num.IMatrix.SetConstant(), IG.Num.MatrixBase.Subtract(), and IG.Num.IVector.ToString().
|
inline |
Performs numerical tests on the function, with output written to the console. Derivatives and second derivatives are tested and compared to numerical derivatives.
from | Initial parameters on which tests are performed. |
to | Final parameters on which tests are performed. |
numProbes | Number of points on which tests are performed. Points are linearly distributed between from and to. |
stepSizes | Step sizes for numerical differentiation. |
tolerance | Absolute tolerance for match between numerical and analytical values. |
testDerivatives | Specifies whether first order derivatives should be tested. |
testSecondDerivatives | Specifies whether second order derivatives should be tested. |
printDifferences | Specifies whether differences between numerical and analytical derivatives should be printed. |
printResults | Specifies whether results should be printed. |
References IG.Num.VectorBase.Add(), IG.Num.VectorBase.Copy(), IG.Num.VectorBase.Divide(), IG.Num.IVector.GetNew(), IG.Num.VectorBase.Multiply(), IG.Num.VectorBase.Subtract(), and IG.Num.MatrixBase.Subtract().
|
inline |
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.
from | Initial parameters on which tests are performed. |
to | Final parameters on which tests are performed. |
numProbes | Number of points on which tests are performed. Points are linearly distributed between from and to. |
stepSizes | Step sizes for numerical differentiation. |
tolerance | Absolute tolerance for match between numerical and analytical values. |
|
inline |
Performs numerical tests on the function, with output written to the console. Derivatives and second derivatives are tested and compared to numerical derivatives.
from | Initial parameters on which tests are performed. |
to | Final parameters on which tests are performed. |
numProbes | Number of points on which tests are performed. Points are linearly distributed between from and to. |
stepSize | Step size for numerical differentiation (the same in all directions). |
tolerance | Absolute tolerance for match between numerical and analytical values. |
testDerivatives | Specifies whether first order derivatives should be tested. |
testSecondDerivatives | Specifies whether second order derivatives should be tested. |
printDifferences | Specifies whether differences between numerical and analytical derivatives should be printed. |
printResults | Specifies whether results should be printed. |
References IG.Num.IVector.GetNew().
|
inline |
Performs numerical tests on the function, with output written to the console. Derivatives and second derivatives are tested and compared to numerical derivatives.
from | Initial parameters on which tests are performed. |
to | Final parameters on which tests are performed. |
numProbes | Number of points on which tests are performed. Points are linearly distributed between from and to. |
stepSize | Step size for numerical differentiation (the same in all directions). |
tolerance | Absolute tolerance for match between numerical and analytical values. |
|
protected |
|
protected |
|
getset |
Returns a short name of thecurrent function.
|
getset |
Returns a short description of the current function.
|
getprotected set |
Tells whether value of the function is defined by implementation.
|
getprotected set |
Tells whether the first derivative is defined for this function (by implementation, not mathematically)
|
getprotected set |
Tells whether the second derivative is defined for this function (by implementation, not mathematically)