CppADCodeGen  HEAD
A C++ Algorithmic Differentiation Package with Source Code Generation
CppAD::cg::CG< Base > Class Template Reference
Inheritance diagram for CppAD::cg::CG< Base >:
Inheritance graph
Collaboration diagram for CppAD::cg::CG< Base >:
Collaboration graph

Public Member Functions

 CG ()
 
 CG (OperationNode< Base > &node)
 
 CG (const CG< Base > &orig)
 
 CG (CG< Base > &&orig)
 
CGoperator= (const CG< Base > &rhs)
 
CGoperator= (CG< Base > &&rhs)
 
 CG (const Base &val)
 
CGoperator= (const Base &rhs)
 
CodeHandler< Base > * getCodeHandler () const
 
bool isVariable () const
 
bool isParameter () const
 
bool isValueDefined () const
 
const Base & getValue () const
 
void setValue (const Base &val)
 
bool isIdenticalZero () const
 
bool isIdenticalOne () const
 
OperationNode< Base > * getOperationNode () const
 
CG< Base > & operator+= (const CG< Base > &right)
 
CG< Base > & operator-= (const CG< Base > &right)
 
CG< Base > & operator*= (const CG< Base > &right)
 
CG< Base > & operator/= (const CG< Base > &right)
 
CG< Base > & operator+= (const Base &right)
 
CG< Base > & operator-= (const Base &right)
 
CG< Base > & operator*= (const Base &right)
 
CG< Base > & operator/= (const Base &right)
 
template<class T >
CG< Base > & operator+= (const T &right)
 
template<class T >
CG< Base > & operator-= (const T &right)
 
template<class T >
CG< Base > & operator/= (const T &right)
 
template<class T >
CG< Base > & operator*= (const T &right)
 
CG< Base > operator+ () const
 
CG< Base > operator- () const
 

Protected Member Functions

 CG (const Argument< Base > &arg)
 
void makeParameter (const Base &b)
 
void makeVariable (OperationNode< Base > &operation)
 
void makeVariable (OperationNode< Base > &operation, std::unique_ptr< Base > &value)
 
Argument< Base > argument () const
 

Friends

class CodeHandler< Base >
 
class CGAbstractAtomicFun< Base >
 
class Loop< Base >
 
class LoopModel< Base >
 
CG< Base > CppAD::cg::operator+ (const CG< Base > &left, const CG< Base > &right)
 
CG< Base > CppAD::cg::operator- (const CG< Base > &left, const CG< Base > &right)
 
CG< Base > CppAD::cg::operator* (const CG< Base > &left, const CG< Base > &right)
 
CG< Base > CppAD::cg::operator/ (const CG< Base > &left, const CG< Base > &right)
 
bool GreaterThanZero (const CG< Base > &x)
 
bool GreaterThanOrZero (const CG< Base > &x)
 
bool LessThanZero (const CG< Base > &x)
 
bool LessThanOrZero (const CG< Base > &x)
 
bool abs_geq (const CG< Base > &x, const CG< Base > &y)
 
bool EqualOpSeq (const CG< Base > &u, const CG< Base > &v)
 
bool NearEqual (const CG< Base > &x, const CG< Base > &y, const Base &r, const Base &a)
 
bool NearEqual (const Base &x, const CG< Base > &y, const Base &r, const Base &a)
 
bool NearEqual (const CG< Base > &x, const Base &y, const Base &r, const Base &a)
 
CG< Base > CondExp (CGOpCode op, const CG< Base > &left, const CG< Base > &right, const CG< Base > &trueCase, const CG< Base > &falseCase, bool(*compare)(const Base &, const Base &))
 
CG< Base > sign (const CG< Base > &x)
 
CG< Base > pow (const CG< Base > &x, const CG< Base > &y)
 
CG< Base > abs (const CG< Base > &var)
 
CG< Base > fabs (const CG< Base > &var)
 
CG< Base > acos (const CG< Base > &var)
 
CG< Base > asin (const CG< Base > &var)
 
CG< Base > atan (const CG< Base > &var)
 
CG< Base > cos (const CG< Base > &var)
 
CG< Base > cosh (const CG< Base > &var)
 
CG< Base > exp (const CG< Base > &var)
 
CG< Base > log (const CG< Base > &var)
 
CG< Base > sin (const CG< Base > &var)
 
CG< Base > sinh (const CG< Base > &var)
 
CG< Base > sqrt (const CG< Base > &var)
 
CG< Base > tan (const CG< Base > &var)
 
CG< Base > tanh (const CG< Base > &var)
 

Detailed Description

template<class Base>
class CppAD::cg::CG< Base >

The base data type used to create models. It can represent either the result of a symbolic operation or a constant parameter value.

Author
Joao Leal

Definition at line 29 of file cg.hpp.

