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

#include <sleipnir/autodiff/Variable.hpp>

Public Member Functions

 Variable ()=default
 
constexpr Variable (std::nullptr_t)
 
 Variable (std::floating_point auto value)
 
 Variable (std::integral auto value)
 
 Variable (const detail::ExpressionPtr &expr)
 
constexpr Variable (detail::ExpressionPtr &&expr)
 
Variableoperator= (double value)
 
void SetValue (double value)
 
Variableoperator*= (const Variable &rhs)
 
Variableoperator/= (const Variable &rhs)
 
Variableoperator+= (const Variable &rhs)
 
Variableoperator-= (const Variable &rhs)
 
double Value ()
 
ExpressionType Type () const
 

Friends

class detail::ExpressionGraph
 
class SLEIPNIR_DLLEXPORT Hessian
 
class SLEIPNIR_DLLEXPORT Jacobian
 
SLEIPNIR_DLLEXPORT Variable operator* (const Variable &lhs, const Variable &rhs)
 
SLEIPNIR_DLLEXPORT Variable operator/ (const Variable &lhs, const Variable &rhs)
 
SLEIPNIR_DLLEXPORT Variable operator+ (const Variable &lhs, const Variable &rhs)
 
SLEIPNIR_DLLEXPORT Variable operator- (const Variable &lhs, const Variable &rhs)
 
SLEIPNIR_DLLEXPORT Variable operator- (const Variable &lhs)
 
SLEIPNIR_DLLEXPORT Variable operator+ (const Variable &lhs)
 
SLEIPNIR_DLLEXPORT Variable abs (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable acos (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable asin (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable atan (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable atan2 (const Variable &y, const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable cos (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable cosh (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable erf (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable exp (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable hypot (const Variable &x, const Variable &y)
 
SLEIPNIR_DLLEXPORT Variable log (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable log10 (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable pow (const Variable &base, const Variable &power)
 
SLEIPNIR_DLLEXPORT Variable sign (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable sin (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable sinh (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable sqrt (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable tan (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable tanh (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable hypot (const Variable &x, const Variable &y, const Variable &z)
 

Detailed Description

An autodiff variable pointing to an expression node.

Constructor & Destructor Documentation

◆ Variable() [1/6]

sleipnir::Variable::Variable ( )
default

Constructs a linear Variable with a value of zero.

◆ Variable() [2/6]

constexpr sleipnir::Variable::Variable ( std::nullptr_t  )
inlineexplicitconstexpr

Constructs an empty Variable.

◆ Variable() [3/6]

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

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

Constructs a Variable from an integral type.

Parameters
valueThe value of the Variable.

◆ Variable() [5/6]

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

Constructs a Variable pointing to the specified expression.

Parameters
exprThe autodiff variable.

◆ Variable() [6/6]

constexpr sleipnir::Variable::Variable ( detail::ExpressionPtr &&  expr)
inlineexplicitconstexpr

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 ( )

Returns the value of this variable.

Friends And Related Symbol Documentation

◆ abs

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

std::cos() for Variables.

Parameters
xThe argument.

◆ cosh

SLEIPNIR_DLLEXPORT Variable cosh ( const Variable x)
friend

std::cosh() for Variables.

Parameters
xThe argument.

◆ detail::ExpressionGraph

◆ erf

std::erf() for Variables.

Parameters
xThe argument.

◆ exp

std::exp() for Variables.

Parameters
xThe argument.

◆ Hessian

◆ 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

◆ log

std::log() for Variables.

Parameters
xThe argument.

◆ log10

SLEIPNIR_DLLEXPORT Variable log10 ( const Variable x)
friend

std::log10() for Variables.

Parameters
xThe argument.

◆ operator*

Variable-Variable multiplication operator.

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

◆ operator+ [1/2]

Unary plus operator.

Parameters
lhsOperand for unary plus.

◆ operator+ [2/2]

Variable-Variable addition operator.

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

◆ operator- [1/2]

Unary minus operator.

Parameters
lhsOperand for unary minus.

◆ operator- [2/2]

Variable-Variable subtraction operator.

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

◆ operator/

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

SLEIPNIR_DLLEXPORT Variable sign ( const Variable x)
friend

sign() for Variables.

Parameters
xThe argument.

◆ sin

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

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: