TMB Documentation  v1.9.11
Public Member Functions | List of all members
TMBad::global::Complete< OperatorBase > Struct Template Reference

Operator auto-completion. More...

#include <global.hpp>

Public Member Functions

OperatorPurecopy ()
 Return a copy of this OperatorPure.
 
void deallocate ()
 Deallocate this OperatorPure.
 
void decrement (IndexPair &ptr)
 Decrement input/output pointers to prepare for the previous OperatorPure in the stack.
 
void dependencies (Args<> &args, Dependencies &dep)
 Get the indices of variables required by this operator. More...
 
void dependencies_updating (Args<> &args, Dependencies &dep)
 Get the indices of variables updated by this operator. More...
 
void forward (ForwardArgs< Scalar > &args)
 Update output values of this OperatorPure.
 
void forward (ForwardArgs< Replay > &args)
 Replay operation sequence. More...
 
void forward (ForwardArgs< bool > &args)
 Mark forward dependencies. More...
 
void forward (ForwardArgs< Writer > &args)
 Source code writer. More...
 
void forward_incr (ForwardArgs< Scalar > &args)
 Fast equivalent of combined forward() and increment()
 
void forward_incr (ForwardArgs< Replay > &args)
 Replay operation sequence. More...
 
void forward_incr (ForwardArgs< bool > &args)
 Fast equivalent of combined forward() and increment() More...
 
void forward_incr (ForwardArgs< Writer > &args)
 Source code writer. More...
 
void forward_incr_mark_dense (ForwardArgs< bool > &args)
 Conditionally mark all outputs.
 
void * identifier ()
 Operator identifier. More...
 
void * incomplete ()
 Get pointer to operator before it was completed. More...
 
void increment (IndexPair &ptr)
 Increment input/output pointers to prepare for the next OperatorPure in the stack.
 
op_info info ()
 Get operator info.
 
Index input_size ()
 Number of inputs to this OperatorPure.
 
const char * op_name ()
 Name of this OperatorPure.
 
std::vector< ad_plain > operator() (const std::vector< ad_plain > &x)
 Move a stack allocated instance to the heap and let the operation_stack manage the memory. More...
 
void * operator_data ()
 Optional operator_data.
 
OperatorPureother_fuse (OperatorPure *other)
 Lookup table for operator fusion. Merge this OperatorPure with another operator. If no match return NULL.
 
Index output_size ()
 Number of outputs from this OperatorPure.
 
void print (print_config cfg)
 Optional print method.
 
void reverse (ReverseArgs< Scalar > &args)
 Update input derivs of this OperatorPure.
 
void reverse (ReverseArgs< Replay > &args)
 Replay operation sequence. More...
 
void reverse (ReverseArgs< bool > &args)
 Mark reverse dependencies. More...
 
void reverse (ReverseArgs< Writer > &args)
 Source code writer. More...
 
void reverse_decr (ReverseArgs< Scalar > &args)
 Fast equivalent of combined decrement() and reverse()
 
void reverse_decr (ReverseArgs< Replay > &args)
 Replay operation sequence. More...
 
void reverse_decr (ReverseArgs< bool > &args)
 Fast equivalent of combined decrement() and reverse() More...
 
void reverse_decr (ReverseArgs< Writer > &args)
 Source code writer. More...
 
OperatorPureself_fuse ()
 Lookup table for operator fusion. Merge this OperatorPure with an identical copy. If no match return NULL.
 

Detailed Description

template<class OperatorBase>
struct TMBad::global::Complete< OperatorBase >

Operator auto-completion.

Generate the mandatory members required by OperatorPure based on a given Operator.

Definition at line 2129 of file global.hpp.

Member Function Documentation

§ dependencies()

template<class OperatorBase>
void TMBad::global::Complete< OperatorBase >::dependencies ( Args<> &  args,
Dependencies &  dep 
)
inlinevirtual

Get the indices of variables required by this operator.

Result of this operation (the indices) are appended to the dep argument. Its main purpose is to build the computational graph. Under normal circumstances the information can be autogenerated from the operator inputs. However there is a subtle exception: Operators are allowed to take reference inputs. For instance a matrix multiply only requires addresses of the first element of the two input matrices. Such cases must have special code to provide all input addresses.

Note
This information is somewhat overlapping with that of reverse(ReverseArgs<Replay>& args).

Implements TMBad::global::OperatorPure.

Definition at line 2209 of file global.hpp.

§ dependencies_updating()

template<class OperatorBase>
void TMBad::global::Complete< OperatorBase >::dependencies_updating ( Args<> &  args,
Dependencies &  dep 
)
inlinevirtual

Get the indices of variables updated by this operator.

Used only when Operator::updating flag is set.

Implements TMBad::global::OperatorPure.

Definition at line 2212 of file global.hpp.

§ forward() [1/3]

template<class OperatorBase>
void TMBad::global::Complete< OperatorBase >::forward ( ForwardArgs< Replay > &  args)
inlinevirtual

Replay operation sequence.

Update output values of this OperatorPure.