Constructor & Destructor Documentation

◆ CG() [1/6]

template<class Base >
CppAD::cg::CG< Base >::CG ( )
inline

Default constructor (creates a parameter with a zero value)

Creates a parameter with a zero value

Definition at line 25 of file default.hpp.

◆ CG() [2/6]

template<class Base>
CppAD::cg::CG< Base >::CG ( OperationNode< Base > &  node)
inline

Creates a variable resulting from the evaluation this node

Parameters
nodeThe operation node.

Definition at line 31 of file default.hpp.

◆ CG() [3/6]

template<class Base>
CppAD::cg::CG< Base >::CG ( const CG< Base > &  orig)
inline

Copy constructor

Definition at line 55 of file default.hpp.

◆ CG() [4/6]

template<class Base>
CppAD::cg::CG< Base >::CG ( CG< Base > &&  orig)
inline

Move constructor

Definition at line 64 of file default.hpp.

◆ CG() [5/6]

template<class Base>
CppAD::cg::CG< Base >::CG ( const Base &  b)
inline

Creates a parameter with the provided value

Parameters
valThe parameter value

Creates a parameter with the given value

Definition at line 46 of file default.hpp.

◆ CG() [6/6]

template<class Base>
CppAD::cg::CG< Base >::CG ( const Argument< Base > &  arg)
inlineprotected

Creates a variable/parameter from an existing argument

Parameters
argAn argument that may be a parameter or a variable. (the node is assumed to already be managed by the handler)

Definition at line 36 of file default.hpp.

Member Function Documentation

◆ getCodeHandler()

template<class Base >
CodeHandler< Base > * CppAD::cg::CG< Base >::getCodeHandler ( ) const
inline
Returns
The code handler that owns the OperationNode when it is a variable, null when it is a parameter.

Definition at line 22 of file variable.hpp.

Referenced by CppAD::cg::EquationPattern< Base >::detectNonIndexedIndependents(), and CppAD::pow().

◆ getValue()

◆ isParameter()

template<class Base >
bool CppAD::cg::CG< Base >::isParameter ( ) const
inline

◆ isValueDefined()

template<class Base >
bool CppAD::cg::CG< Base >::isValueDefined ( ) const
inline

Determines if there is value defined. Parameters must have a value defined while variable can optionally define it.

Returns
true if there is a value defined

Definition at line 40 of file variable.hpp.

Referenced by CppAD::CondExp().

◆ isVariable()

template<class Base >
bool CppAD::cg::CG< Base >::isVariable ( ) const
inline

Determines if it represents the result from a symbolic operation which is registered in operation graph of a CodeHandler.

Returns
true if it represents the result from a symbolic operation

Definition at line 30 of file variable.hpp.

Referenced by CppAD::cg::EquationPattern< Base >::detectNonIndexedIndependents().

◆ operator=() [1/3]

template<class Base>
CG< Base > & CppAD::cg::CG< Base >::operator= ( const CG< Base > &  rhs)
inline

Copy assignment operator

Definition at line 84 of file default.hpp.

◆ operator=() [2/3]

template<class Base>
CG< Base > & CppAD::cg::CG< Base >::operator= ( CG< Base > &&  rhs)
inline

Move assignment operator

Definition at line 103 of file default.hpp.

◆ operator=() [3/3]

template<class Base>
CG< Base > & CppAD::cg::CG< Base >::operator= ( const Base &  b)
inline

Assignment operator to a parameter value

Parameters
rhsThe parameter value

Creates a parameter with the given value

Definition at line 73 of file default.hpp.

◆ setValue()

Friends And Related Function Documentation

◆ CondExp

template<class Base>
CG<Base> CondExp ( CGOpCode  op,
const CG< Base > &  left,
const CG< Base > &  right,
const CG< Base > &  trueCase,
const CG< Base > &  falseCase,
bool(*)(const Base &, const Base &)  compare 
)
friend

Creates a conditional expression. INTERNAL ONLY

Definition at line 80 of file cond_exp_op.hpp.

◆ CppAD::cg::operator+

template<class Base>
CG<Base> CppAD::cg::operator+ ( const CG< Base > &  left,
const CG< Base > &  right 
)
friend

arithmetic binary operators

◆ GreaterThanZero

template<class Base>
bool GreaterThanZero ( const CG< Base > &  x)
friend

order determining functions

Definition at line 21 of file ordered.hpp.

◆ pow

template<class Base>
CG<Base> pow ( const CG< Base > &  x,
const CG< Base > &  y 
)
friend

math functions

Definition at line 21 of file math_other.hpp.

◆ sign

template<class Base>
CG<Base> sign ( const CG< Base > &  x)
friend

Math functions

Definition at line 74 of file math_other.hpp.


The documentation for this class was generated from the following files: