Skip to content

Commit

Permalink
Merge pull request #318 from GitPaean/fixing_gen_eval_python
Browse files Browse the repository at this point in the history
fixing genEvalSpecializations.py instead of editing Evaluationn directly
  • Loading branch information
andlaus authored Dec 18, 2018
2 parents 9a1f9ea + 7482a2f commit d8f7702
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bin/genEvalSpecializations.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,11 @@ class Evaluation<ValueT, {{ numDerivs }}>
// negation (unary minus) operator
Evaluation operator-() const
{
{% if numDerivs < 0 %}\
Evaluation result(*this);
{% else %}\
Evaluation result;
{% endif %}\
// set value and derivatives to negative
{% if numDerivs <= 0 %}\
Expand Down Expand Up @@ -765,9 +769,7 @@ class Evaluation<ValueT, {{ numDerivs }}>
template <class RhsValueType, class ValueType, int numVars>
Evaluation<ValueType, numVars> operator-(const RhsValueType& a, const Evaluation<ValueType, numVars>& b)
{
Evaluation<ValueType, numVars> result(a);
result -= b;
return result;
return -(b - a);
}
template <class RhsValueType, class ValueType, int numVars>
Expand Down

0 comments on commit d8f7702

Please sign in to comment.