CoDiPack  3.0.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
codi::UnaryOperation< T_Real, T_Impl > Struct Template Reference

Implements ComputeOperation for one argument. More...

#include <computeExpression.hpp>

Inheritance diagram for codi::UnaryOperation< T_Real, T_Impl >:

Public Types

using Impl = T_Impl
 See UnaryOperation.
 
using Real = T_Real
 See UnaryOperation.
 
- Public Types inherited from codi::ComputeOperation< T_Real >
using Real = T_Real
 See ComputeOperation.
 

Static Public Member Functions

template<size_t argNumber, typename Adjoint, typename Arg>
static inlineauto applyAdjoint (Adjoint const &adjoint, Real const &result, Arg const &arg)
 
template<typename Adjoint, typename Arg>
static inlineauto applyAdjointArg (Adjoint const &adjoint, Real const &result, Arg const &arg)
 
template<size_t argNumber, typename Tangent, typename Arg>
static inlineauto applyTangent (Tangent const &tangent, Real const &result, Arg const &arg)
 
template<typename Tangent, typename Arg>
static inlineauto applyTangentArg (Tangent const &tangent, Real const &result, Arg const &arg)
 
template<typename Arg>
static inlineReal primal (Arg const &arg)
 
- Static Public Member Functions inherited from codi::ComputeOperation< T_Real >
template<size_t argNumber, typename Adjoint, typename... Args>
static inlineauto applyAdjoint (Adjoint const &adjoint, Real const &result, Args const &... args)
 
template<size_t argNumber, typename Tangent, typename... Args>
static inlineauto applyTangent (Tangent const &tangent, Real const &result, Args const &... args)
 
static inlinestd::string getMathRep ()
 Get the math symbol of the operation. E.g. + for operators and pow() for functions.
 
template<typename... Args>
static inlineReal primal (Args const &... args)
 

Detailed Description

template<typename T_Real, typename T_Impl>
struct codi::UnaryOperation< T_Real, T_Impl >

Implements ComputeOperation for one argument.

Implementations need to define primal, applyTangentArg and applyAdjointArg.

See ComputeOperation for details.

Template Parameters
T_RealOriginal primal value of the statement/expression.
T_ImplFinal implementation of the operation.

Member Function Documentation

◆ applyAdjoint()

template<typename T_Real, typename T_Impl>
template<size_t argNumber, typename Adjoint, typename Arg>
static inlineauto codi::UnaryOperation< T_Real, T_Impl >::applyAdjoint ( Adjoint const & adjoint,
Real const & result,
Arg const & arg )
inlinestatic

Apply the reverse AD mode with respect to the given argument on the adjoint and return the result. Computes $ \bar x_{argNumber} = \frac{\d f}{\d x_{argNumber}}^T \bar w $

Forwards to applyAdjointArg.

◆ applyAdjointArg()

template<typename T_Real, typename T_Impl>
template<typename Adjoint, typename Arg>
static inlineauto codi::UnaryOperation< T_Real, T_Impl >::applyAdjointArg ( Adjoint const & adjoint,
Real const & result,
Arg const & arg )
static

Apply the reverse AD mode with respect to the argument on the adjoint and return the result. Computes $ \bar x = \frac{\d f}{\d x}^T \bar w $

◆ applyTangent()

template<typename T_Real, typename T_Impl>
template<size_t argNumber, typename Tangent, typename Arg>
static inlineauto codi::UnaryOperation< T_Real, T_Impl >::applyTangent ( Tangent const & tangent,
Real const & result,
Arg const & arg )
inlinestatic

Apply the forward AD mode with respect to the given argument on the tangent and return the result. Computes $ \dot w = \frac{\d f}{\d x_{argNumber}} \dot x_{argNumber} $

Forwards to applyTangentArg.

◆ applyTangentArg()

template<typename T_Real, typename T_Impl>
template<typename Tangent, typename Arg>
static inlineauto codi::UnaryOperation< T_Real, T_Impl >::applyTangentArg ( Tangent const & tangent,
Real const & result,
Arg const & arg )
static

Apply the forward AD mode with respect to the argument on the tangent and return the result. Computes $ \dot w = \frac{\d f}{\d x} \dot x $

◆ primal()

template<typename T_Real, typename T_Impl>
template<typename Arg>
static inlineReal codi::UnaryOperation< T_Real, T_Impl >::primal ( Arg const & arg)
static

Compute the primal value from the arguments. E.g. evaluates $ w = f(x)$

The argument types are the types of the result of a getValue call on the expression.


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