Sleipnir C++ API
Loading...
Searching...
No Matches
slp::detail::AbsExpression< Scalar > Struct Template Referencefinal

#include </home/runner/work/Sleipnir/Sleipnir/include/sleipnir/autodiff/expression.hpp>

Inheritance diagram for slp::detail::AbsExpression< Scalar >:
slp::detail::Expression< Scalar >

Public Member Functions

constexpr AbsExpression (ExpressionPtr< Scalar > x)
 
void visit_args (function_ref< void(Expression< Scalar > *arg)> func) const override
 
Scalar value () const override
 
ExpressionType type () const override
 
std::string_view name () const override
 
void accumulate_adjoints () const override
 Accumulates the child adjoints as Scalars.
 
void accumulate_adjoints_expr () const override
 Accumulates the child adjoints as Expressions.
 
- Public Member Functions inherited from slp::detail::Expression< Scalar >
constexpr Expression ()=default
 Constructs a constant expression with a value of zero.
 
constexpr Expression (Scalar value)
 
constexpr bool is_constant (Scalar constant) const
 

Public Attributes

ExpressionPtr< Scalar > x
 Unary operator's operand.
 
- Public Attributes inherited from slp::detail::Expression< Scalar >
Scalar val
 The value of the expression node.
 
Scalar adj
 The adjoint of the expression node, used during autodiff.
 
ExpressionPtr< Scalar > adj_expr
 
bool is_leaf
 
int32_t scratch
 
uint32_t ref_count
 Reference count for intrusive shared pointer.
 

Additional Inherited Members

- Public Types inherited from slp::detail::Expression< Scalar >
using Scalar = Scalar
 Scalar type alias.
 

Detailed Description

template<typename Scalar>
struct slp::detail::AbsExpression< Scalar >

Derived expression type for abs().

Template Parameters
ScalarScalar type.

Constructor & Destructor Documentation

◆ AbsExpression()

template<typename Scalar >
constexpr slp::detail::AbsExpression< Scalar >::AbsExpression ( ExpressionPtr< Scalar >  x)
inlineexplicitconstexpr

Constructs an unary expression (an operator with one argument).

Parameters
xUnary operator's operand.

Member Function Documentation

◆ accumulate_adjoints()

template<typename Scalar >
void slp::detail::AbsExpression< Scalar >::accumulate_adjoints ( ) const
inlineoverridevirtual

Accumulates the child adjoints as Scalars.

Reimplemented from slp::detail::Expression< Scalar >.

◆ accumulate_adjoints_expr()

template<typename Scalar >
void slp::detail::AbsExpression< Scalar >::accumulate_adjoints_expr ( ) const
inlineoverridevirtual

Accumulates the child adjoints as Expressions.

Reimplemented from slp::detail::Expression< Scalar >.

◆ name()

template<typename Scalar >
std::string_view slp::detail::AbsExpression< Scalar >::name ( ) const
inlineoverridevirtual

Returns the name of this expression.

Returns
The name of this expression.

Implements slp::detail::Expression< Scalar >.

◆ type()

template<typename Scalar >
ExpressionType slp::detail::AbsExpression< Scalar >::type ( ) const
inlineoverridevirtual

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

Returns
The type of this expression.

Implements slp::detail::Expression< Scalar >.

◆ value()

template<typename Scalar >
Scalar slp::detail::AbsExpression< Scalar >::value ( ) 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.

Returns
The node's value.

Implements slp::detail::Expression< Scalar >.

◆ visit_args()

template<typename Scalar >
void slp::detail::AbsExpression< Scalar >::visit_args ( function_ref< void(Expression< Scalar > *arg)>  func) const
inlineoverridevirtual

Runs a function on each argument.

Parameters
funcThe function to run.

Reimplemented from slp::detail::Expression< Scalar >.


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