Sleipnir C++ API
Loading...
Searching...
No Matches
slp::Hessian< Scalar, UpLo > Class Template Reference

#include <sleipnir/autodiff/hessian.hpp>

Public Member Functions

 Hessian (Variable< Scalar > variable, Variable< Scalar > wrt)
 
 Hessian (Variable< Scalar > variable, SleipnirMatrixLike< Scalar > auto wrt)
 
VariableMatrix< Scalar > get () const
 
const Eigen::SparseMatrix< Scalar > & value ()
 

Detailed Description

template<typename Scalar, int UpLo>
requires (UpLo == Eigen::Lower) || (UpLo == (Eigen::Lower | Eigen::Upper))
class slp::Hessian< Scalar, UpLo >

This class calculates the Hessian of a variable with respect to a vector of variables.

The gradient tree is cached so subsequent Hessian calculations are faster, and the Hessian is only recomputed if the variable expression is nonlinear.

Template Parameters
ScalarScalar type.
UpLoWhich part of the Hessian to compute (Lower or Lower | Upper).

Constructor & Destructor Documentation

◆ Hessian() [1/2]

template<typename Scalar , int UpLo>
slp::Hessian< Scalar, UpLo >::Hessian ( Variable< Scalar >  variable,
Variable< Scalar >  wrt 
)
inline

Constructs a Hessian object.

Parameters
variableVariable of which to compute the Hessian.
wrtVariable with respect to which to compute the Hessian.

◆ Hessian() [2/2]

template<typename Scalar , int UpLo>
slp::Hessian< Scalar, UpLo >::Hessian ( Variable< Scalar >  variable,
SleipnirMatrixLike< Scalar > auto  wrt 
)
inline

Constructs a Hessian object.

Parameters
variableVariable of which to compute the Hessian.
wrtVector of variables with respect to which to compute the Hessian.

Member Function Documentation

◆ get()

template<typename Scalar , int UpLo>
VariableMatrix< Scalar > slp::Hessian< Scalar, UpLo >::get ( ) const
inline

Returns the Hessian as a VariableMatrix.

This is useful when constructing optimization problems with derivatives in them.

Returns
The Hessian as a VariableMatrix.

◆ value()

template<typename Scalar , int UpLo>
const Eigen::SparseMatrix< Scalar > & slp::Hessian< Scalar, UpLo >::value ( )
inline

Evaluates the Hessian at wrt's value.

Returns
The Hessian at wrt's value.

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