CppADCodeGen
HEAD
A C++ Algorithmic Differentiation Package with Source Code Generation
|
Public Member Functions | |
virtual const std::vector< FuncArgument > & | getDependent () const |
virtual const std::vector< FuncArgument > & | getIndependent () const |
virtual const std::vector< FuncArgument > & | getTemporary () const |
virtual size_t | getMinTemporaryVariableID () const =0 |
virtual size_t | getMaxTemporaryVariableID () const =0 |
virtual size_t | getMaxTemporaryArrayVariableID () const =0 |
virtual size_t | getMaxTemporarySparseArrayVariableID () const =0 |
virtual std::string | generateDependent (size_t index)=0 |
virtual std::string | generateIndependent (const OperationNode< Base > &variable, size_t id)=0 |
virtual std::string | generateTemporary (const OperationNode< Base > &variable, size_t id)=0 |
virtual std::string | generateTemporaryArray (const OperationNode< Base > &variable, size_t id)=0 |
virtual std::string | generateTemporarySparseArray (const OperationNode< Base > &variable, size_t id)=0 |
virtual std::string | generateIndexedDependent (const OperationNode< Base > &var, size_t id, const IndexPattern &ip)=0 |
virtual std::string | generateIndexedIndependent (const OperationNode< Base > &var, size_t id, const IndexPattern &ip)=0 |
virtual void | setTemporaryVariableID (size_t minTempID, size_t maxTempID, size_t maxTempArrayID, size_t maxTempSparseArrayID)=0 |
virtual const std::string & | getIndependentArrayName (const OperationNode< Base > &indep, size_t id)=0 |
virtual size_t | getIndependentArrayIndex (const OperationNode< Base > &indep, size_t id)=0 |
virtual bool | isConsecutiveInIndepArray (const OperationNode< Base > &indepFirst, size_t idFirst, const OperationNode< Base > &indepSecond, size_t idSecond)=0 |
virtual bool | isInSameIndependentArray (const OperationNode< Base > &indep1, size_t id1, const OperationNode< Base > &indep2, size_t id2)=0 |
virtual const std::string & | getTemporaryVarArrayName (const OperationNode< Base > &var, size_t id)=0 |
virtual size_t | getTemporaryVarArrayIndex (const OperationNode< Base > &var, size_t id)=0 |
virtual bool | isConsecutiveInTemporaryVarArray (const OperationNode< Base > &varFirst, size_t idFirst, const OperationNode< Base > &varSecond, size_t idSecond)=0 |
virtual bool | isInSameTemporaryVarArray (const OperationNode< Base > &var1, size_t id1, const OperationNode< Base > &var2, size_t id2)=0 |
virtual void | customFunctionVariableDeclarations (std::ostream &out) |
virtual void | prepareCustomFunctionVariables (std::ostream &out) |
virtual void | finalizeCustomFunctionVariables (std::ostream &out) |
Protected Attributes | |
std::vector< FuncArgument > | _dependent |
std::vector< FuncArgument > | _independent |
std::vector< FuncArgument > | _temporary |
Creates variables names for the source code.
Definition at line 129 of file declare_cg.hpp.
|
pure virtual |
Creates a name for a dependent variable.
index | the dependent variable index |
Implemented in CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >, CppAD::cg::LangLatexCustomVariableNameGenerator< Base >, CppAD::cg::LangMathMLCustomVariableNameGenerator< Base >, and CppAD::cg::LangCCustomVariableNameGenerator< Base >.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::generateDependent(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::generateDependent().
|
pure virtual |
Creates a name for a dependent variable.
variable | the node representing the independent variable |
id | an ID assigned by the CodeHandler to the operation node (unique for independent variables) |
Implemented in CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >, CppAD::cg::LangLatexCustomVariableNameGenerator< Base >, CppAD::cg::LangMathMLCustomVariableNameGenerator< Base >, and CppAD::cg::LangCCustomVariableNameGenerator< Base >.
Referenced by CppAD::cg::LanguageMathML< Base >::createHtmlID(), CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::generateIndependent(), CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::generateIndependent(), CppAD::cg::LanguageDot< Base >::generateSourceCode(), CppAD::cg::LanguageMathML< Base >::generateSourceCode(), CppAD::cg::LanguageLatex< Base >::generateSourceCode(), and CppAD::cg::LanguageLatex< Base >::requiresVariableDependencies().
|
pure virtual |
Creates a name for a reference to an indexed dependent variable expression.
var | the node representing an indexed dependent variable |
id | an ID assigned by the CodeHandler to the operation node (potentially not unique) |
ip | the index pattern |
Implemented in CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, and CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::generateIndexedDependent(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::generateIndexedDependent().
|
pure virtual |
Creates a name for a reference to an indexed independent variable expression.
var | the node representing an indexed independent variable |
id | an ID assigned by the CodeHandler to the operation node (unique for indexed independent variables) |
ip | the index pattern |
Implemented in CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, and CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::generateIndexedIndependent(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::generateIndexedIndependent().
|
pure virtual |
Creates a name for a temporary variable.
variable | the node representing the temporary variable |
id | an ID assigned by the CodeHandler to the operation node (potentially not unique) |
Implemented in CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, and CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::generateTemporary(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::generateTemporary().
|
pure virtual |
Creates a name for a temporary dense array variable.
variable | the node representing the dense array variable creation |
id | an ID assigned by the CodeHandler to the operation node (potentially not unique) |
Implemented in CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, and CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::generateTemporaryArray(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::generateTemporaryArray().
|
pure virtual |
Creates a name for a temporary sparse array variable.
variable | the node representing the sparse array variable creation |
id | an ID assigned by the CodeHandler to the operation node (potentially not unique) |
Implemented in CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, and CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::generateTemporarySparseArray(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::generateTemporarySparseArray().
|
inlinevirtual |
Provides the dependent variable arguments used by a function.
Reimplemented in CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, and CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >.
Definition at line 56 of file variable_name_generator.hpp.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::getDependent(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::getDependent().
|
inlinevirtual |
Provides the independent variable arguments used by a function.
Definition at line 65 of file variable_name_generator.hpp.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::isInSameTemporaryVarArray(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::setTemporaryVariableID().
|
pure virtual |
Provides the index in the associated independent array of an independent variable. It should only be called if independents are saved in an array.
indep | the independent variable node (CGInvOp) |
id | an ID assigned by the CodeHandler to the operation node (unique for independent variable arrays) |
Implemented in CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, and CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::getIndependentArrayIndex(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::getIndependentArrayIndex().
|
pure virtual |
Provides the array name where independent variables are provided to the function. It should only be called if independents are saved in an array.
indep | the independent variable node (CGInvOp) |
id | an ID assigned by the CodeHandler to the operation node (unique for independent variable arrays) |
Implemented in CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, and CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::getIndependentArrayName(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::getIndependentArrayName().
|
pure virtual |
Provides the maximum variable ID of temporary dense array variables.
Implemented in CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, and CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >.
Referenced by CppAD::cg::LanguageMathML< Base >::generateSourceCode(), CppAD::cg::LanguageLatex< Base >::generateSourceCode(), CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::getMaxTemporaryArrayVariableID(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::getMaxTemporaryArrayVariableID().
|
pure virtual |
Provides the maximum variable ID of temporary sparse array variables.
Implemented in CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, and CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >.
Referenced by CppAD::cg::LanguageMathML< Base >::generateSourceCode(), CppAD::cg::LanguageLatex< Base >::generateSourceCode(), CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::getMaxTemporarySparseArrayVariableID(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::getMaxTemporarySparseArrayVariableID().
|
pure virtual |
Provides the maximum used variable ID of temporary variables.
Implemented in CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, and CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::getMaxTemporaryVariableID(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::getMaxTemporaryVariableID().
|
pure virtual |
Provides the minimum variable ID of temporary variables.
Implemented in CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, and CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::getMinTemporaryVariableID(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::getMinTemporaryVariableID().
|
inlinevirtual |
Provides the temporary variable arguments used by a function.
Reimplemented in CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, and CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >.
Definition at line 74 of file variable_name_generator.hpp.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::getTemporary(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::getTemporary().
|
pure virtual |
Provides the index in the associated temporary array of a temporary variable. It should only be called if temporary variables are saved in an array.
var | the temporary variable node |
id | an ID assigned by the CodeHandler to the operation node (potentially not unique) |
Implemented in CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, and CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::getTemporaryVarArrayIndex(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::getTemporaryVarArrayIndex().
|
pure virtual |
Provides the array name for the temporary variables. It should only be called if temporary variables are saved in an array.
var | the temporary variable node |
id | an ID assigned by the CodeHandler to the operation node (potentially not unique) |
Implemented in CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, and CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::getTemporaryVarArrayName(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::getTemporaryVarArrayName().
|
pure virtual |
Whether or not two independent variables are considered to be part of the same independent variable array at consecutive locations.
indepFirst | the independent node (CGInvOp) with the lower index |
idFirst | an ID assigned by the CodeHandler to the first node (unique for independent variables) |
indepSecond | the independent node (CGInvOp) with the higher index |
idSecond | an ID assigned by the CodeHandler to the second node (unique for independent variables) |
Implemented in CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >, CppAD::cg::LangLatexCustomVariableNameGenerator< Base >, CppAD::cg::LangMathMLCustomVariableNameGenerator< Base >, and CppAD::cg::LangCCustomVariableNameGenerator< Base >.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::isConsecutiveInIndepArray(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::isConsecutiveInIndepArray().
|
pure virtual |
Whether or not two temporary variables are considered to be part of the same temporary variable array at consecutive locations.
varFirst | the temporary variable node with the lower index |
idFirst | an ID assigned by the CodeHandler to the first node (potentially not unique) |
varSecond | the temporary variable node with the higher index |
varSecond | an ID assigned by the CodeHandler to the second node (potentially not unique) |
Implemented in CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, and CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::isConsecutiveInTemporaryVarArray(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::isConsecutiveInTemporaryVarArray().
|
pure virtual |
Determines whether or not two independents are part of the same independent variable array.
indep1 | the first independent node (CGInvOp or CGLoopIndexedIndepOp) |
id1 | an ID assigned by the CodeHandler to indep1 (unique for independent variables) |
indep2 | the second independent node (CGInvOp or CGLoopIndexedIndepOp) |
id2 | an ID assigned by the CodeHandler to indep2 (unique for independent variables) |
Implemented in CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >, CppAD::cg::LangLatexCustomVariableNameGenerator< Base >, CppAD::cg::LangMathMLCustomVariableNameGenerator< Base >, and CppAD::cg::LangCCustomVariableNameGenerator< Base >.
|
pure virtual |
Determines whether or not two temporary variables are part of the same temporary variable array.
var1 | the temporary variable node |
id1 | an ID assigned by the CodeHandler to var1 (potentially not unique) |
var2 | the temporary variable node |
id2 | an ID assigned by the CodeHandler to var2 (potentially not unique) |
Implemented in CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultVariableNameGenerator< Base >, and CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >.
Referenced by CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::isInSameTemporaryVarArray(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::isInSameTemporaryVarArray().
|
pure virtual |
Defines the ID ranges used by each variable type.
minTempID | the lowest ID of temporary variables |
maxTempID | the highest used ID of temporary variables |
maxTempArrayID | the highest used ID of temporary dense array variables |
maxTempSparseArrayID | the highest used ID of temporary sparse array variables |
Implemented in CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >, CppAD::cg::LangMathMLDefaultVariableNameGenerator< Base >, CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >, CppAD::cg::LangLatexDefaultVariableNameGenerator< Base >, and CppAD::cg::LangCDefaultVariableNameGenerator< Base >.
Referenced by CppAD::cg::CodeHandler< ScalarOut >::generateCode(), CppAD::cg::LangCDefaultHessianVarNameGenerator< Base >::setTemporaryVariableID(), and CppAD::cg::LangCDefaultReverse2VarNameGenerator< Base >::setTemporaryVariableID().