Sleipnir C++ API
Loading...
Searching...
No Matches
slp::detail::UnaryMinusExpression< Scalar, T > Struct Template Reference

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

Inheritance diagram for slp::detail::UnaryMinusExpression< Scalar, T >:
slp::detail::Expression< Scalar >

Public Member Functions

constexpr UnaryMinusExpression (ExpressionPtr< Scalar > lhs)
 
Scalar value (Scalar lhs, Scalar) const override
 
ExpressionType type () const override
 
std::string_view name () const override
 
Scalar grad_l (Scalar, Scalar) const override
 
ExpressionPtr< Scalargrad_expr_l (const ExpressionPtr< Scalar > &, const ExpressionPtr< Scalar > &) const override
 
- 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 Expression (ExpressionPtr< Scalar > lhs)
 
constexpr Expression (ExpressionPtr< Scalar > lhs, ExpressionPtr< Scalar > rhs)
 
constexpr bool is_constant (Scalar constant) const
 
virtual Scalar grad_r (Scalar lhs, Scalar rhs) const
 
virtual ExpressionPtr< Scalargrad_expr_r (const ExpressionPtr< Scalar > &lhs, const ExpressionPtr< Scalar > &rhs) const
 

Additional Inherited Members

- Public Types inherited from slp::detail::Expression< Scalar >
using Scalar = Scalar
 Scalar type alias.
 
- Public Attributes inherited from slp::detail::Expression< Scalar >
Scalar val
 The value of the expression node.
 
Scalar adjoint
 The adjoint of the expression node, used during autodiff.
 
ExpressionPtr< Scalaradjoint_expr
 
std::array< ExpressionPtr< Scalar >, 2 > args
 Expression arguments.
 
int32_t scratch
 
uint32_t ref_count
 Reference count for intrusive shared pointer.
 

Detailed Description

template<typename Scalar, ExpressionType T>
struct slp::detail::UnaryMinusExpression< Scalar, T >

Derived expression type for unary minus operator.

Template Parameters
ScalarScalar type.
TExpression type.

Constructor & Destructor Documentation

◆ UnaryMinusExpression()

template<typename Scalar , ExpressionType T>
constexpr slp::detail::UnaryMinusExpression< Scalar, T >::UnaryMinusExpression ( ExpressionPtr< Scalar lhs)
inlineexplicitconstexpr

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

Parameters
lhsUnary operator's operand.

Member Function Documentation

◆ grad_expr_l()

template<typename Scalar , ExpressionType T>
ExpressionPtr< Scalar > slp::detail::UnaryMinusExpression< Scalar, T >::grad_expr_l ( const ExpressionPtr< Scalar > &  lhs,
const ExpressionPtr< Scalar > &  rhs 
) const
inlineoverridevirtual

Returns ∂/∂l as an Expression.

Parameters
lhsLeft argument to binary operator.
rhsRight argument to binary operator.
Returns
∂/∂l as an Expression.

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

◆ grad_l()

template<typename Scalar , ExpressionType T>
Scalar slp::detail::UnaryMinusExpression< Scalar, T >::grad_l ( Scalar  lhs,
Scalar  rhs 
) const
inlineoverridevirtual

Returns ∂/∂l as a Scalar.

Parameters
lhsLeft argument to binary operator.
rhsRight argument to binary operator.
Returns
∂/∂l as a Scalar.

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

◆ name()

template<typename Scalar , ExpressionType T>
std::string_view slp::detail::UnaryMinusExpression< Scalar, T >::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 T>
ExpressionType slp::detail::UnaryMinusExpression< Scalar, 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< Scalar >.

◆ value()

template<typename Scalar , ExpressionType T>
Scalar slp::detail::UnaryMinusExpression< Scalar, T >::value ( Scalar  lhs,
Scalar  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< Scalar >.


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