Sleipnir C++ API
|
#include <sleipnir/autodiff/Expression.hpp>
Public Attributes | |
double | value = 0.0 |
The value of the expression node. | |
double | adjoint = 0.0 |
The adjoint of the expression node used during autodiff. | |
uint32_t | duplications = 0 |
int32_t | row = -1 |
ExpressionPtr | adjointExpr |
uint32_t | refCount = 0 |
Reference count for intrusive shared pointer. | |
std::array< ExpressionPtr, 2 > | args {nullptr, nullptr} |
Expression arguments. | |
An autodiff expression node.
|
constexprdefault |
Constructs a constant expression with a value of zero.
Constructs a nullary expression (an operator with no arguments).
value | The expression value. |
|
inlineexplicitconstexpr |
Constructs an unary expression (an operator with one argument).
lhs | Unary operator's operand. |
|
inlineconstexpr |
Constructs a binary expression (an operator with two arguments).
lhs | Binary operator's left operand. |
rhs | Binary operator's right operand. |
|
virtualdefault |
|
inlinevirtual |
Returns Variable adjoint of the left child expression.
lhs | Left argument to binary operator. |
rhs | Right argument to binary operator. |
parentAdjoint | Adjoint of parent expression. |
Reimplemented in sleipnir::detail::SignExpression, sleipnir::detail::BinaryMinusExpression< T >, sleipnir::detail::BinaryPlusExpression< T >, sleipnir::detail::UnaryMinusExpression< T >, sleipnir::detail::DivExpression< T >, sleipnir::detail::PowExpression< T >, sleipnir::detail::MultExpression< T >, sleipnir::detail::AbsExpression, sleipnir::detail::AcosExpression, sleipnir::detail::AsinExpression, sleipnir::detail::AtanExpression, sleipnir::detail::CosExpression, sleipnir::detail::CoshExpression, sleipnir::detail::ErfExpression, sleipnir::detail::ExpExpression, sleipnir::detail::LogExpression, sleipnir::detail::Log10Expression, sleipnir::detail::SinExpression, sleipnir::detail::SinhExpression, sleipnir::detail::SqrtExpression, sleipnir::detail::TanExpression, sleipnir::detail::TanhExpression, sleipnir::detail::HypotExpression, and sleipnir::detail::Atan2Expression.
|
inlinevirtual |
Returns Variable adjoint of the right child expression.
lhs | Left argument to binary operator. |
rhs | Right argument to binary operator. |
parentAdjoint | Adjoint of parent expression. |
Reimplemented in sleipnir::detail::BinaryMinusExpression< T >, sleipnir::detail::BinaryPlusExpression< T >, sleipnir::detail::PowExpression< T >, sleipnir::detail::DivExpression< T >, sleipnir::detail::MultExpression< T >, sleipnir::detail::HypotExpression, and sleipnir::detail::Atan2Expression.
|
inlinevirtual |
Returns double adjoint of the left child expression.
lhs | Left argument to binary operator. |
rhs | Right argument to binary operator. |
parentAdjoint | Adjoint of parent expression. |
Reimplemented in sleipnir::detail::PowExpression< T >, sleipnir::detail::MultExpression< T >, sleipnir::detail::HypotExpression, sleipnir::detail::AbsExpression, sleipnir::detail::AcosExpression, sleipnir::detail::AsinExpression, sleipnir::detail::AtanExpression, sleipnir::detail::CosExpression, sleipnir::detail::CoshExpression, sleipnir::detail::ErfExpression, sleipnir::detail::ExpExpression, sleipnir::detail::LogExpression, sleipnir::detail::Log10Expression, sleipnir::detail::SinExpression, sleipnir::detail::SinhExpression, sleipnir::detail::SqrtExpression, sleipnir::detail::TanExpression, sleipnir::detail::TanhExpression, sleipnir::detail::Atan2Expression, sleipnir::detail::DivExpression< T >, sleipnir::detail::BinaryMinusExpression< T >, sleipnir::detail::BinaryPlusExpression< T >, sleipnir::detail::UnaryMinusExpression< T >, and sleipnir::detail::SignExpression.
|
inlinevirtual |
Returns double adjoint of the right child expression.
lhs | Left argument to binary operator. |
rhs | Right argument to binary operator. |
parentAdjoint | Adjoint of parent expression. |
Reimplemented in sleipnir::detail::PowExpression< T >, sleipnir::detail::DivExpression< T >, sleipnir::detail::MultExpression< T >, sleipnir::detail::HypotExpression, sleipnir::detail::Atan2Expression, sleipnir::detail::BinaryMinusExpression< T >, and sleipnir::detail::BinaryPlusExpression< T >.
Returns true if the expression is the given constant.
constant | The constant. |
|
pure virtual |
Returns the type of this expression (constant, linear, quadratic, or nonlinear).
Implemented in sleipnir::detail::BinaryMinusExpression< T >, sleipnir::detail::BinaryPlusExpression< T >, sleipnir::detail::ConstExpression, sleipnir::detail::DecisionVariableExpression, sleipnir::detail::DivExpression< T >, sleipnir::detail::MultExpression< T >, sleipnir::detail::UnaryMinusExpression< T >, sleipnir::detail::AbsExpression, sleipnir::detail::AcosExpression, sleipnir::detail::AsinExpression, sleipnir::detail::AtanExpression, sleipnir::detail::Atan2Expression, sleipnir::detail::CosExpression, sleipnir::detail::CoshExpression, sleipnir::detail::ErfExpression, sleipnir::detail::ExpExpression, sleipnir::detail::HypotExpression, sleipnir::detail::LogExpression, sleipnir::detail::Log10Expression, sleipnir::detail::PowExpression< T >, sleipnir::detail::SignExpression, sleipnir::detail::SinExpression, sleipnir::detail::SinhExpression, sleipnir::detail::SqrtExpression, sleipnir::detail::TanExpression, and sleipnir::detail::TanhExpression.
Either nullary operator with no arguments, unary operator with one argument, or binary operator with two arguments. This operator is used to update the node's value.
lhs | Left argument to binary operator. |
rhs | Right argument to binary operator. |
Implemented in sleipnir::detail::PowExpression< T >, sleipnir::detail::BinaryMinusExpression< T >, sleipnir::detail::BinaryPlusExpression< T >, sleipnir::detail::DivExpression< T >, sleipnir::detail::MultExpression< T >, sleipnir::detail::UnaryMinusExpression< T >, sleipnir::detail::HypotExpression, sleipnir::detail::AbsExpression, sleipnir::detail::AcosExpression, sleipnir::detail::AsinExpression, sleipnir::detail::AtanExpression, sleipnir::detail::CosExpression, sleipnir::detail::CoshExpression, sleipnir::detail::ErfExpression, sleipnir::detail::ExpExpression, sleipnir::detail::LogExpression, sleipnir::detail::Log10Expression, sleipnir::detail::SignExpression, sleipnir::detail::SinExpression, sleipnir::detail::SinhExpression, sleipnir::detail::SqrtExpression, sleipnir::detail::TanExpression, sleipnir::detail::TanhExpression, sleipnir::detail::Atan2Expression, sleipnir::detail::ConstExpression, and sleipnir::detail::DecisionVariableExpression.
|
friend |
Expression-Expression multiplication operator.
lhs | Operator left-hand side. |
rhs | Operator right-hand side. |
|
friend |
Unary plus operator.
lhs | Operand of unary plus. |
|
friend |
Expression-Expression addition operator.
lhs | Operator left-hand side. |
rhs | Operator right-hand side. |
|
friend |
Unary minus operator.
lhs | Operand of unary minus. |
|
friend |
Expression-Expression subtraction operator.
lhs | Operator left-hand side. |
rhs | Operator right-hand side. |
|
friend |
Expression-Expression division operator.
lhs | Operator left-hand side. |
rhs | Operator right-hand side. |
double sleipnir::detail::Expression::adjoint = 0.0 |
The adjoint of the expression node used during autodiff.
ExpressionPtr sleipnir::detail::Expression::adjointExpr |
The adjoint of the expression node used during gradient expression tree generation.
std::array<ExpressionPtr, 2> sleipnir::detail::Expression::args {nullptr, nullptr} |
Expression arguments.
uint32_t sleipnir::detail::Expression::duplications = 0 |
Tracks the number of instances of this expression yet to be encountered in an expression tree.
uint32_t sleipnir::detail::Expression::refCount = 0 |
Reference count for intrusive shared pointer.
int32_t sleipnir::detail::Expression::row = -1 |
double sleipnir::detail::Expression::value = 0.0 |
The value of the expression node.