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

Implements ComputeOperation for two arguments. More...

#include <computeExpression.hpp>

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

Public Types

using Impl = T_Impl
 See BinaryOperation.
 
using Real = T_Real
 See BinaryOperation.
 
- 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 ArgA, typename ArgB>
static inlineauto applyAdjoint (Adjoint const &adjoint, Real const &result, ArgA const &argA, ArgB const &argB)
 
template<typename Adjoint, typename ArgA, typename ArgB>
static inlineauto applyAdjointArgA (Adjoint const &adjoint, Real const &result, ArgA const &argA, ArgB const &argB)
 
template<typename Adjoint, typename ArgA, typename ArgB>
static inlineauto applyAdjointArgB (Adjoint const &adjoint, Real const &result, ArgA const &argA, ArgB const &argB)
 
template<size_t argNumber, typename Tangent, typename ArgA, typename ArgB>
static inlineauto applyTangent (Tangent const &tangent, Real const &result, ArgA const &argA, ArgB const &argB)
 
template<typename Tangent, typename ArgA, typename ArgB>
static inlineauto applyTangentArgA (Tangent const &tangent, Real const &result, ArgA const &argA, ArgB const &argB)
 
template<typename Tangent, typename ArgA, typename ArgB>
static inlineauto applyTangentArgB (Tangent const &tangent, Real const &result, ArgA const &argA, ArgB const &argB)
 
template<typename ArgA, typename ArgB>
static inlineReal primal (ArgA const &argA, ArgB const &argB)
 
- 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::BinaryOperation< T_Real, T_Impl >

Implements ComputeOperation for two arguments.

Represents an operation $ w = f(a, b)$.

Implementations need to define primal, applyTangentArgA, applyTangentArgB, applyAdjointArgA and applyAdjointArgB.

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 ArgA, typename ArgB>
static inlineauto codi::BinaryOperation< T_Real, T_Impl >::applyAdjoint ( Adjoint const & adjoint,
Real const & result,
ArgA const & argA,
ArgB const & argB )
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 applyAdjointArgA and applyAdjointArgB.

◆ applyAdjointArgA()

template<typename T_Real, typename T_Impl>
template<typename Adjoint, typename ArgA, typename ArgB>
static inlineauto codi::BinaryOperation< T_Real, T_Impl >::applyAdjointArgA ( Adjoint const & adjoint,
Real const & result,
ArgA const & argA,
ArgB const & argB )
static

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

◆ applyAdjointArgB()

template<typename T_Real, typename T_Impl>
template<typename Adjoint, typename ArgA, typename ArgB>
static inlineauto codi::BinaryOperation< T_Real, T_Impl >::applyAdjointArgB ( Adjoint const & adjoint,
Real const & result,
ArgA const & argA,
ArgB const & argB )
static

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

◆ applyTangent()

template<typename T_Real, typename T_Impl>
template<size_t argNumber, typename Tangent, typename ArgA, typename ArgB>
static inlineauto codi::BinaryOperation< T_Real, T_Impl >::applyTangent ( Tangent const & tangent,
Real const & result,
ArgA const & argA,
ArgB const & argB )
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 applyTangentArgA and applyTangentArgB.

◆ applyTangentArgA()

template<typename T_Real, typename T_Impl>
template<typename Tangent, typename ArgA, typename ArgB>
static inlineauto codi::BinaryOperation< T_Real, T_Impl >::applyTangentArgA ( Tangent const & tangent,
Real const & result,
ArgA const & argA,
ArgB const & argB )
static

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

◆ applyTangentArgB()

template<typename T_Real, typename T_Impl>
template<typename Tangent, typename ArgA, typename ArgB>
static inlineauto codi::BinaryOperation< T_Real, T_Impl >::applyTangentArgB ( Tangent const & tangent,
Real const & result,
ArgA const & argA,
ArgB const & argB )
static

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

◆ primal()

template<typename T_Real, typename T_Impl>
template<typename ArgA, typename ArgB>
static inlineReal codi::BinaryOperation< T_Real, T_Impl >::primal ( ArgA const & argA,
ArgB const & argB )
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: