FiniteDifferenceGradient¶
-
class
FiniteDifferenceGradient
(*args)¶ Base class for first order finite-difference schemes.
- Available constructors:
FiniteDifferenceGradient(epsilon, evalImpl)
FiniteDifferenceGradient(step, evalImpl)
- Parameters
- evalImpl
EvaluationImplementation
Implementation of the evaluation of a function.
- epsilonfloat, sequence of float
Finite difference steps for each dimension.
- step
FiniteDifferenceStep
Defines how finite difference steps values are computed.
- evalImpl
Notes
Base class to define first order finite-difference schemes. The gradient can be computed only through its derived classes:
Methods
getCallsNumber
(self)Accessor to the number of times the gradient has been called.
getClassName
(self)Accessor to the object’s name.
getEpsilon
(self)Get the finite difference steps.
getEvaluation
(self)Get the implementation of the evaluation of the function.
getFiniteDifferenceStep
(self)Get the finite difference step.
getId
(self)Accessor to the object’s id.
getInputDimension
(self)Get the input dimension.
getMarginal
(self, \*args)Accessor to the gradient implementation of a specific output.
getName
(self)Accessor to the object’s name.
getOutputDimension
(self)Get the output dimension.
getParameter
(self)Accessor to the parameter values.
getShadowedId
(self)Accessor to the object’s shadowed id.
getVisibility
(self)Accessor to the object’s visibility state.
gradient
(self, inP)Get the gradient at some point.
hasName
(self)Test if the object is named.
hasVisibleName
(self)Test if the object has a distinguishable name.
isActualImplementation
(self)Accessor to the validity flag.
setFiniteDifferenceStep
(self, …)Set the finite difference step.
setName
(self, name)Accessor to the object’s name.
setParameter
(self, parameter)Accessor to the parameter values.
setShadowedId
(self, id)Accessor to the object’s shadowed id.
setVisibility
(self, visible)Accessor to the object’s visibility state.
-
__init__
(self, \*args)¶ Initialize self. See help(type(self)) for accurate signature.
-
getCallsNumber
(self)¶ Accessor to the number of times the gradient has been called.
- Returns
- calls_numberint
Integer that counts the number of times the gradient has been called since its creation.
-
getClassName
(self)¶ Accessor to the object’s name.
- Returns
- class_namestr
The object class name (object.__class__.__name__).
-
getEpsilon
(self)¶ Get the finite difference steps.
- Returns
- epsilon
Point
Finite difference steps for each dimension.
- epsilon
-
getEvaluation
(self)¶ Get the implementation of the evaluation of the function.
- Returns
- evalImpl
EvaluationImplementation
Implementation of the evaluation of a function.
- evalImpl
-
getFiniteDifferenceStep
(self)¶ Get the finite difference step.
- Returns
- step
FiniteDifferenceStep
Defines how finite difference steps values are computed.
- step
-
getId
(self)¶ Accessor to the object’s id.
- Returns
- idint
Internal unique identifier.
-
getInputDimension
(self)¶ Get the input dimension.
- Returns
- dimensionint
Input dimension.
-
getMarginal
(self, \*args)¶ Accessor to the gradient implementation of a specific output.
- Parameters
- iinteger
Integer corresponding to the output (Care: it starts at 0).
- indicessequence of integer
The set of indices for which the outputs are extracted.
- Returns
- gradientImplementation
GradientImplementation
A gradient implementation restricted to its compenents functions which indices are i or indices.
- gradientImplementation
-
getName
(self)¶ Accessor to the object’s name.
- Returns
- namestr
The name of the object.
-
getOutputDimension
(self)¶ Get the output dimension.
- Returns
- dimensionint
Output dimension.
-
getShadowedId
(self)¶ Accessor to the object’s shadowed id.
- Returns
- idint
Internal unique identifier.
-
getVisibility
(self)¶ Accessor to the object’s visibility state.
- Returns
- visiblebool
Visibility flag.
-
gradient
(self, inP)¶ Get the gradient at some point.
- Parameters
- pointsequence of float
Point where the gradient is computed.
- Returns
- gradient
Matrix
Transposed Jacobian matrix evaluated at point.
- gradient
-
hasName
(self)¶ Test if the object is named.
- Returns
- hasNamebool
True if the name is not empty.
-
hasVisibleName
(self)¶ Test if the object has a distinguishable name.
- Returns
- hasVisibleNamebool
True if the name is not empty and not the default one.
-
isActualImplementation
(self)¶ Accessor to the validity flag.
- Returns
- is_implbool
Whether the implementation is valid.
-
setFiniteDifferenceStep
(self, finiteDifferenceStep)¶ Set the finite difference step.
- Parameters
- step
FiniteDifferenceStep
Defines how finite difference steps values are computed.
- step
-
setName
(self, name)¶ Accessor to the object’s name.
- Parameters
- namestr
The name of the object.
-
setParameter
(self, parameter)¶ Accessor to the parameter values.
- Parameters
- parametersequence of float
The parameter values.
-
setShadowedId
(self, id)¶ Accessor to the object’s shadowed id.
- Parameters
- idint
Internal unique identifier.
-
setVisibility
(self, visible)¶ Accessor to the object’s visibility state.
- Parameters
- visiblebool
Visibility flag.