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

#include <sleipnir/autodiff/hessian.hpp>

Public Member Functions

 Hessian (Variable variable, Variable wrt) noexcept
 
 Hessian (Variable variable, SleipnirMatrixLike auto wrt) noexcept
 
VariableMatrix get () const
 
const Eigen::SparseMatrix< double > & value ()
 
const small_vector< SolveProfiler > & get_profilers () const
 

Detailed Description

template<int UpLo>
requires (UpLo == Eigen::Lower) || (UpLo == (Eigen::Lower | Eigen::Upper))
class slp::Hessian< 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
UpLoWhich part of the Hessian to compute (Lower or Lower | Upper).

Constructor & Destructor Documentation

◆ Hessian() [1/2]

template<int UpLo>
slp::Hessian< UpLo >::Hessian ( Variable  variable,
Variable  wrt 
)
inlinenoexcept

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<int UpLo>
slp::Hessian< UpLo >::Hessian ( Variable  variable,
SleipnirMatrixLike auto  wrt 
)
inlinenoexcept

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<int UpLo>
VariableMatrix slp::Hessian< 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.

◆ get_profilers()

template<int UpLo>
const small_vector< SolveProfiler > & slp::Hessian< UpLo >::get_profilers ( ) const
inline

Returns the profilers.

Returns
The profilers.

◆ value()

template<int UpLo>
const Eigen::SparseMatrix< double > & slp::Hessian< 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: