Skip to content

Commit

Permalink
Revert "reduce ExpressionSimplify-Calls inside solve(.)"
Browse files Browse the repository at this point in the history
This reverts commit 4b79bb8.
  • Loading branch information
lochel authored and OpenModelica-Hudson committed Nov 26, 2015
1 parent 0d78a38 commit 885c632
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Compiler/BackEnd/ExpressionSolve.mo
Expand Up @@ -488,8 +488,9 @@ preprocessing for solve1,
Integer iter;

algorithm
(x, _) := ExpressionSimplify.simplify1(inExp1);
res := Expression.expSub(x, inExp2);
(x, _) := ExpressionSimplify.simplify(inExp1);
(y, _) := ExpressionSimplify.simplify(inExp2);
res := Expression.expSub(x, y);
resTerms := Expression.terms(res);

// split and sort
Expand Down Expand Up @@ -525,7 +526,7 @@ preprocessing for solve1,
end if;

if not con then
(x, con) := ExpressionSimplify.simplify1(x);
(x, con) := ExpressionSimplify.simplify(x);
// Z/N = rhs -> Z = rhs*N
(x,N) := Expression.makeFraction(x);
if not Expression.isOne(N) then
Expand Down Expand Up @@ -964,7 +965,7 @@ algorithm

f2 := Expression.expandFactors(inExp2);
(factorWithX2, factorWithoutX2) := List.split1OnTrue(f2, expHasCref, inExp3);
pWithX2 := makeProductLstSort(factorWithX2);
(pWithX2,_) := ExpressionSimplify.simplify1(makeProductLstSort(factorWithX2));
pWithoutX2 := makeProductLstSort(factorWithoutX2);
//print("\nf1 =");print(ExpressionDump.printExpListStr(f1));
//print("\nf2 =");print(ExpressionDump.printExpListStr(f2));
Expand Down Expand Up @@ -1046,6 +1047,7 @@ algorithm

//rhs
outRhs := Expression.makeSum(rhs);
(outRhs,_) := ExpressionSimplify.simplify1(outRhs);

if expand then
resTerms := Expression.terms(Expression.expand(outLhs));
Expand All @@ -1058,6 +1060,7 @@ algorithm
end for;
//rhs
outRhs := Expression.expAdd(outRhs,Expression.makeSum(rhs));
(outRhs,_) := ExpressionSimplify.simplify1(outRhs);

resTerms := Expression.allTerms(outLhs);
(lhs, rhs) := List.split1OnTrue(resTerms, expHasCref, inExp3);
Expand All @@ -1069,6 +1072,7 @@ algorithm
end for;
//rhs
outRhs := Expression.expAdd(outRhs,Expression.makeSum(rhs));
(outRhs,_) := ExpressionSimplify.simplify1(outRhs);

end if;

Expand Down Expand Up @@ -1709,6 +1713,7 @@ algorithm
// a = 0
e7 := Expression.makeDiv(inExp2,b);
invExp := Expression.inverseFactors(n);
(invExp, _) := ExpressionSimplify.simplify1(invExp);
e7 := Expression.expPow(e7, invExp);

// if a==0
Expand Down Expand Up @@ -1940,7 +1945,8 @@ protected function makeProductLstSort2
protected
list<DAE.Exp> rest;
algorithm
for elem in inExpLst loop
rest := ExpressionSimplify.simplifyList(inExpLst, {});
for elem in rest loop
if not Expression.isOne(elem) then
outExp := match(elem)
local DAE.Exp e1,e2,e3;
Expand Down

0 comments on commit 885c632

Please sign in to comment.