CppADCodeGen
HEAD
A C++ Algorithmic Differentiation Package with Source Code Generation
|
Public Types | |
using | CGB = CppAD::cg::CG< Base > |
using | Arg = Argument< Base > |
using | pairss = std::pair< size_t, size_t > |
Public Member Functions | |
LoopModel (ADFun< CGB > *fun, bool containsAtoms, size_t iterationCount, const std::vector< std::vector< size_t > > &dependentOrigIndexes, const std::vector< std::vector< size_t > > &indexedIndepOrigIndexes, const std::vector< size_t > &nonIndexedIndepOrigIndexes, const std::vector< size_t > &temporaryIndependents) | |
LoopModel (const LoopModel< Base > &)=delete | |
LoopModel & | operator= (const LoopModel< Base > &)=delete |
size_t | getLoopId () const |
bool | isContainsAtomics () const |
const size_t | getIterationCount () const |
ADFun< CGB > & | getTape () const |
size_t | getTapeDependentCount () const |
size_t | getTapeIndependentCount () const |
const std::vector< std::vector< LoopPosition > > & | getDependentIndexes () const |
const std::vector< IterEquationGroup< Base > > & | getEquationsGroups () const |
const std::vector< std::set< const IterEquationGroup< Base > * > > & | getIterationEquationsGroup () const |
const std::vector< std::vector< LoopPosition > > & | getIndexedIndepIndexes () const |
const std::vector< LoopPosition > & | getNonIndexedIndepIndexes () const |
const std::vector< LoopPosition > & | getTemporaryIndependents () const |
const LoopIndexedPosition & | getTapeDependentIndex (size_t origI) const |
const std::map< size_t, LoopIndexedPosition > & | getOriginalDependentIndexes () const |
const LoopPosition * | getNonIndexedIndepIndexes (size_t origJ) const |
const LoopPosition * | getTempIndepIndexes (size_t k) const |
const std::set< size_t > & | getIndexedTapeIndexes (size_t iteration, size_t origJ) const |
std::map< size_t, std::set< size_t > > | getIndexedTapeIndexes (size_t origJ) const |
void | detectIndexPatterns () |
const std::vector< IndexPattern * > & | getDependentIndexPatterns () const |
const std::vector< IndexPattern * > & | getIndependentIndexPatterns () const |
bool | isTemporary (size_t tapeJ) const |
bool | isIndexedIndependent (size_t tapeJ) const |
void | evalJacobianSparsity () |
const std::vector< std::set< size_t > > & | getJacobianSparsity () const |
void | evalHessianSparsity () |
const std::vector< std::set< size_t > > & | getHessianSparsity () const |
Static Public Member Functions | |
static void | printOriginalVariableIndexes (std::ostringstream &ss, const std::vector< LoopPosition > &indexes) |
Static Public Attributes | |
static const std::string | ITERATION_INDEX_NAME |
A model representing a loop body for source code generation
Definition at line 108 of file declare_cg.hpp.
|
inline |
Creates a new atomic function that is responsible for defining the dependencies to calls of a user atomic function.
fun | The tape for a single loop iteration (loop model) |
containsAtoms | Whether or not fun calls atomic functions |
iterationCount | Number of loop iterations |
dependentOrigIndexes | |
indexedIndepOrigIndexes | |
nonIndexedIndepOrigIndexes | |
temporaryIndependents |
dependents
Must determine the equations which are present at the same iterations (some equations may not be present at some iterations)
independents
Definition at line 125 of file loop_model.hpp.
|
inline |
Provides the dependent variables indexes ([tape equation][iteration])
Definition at line 291 of file loop_model.hpp.
Referenced by CppAD::cg::ModelCSourceGen< Base >::prepareSparseReverseOneWithLoops().
|
inline |
Provides groups of equations present at the same iterations
Definition at line 298 of file loop_model.hpp.
Referenced by CppAD::cg::LoopFreeModel< Base >::calculateJacobianHessianUsedByLoops(), and CppAD::cg::loops::HessianWithLoopsInfo< Base >::evalLoopModelJacobianHessian().
|
inline |
Provides the indexed independent variables ([tape variable][iteration])
Definition at line 309 of file loop_model.hpp.
Referenced by CppAD::cg::ModelCSourceGen< Base >::analyseSparseJacobianWithLoops(), and CppAD::cg::IterEquationGroup< Base >::evalHessianSparsity().
|
inline |
Finds the local tape variable indexes which use a given model variable at a given iteration
origJ | the index of the variable in the original model |
iteration | the iteration |
Definition at line 374 of file loop_model.hpp.
Referenced by CppAD::cg::ModelCSourceGen< Base >::analyseSparseJacobianWithLoops().
|
inline |
Finds the local tape variable indexes which use a given model variable
origJ | the index of the variable in the original model |
Definition at line 393 of file loop_model.hpp.
|
inline |
Provides the number of iterations in the loop
Definition at line 254 of file loop_model.hpp.
Referenced by CppAD::cg::ModelCSourceGen< Base >::analyseSparseJacobianWithLoops(), CppAD::cg::LoopFreeModel< Base >::calculateJacobianHessianUsedByLoops(), CppAD::cg::IterEquationGroup< Base >::evalHessianSparsity(), CppAD::cg::ModelCSourceGen< Base >::prepareSparseJacobianWithLoops(), and CppAD::cg::ModelCSourceGen< Base >::prepareSparseReverseOneWithLoops().
|
inline |
Provides a unique identifier for this loop.
Definition at line 236 of file loop_model.hpp.
Referenced by CppAD::cg::CodeHandler< Base >::LoopData::getLoopName(), CppAD::cg::ModelCSourceGen< Base >::prepareSparseForwardOneWithLoops(), and CppAD::cg::ModelCSourceGen< Base >::prepareSparseReverseOneWithLoops().
|
inline |
Provides the non-indexed independent variables ([tape variable])
Definition at line 316 of file loop_model.hpp.
Referenced by CppAD::cg::ModelCSourceGen< Base >::analyseSparseJacobianWithLoops(), CppAD::cg::IterEquationGroup< Base >::evalHessianSparsity(), and CppAD::cg::ModelCSourceGen< Base >::prepareSparseJacobianRowWithLoops().
|
inline |
Maps the original variable indexes to non-indexed variables
Definition at line 345 of file loop_model.hpp.
|
inline |
Provides the tape that represents the loop model
Definition at line 263 of file loop_model.hpp.
Referenced by CppAD::cg::IterEquationGroup< Base >::evalHessianSparsity(), CppAD::cg::loops::HessianWithLoopsInfo< Base >::evalLoopModelJacobianHessian(), CppAD::cg::ModelCSourceGen< Base >::prepareSparseForwardOneWithLoops(), CppAD::cg::ModelCSourceGen< Base >::prepareSparseJacobianWithLoops(), and CppAD::cg::ModelCSourceGen< Base >::prepareSparseReverseOneWithLoops().
|
inline |
Provides the number of dependent variables in the loop tape/model (number of equation patterns).
Definition at line 274 of file loop_model.hpp.
|
inline |
Provides the locations where a dependent variable is used
origI | the dependent variable index in the original model |
Definition at line 334 of file loop_model.hpp.
|
inline |
Provides the number of independent variables in the loop tape/model (number of indexed + non-indexed + temporary variables).
Definition at line 284 of file loop_model.hpp.
|
inline |
Maps the temporary variable indexes to temporary variables
Definition at line 357 of file loop_model.hpp.
Referenced by CppAD::cg::LoopFreeModel< Base >::calculateJacobianHessianUsedByLoops(), and CppAD::cg::ModelCSourceGen< Base >::prepareSparseJacobianRowWithLoops().
|
inline |
Provides the independent variables related with temporary variables of the original model.
Definition at line 324 of file loop_model.hpp.
Referenced by CppAD::cg::ModelCSourceGen< Base >::analyseSparseJacobianWithLoops(), and CppAD::cg::IterEquationGroup< Base >::evalHessianSparsity().
|
inline |
Whether or not the tape for the loop calls atomic functions.
Definition at line 245 of file loop_model.hpp.