WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
sleipnir::Gradient Class Reference

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

#include </home/runner/work/allwpilib/allwpilib/wpimath/src/main/native/thirdparty/sleipnir/include/sleipnir/autodiff/Gradient.hpp>

Public Member Functions

 Gradient (Variable variable, Variable wrt) noexcept
 Constructs a Gradient object.
 
 Gradient (Variable variable, const VariableMatrix &wrt) noexcept
 Constructs a Gradient object.
 
VariableMatrix Get () const
 Returns the gradient as a VariableMatrix.
 
const Eigen::SparseVector< double > & Value ()
 Evaluates the gradient at wrt's value.
 
ProfilerGetProfiler ()
 Returns the profiler.
 

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: