Skip to content

Commit

Permalink
improved resolveLoops (#8680)
Browse files Browse the repository at this point in the history
  • Loading branch information
hkiel committed Mar 16, 2022
1 parent d30cc41 commit c553b0a
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 141 deletions.
5 changes: 3 additions & 2 deletions OMCompiler/Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -2508,12 +2508,13 @@ protected function filladjacencyMatrixT
output BackendDAE.AdjacencyMatrixT outAdjacencyArrayT = inAdjacencyArrayT;
protected
BackendDAE.AdjacencyMatrixElement row;
list<Integer> ei;
list<Integer> ei, eqnsindxsNeg;
algorithm
eqnsindxsNeg := list(intNeg(e) for e in eqnsindxs);
for v in eqns loop
if v < 0 then
v := intAbs(v);
ei := list(intNeg(e) for e in eqnsindxs);
ei := eqnsindxsNeg;
else
ei := eqnsindxs;
end if;
Expand Down
8 changes: 3 additions & 5 deletions OMCompiler/Compiler/BackEnd/HpcOmTaskGraph.mo
Expand Up @@ -4305,21 +4305,19 @@ public function equalLists "author: Waurich TUD 2013-07
input list<Integer> inList2;
output Boolean outIsEqual;
algorithm
outIsEqual := matchcontinue(inList1, inList2)
outIsEqual := match(inList1, inList2)
local
Integer e1, e2;
list<Integer> rest1, rest2;

case ({}, {}) then true;
case ({}, _) then false;
case (_, {}) then false;
case (e1 :: rest1, e2 :: rest2)
equation
true = intEq(e1,e2);
case (e1 :: rest1, e2 :: rest2) guard intEq(e1,e2)
then
equalLists(rest1, rest2);
else false;
end matchcontinue;
end match;
end equalLists;

protected function findOneChildParents "author: Waurich TUD 2013-07
Expand Down
17 changes: 6 additions & 11 deletions OMCompiler/Compiler/BackEnd/Matching.mo
Expand Up @@ -5320,34 +5320,29 @@ public function PFPlusExternal
output BackendDAE.EqSystem osyst;
output BackendDAE.Shared oshared;
output BackendDAE.StructurallySingularSystemHandlerArg outArg;
protected
Integer nvars,neqns;
algorithm
neqns := BackendDAEUtil.systemSize(isyst);
nvars := BackendVariable.daenumVariables(isyst);
(osyst,oshared,outArg) :=
matchcontinue (isyst,ishared,clearMatching,inMatchingOptions,sssHandler,inArg)
local
Integer nvars,neqns;
array<Integer> vec1,vec2;
BackendDAE.StructurallySingularSystemHandlerArg arg;
BackendDAE.EqSystem syst;
BackendDAE.Shared shared;
case (_,_,_,_,_,_)
case (_,_,_,_,_,_) guard intGt(nvars,0) and intGt(neqns,0)
equation
neqns = BackendDAEUtil.systemSize(isyst);
nvars = BackendVariable.daenumVariables(isyst);
true = intGt(nvars,0);
true = intGt(neqns,0);
(vec1,vec2) = getAssignment(clearMatching,nvars,neqns,isyst);
true = if not clearMatching then BackendDAEEXT.setAssignment(neqns, nvars, vec1, vec2) else true;
(vec1,vec2,syst,shared,arg) = matchingExternal({},false,5,Config.getCheapMatchingAlgorithm(),if clearMatching then 1 else 0,isyst,ishared,nvars, neqns, vec1, vec2, inMatchingOptions, sssHandler, inArg);
syst = BackendDAEUtil.setEqSystMatching(syst,BackendDAE.MATCHING(vec2,vec1,{}));
then
(syst,shared,arg);
// fail case if system is empty
case (_,_,_,_,_,_)
case (_,_,_,_,_,_) guard not intGt(nvars,0) and not intGt(neqns,0)
equation
neqns = BackendDAEUtil.systemSize(isyst);
nvars = BackendVariable.daenumVariables(isyst);
false = intGt(nvars,0);
false = intGt(neqns,0);
vec1 = listArray({});
vec2 = listArray({});
syst = BackendDAEUtil.setEqSystMatching(isyst,BackendDAE.MATCHING(vec2,vec1,{}));
Expand Down

0 comments on commit c553b0a

Please sign in to comment.