Implements TMBad::global::OperatorPure.

Definition at line 2138 of file global.hpp.

§ forward() [2/3]

template<class OperatorBase>
void TMBad::global::Complete< OperatorBase >::forward ( ForwardArgs< bool > &  args)
inlinevirtual

Mark forward dependencies.

Calculate \(y=Jx\) where \(J\) denotes the Jacobian sparsity pattern of the operator. Operators are by default assumed to be dense.

Implements TMBad::global::OperatorPure.

Definition at line 2154 of file global.hpp.

§ forward() [3/3]

template<class OperatorBase>
void TMBad::global::Complete< OperatorBase >::forward ( ForwardArgs< Writer > &  args)
inlinevirtual

Source code writer.

Update output values of this OperatorPure.

Implements TMBad::global::OperatorPure.

Definition at line 2163 of file global.hpp.

§ forward_incr() [1/3]

template<class OperatorBase>
void TMBad::global::Complete< OperatorBase >::forward_incr ( ForwardArgs< Replay > &  args)
inlinevirtual

Replay operation sequence.

Fast equivalent of combined forward() and increment()

Implements TMBad::global::OperatorPure.

Definition at line 2145 of file global.hpp.

§ forward_incr() [2/3]

template<class OperatorBase>
void TMBad::global::Complete< OperatorBase >::forward_incr ( ForwardArgs< bool > &  args)
inlinevirtual

Fast equivalent of combined forward() and increment()

Implements TMBad::global::OperatorPure.

Definition at line 2156 of file global.hpp.

§ forward_incr() [3/3]

template<class OperatorBase>
void TMBad::global::Complete< OperatorBase >::forward_incr ( ForwardArgs< Writer > &  args)
inlinevirtual

Source code writer.

Fast equivalent of combined forward() and increment()

Implements TMBad::global::OperatorPure.

Definition at line 2165 of file global.hpp.

§ identifier()

template<class OperatorBase>
void* TMBad::global::Complete< OperatorBase >::identifier ( )
inlinevirtual

Operator identifier.

If two operators have equal identifier it can be assumed that they represent equal mappings, i.e. same input implies same output.

Implements TMBad::global::OperatorPure.

Definition at line 2263 of file global.hpp.

§ incomplete()

template<class OperatorBase>
void* TMBad::global::Complete< OperatorBase >::incomplete ( )
inlinevirtual

Get pointer to operator before it was completed.

Warning
Avoid unless strictly necessary

Implements TMBad::global::OperatorPure.

Definition at line 2271 of file global.hpp.

§ operator()()

template<class OperatorBase>
std::vector<ad_plain> TMBad::global::Complete< OperatorBase >::operator() ( const std::vector< ad_plain > &  x)
inline

Move a stack allocated instance to the heap and let the operation_stack manage the memory.

This is only useful for dynamic operators and therfore disallowed for static operators.

Definition at line 2171 of file global.hpp.

§ reverse() [1/3]

template<class OperatorBase>
void TMBad::global::Complete< OperatorBase >::reverse ( ReverseArgs< Replay > &  args)
inlinevirtual

Replay operation sequence.

Update input derivs of this OperatorPure.

Implements TMBad::global::OperatorPure.

Definition at line 2144 of file global.hpp.

§ reverse() [2/3]

template<class OperatorBase>
void TMBad::global::Complete< OperatorBase >::reverse ( ReverseArgs< bool > &  args)
inlinevirtual

Mark reverse dependencies.

Calculate \(x=J^Ty\) where \(J\) denotes the Jacobian sparsity pattern of the operator. Operators are by default assumed to be dense.

Implements TMBad::global::OperatorPure.

Definition at line 2155 of file global.hpp.

§ reverse() [3/3]

template<class OperatorBase>
void TMBad::global::Complete< OperatorBase >::reverse ( ReverseArgs< Writer > &  args)
inlinevirtual

Source code writer.

Update input derivs of this OperatorPure.

Implements TMBad::global::OperatorPure.

Definition at line 2164 of file global.hpp.

§ reverse_decr() [1/3]

template<class OperatorBase>
void TMBad::global::Complete< OperatorBase >::reverse_decr ( ReverseArgs< Replay > &  args)
inlinevirtual

Replay operation sequence.

Fast equivalent of combined decrement() and reverse()

Implements TMBad::global::OperatorPure.

Definition at line 2152 of file global.hpp.

§ reverse_decr() [2/3]

template<class OperatorBase>
void TMBad::global::Complete< OperatorBase >::reverse_decr ( ReverseArgs< bool > &  args)
inlinevirtual

Fast equivalent of combined decrement() and reverse()

Implements TMBad::global::OperatorPure.

Definition at line 2157 of file global.hpp.

§ reverse_decr() [3/3]

template<class OperatorBase>
void TMBad::global::Complete< OperatorBase >::reverse_decr ( ReverseArgs< Writer > &  args)
inlinevirtual

Source code writer.

Fast equivalent of combined decrement() and reverse()

Implements TMBad::global::OperatorPure.

Definition at line 2166 of file global.hpp.


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