| 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 | Protected Attributes | Properties

# IG::Num::ScalarFunctionResults Class Reference

Storage for results of a scalar function. Includes parameters at which function was (or should be) evaluated, flags specifying what has been and what should be evaluated, calculated value, gradient and Hessian of the function in the specified point. More...

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

List of all members.

## Public Member Functions
| ScalarFunctionResults ()
| 1 parameter, no constraints, 1 objective function. No gradients required
| ScalarFunctionResults (bool reqGradients)
| 1 parameter, no constraints, 1 objective function.
| ScalarFunctionResults (int numParameters)
| Specified number of parameters, 1 objective, no constraints. No gradients required.
| ScalarFunctionResults (int numParameters, bool reqGradients)
| Specified number of parameters, 1 objective, no constraints. No gradients required.
virtual IVector | GetParameters ()
| Returns vector of optimization parameters.
virtual void | SetParameters (IVector value)
| Sets the vector of optimization parameters. If CopyReferences=true (false by default) then only the reference is copied.
virtual void | SetParametersReference (IVector reference)
| Sets the vector of optimization parameters. Only the reference is copied.
virtual double | GetParameter (int index)
| Returns specific optimization parameter. Throws exception if not defined or index out of bounds.
virtual void | SetParameter (int index, double value)
| Sets the specified optimization parameter.
virtual double | GetValue ()
| Returns the value of the function./summary>
virtual void | SetValue (double value)
| Sets the value of the function.
virtual IVector | GetGradient ()
| Returns the function gradient.
virtual void | SetGradient (IVector value)
| Sets the function gradient. If CopyReferences=true (false by default) then only the reference is copied.
virtual void | SetGradientReference (IVector reference)
| Sets the function gradient. Only the reference is copied.
virtual double | GetGradient (int index)
| Returns the specified component of the function gradient.
virtual void | SetGradient (int index, double value)
| Sets the specified component of the function gradient.
virtual IMatrix | GetHessian ()
| Returns the function's Hessian.
virtual void | SetHessian (IMatrix value)
| Sets the functions' Hessian. If CopyReferences=true (false by default) then only the reference is copied.
virtual void | SetHessianReference (IMatrix reference)
| Sets the functions' Hessian. Only the reference is copied.
virtual double | GetHessian (int rowIndex, int columnIndex)
| Returns the specified component of the function's Hessian.
virtual void | SetHessian (int rowIndex, int columnIndex, double value)
| Sets the specified component of the function's Hessian.
virtual void | NullifyAll ()
| Sets all objects (parameters and result objects) to null. If the references are not assigned elsewhere, these objects become eligible for garbage collection.
virtual void | NullifyResults ()
| Sets all result objects to null. If the references are not assigned elsewhere, these objects become eligible for garbage collection.
virtual void | AllocateParameters ()
| Allocates space for parameters.
virtual void | AllocateRequested ()
| Allocates space for all requested result objects.
virtual void | AllocateGradient ()
| Allocate space for function gradient.
virtual void | AllocateHessian ()
| Allocates space for function Hessian.
virtual void | ResetResults ()
| Sets all calculated flags to false, error code to 0 (no error) and error string to null.
virtual void | Copy (IScalarFunctionResults results)
| Copies data from another analysis results.
virtual IScalarFunctionResults | GetCopy ()
| Returns an exact deep copy of the current object.
## Protected Attributes
int | _numParameters = 1
IVector | _parameters
double | _value
IVector | _Gradient
IMatrix | _Hessian
bool | _copyReferences = false
bool | _reqValue = true
bool | _reqGradient = false
bool | _reqHessian = false
int | _errorCode = 0
string | _errorString = null
bool | _calcValue = false
bool | _calcGradient = false
bool | _calcHessian = false
int | _numObjectives = 1
int | _numConstraints = 0
int | _numEqualityConstraints = 0
List< double > | _constraints
List< IVector > | _constraintGradients
List< IMatrix > | _constraintHessians
bool | _reqConstraints = true
bool | _reqConstraintGradients = false
bool | _reqConstraintHessians = false
bool | _calcConstraints = false
bool | _calcConstraintGradients = false
bool | _calcConstraintHessians = false
## Properties
virtual int | NumParameters`[get, set]`
| Number of parameters.
virtual bool | CopyReferences`[get, set]`
| Indicates whether just references can be copied when setting function parameters or results. If false then deep copy is always performed. Default is false.
virtual IVector | Parameters`[get, set]`
| Optimization parameters. If CopyReferences=true (false by default) then only the reference is copied when assigning.
virtual double | Value`[get, set]`
| Value of the function.
virtual IVector | Gradient`[get, set]`
| Function gradient. If CopyReferences=true (false by default) then only the reference is copied in assignments.
virtual IMatrix | Hessian`[get, set]`
| Function Hessian (matrix of second derivatives). If CopyReferences=true (false by default) then only the reference is copied in assignments.
virtual bool | ReqValue`[get, set]`
| Indicates whether calculation of function value is/was requested.
virtual bool | ReqGradient`[get, set]`
| Indicates whether calculation of function gradient is/was requested.
virtual bool | ReqHessian`[get, set]`
| Indicates whether calculation of function Hessian is/was requested.
virtual int | ErrorCode`[get, set]`
| Error code. 0 - everything is OK. negative value - something went wrong.
virtual String | ErrorString`[get, set]`
| Error string indicating what went wrong.
virtual bool | Calculated`[get, set]`
| Collectively gets or sets calculated flags. Set false: all calculated flags are set to false. Set true: all calculated flags for which the corresponding request flags are true, are set to truee, others are set to false. Get: returns true if all the flags for which the corresponding request flags are true, are also true. Otherwise returns false.
virtual bool | CalculatedValue`[get, set]`
| Indicates whether calculation of function value is/was requested.
virtual bool | CalculatedGradient`[get, set]`
| Indicates whether calculation of function gradient is/was requested.
virtual bool | CalculatedHessian`[get, set]`
| Indicates whether calculation of function Hessian is/was requested.

