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

Public Types

using CGB = CppAD::cg::CG< Base >
 
using Arg = Argument< Base >
 
using VectorSet = std::vector< std::set< size_t > >
 

Public Member Functions

 LoopFreeModel (ADFun< CGB > *fun, const std::vector< size_t > &dependentOrigIndexes)
 
 LoopFreeModel (const LoopFreeModel< Base > &)=delete
 
LoopFreeModeloperator= (const LoopFreeModel< Base > &)=delete
 
ADFun< CGB > & getTape () const
 
size_t getTapeDependentCount () const
 
size_t getTemporaryDependentCount () const
 
size_t getTapeIndependentCount () const
 
const std::vector< size_t > & getOrigDependentIndexes () const
 
size_t getLocalDependentIndex (size_t origI) const
 
void evalJacobianSparsity ()
 
const VectorSet & getJacobianSparsity () const
 
void evalHessianSparsity ()
 
const VectorSet & getHessianTempEqsSparsity () const
 
const VectorSet & getHessianOrigEqsSparsity () const
 
CG< Base > createConditionalOperation (CodeHandler< Base > &handler, const std::set< size_t > &iterations, size_t iterCount, const CG< Base > &value, IndexOperationNode< Base > &iterationIndexOp)
 
std::map< size_t, std::map< size_t, CGB > > calculateJacobianHessianUsedByLoops (CodeHandler< Base > &handler, std::map< LoopModel< Base > *, loops::HessianWithLoopsInfo< Base > > &loopHessInfo, const std::vector< CGB > &x, std::vector< CGB > &temps, const VectorSet &noLoopEvalJacSparsity, bool individualColoring)
 
void calculateHessian4OrignalEquations (const std::vector< CGB > &x, const std::vector< CGB > &w, const VectorSet &noLoopEvalHessSparsity, const std::vector< std::map< size_t, std::set< size_t > > > &noLoopEvalHessLocations, std::vector< CGB > &hess)
 

Protected Attributes

ADFun< CGB > *const fun_
 
std::vector< size_t > dependentIndexes_
 
std::map< size_t, size_t > dependentOrig2Local
 
VectorSet jacTapeSparsity_
 
bool jacSparsity_
 
VectorSet hessTapeTempSparsity_
 
VectorSet hessTapeOrigEqSparsity_
 
bool hessSparsity_
 

Detailed Description

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

Altered model without the loop equations and with extra dependents for the non-indexed temporary variables used by loops

Author
Joao Leal

Definition at line 105 of file declare_cg.hpp.

Constructor & Destructor Documentation

◆ LoopFreeModel()

template<class Base>
CppAD::cg::LoopFreeModel< Base >::LoopFreeModel ( ADFun< CGB > *  fun,
const std::vector< size_t > &  dependentOrigIndexes 
)
inline

Creates a model for the non-indexed operations

Parameters
fun
dependentOrigIndexes

Definition at line 69 of file loop_free_model.hpp.

Member Function Documentation

◆ calculateHessian4OrignalEquations()

template<class Base>
void CppAD::cg::LoopFreeModel< Base >::calculateHessian4OrignalEquations ( const std::vector< CGB > &  x,
const std::vector< CGB > &  w,
const VectorSet &  noLoopEvalHessSparsity,
const std::vector< std::map< size_t, std::set< size_t > > > &  noLoopEvalHessLocations,
std::vector< CGB > &  hess 
)
inline

hessian - original equations

Definition at line 348 of file loop_free_model.hpp.

◆ calculateJacobianHessianUsedByLoops()

template<class Base>
std::map<size_t, std::map<size_t, CGB> > CppAD::cg::LoopFreeModel< Base >::calculateJacobianHessianUsedByLoops ( CodeHandler< Base > &  handler,
std::map< LoopModel< Base > *, loops::HessianWithLoopsInfo< Base > > &  loopHessInfo,
const std::vector< CGB > &  x,
std::vector< CGB > &  temps,
const VectorSet &  noLoopEvalJacSparsity,
bool  individualColoring 
)
inline

Determines the Hessian for the temporary variables only used by each loop

Parameters
loopHessInfo
xthe independent variables
temps
noLoopEvalJacSparsity
individualColoring
iterationIndexOp
Returns

Hessian - temporary variables

Some equations are not present in all iterations

Definition at line 235 of file loop_free_model.hpp.

◆ createConditionalOperation()

template<class Base>
CG<Base> CppAD::cg::LoopFreeModel< Base >::createConditionalOperation ( CodeHandler< Base > &  handler,
const std::set< size_t > &  iterations,
size_t  iterCount,
const CG< Base > &  value,
IndexOperationNode< Base > &  iterationIndexOp 
)
inline

Creates conditional nodes for temporary variables

Parameters
handlersource code handler
iterationsthe iterations where the value should be evaluated
iterCountthe number of iteration of the loop
valuethe value determined inside the loop
iterationIndexOpthe iteration index operation for this loop
Returns

must create a conditional element so that this contribution is only evaluated at the relevant iterations

Definition at line 173 of file loop_free_model.hpp.

Referenced by CppAD::cg::LoopFreeModel< Base >::calculateJacobianHessianUsedByLoops().

◆ getOrigDependentIndexes()

template<class Base>
const std::vector<size_t>& CppAD::cg::LoopFreeModel< Base >::getOrigDependentIndexes ( ) const
inline

Provides the dependent variables indexes present in the original model

Definition at line 105 of file loop_free_model.hpp.

Member Data Documentation

◆ dependentIndexes_

template<class Base>
std::vector<size_t> CppAD::cg::LoopFreeModel< Base >::dependentIndexes_
protected

The dependent variables in this tape to their original indexes

Definition at line 42 of file loop_free_model.hpp.

Referenced by CppAD::cg::LoopFreeModel< Base >::getOrigDependentIndexes().

◆ fun_

◆ hessTapeOrigEqSparsity_

template<class Base>
VectorSet CppAD::cg::LoopFreeModel< Base >::hessTapeOrigEqSparsity_
protected

Hessian sparsity pattern for the original model equations in the tape (ignores the equations for the temporaries)

Definition at line 58 of file loop_free_model.hpp.

Referenced by CppAD::cg::LoopFreeModel< Base >::getOrigDependentIndexes().

◆ hessTapeTempSparsity_

template<class Base>
VectorSet CppAD::cg::LoopFreeModel< Base >::hessTapeTempSparsity_
protected

Hessian sparsity pattern for equations used to determine the temporaries (ignores the the original model equations)

Definition at line 53 of file loop_free_model.hpp.

Referenced by CppAD::cg::LoopFreeModel< Base >::getOrigDependentIndexes().

◆ jacTapeSparsity_

template<class Base>
VectorSet CppAD::cg::LoopFreeModel< Base >::jacTapeSparsity_
protected

Jacobian sparsity pattern of the tape

Definition at line 47 of file loop_free_model.hpp.

Referenced by CppAD::cg::LoopFreeModel< Base >::getOrigDependentIndexes().


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