Minor simplification

master
Sébastien Villemot 2023-03-02 17:28:03 +01:00
parent bf8ca27a47
commit f8edce01ec
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 3 additions and 2 deletions

View File

@ -1436,10 +1436,11 @@ VariableNode::computeChainRuleDerivative(int deriv_id,
[[fallthrough]];
case SymbolType::endogenous:
case SymbolType::parameter:
if (deriv_id == datatree.getDerivID(symb_id, lag))
if (int my_deriv_id {datatree.getDerivID(symb_id, lag)};
deriv_id == my_deriv_id)
return datatree.One;
// If there is in the equation a recursive variable we could use a chaine rule derivation
else if (auto it = recursive_variables.find(datatree.getDerivID(symb_id, lag));
else if (auto it = recursive_variables.find(my_deriv_id);
it != recursive_variables.end())
return it->second->arg2->getChainRuleDerivative(deriv_id, recursive_variables, cache);
else