Saarland University
Lehrstuhl für Automatisierungstechnik

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> for loop thoughts
daniel@ka
post Nov 20 2009, 09:00 AM
Post #1


Member
**

Group: Members
Posts: 23
Joined: 3-June 08
Member No.: 11,399



Hi,

for i in 1:N loop
for j in 1:i-1,i+1:N loop
// do stuff
end for;
end for;

yesterday I was trying to exclude (i,i) pairs
today I came up with this

for i in 1:N loop
for j in vector([1:i-1;i+1:N]) loop
// do stuff
end for;
end for;

but I am not sure that non-constants (like i) are allowed in the low:high construct at all.
Is it disallowed?

Are there possibilities for manipulating the "compile-time" index space of nested loops?
I would think that equations are produced at "compile-time" and there would be no interference problems
with the rest of solving engine.

modelica for-loop in this regard is not a software for-loop which runs again and again when a function
containing it happens to be called, but more of generate-loop of VHDL, which is evaluated once.

In this way it would be nicer (straigth forward) when
for i in 1:N loop
for j in 1:N loop
if i == j then continue;
// do stuff
end for;
end for;
could be used.

Regards, Daniel
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 20th August 2019 - 02:16 PM