Skip to content

Commit

Permalink
change differentiation rule for the homotopy operator
Browse files Browse the repository at this point in the history
der(homotopy(actual, simplified)) ->
* Previous rule: der(actual)
* New rule: homotopy(der(actual), der(simplified))
  • Loading branch information
lochel committed Mar 11, 2016
1 parent 6b7b848 commit bf26a22
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Compiler/BackEnd/Differentiate.mo
Expand Up @@ -545,8 +545,10 @@ algorithm
expStack := inExp :: inExpStack;
(outDiffedExp, outFunctionTree) := match inExp
local
Absyn.Path p;
Boolean b;
DAE.Exp e1, e2, e3, actual;
DAE.CallAttributes attr;
DAE.Exp e1, e2, e3, actual, simplified;
DAE.Exp res, res1, res2;
DAE.FunctionTree functionTree;
DAE.Operator op;
Expand Down Expand Up @@ -578,9 +580,11 @@ algorithm
then (Expression.makeConstZero(tp), inFunctionTree);

// differentiate homotopy
case DAE.CALL(path=Absyn.IDENT(name="homotopy"), expLst=actual::_) equation
case DAE.CALL(path=p as Absyn.IDENT(name="homotopy"), expLst={actual, simplified}, attr=attr) equation
(e1, functionTree) = differentiateExp(actual, inDiffwrtCref, inInputData, inDiffType, inFunctionTree, maxIter, inExpStack);
then (e1, functionTree);
(e2, functionTree) = differentiateExp(simplified, inDiffwrtCref, inInputData, inDiffType, functionTree, maxIter, inExpStack);
res = DAE.CALL(p, {e1, e2}, attr);
then (res, functionTree);

// differentiate call
case DAE.CALL() equation
Expand Down

0 comments on commit bf26a22

Please sign in to comment.