Re: Arbitrarily Many Nested Loops
- From: Ilya Zakharevich <nospam-abuse@xxxxxxxxx>
- Date: Thu, 30 Mar 2006 01:08:39 +0000 (UTC)
[A complimentary Cc of this posting was sent to
A. Sinan Unur
<1usa@xxxxxxxxxxxxxxxxxxx>], who wrote in article <Xns9795CB63AB7DAasu1cornelledu@xxxxxxxxx>:
You need to work a little on explaining the problem and algorithm.
Neither the code snippet above nor your verbal description makes any
sense to me
I'm afraid the problem is on your side. The explanation-by-code looks
absolutely clear to me.
Looks like there is a multi-dimensional array of unknown-in-advance
dimension. It is known that it is "rectangular"; the sizes are stored
in another vector (one size per dimension).
One wants a CONVENIENT way to run through the elements of this array.
One hint to OP: since you do not know the dimension at compile
time, you cannot be sure that the index of 1st,2nd,3rd etc
dimensions is $k, $l, $m etc. So the only solution is to have the
running index to be an array too: $I[0], $I[1], $I[3] etc.
This more or less immediately suggests a possible solution...
Hope this helps,
Ilya
P.S. One could also use Math::Pari's forvec(); might be a little bit
heavy-weight solution, but maybe then you will find some use for
other functions in Math::Pari too. ;-)
.
- Follow-Ups:
- Re: Arbitrarily Many Nested Loops
- From: Anno Siegel
- Re: Arbitrarily Many Nested Loops
- From: A. Sinan Unur
- Re: Arbitrarily Many Nested Loops
- From: Jacob JKW
- Re: Arbitrarily Many Nested Loops
- References:
- Arbitrarily Many Nested Loops
- From: Jacob JKW
- Re: Arbitrarily Many Nested Loops
- From: A. Sinan Unur
- Arbitrarily Many Nested Loops
- Prev by Date: Re: Arbitrarily Many Nested Loops
- Next by Date: Re: for loop is not going to all array elements
- Previous by thread: Re: Arbitrarily Many Nested Loops
- Next by thread: Re: Arbitrarily Many Nested Loops
- Index(es):
Relevant Pages
|