1 #ifndef CPPAD_CG_GRAPH_MOD_INCLUDED
2 #define CPPAD_CG_GRAPH_MOD_INCLUDED
24 bool removeFromIndependents) {
25 substituteIndependent(*indep.getOperationNode(), *dep.getOperationNode(), removeFromIndependents);
31 bool removeFromIndependents) {
36 size_t indepIndex = getIndependentVariableIndex(indep);
40 if (pos >= _codeBlocks.size() || &dep != _codeBlocks[pos]) {
41 throw CGException(
"The dependent variable does not belong to this handler");
45 CGBase dummyExp = solveFor(dep, indep);
49 if (dummyExp.isVariable()) {
50 arg = Argument<Base> (*dummyExp.getOperationNode());
53 arg = Argument<Base> (dummyExp.getValue());
58 if (removeFromIndependents) {
60 _independentVariables.erase(_independentVariables.begin() + indepIndex);
66 typename std::vector<OperationNode<Base> *>::const_iterator it =
67 std::find(_independentVariables.begin(), _independentVariables.end(), &indep);
68 if (it == _independentVariables.end()) {
69 throw CGException(
"Variable not found in the independent variable vector");
78 throw CGException(
"Cannot remove independent variable: not an alias");
81 typename std::vector<OperationNode<Base> *>::iterator it =
82 std::find(_independentVariables.begin(), _independentVariables.end(), &indep);
83 if (it == _independentVariables.end()) {
84 throw CGException(
"Variable not found in the independent variable vector");
86 _independentVariables.erase(it);