Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
fix array differentiation for symbolic jacobains
Browse files Browse the repository at this point in the history
Belonging to [master]:
  - #1895
  • Loading branch information
Willi Braun authored and OpenModelica-Hudson committed Oct 13, 2017
1 parent a9268a9 commit aa907b1
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions Compiler/BackEnd/Differentiate.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,7 @@ algorithm
matchcontinue(inExp, inDiffwrtCref, inInputData, inDiffType, inFunctionTree)
local

BackendDAE.DifferentiationType diffType;
Absyn.Path path;

BackendDAE.Variables timevars;
Expand Down Expand Up @@ -1035,14 +1036,6 @@ algorithm
then
(res, outFunctionTree);

// case for array without expanding the array
// for generic gradient
case (DAE.CREF(componentRef = cr,ty=tp as DAE.T_ARRAY(ty=arrayType)), _, BackendDAE.DIFFINPUTDATA(matrixName=SOME(matrixName)), BackendDAE.GENERIC_GRADIENT(), _)
equation
cr = createDifferentiatedCrefName(cr, inDiffwrtCref, matrixName);
res = DAE.CREF(cr, tp);
then
(res, inFunctionTree);

// case for array without expanding the array
case (DAE.CREF(componentRef = cr,ty=tp as DAE.T_ARRAY()), _, BackendDAE.DIFFINPUTDATA(matrixName=SOME(matrixName)), BackendDAE.DIFFERENTIATION_FUNCTION(), _)
Expand All @@ -1055,7 +1048,7 @@ algorithm
(res, inFunctionTree);

// case for arrays
case ((e as DAE.CREF(ty = DAE.T_ARRAY())), _, _, _, _)
case ((e as DAE.CREF(ty = DAE.T_ARRAY())), _, _, diffType, _) guard ( match diffType case BackendDAE.GENERIC_GRADIENT() then false; else true; end match )
equation
(e1,true) = Expression.extendArrExp(e,false);
(res, outFunctionTree) = differentiateExp(e1, inDiffwrtCref, inInputData, inDiffType, inFunctionTree, maxIter);
Expand Down

0 comments on commit aa907b1

Please sign in to comment.