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

#include <sleipnir/autodiff/Gradient.hpp>

Public Member Functions

 Gradient (Variable variable, Variable wrt) noexcept
 
 Gradient (Variable variable, const VariableMatrix &wrt) noexcept
 
VariableMatrix Get () const
 
const Eigen::SparseVector< double > & Value ()
 
ProfilerGetProfiler ()
 

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]

sleipnir::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]

sleipnir::Gradient::Gradient ( Variable  variable,
const VariableMatrix 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 sleipnir::Gradient::Get ( ) const
inline

Returns the gradient as a VariableMatrix.

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

◆ GetProfiler()

Profiler & sleipnir::Gradient::GetProfiler ( )
inline

Returns the profiler.

◆ Value()

const Eigen::SparseVector< double > & sleipnir::Gradient::Value ( )
inline

Evaluates the gradient at wrt's value.


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