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

Commit fdcc01d

Browse files
hkielOpenModelica-Hudson
authored andcommitted
absAdjacencyMatrix only changes lists if values < 0 are contained
improves ticket:1451 Belonging to [master]: - #1900
1 parent b5d86d3 commit fdcc01d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Compiler/BackEnd/AdjacencyMatrix.mo

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import Array;
3838
import Debug;
3939
import Flags;
4040
import List;
41+
import MetaModelica.Dangerous;
4142

4243
public function copyAdjacencyMatrix
4344
input Option<BackendDAE.AdjacencyMatrix> inAdjacencyMatrix;
@@ -267,10 +268,19 @@ public function absAdjacencyMatrix "author: PA
267268
output BackendDAE.AdjacencyMatrix res;
268269
protected
269270
list<list<Integer>> lst, lst_1;
271+
Integer i = 1;
272+
Integer minn;
270273
algorithm
271-
lst := arrayList(m);
272-
lst_1 := List.mapList(lst, intAbs);
273-
res := listArray(lst_1);
274+
res := Dangerous.arrayCreateNoInit(arrayLength(m),{});
275+
for v in m loop
276+
minn := List.fold(v,intMin,0);
277+
if minn < 0 then
278+
Dangerous.arrayUpdateNoBoundsChecking(res, i, List.map(v,intAbs));
279+
else
280+
Dangerous.arrayUpdateNoBoundsChecking(res, i, v);
281+
end if;
282+
i := i+1;
283+
end for;
274284
end absAdjacencyMatrix;
275285

276286
annotation(__OpenModelica_Interface="backend");

0 commit comments

Comments
 (0)