|
| AutomaticDifferentiationT ()=default |
| Creates a new differentiation object without initializing the parameters. More...
|
|
| AutomaticDifferentiationT (const T &value) |
| Creates a new differentiation object for a given scalar value (not a constant). More...
|
|
| AutomaticDifferentiationT (const T &value, const T &derivative) |
| Creates a new differentiation object by a given scalar and it's known derivative of the function at the specified location 'value'. More...
|
|
| AutomaticDifferentiationT (const T &value, const bool isVariable) |
| Creates a new differentiation object by a given scalar or constant value, while a boolean state specifies whether the parameter is a scalar or a constant. More...
|
|
const T & | derivative () const |
| Returns the actual derivative of this object. More...
|
|
const T & | value () const |
| Returns the value of this object. More...
|
|
const T & | operator() () const |
| Returns the actual derivative value of this object. More...
|
|
AutomaticDifferentiationT< T, TNumeric > | operator+ (const T &right) const |
| Adds a scalar value to this differentiation object. More...
|
|
AutomaticDifferentiationT< T, TNumeric > & | operator+= (const T &right) |
| Adds a scalar value to this differentiation object. More...
|
|
AutomaticDifferentiationT< T, TNumeric > | operator+ (const AutomaticDifferentiationT< T, TNumeric > &right) const |
| Adds two differentiation objects and determines the sum derivative. More...
|
|
AutomaticDifferentiationT< T, TNumeric > & | operator+= (const AutomaticDifferentiationT< T, TNumeric > &right) |
| Adds two differentiation objects and determines the sum derivative. More...
|
|
AutomaticDifferentiationT< T, TNumeric > | operator- (const T &right) const |
| Subtracts a scalar value from this differentiation object. More...
|
|
AutomaticDifferentiationT< T, TNumeric > & | operator-= (const T &right) |
| Subtracts a scalar value from this differentiation object. More...
|
|
AutomaticDifferentiationT< T, TNumeric > | operator- (const AutomaticDifferentiationT< T, TNumeric > &right) const |
| Subtracts two differentiation objects and determines the resulting derivative. More...
|
|
AutomaticDifferentiationT< T, TNumeric > | operator- () const |
| Unary negation operator returns the negative of this differentiation object. More...
|
|
AutomaticDifferentiationT< T, TNumeric > & | operator-= (const AutomaticDifferentiationT< T, TNumeric > &right) |
| Subtracts two differentiation objects and determines the resulting derivative. More...
|
|
AutomaticDifferentiationT< T, TNumeric > | operator* (const AutomaticDifferentiationT< T, TNumeric > &right) const |
| Multiplies two differentiation objects and determines the product derivative. More...
|
|
AutomaticDifferentiationT< T, TNumeric > & | operator*= (const AutomaticDifferentiationT< T, TNumeric > &right) |
| Multiplies two differentiation objects and determines the product derivative. More...
|
|
AutomaticDifferentiationT< T, TNumeric > | operator* (const T &right) const |
| Multiplies this differentiation objects with a scalar. More...
|
|
AutomaticDifferentiationT< T, TNumeric > & | operator*= (const T &right) |
| Multiplies this differentiation objects with a scalar. More...
|
|
AutomaticDifferentiationT< T, TNumeric > | operator/ (const AutomaticDifferentiationT< T, TNumeric > &right) const |
| Divides two differentiation objects and determines the quotient derivative. More...
|
|
AutomaticDifferentiationT< T, TNumeric > & | operator/= (const AutomaticDifferentiationT< T, TNumeric > &right) |
| Divides two differentiation objects and determines the quotient derivative. More...
|
|
AutomaticDifferentiationT< T, TNumeric > | operator/ (const T &right) const |
| Divides this differentiation object by a scalar value. More...
|
|
AutomaticDifferentiationT< T, TNumeric > & | operator/= (const T &right) |
| Divides this differentiation object by a scalar value. More...
|
|
|
static AutomaticDifferentiationT< T, TNumeric > | sin (const AutomaticDifferentiationT< T, TNumeric > &value) |
| Determines the derivative of the sinus function. More...
|
|
static AutomaticDifferentiationT< T, TNumeric > | cos (const AutomaticDifferentiationT< T, TNumeric > &value) |
| Determines the derivative of the cosine function. More...
|
|
static AutomaticDifferentiationT< T, TNumeric > | tan (const AutomaticDifferentiationT< T, TNumeric > &value) |
| Determines the derivative of the tangent function. More...
|
|
static AutomaticDifferentiationT< T, TNumeric > | sqrt (const AutomaticDifferentiationT< T, TNumeric > &value) |
| Determines the derivative of the square root function. More...
|
|
static AutomaticDifferentiationT< T, TNumeric > | sqr (const AutomaticDifferentiationT< T, TNumeric > &value) |
| Determines the derivative of the square function. More...
|
|
static AutomaticDifferentiationT< T, TNumeric > | exp (const AutomaticDifferentiationT< T, TNumeric > &value) |
| Determines the derivative of the exponential function. More...
|
|
static AutomaticDifferentiationT< T, TNumeric > | log (const AutomaticDifferentiationT< T, TNumeric > &value) |
| Determines the derivative of the natural logarithm. More...
|
|
static AutomaticDifferentiationT< T, TNumeric > | log2 (const AutomaticDifferentiationT< T, TNumeric > &value) |
| Determines the derivative of the logarithm to the base 2. More...
|
|
static AutomaticDifferentiationT< T, TNumeric > | log10 (const AutomaticDifferentiationT< T, TNumeric > &value) |
| Determines the derivative of the logarithm to the base 10. More...
|
|
static AutomaticDifferentiationT< T, TNumeric > | pow (const AutomaticDifferentiationT< T, TNumeric > &x, const T &y) |
| Determines the derivative of the power function calculating x to the power of y. More...
|
|
static AutomaticDifferentiationT< T, TNumeric > | abs (const AutomaticDifferentiationT< T, TNumeric > &value) |
| Determines the derivative of the abs function. More...
|
|
static AutomaticDifferentiationT< T, TNumeric > | min (const AutomaticDifferentiationT< T, TNumeric > &value, const T &second) |
| Determines the derivative of the min function. More...
|
|
static AutomaticDifferentiationT< T, TNumeric > | max (const AutomaticDifferentiationT< T, TNumeric > &value, const T &second) |
| Determines the derivative of the max function. More...
|
|
|
template<typename T1 , typename TNumeric1 , typename T2 > |
AutomaticDifferentiationT< T1, TNumeric1 > | operator+ (const T2 &left, const AutomaticDifferentiationT< T1, TNumeric1 > &right) |
|
template<typename T1 , typename TNumeric1 , typename T2 > |
AutomaticDifferentiationT< T1, TNumeric1 > | operator- (const T2 &left, const AutomaticDifferentiationT< T1, TNumeric1 > &right) |
|
template<typename T1 , typename TNumeric1 , typename T2 > |
AutomaticDifferentiationT< T1, TNumeric1 > | operator* (const T2 &left, const AutomaticDifferentiationT< T1, TNumeric1 > &right) |
|
template<typename T1 , typename TNumeric1 , typename T2 > |
AutomaticDifferentiationT< T1, TNumeric1 > | operator/ (const T2 &left, const AutomaticDifferentiationT< T1, TNumeric1 > &right) |
|
template<typename T, typename TNumeric = NumericT<T>>
class Ocean::AutomaticDifferentiationT< T, TNumeric >
This class implements an automatic differentiation functionality.
The automatic differentiation is realized by a pair of two values using the forward mode: the actual value of a function and the corresponding derivative at this location.
Therefore, each object holds the value of x and x' for a given parameter x.
Automatic differentiation is a nice tool for fast prototyping of e.g., non-linear optimization functions.
The accuracy of the resulting derivative is almost ideal and significantly better compared to numerical differentiation.
However, in general the performance of the automatic differentiation (using the forward method) will be at least two times slower than calculating the derivative directory.
The following code snippet shows a simple example how the AutomaticDifferentiation class can be used.
const Scalar derivative0 = automaticDerivative0.derivative();
const Scalar derivative1 = automaticDerivative1.derivative();
static AutomaticDifferentiationT< T, TNumeric > sin(const AutomaticDifferentiationT< T, TNumeric > &value)
Determines the derivative of the sinus function.
Definition: AutomaticDifferentiation.h:583
AutomaticDifferentiationT< Scalar, Numeric > AutomaticDifferentiation
Definition of a scalar differentiation object using the data type of Scalar as parameter.
Definition: AutomaticDifferentiation.h:18
float Scalar
Definition of a scalar type.
Definition: Math.h:128
In the case a Jacobian matrix needs to be determined the constructor with additional boolean parameter may be used for calculations:
for (unsigned int n = 0u; n < 2u; ++n)
{
jacobian[n] = d();
}
- Template Parameters
-
T | The data type of the scalar |
TNumeric | The numeric class providing access to standard mathematical functions like sin, cos, sqrt, etc. |