Opened 10 years ago

Last modified 9 years ago

#2874 new enhancement

Implement threaded for-loops in MetaModelica — at Version 2

Reported by: Per Östlund Owned by: Martin Sjölund
Priority: high Milestone: Future
Component: MetaModelica Version: trunk
Keywords: Cc:

Description (last modified by Martin Sjölund)

We currently have threaded reductions, it would be nice to have the equivalent for-loops also (syntax is only a suggestion):

for threaded e1 in list1, e2 in list2 loop
  // Iterates simultaneously over list1 and list2.
end for;

Change History (2)

comment:1 by Martin Sjölund, 10 years ago

Description: modified (diff)

The for-loops are currently translated into nested loops, making this require substantial changes to the DAE

model M
  Real r(start=0);
algorithm
  for i in 1:20, j in 1:30 loop
    r := r + i + j;
  end for;
end M;

=>

class M
  Real r(start = 0.0);
algorithm
  for i in 1:20 loop
    for j in 1:30 loop
      r := r + /*Real*/(i) + /*Real*/(j);
    end for;
  end for;
end M;
Last edited 10 years ago by Martin Sjölund (previous) (diff)

comment:2 by Martin Sjölund, 10 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.