CppADCodeGen
HEAD
A C++ Algorithmic Differentiation Package with Source Code Generation
|
Public Member Functions | |
LangMathMLCustomVariableNameGenerator (const std::vector< std::string > &depNames, const std::vector< std::string > &indepNames, const std::string &depName="y", const std::string &indepName="x", const std::string &tmpName="v", const std::string &tmpArrayName="a", const std::string &tmpSparseArrayName="s") | |
std::string | generateDependent (size_t index) override |
std::string | generateIndependent (const OperationNode< Base > &independent, size_t id) override |
bool | isConsecutiveInIndepArray (const OperationNode< Base > &indepFirst, size_t idFirst, const OperationNode< Base > &indepSecond, size_t idSecond) override |
bool | isInSameIndependentArray (const OperationNode< Base > &indep1, size_t id1, const OperationNode< Base > &indep2, size_t id2) override |
size_t | getMinTemporaryVariableID () const override |
size_t | getMaxTemporaryVariableID () const override |
size_t | getMaxTemporaryArrayVariableID () const override |
size_t | getMaxTemporarySparseArrayVariableID () const override |
std::string | generateTemporary (const OperationNode< Base > &variable, size_t id) override |
std::string | generateTemporaryArray (const OperationNode< Base > &variable, size_t id) override |
std::string | generateTemporarySparseArray (const OperationNode< Base > &variable, size_t id) override |
std::string | generateIndexedDependent (const OperationNode< Base > &var, size_t id, const IndexPattern &ip) override |
std::string | generateIndexedIndependent (const OperationNode< Base > &independent, size_t id, const IndexPattern &ip) override |
void | setTemporaryVariableID (size_t minTempID, size_t maxTempID, size_t maxTempArrayID, size_t maxTempSparseArrayID) override |
const std::string & | getIndependentArrayName (const OperationNode< Base > &indep, size_t id) override |
size_t | getIndependentArrayIndex (const OperationNode< Base > &indep, size_t id) override |
const std::string & | getTemporaryVarArrayName (const OperationNode< Base > &var, size_t id) override |
size_t | getTemporaryVarArrayIndex (const OperationNode< Base > &var, size_t id) override |
bool | isConsecutiveInTemporaryVarArray (const OperationNode< Base > &varFirst, size_t idFirst, const OperationNode< Base > &varSecond, size_t idSecond) override |
bool | isInSameTemporaryVarArray (const OperationNode< Base > &var1, size_t id1, const OperationNode< Base > &var2, size_t id2) override |
virtual const std::vector< FuncArgument > & | getDependent () const |
virtual const std::vector< FuncArgument > & | getIndependent () const |
virtual const std::vector< FuncArgument > & | getTemporary () const |
virtual void | customFunctionVariableDeclarations (std::ostream &out) |
virtual void | prepareCustomFunctionVariables (std::ostream &out) |
virtual void | finalizeCustomFunctionVariables (std::ostream &out) |
Protected Types | |
using | Super = LangMathMLDefaultVariableNameGenerator< Base > |
Static Protected Member Functions | |
static std::vector< const OperationNode< Base > * > | getIndexes (const OperationNode< Base > &var, size_t offset=0) |
Protected Attributes | |
const std::vector< std::string > | depNames_ |
const std::vector< std::string > | indepNames_ |
std::stringstream | _ss |
std::string | _depName |
std::string | _indepName |
std::string | _tmpName |
std::string | _tmpArrayName |
std::string | _tmpSparseArrayName |
size_t | _minTemporaryID |
size_t | _maxTemporaryID |
size_t | _maxTemporaryArrayID |
size_t | _maxTemporarySparseArrayID |
std::vector< FuncArgument > | _dependent |
std::vector< FuncArgument > | _independent |
std::vector< FuncArgument > | _temporary |
Creates variables names for the source code using a list of provided custom names.
Definition at line 29 of file lang_mathml_custom_var_name_gen.hpp.
|
inlineoverridevirtual |
Creates a name for a dependent variable.
index | the dependent variable index |
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 52 of file lang_mathml_custom_var_name_gen.hpp.
|
inlineoverridevirtual |
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) |
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 60 of file lang_mathml_custom_var_name_gen.hpp.
|
inlineoverridevirtualinherited |
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 |
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 173 of file lang_mathml_default_var_name_gen.hpp.
|
inlineoverridevirtualinherited |
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 |
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 192 of file lang_mathml_default_var_name_gen.hpp.
|
inlineoverridevirtualinherited |
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) |
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 117 of file lang_mathml_default_var_name_gen.hpp.
|
inlineoverridevirtualinherited |
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) |
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 137 of file lang_mathml_default_var_name_gen.hpp.
|
inlineoverridevirtualinherited |
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) |
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 155 of file lang_mathml_default_var_name_gen.hpp.
|
inlinevirtualinherited |
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().
|
inlinevirtualinherited |
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().
|
inlineoverridevirtualinherited |
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) |
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 232 of file lang_mathml_default_var_name_gen.hpp.
|
inlineoverridevirtualinherited |
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) |
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 227 of file lang_mathml_default_var_name_gen.hpp.
|
inlineoverridevirtualinherited |
Provides the maximum variable ID of temporary dense array variables.
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 84 of file lang_mathml_default_var_name_gen.hpp.
|
inlineoverridevirtualinherited |
Provides the maximum variable ID of temporary sparse array variables.
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 88 of file lang_mathml_default_var_name_gen.hpp.
|
inlineoverridevirtualinherited |
Provides the maximum used variable ID of temporary variables.
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 80 of file lang_mathml_default_var_name_gen.hpp.
|
inlineoverridevirtualinherited |
Provides the minimum variable ID of temporary variables.
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 76 of file lang_mathml_default_var_name_gen.hpp.
|
inlinevirtualinherited |
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().
|
inlineoverridevirtualinherited |
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) |
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 256 of file lang_mathml_default_var_name_gen.hpp.
|
inlineoverridevirtualinherited |
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) |
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 251 of file lang_mathml_default_var_name_gen.hpp.
|
inlineoverridevirtual |
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) |
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 70 of file lang_mathml_custom_var_name_gen.hpp.
|
inlineoverridevirtualinherited |
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) |
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 261 of file lang_mathml_default_var_name_gen.hpp.
|
inlineoverridevirtual |
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) |
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 85 of file lang_mathml_custom_var_name_gen.hpp.
|
inlineoverridevirtualinherited |
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) |
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 268 of file lang_mathml_default_var_name_gen.hpp.
|
inlineoverridevirtualinherited |
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 |
Implements CppAD::cg::VariableNameGenerator< Base >.
Definition at line 212 of file lang_mathml_default_var_name_gen.hpp.