- 3.0.2 core module.
ct::core::DerivativesNumDiff< IN_DIM, OUT_DIM > Class Template Reference

Derivatives using Num-Diff Codegeneration. More...

#include <DerivativesNumDiff.h>

Inheritance diagram for ct::core::DerivativesNumDiff< IN_DIM, OUT_DIM >:
ct::core::Derivatives< IN_DIM, OUT_DIM, double >

Public Types

typedef Eigen::Matrix< double, OUT_DIM, 1 > OUT_TYPE
 function output vector type More...
 
typedef Eigen::Matrix< double, OUT_DIM, IN_DIM > JAC_TYPE
 
typedef Eigen::Matrix< double, IN_DIM, IN_DIM > HES_TYPE
 
typedef std::function< OUT_TYPE(const IN_TYPE &)> Function
 function tpye More...
 
- Public Types inherited from ct::core::Derivatives< IN_DIM, OUT_DIM, double >
typedef Eigen::Matrix< double, IN_DIM, 1 > IN_TYPE
 function input vector type More...
 
typedef Eigen::Matrix< double, OUT_DIM, 1 > OUT_TYPE
 function output vector type More...
 
typedef Eigen::Matrix< double, OUT_DIM, IN_DIM > JAC_TYPE
 
typedef Eigen::Matrix< double, IN_DIM, IN_DIM > HES_TYPE
 

Public Member Functions

 DerivativesNumDiff (Function &f, bool doubleSidedDerivative=false)
 default constructor More...
 
 DerivativesNumDiff (const DerivativesNumDiff &arg)
 
virtual ~DerivativesNumDiff ()
 default destructor More...
 
DerivativesNumDiffclone () const override
 deep cloning More...
 
virtual OUT_TYPE forwardZero (const Eigen::VectorXd &x) override
 Evaluates the method itself. More...
 
virtual JAC_TYPE jacobian (const Eigen::VectorXd &x) override
 evaluate Derivatives at a given point More...
 
- Public Member Functions inherited from ct::core::Derivatives< IN_DIM, OUT_DIM, double >
 Derivatives ()
 
virtual ~Derivatives ()
 default destructor More...
 
virtual void sparseJacobian (const Eigen::VectorXd &x, Eigen::VectorXd &jac, Eigen::VectorXi &iRow, Eigen::VectorXi &jCol)
 Returns the evaluated jacobian in sparse format. More...
 
virtual Eigen::VectorXd sparseJacobianValues (const Eigen::VectorXd &x)
 Returns the non zero values of the jacobian. More...
 
virtual HES_TYPE hessian (const Eigen::VectorXd &x, const Eigen::VectorXd &lambda)
 Evaluates the hessian (2nd order derivatives with respect to input) of the method. In case of a vector valued function, the method returns the weighted sum of the hessians with weights w. More...
 
virtual void sparseHessian (const Eigen::VectorXd &x, const Eigen::VectorXd &lambda, Eigen::VectorXd &hes, Eigen::VectorXi &iRow, Eigen::VectorXi &jCol)
 Returns the weighted sum of hessian of the problem in sparse format. More...
 
virtual Eigen::VectorXd sparseHessianValues (const Eigen::VectorXd &x, const Eigen::VectorXd &lambda)
 Returns the non zero elements of the hessian of the problem. More...
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef Eigen::Matrix< double, IN_DIM, 1 > IN_TYPE
 function input vector type More...
 

Detailed Description

template<int IN_DIM, int OUT_DIM>
class ct::core::DerivativesNumDiff< IN_DIM, OUT_DIM >

Derivatives using Num-Diff Codegeneration.

Uses Num-Diff code generation to compute the Derivatives $ J(x_s) = \frac{df}{dx} |_{x=x_s} $ of a regular vector-valued mathematical function $ y = f(x) $ .

x has IN_DIM dimension and y has OUT_DIM dimension. Thus, they can be scalar functions (IN_DIM = 1, OUT_DIM = 1), fixed or variable size (IN_DIM = -1, OUT_DIM = -1) functions.

