WPILibC++ 2027.0.0-alpha-2
Loading...
Searching...
No Matches
slp::detail::BinaryMinusExpression< T > Struct Template Referencefinal

Derived expression type for binary minus operator. More...

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

Inheritance diagram for slp::detail::BinaryMinusExpression< T >:
slp::detail::Expression

Public Member Functions

constexpr BinaryMinusExpression (ExpressionPtr lhs, ExpressionPtr rhs)
 Constructs a binary expression (an operator with two arguments).
 
double value (double lhs, double rhs) const override
 Either nullary operator with no arguments, unary operator with one argument, or binary operator with two arguments.
 
ExpressionType type () const override
 Returns the type of this expression (constant, linear, quadratic, or nonlinear).
 
double grad_l (double, double, double parent_adjoint) const override
 Returns double adjoint of the left child expression.
 
double grad_r (double, double, double parent_adjoint) const override
 Returns double adjoint of the right child expression.
 
ExpressionPtr grad_expr_l (const ExpressionPtr &, const ExpressionPtr &, const ExpressionPtr &parent_adjoint) const override
 Returns Expression adjoint of the left child expression.
 
ExpressionPtr grad_expr_r (const ExpressionPtr &, const ExpressionPtr &, const ExpressionPtr &parent_adjoint) const override
 Returns Expression adjoint of the right child expression.
 
- Public Member Functions inherited from slp::detail::Expression
constexpr Expression ()=default
 Constructs a constant expression with a value of zero.
 
constexpr Expression (double value)
 Constructs a nullary expression (an operator with no arguments).
 
constexpr Expression (ExpressionPtr lhs)
 Constructs an unary expression (an operator with one argument).
 
constexpr Expression (ExpressionPtr lhs, ExpressionPtr rhs)
 Constructs a binary expression (an operator with two arguments).
 
virtual ~Expression ()=default
 
constexpr bool is_constant (double constant) const
 Returns true if the expression is the given constant.
 

Additional Inherited Members

- Public Attributes inherited from slp::detail::Expression
double val = 0.0
 The value of the expression node.
 
double adjoint = 0.0
 The adjoint of the expression node used during autodiff.
 
uint32_t incoming_edges = 0
 Counts incoming edges for this node.
 
int32_t col = -1
 This expression's column in a Jacobian, or -1 otherwise.
 
ExpressionPtr adjoint_expr
 The adjoint of the expression node used during gradient expression tree generation.
 
uint32_t ref_count = 0
 Reference count for intrusive shared pointer.
 
std::array< ExpressionPtr, 2 > args {nullptr, nullptr}
 Expression arguments.
 

Detailed Description

template<ExpressionType T>
struct slp::detail::BinaryMinusExpression< T >

Derived expression type for binary minus operator.

Template Parameters
TExpression type.

Constructor & Destructor Documentation

◆ BinaryMinusExpression()

template<ExpressionType T>
slp::detail::BinaryMinusExpression< T >::BinaryMinusExpression ( ExpressionPtr lhs,
ExpressionPtr rhs )
inlineconstexpr

Constructs a binary expression (an operator with two arguments).

Parameters
lhsBinary operator's left operand.
rhsBinary operator's right operand.

Member Function Documentation

◆ grad_expr_l()

template<ExpressionType T>
ExpressionPtr slp::detail::BinaryMinusExpression< T >::grad_expr_l ( const ExpressionPtr & lhs,
const ExpressionPtr & rhs,
const ExpressionPtr & parent_adjoint ) const
inlineoverridevirtual

Returns Expression adjoint of the left child expression.

Parameters
lhsLeft argument to binary operator.
rhsRight argument to binary operator.
parent_adjointAdjoint of parent expression.
Returns
The Expression adjoint of the left child expression.

Reimplemented from slp::detail::Expression.

◆ grad_expr_r()

template<ExpressionType T>
ExpressionPtr slp::detail::BinaryMinusExpression< T >::grad_expr_r ( const ExpressionPtr & lhs,
const ExpressionPtr & rhs,
const ExpressionPtr & parent_adjoint ) const
inlineoverridevirtual

Returns Expression adjoint of the right child expression.

Parameters
lhsLeft argument to binary operator.
rhsRight argument to binary operator.
parent_adjointAdjoint of parent expression.
Returns
The Expression adjoint of the right child expression.

Reimplemented from slp::detail::Expression.

◆ grad_l()

template<ExpressionType T>
double slp::detail::BinaryMinusExpression< T >::grad_l ( double lhs,
double rhs,
double parent_adjoint ) const
inlineoverridevirtual

Returns double adjoint of the left child expression.

Parameters
lhsLeft argument to binary operator.
rhsRight argument to binary operator.
parent_adjointAdjoint of parent expression.
Returns
The double adjoint of the left child expression.

Reimplemented from slp::detail::Expression.

◆ grad_r()

template<ExpressionType T>
double slp::detail::BinaryMinusExpression< T >::grad_r ( double lhs,
double rhs,
double parent_adjoint ) const
inlineoverridevirtual

Returns double adjoint of the right child expression.

Parameters
lhsLeft argument to binary operator.
rhsRight argument to binary operator.
parent_adjointAdjoint of parent expression.
Returns
The double adjoint of the right child expression.

Reimplemented from slp::detail::Expression.

◆ type()

template<ExpressionType T>
ExpressionType slp::detail::BinaryMinusExpression< T >::type ( ) const
inlineoverridevirtual

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

Returns
The type of this expression.

Implements slp::detail::Expression.

◆ value()

template<ExpressionType T>
double slp::detail::BinaryMinusExpression< T >::value ( double lhs,
double rhs ) const
inlineoverridevirtual

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.

Parameters
lhsLeft argument to binary operator.
rhsRight argument to binary operator.
Returns
The node's value.

Implements slp::detail::Expression.


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