WPILibC++ 2027.0.0-alpha-2
Loading...
Searching...
No Matches
slp::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 (std::nullptr_t)
 Constructs an empty Variable.
 
 Variable (std::floating_point auto value)
 Constructs a Variable from a floating point type.
 
 Variable (std::integral auto value)
 Constructs a Variable from an integral type.
 
 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 set_value (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 detail::AdjointExpressionGraph
 
template<int UpLo>
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/6]

slp::Variable::Variable ( )
default

Constructs a linear Variable with a value of zero.

◆ Variable() [2/6]

slp::Variable::Variable ( std::nullptr_t )
inlineexplicit

Constructs an empty Variable.

◆ Variable() [3/6]

slp::Variable::Variable ( std::floating_point auto value)
inline

Constructs a Variable from a floating point type.

Parameters
valueThe value of the Variable.

◆ Variable() [4/6]

slp::Variable::Variable ( std::integral auto value)
inline

Constructs a Variable from an integral type.

Parameters
valueThe value of the Variable.

◆ Variable() [5/6]

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

Constructs a Variable pointing to the specified expression.

Parameters
exprThe autodiff variable.

◆ Variable() [6/6]

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

Constructs a Variable pointing to the specified expression.

Parameters
exprThe autodiff variable.

Member Function Documentation

◆ operator*=()

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

Variable-Variable compound multiplication operator.

Parameters
rhsOperator right-hand side.
Returns
Result of multiplication.

◆ operator+=()

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

Variable-Variable compound addition operator.

Parameters
rhsOperator right-hand side.
Returns
Result of addition.

◆ operator-=()

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

Variable-Variable compound subtraction operator.

Parameters
rhsOperator right-hand side.
Returns
Result of subtraction.

◆ operator/=()

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

Variable-Variable compound division operator.

Parameters
rhsOperator right-hand side.
Returns
Result of division.

◆ operator=()

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

Assignment operator for double.

Parameters
valueThe value of the Variable.
Returns
This variable.

◆ set_value()

void slp::Variable::set_value ( double value)
inline

Sets Variable's internal value.

Parameters
valueThe value of the Variable.

◆ type()

ExpressionType slp::Variable::type ( ) const
inline

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

Returns
The type of this expression.

◆ value()

double slp::Variable::value ( )
inline

Returns the value of this variable.

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.

◆ detail::AdjointExpressionGraph

friend class detail::AdjointExpressionGraph
friend

◆ 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

template<int UpLo>
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.
Returns
Result of multiplication.

◆ 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.
Returns
Result of addition.

◆ 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.
Returns
Result of subtraction.

◆ 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.
Returns
Result of division.

◆ 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: