Skip to content

Commit

Permalink
Don't create new matrix expressions unless needed
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17923 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Oct 29, 2013
1 parent 92cae27 commit 37a4fd8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Compiler/FrontEnd/Expression.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4327,18 +4327,18 @@ protected function traverseExpMatrix
"author: PA
Helper function to traverseExp, traverses matrix expressions."
replaceable type Type_a subtypeof Any;
input list<list<DAE.Exp>> inTplExpBooleanLstLst;
input list<list<DAE.Exp>> inMatrix;
input FuncExpType func;
input Type_a inTypeA;
output list<list<DAE.Exp>> outTplExpBooleanLstLst;
output list<list<DAE.Exp>> outMatrix;
output Type_a outTypeA;
partial function FuncExpType
input tuple<DAE.Exp, Type_a> inTplExpTypeA;
output tuple<DAE.Exp, Type_a> outTplExpTypeA;
replaceable type Type_a subtypeof Any;
end FuncExpType;
algorithm
(outTplExpBooleanLstLst,outTypeA) := match (inTplExpBooleanLstLst,func,inTypeA)
(outMatrix,outTypeA) := match (inMatrix,func,inTypeA)
local
FuncExpType rel;
Type_a e_arg,e_arg_1,e_arg_2;
Expand All @@ -4351,8 +4351,9 @@ algorithm
equation
((row_1,e_arg_1)) = traverseExpList(row, rel, e_arg);
(rows_1,e_arg_2) = traverseExpMatrix(rows, rel, e_arg_1);
rows_1 = Util.if_(referenceEq(row,row_1) and referenceEq(rows,rows_1),inMatrix,row_1::rows_1);
then
((row_1 :: rows_1),e_arg_2);
(rows_1,e_arg_2);
end match;
end traverseExpMatrix;

Expand Down

0 comments on commit 37a4fd8

Please sign in to comment.