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

An autodiff variable pointing to an expression node. More...

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

Public Member Functions

 Variable ()=default
 Constructs a linear Variable with a value of zero.
 
 Variable (double value)
 Constructs a Variable from a double.
 
 Variable (const detail::ExpressionPtr &expr)
 Constructs a Variable pointing to the specified expression.
 
 Variable (detail::ExpressionPtr &&expr)
 Constructs a Variable pointing to the specified expression.
 
Variableoperator= (double value)
 Assignment operator for double.
 
void SetValue (double value)
 Sets Variable's internal value.
 
Variableoperator*= (const Variable &rhs)
 Variable-Variable compound multiplication operator.
 
Variableoperator/= (const Variable &rhs)
 Variable-Variable compound division operator.
 
Variableoperator+= (const Variable &rhs)
 Variable-Variable compound addition operator.
 
Variableoperator-= (const Variable &rhs)
 Variable-Variable compound subtraction operator.
 
double Value ()
 Returns the value of this variable.
 
ExpressionType Type () const
 Returns the type of this expression (constant, linear, quadratic, or nonlinear).
 

Friends

class SLEIPNIR_DLLEXPORT Hessian
 
class SLEIPNIR_DLLEXPORT Jacobian
 
SLEIPNIR_DLLEXPORT Variable operator* (const Variable &lhs, const Variable &rhs)
 Variable-Variable multiplication operator.
 
SLEIPNIR_DLLEXPORT Variable operator/ (const Variable &lhs, const Variable &rhs)
 Variable-Variable division operator.
 
SLEIPNIR_DLLEXPORT Variable operator+ (const Variable &lhs, const Variable &rhs)
 Variable-Variable addition operator.
 
SLEIPNIR_DLLEXPORT Variable operator- (const Variable &lhs, const Variable &rhs)
 Variable-Variable subtraction operator.
 
SLEIPNIR_DLLEXPORT Variable operator- (const Variable &lhs)
 Unary minus operator.
 
SLEIPNIR_DLLEXPORT Variable operator+ (const Variable &lhs)
 Unary plus operator.
 
SLEIPNIR_DLLEXPORT Variable abs (const Variable &x)
 std::abs() for Variables.
 
SLEIPNIR_DLLEXPORT Variable acos (const Variable &x)
 std::acos() for Variables.
 
SLEIPNIR_DLLEXPORT Variable asin (const Variable &x)
 std::asin() for Variables.
 
SLEIPNIR_DLLEXPORT Variable atan (const Variable &x)
 std::atan() for Variables.
 
SLEIPNIR_DLLEXPORT Variable atan2 (const Variable &y, const Variable &x)
 std::atan2() for Variables.
 
SLEIPNIR_DLLEXPORT Variable cos (const Variable &x)
 std::cos() for Variables.
 
SLEIPNIR_DLLEXPORT Variable cosh (const Variable &x)
 std::cosh() for Variables.
 
SLEIPNIR_DLLEXPORT Variable erf (const Variable &x)
 std::erf() for Variables.
 
SLEIPNIR_DLLEXPORT Variable exp (const Variable &x)
 std::exp() for Variables.
 
SLEIPNIR_DLLEXPORT Variable hypot (const Variable &x, const Variable &y)
 std::hypot() for Variables.
 
SLEIPNIR_DLLEXPORT Variable log (const Variable &x)
 std::log() for Variables.
 
SLEIPNIR_DLLEXPORT Variable log10 (const Variable &x)
 std::log10() for Variables.
 
SLEIPNIR_DLLEXPORT Variable pow (const Variable &base, const Variable &power)
 std::pow() for Variables.
 
SLEIPNIR_DLLEXPORT Variable sign (const Variable &x)
 sign() for Variables.
 
SLEIPNIR_DLLEXPORT Variable sin (const Variable &x)
 std::sin() for Variables.
 
SLEIPNIR_DLLEXPORT Variable sinh (const Variable &x)
 std::sinh() for Variables.
 
SLEIPNIR_DLLEXPORT Variable sqrt (const Variable &x)
 std::sqrt() for Variables.
 
SLEIPNIR_DLLEXPORT Variable tan (const Variable &x)
 std::tan() for Variables.
 
SLEIPNIR_DLLEXPORT Variable tanh (const Variable &x)
 std::tanh() for Variables.
 
SLEIPNIR_DLLEXPORT Variable hypot (const Variable &x, const Variable &y, const Variable &z)
 std::hypot() for Variables.
 

Detailed Description

An autodiff variable pointing to an expression node.

Constructor & Destructor Documentation

◆ Variable() [1/4]

sleipnir::Variable::Variable ( )
default

Constructs a linear Variable with a value of zero.

◆ Variable() [2/4]

sleipnir::Variable::Variable ( double value)
inline

Constructs a Variable from a double.

Parameters
valueThe value of the Variable.

◆ Variable() [3/4]

sleipnir::Variable::Variable ( const detail::ExpressionPtr & expr)
inlineexplicit

Constructs a Variable pointing to the specified expression.

Parameters
exprThe autodiff variable.

◆ Variable() [4/4]

sleipnir::Variable::Variable ( detail::ExpressionPtr && expr)
inlineexplicit

Constructs a Variable pointing to the specified expression.

Parameters
exprThe autodiff variable.

Member Function Documentation

◆ operator*=()

Variable & sleipnir::Variable::operator*= ( const Variable & rhs)
inline

Variable-Variable compound multiplication operator.

Parameters
rhsOperator right-hand side.

◆ operator+=()

Variable & sleipnir::Variable::operator+= ( const Variable & rhs)
inline

Variable-Variable compound addition operator.

Parameters
rhsOperator right-hand side.

◆ operator-=()

Variable & sleipnir::Variable::operator-= ( const Variable & rhs)
inline

Variable-Variable compound subtraction operator.

Parameters
rhsOperator right-hand side.

◆ operator/=()

Variable & sleipnir::Variable::operator/= ( const Variable & rhs)
inline

Variable-Variable compound division operator.

Parameters
rhsOperator right-hand side.

◆ operator=()

Variable & sleipnir::Variable::operator= ( double value)
inline

Assignment operator for double.

Parameters
valueThe value of the Variable.

◆ SetValue()

void sleipnir::Variable::SetValue ( double value)
inline

Sets Variable's internal value.

Parameters
valueThe value of the Variable.

◆ Type()

ExpressionType sleipnir::Variable::Type ( ) const
inline

Returns the type of this expression (constant, linear, quadratic, or nonlinear).

◆ Value()

double sleipnir::Variable::Value ( )
inline

Returns the value of this variable.

Friends And Related Symbol Documentation

◆ abs

SLEIPNIR_DLLEXPORT Variable abs ( const Variable & x)
friend

std::abs() for Variables.

Parameters
xThe argument.

◆ acos

SLEIPNIR_DLLEXPORT Variable acos ( const Variable & x)
friend

std::acos() for Variables.

Parameters
xThe argument.

◆ asin

SLEIPNIR_DLLEXPORT Variable asin ( const Variable & x)
friend

std::asin() for Variables.

Parameters
xThe argument.

◆ atan

SLEIPNIR_DLLEXPORT Variable atan ( const Variable & x)
friend

std::atan() for Variables.

Parameters
xThe argument.

◆ atan2

SLEIPNIR_DLLEXPORT Variable atan2 ( const Variable & y,
const Variable & x )
friend

std::atan2() for Variables.

Parameters
yThe y argument.
xThe x argument.

◆ cos

SLEIPNIR_DLLEXPORT Variable cos ( const Variable & x)
friend

std::cos() for Variables.

Parameters
xThe argument.

◆ cosh

SLEIPNIR_DLLEXPORT Variable cosh ( const Variable & x)
friend

std::cosh() for Variables.

Parameters
xThe argument.

◆ erf

SLEIPNIR_DLLEXPORT Variable erf ( const Variable & x)
friend

std::erf() for Variables.

Parameters
xThe argument.

◆ exp

SLEIPNIR_DLLEXPORT Variable exp ( const Variable & x)
friend

std::exp() for Variables.

Parameters
xThe argument.

◆ Hessian

friend class SLEIPNIR_DLLEXPORT Hessian
friend

◆ hypot [1/2]

SLEIPNIR_DLLEXPORT Variable hypot ( const Variable & x,
const Variable & y )
friend

std::hypot() for Variables.

Parameters
xThe x argument.
yThe y argument.

◆ hypot [2/2]

SLEIPNIR_DLLEXPORT Variable hypot ( const Variable & x,
const Variable & y,
const Variable & z )
friend

std::hypot() for Variables.

Parameters
xThe x argument.
yThe y argument.
zThe z argument.

◆ Jacobian

friend class SLEIPNIR_DLLEXPORT Jacobian
friend

◆ log

SLEIPNIR_DLLEXPORT Variable log ( const Variable & x)
friend

std::log() for Variables.

Parameters
xThe argument.

◆ log10

SLEIPNIR_DLLEXPORT Variable log10 ( const Variable & x)
friend

std::log10() for Variables.

Parameters
xThe argument.

◆ operator*

SLEIPNIR_DLLEXPORT Variable operator* ( const Variable & lhs,
const Variable & rhs )
friend

Variable-Variable multiplication operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.

◆ operator+ [1/2]

SLEIPNIR_DLLEXPORT Variable operator+ ( const Variable & lhs)
friend

Unary plus operator.

Parameters
lhsOperand for unary plus.

◆ operator+ [2/2]

SLEIPNIR_DLLEXPORT Variable operator+ ( const Variable & lhs,
const Variable & rhs )
friend

Variable-Variable addition operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.

◆ operator- [1/2]

SLEIPNIR_DLLEXPORT Variable operator- ( const Variable & lhs)
friend

Unary minus operator.

Parameters
lhsOperand for unary minus.

◆ operator- [2/2]

SLEIPNIR_DLLEXPORT Variable operator- ( const Variable & lhs,
const Variable & rhs )
friend

Variable-Variable subtraction operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.

◆ operator/

SLEIPNIR_DLLEXPORT Variable operator/ ( const Variable & lhs,
const Variable & rhs )
friend

Variable-Variable division operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.

◆ pow

SLEIPNIR_DLLEXPORT Variable pow ( const Variable & base,
const Variable & power )
friend

std::pow() for Variables.

Parameters
baseThe base.
powerThe power.

◆ sign

sign() for Variables.

Parameters
xThe argument.

◆ sin

SLEIPNIR_DLLEXPORT Variable sin ( const Variable & x)
friend

std::sin() for Variables.

Parameters
xThe argument.

◆ sinh

SLEIPNIR_DLLEXPORT Variable sinh ( const Variable & x)
friend

std::sinh() for Variables.

Parameters
xThe argument.

◆ sqrt

SLEIPNIR_DLLEXPORT Variable sqrt ( const Variable & x)
friend

std::sqrt() for Variables.

Parameters
xThe argument.

◆ tan

SLEIPNIR_DLLEXPORT Variable tan ( const Variable & x)
friend

std::tan() for Variables.

Parameters
xThe argument.

◆ tanh

SLEIPNIR_DLLEXPORT Variable tanh ( const Variable & x)
friend

std::tanh() for Variables.

Parameters
xThe argument.

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