## Detailed Description

Storage for results of a scalar function. Includes parameters at which function was (or should be) evaluated, flags specifying what has been and what should be evaluated, calculated value, gradient and Hessian of the function in the specified point.

$A Igor xx Dec09 Nov10;

## Constructor & Destructor Documentation

IG::Num::ScalarFunctionResults::ScalarFunctionResults | ( |  | ) | `[inline]`

1 parameter, no constraints, 1 objective function. No gradients required

IG::Num::ScalarFunctionResults::ScalarFunctionResults | ( | bool | reqGradients | ) | `[inline]`

1 parameter, no constraints, 1 objective function.

Parameters:

  reqGradients | Whether gradient of the objective function is required.

IG::Num::ScalarFunctionResults::ScalarFunctionResults | ( | int | numParameters | ) | `[inline]`

Specified number of parameters, 1 objective, no constraints. No gradients required.

Parameters:

  numParameters | Number of parameters.

IG::Num::ScalarFunctionResults::ScalarFunctionResults | ( | int | numParameters,
|  | bool | reqGradients
| ) |  | `[inline]`

Specified number of parameters, 1 objective, no constraints. No gradients required.

Parameters:

  numParameters | Number of parameters.
  reqGradients | Whether gradients are requested.

## Member Function Documentation

virtual IVector IG::Num::ScalarFunctionResults::GetParameters | ( |  | ) | `[inline, virtual]`

Returns vector of optimization parameters.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetParameters | ( | IVector | value | ) | `[inline, virtual]`

Sets the vector of optimization parameters. If CopyReferences=true (false by default) then only the reference is copied.

Parameters:

  value | Value to be assigned.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetParametersReference | ( | IVector | reference | ) | `[inline, virtual]`

Sets the vector of optimization parameters. Only the reference is copied.

Parameters:

  value | Reference to be assigned.

Implements IG::Num::IScalarFunctionResults.

virtual double IG::Num::ScalarFunctionResults::GetParameter | ( | int | index | ) | `[inline, virtual]`

Returns specific optimization parameter. Throws exception if not defined or index out of bounds.

Parameters:

  iindex | Index of parameter to be returned (counting from 0).

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetParameter | ( | int | index,
|  | double | value
| ) |  | `[inline, virtual]`

Sets the specified optimization parameter.

Parameters:

  index | Index of parameter to be set (counting from 0).
  value | Parameter value.

Implements IG::Num::IScalarFunctionResults.

virtual double IG::Num::ScalarFunctionResults::GetValue | ( |  | ) | `[inline, virtual]`

Returns the value of the function./summary>

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetValue | ( | double | value | ) | `[inline, virtual]`

Sets the value of the function.

Parameters:

  value | Value to be assigned to the objective function.

Implements IG::Num::IScalarFunctionResults.

virtual IVector IG::Num::ScalarFunctionResults::GetGradient | ( |  | ) | `[inline, virtual]`

Returns the function gradient.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetGradient | ( | IVector | value | ) | `[inline, virtual]`

Sets the function gradient. If CopyReferences=true (false by default) then only the reference is copied.

Parameters:

  value | Value to be assigned.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetGradientReference | ( | IVector | reference | ) | `[inline, virtual]`

Sets the function gradient. Only the reference is copied.

Parameters:

  value | Reference to be assigned.

Implements IG::Num::IScalarFunctionResults.

virtual double IG::Num::ScalarFunctionResults::GetGradient | ( | int | index | ) | `[inline, virtual]`

Returns the specified component of the function gradient.

Parameters:

  index | Index of the component.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetGradient | ( | int | index,
|  | double | value
| ) |  | `[inline, virtual]`

Sets the specified component of the function gradient.

Parameters:

  index | Index of gradient component to be set.
  value | Value of the gradient component.

Implements IG::Num::IScalarFunctionResults.

virtual IMatrix IG::Num::ScalarFunctionResults::GetHessian | ( |  | ) | `[inline, virtual]`

Returns the function's Hessian.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetHessian | ( | IMatrix | value | ) | `[inline, virtual]`

Sets the functions' Hessian. If CopyReferences=true (false by default) then only the reference is copied.

Parameters:

  value | Value to be assigned.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetHessianReference | ( | IMatrix | reference | ) | `[inline, virtual]`

Sets the functions' Hessian. Only the reference is copied.

Parameters:

  value | Reference to be assigned.

Implements IG::Num::IScalarFunctionResults.

virtual double IG::Num::ScalarFunctionResults::GetHessian | ( | int | rowIndex,
|  | int | columnIndex
| ) |  | `[inline, virtual]`

Returns the specified component of the function's Hessian.

Parameters:

  rowIndex | Row index of the component (counting from 0).
  columnIndex | Column index of the component (counting from 0).

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetHessian | ( | int | rowIndex,
|  | int | columnIndex,
|  | double | value
| ) |  | `[inline, virtual]`

Sets the specified component of the function's Hessian.

Parameters:

  rowIndex | Row index of the component (counting from 0).
  columnIndex | Column index of the component (counting from 0).
  value | Value to be assigned to Hessian.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::NullifyAll | ( |  | ) | `[inline, virtual]`

Sets all objects (parameters and result objects) to null. If the references are not assigned elsewhere, these objects become eligible for garbage collection.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::NullifyResults | ( |  | ) | `[inline, virtual]`

Sets all result objects to null. If the references are not assigned elsewhere, these objects become eligible for garbage collection.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::AllocateParameters | ( |  | ) | `[inline, virtual]`

Allocates space for parameters.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::AllocateRequested | ( |  | ) | `[inline, virtual]`

Allocates space for all requested result objects.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::AllocateGradient | ( |  | ) | `[inline, virtual]`

Allocate space for function gradient.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::AllocateHessian | ( |  | ) | `[inline, virtual]`

Allocates space for function Hessian.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::ResetResults | ( |  | ) | `[inline, virtual]`

Sets all calculated flags to false, error code to 0 (no error) and error string to null.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::Copy | ( | IScalarFunctionResults | results | ) | `[inline, virtual]`

Copies data from another analysis results.

Parameters:

  res | Analysis results which data is copied from.

Implements IG::Num::IScalarFunctionResults.

virtual IScalarFunctionResults IG::Num::ScalarFunctionResults::GetCopy | ( |  | ) | `[inline, virtual]`

Returns an exact deep copy of the current object.

Implements IG::Num::IScalarFunctionResults.

## Member Data Documentation

int IG::Num::ScalarFunctionResults::_numParameters = 1`[protected]`

IVector IG::Num::ScalarFunctionResults::_parameters`[protected]`

double IG::Num::ScalarFunctionResults::_value`[protected]`

IVector IG::Num::ScalarFunctionResults::_Gradient`[protected]`

IMatrix IG::Num::ScalarFunctionResults::_Hessian`[protected]`

bool IG::Num::ScalarFunctionResults::_copyReferences = false`[protected]`

bool IG::Num::ScalarFunctionResults::_reqValue = true`[protected]`

bool IG::Num::ScalarFunctionResults::_reqGradient = false`[protected]`

bool IG::Num::ScalarFunctionResults::_reqHessian = false`[protected]`

int IG::Num::ScalarFunctionResults::_errorCode = 0`[protected]`

string IG::Num::ScalarFunctionResults::_errorString = null`[protected]`

bool IG::Num::ScalarFunctionResults::_calcValue = false`[protected]`

bool IG::Num::ScalarFunctionResults::_calcGradient = false`[protected]`

bool IG::Num::ScalarFunctionResults::_calcHessian = false`[protected]`

int IG::Num::ScalarFunctionResults::_numObjectives = 1`[protected]`

int IG::Num::ScalarFunctionResults::_numConstraints = 0`[protected]`

int IG::Num::ScalarFunctionResults::_numEqualityConstraints = 0`[protected]`

List<double> IG::Num::ScalarFunctionResults::_constraints`[protected]`

List<IVector> IG::Num::ScalarFunctionResults::_constraintGradients`[protected]`

List<IMatrix> IG::Num::ScalarFunctionResults::_constraintHessians`[protected]`

bool IG::Num::ScalarFunctionResults::_reqConstraints = true`[protected]`

bool IG::Num::ScalarFunctionResults::_reqConstraintGradients = false`[protected]`

bool IG::Num::ScalarFunctionResults::_reqConstraintHessians = false`[protected]`

bool IG::Num::ScalarFunctionResults::_calcConstraints = false`[protected]`

bool IG::Num::ScalarFunctionResults::_calcConstraintGradients = false`[protected]`

bool IG::Num::ScalarFunctionResults::_calcConstraintHessians = false`[protected]`

## Property Documentation

virtual int IG::Num::ScalarFunctionResults::NumParameters`[get, set]`

Number of parameters.

Implements IG::Num::IScalarFunctionResults.

virtual bool IG::Num::ScalarFunctionResults::CopyReferences`[get, set]`

Indicates whether just references can be copied when setting function parameters or results. If false then deep copy is always performed. Default is false.

Implements IG::Num::IScalarFunctionResults.

virtual IVector IG::Num::ScalarFunctionResults::Parameters`[get, set]`

Optimization parameters. If CopyReferences=true (false by default) then only the reference is copied when assigning.

Implements IG::Num::IScalarFunctionResults.

virtual double IG::Num::ScalarFunctionResults::Value`[get, set]`

Value of the function.

Implements IG::Num::IScalarFunctionResults.

virtual IVector IG::Num::ScalarFunctionResults::Gradient`[get, set]`

Function gradient. If CopyReferences=true (false by default) then only the reference is copied in assignments.

Implements IG::Num::IScalarFunctionResults.

virtual IMatrix IG::Num::ScalarFunctionResults::Hessian`[get, set]`

Function Hessian (matrix of second derivatives). If CopyReferences=true (false by default) then only the reference is copied in assignments.

Implements IG::Num::IScalarFunctionResults.

virtual bool IG::Num::ScalarFunctionResults::ReqValue`[get, set]`

Indicates whether calculation of function value is/was requested.

Implements IG::Num::IScalarFunctionResults.

virtual bool IG::Num::ScalarFunctionResults::ReqGradient`[get, set]`

Indicates whether calculation of function gradient is/was requested.

Implements IG::Num::IScalarFunctionResults.

virtual bool IG::Num::ScalarFunctionResults::ReqHessian`[get, set]`

Indicates whether calculation of function Hessian is/was requested.

Implements IG::Num::IScalarFunctionResults.

virtual int IG::Num::ScalarFunctionResults::ErrorCode`[get, set]`

Error code. 0 - everything is OK. negative value - something went wrong.

Implements IG::Num::IScalarFunctionResults.

virtual String IG::Num::ScalarFunctionResults::ErrorString`[get, set]`

Error string indicating what went wrong.

Implements IG::Num::IScalarFunctionResults.

virtual bool IG::Num::ScalarFunctionResults::Calculated`[get, set]`

Collectively gets or sets calculated flags. Set false: all calculated flags are set to false. Set true: all calculated flags for which the corresponding request flags are true, are set to truee, others are set to false. Get: returns true if all the flags for which the corresponding request flags are true, are also true. Otherwise returns false.

Implements IG::Num::IScalarFunctionResults.

virtual bool IG::Num::ScalarFunctionResults::CalculatedValue`[get, set]`

Indicates whether calculation of function value is/was requested.

Implements IG::Num::IScalarFunctionResults.

virtual bool IG::Num::ScalarFunctionResults::CalculatedGradient`[get, set]`

Indicates whether calculation of function gradient is/was requested.

Implements IG::Num::IScalarFunctionResults.

virtual bool IG::Num::ScalarFunctionResults::CalculatedHessian`[get, set]`

Indicates whether calculation of function Hessian is/was requested.

Implements IG::Num::IScalarFunctionResults.

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

- FunctionScalarResults.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events