Note
In fact, this class is called Derivatives but computes also zero order derivatives
Template Parameters
IN_DIMInput dimensionality of the function (use Eigen::Dynamic (-1) for dynamic size)
OUT_DIMOutput dimensionailty of the function (use Eigen::Dynamic (-1) for dynamic size)

Member Typedef Documentation

◆ OUT_TYPE

template<int IN_DIM, int OUT_DIM>
typedef Eigen::Matrix<double, OUT_DIM, 1> ct::core::DerivativesNumDiff< IN_DIM, OUT_DIM >::OUT_TYPE

function output vector type

◆ JAC_TYPE

template<int IN_DIM, int OUT_DIM>
typedef Eigen::Matrix<double, OUT_DIM, IN_DIM> ct::core::DerivativesNumDiff< IN_DIM, OUT_DIM >::JAC_TYPE

◆ HES_TYPE

template<int IN_DIM, int OUT_DIM>
typedef Eigen::Matrix<double, IN_DIM, IN_DIM> ct::core::DerivativesNumDiff< IN_DIM, OUT_DIM >::HES_TYPE

◆ Function

template<int IN_DIM, int OUT_DIM>
typedef std::function<OUT_TYPE(const IN_TYPE&)> ct::core::DerivativesNumDiff< IN_DIM, OUT_DIM >::Function

function tpye

Constructor & Destructor Documentation

◆ DerivativesNumDiff() [1/2]

template<int IN_DIM, int OUT_DIM>
ct::core::DerivativesNumDiff< IN_DIM, OUT_DIM >::DerivativesNumDiff ( Function f,
bool  doubleSidedDerivative = false 
)
inline

default constructor

Generates a Derivatives of a function using numerical differentiation

Numerical differentiation can either use single sided or double sided derivatives. Double sided derivative can be more accurate but is almost twice as expensive.

Parameters
ffunction to compute Derivatives of
doubleSidedDerivativeuse double sided differentiation

◆ DerivativesNumDiff() [2/2]

template<int IN_DIM, int OUT_DIM>
ct::core::DerivativesNumDiff< IN_DIM, OUT_DIM >::DerivativesNumDiff ( const DerivativesNumDiff< IN_DIM, OUT_DIM > &  arg)
inline

◆ ~DerivativesNumDiff()

template<int IN_DIM, int OUT_DIM>
virtual ct::core::DerivativesNumDiff< IN_DIM, OUT_DIM >::~DerivativesNumDiff ( )
inlinevirtual

default destructor

Member Function Documentation

◆ clone()

template<int IN_DIM, int OUT_DIM>
DerivativesNumDiff* ct::core::DerivativesNumDiff< IN_DIM, OUT_DIM >::clone ( ) const
inlineoverridevirtual

◆ forwardZero()

template<int IN_DIM, int OUT_DIM>
virtual OUT_TYPE ct::core::DerivativesNumDiff< IN_DIM, OUT_DIM >::forwardZero ( const Eigen::VectorXd &  x)
inlineoverridevirtual

Evaluates the method itself.

Parameters
[in]xThe point of evaluation
Returns
The evalution of the method

Reimplemented from ct::core::Derivatives< IN_DIM, OUT_DIM, double >.

◆ jacobian()

template<int IN_DIM, int OUT_DIM>
virtual JAC_TYPE ct::core::DerivativesNumDiff< IN_DIM, OUT_DIM >::jacobian ( const Eigen::VectorXd &  x)
inlineoverridevirtual

evaluate Derivatives at a given point

Parameters
xpoint at which to evaluate the Derivatives at
Returns
Derivatives evaluated at x

Reimplemented from ct::core::Derivatives< IN_DIM, OUT_DIM, double >.

References i.

Member Data Documentation

◆ IN_TYPE

template<int IN_DIM, int OUT_DIM>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef Eigen::Matrix<double, IN_DIM, 1> ct::core::DerivativesNumDiff< IN_DIM, OUT_DIM >::IN_TYPE

function input vector type


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