Sleipnir C++ API
Loading...
Searching...
No Matches
slp::Gradient Class Reference

#include <sleipnir/autodiff/gradient.hpp>

Public Member Functions

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

Detailed Description

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

The gradient is only recomputed if the variable expression is quadratic or higher order.

Constructor & Destructor Documentation

◆ Gradient() [1/2]

slp::Gradient::Gradient ( Variable  variable,
Variable  wrt 
)
inlinenoexcept

Constructs a Gradient object.

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

◆ Gradient() [2/2]

slp::Gradient::Gradient ( Variable  variable,
SleipnirMatrixLike auto  wrt 
)
inlinenoexcept

Constructs a Gradient object.

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

Member Function Documentation

◆ get()

VariableMatrix slp::Gradient::get ( ) const
inline

Returns the gradient as a VariableMatrix.

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

Returns
The gradient as a VariableMatrix.

◆ get_profilers()

const small_vector< SolveProfiler > & slp::Gradient::get_profilers ( ) const
inline

Returns the profiler.

Returns
The profiler.

◆ value()

const Eigen::SparseVector< double > & slp::Gradient::value ( )
inline

Evaluates the gradient at wrt's value.

Returns
The gradient at wrt's value.

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