WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
slp::detail::CosExpression< Scalar > Struct Template Referencefinal

Derived expression type for cos(). More...

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

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

Public Member Functions

constexpr CosExpression (ExpressionPtr< Scalar > lhs)
 Constructs an unary expression (an operator with one argument).
Scalar value (Scalar x, Scalar) 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).
std::string_view name () const override
 Returns the name of this expression.
Scalar grad_l (Scalar x, Scalar, Scalar parent_adjoint) const override
 Returns ∂/∂l as a Scalar.
ExpressionPtr< Scalargrad_expr_l (const ExpressionPtr< Scalar > &x, const ExpressionPtr< Scalar > &, const ExpressionPtr< Scalar > &parent_adjoint) const override
 Returns ∂/∂l as an Expression.
Public Member Functions inherited from slp::detail::Expression< Scalar >
constexpr Expression ()=default
 Constructs a constant expression with a value of zero.
virtual ~Expression ()=default
constexpr bool is_constant (Scalar constant) const
 Returns true if the expression is the given constant.
virtual Scalar grad_r (Scalar lhs, Scalar rhs, Scalar parent_adjoint) const
 Returns ∂/∂r as a Scalar.
virtual ExpressionPtr< Scalargrad_expr_r (const ExpressionPtr< Scalar > &lhs, const ExpressionPtr< Scalar > &rhs, const ExpressionPtr< Scalar > &parent_adjoint) const
 Returns ∂/∂r as an Expression.

Additional Inherited Members

Public Types inherited from slp::detail::Expression< Scalar >
using 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.
uint32_t incoming_edges
 Counts incoming edges for this node.
int32_t col
 This expression's column in a Jacobian, or -1 otherwise.
ExpressionPtr< Scalaradjoint_expr
 The adjoint of the expression node, used during gradient expression tree generation.
uint32_t ref_count
 Reference count for intrusive shared pointer.
std::array< ExpressionPtr< Scalar >, 2 > args
 Expression arguments.

Detailed Description

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

Derived expression type for cos().

Template Parameters
ScalarScalar type.

Constructor & Destructor Documentation

◆ CosExpression()

template<typename Scalar>
slp::detail::CosExpression< Scalar >::CosExpression ( 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>
ExpressionPtr< Scalar > slp::detail::CosExpression< Scalar >::grad_expr_l ( const ExpressionPtr< Scalar > & lhs,
const ExpressionPtr< Scalar > & rhs,
const ExpressionPtr< Scalar > & parent_adjoint ) const
inlineoverridevirtual

Returns ∂/∂l as an Expression.

Parameters
lhsLeft argument to binary operator.
rhsRight argument to binary operator.
parent_adjointAdjoint of parent expression.
Returns
∂/∂l as an Expression.

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

◆ grad_l()

template<typename Scalar>
Scalar slp::detail::CosExpression< Scalar >::grad_l ( Scalar lhs,
Scalar rhs,
Scalar parent_adjoint ) const
inlineoverridevirtual

Returns ∂/∂l as a Scalar.

Parameters
lhsLeft argument to binary operator.
rhsRight argument to binary operator.
parent_adjointAdjoint of parent expression.
Returns
∂/∂l as a Scalar.

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

◆ name()

template<typename Scalar>
std::string_view slp::detail::CosExpression< 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::CosExpression< 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::CosExpression< Scalar >::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:
  • /home/runner/work/allwpilib/allwpilib/wpimath/src/main/native/thirdparty/sleipnir/include/sleipnir/autodiff/expression.hpp