Arbitrarily Many Nested Loops
- From: "Jacob JKW" <jacobcdf@xxxxxxxxx>
- Date: 29 Mar 2006 16:51:14 -0800
This is what I have:
-------------
#!perl
for (my $i = 0; $i<=$n_ra->[0]; $i++) {
for (my $j = 0; $j<=$n_ra->[1]; $j++) {
for (my $k = 0; $k<=$n_ra->[2]; $k++) {
$prob_ra->[$i+$j+$k] += (
$f_raa->[0]->[$i] *
$f_raa->[1]->[$j] *
$f_raa->[2]->[$k] *
);
}
}
-------------
But that's obviously messy and more imprtantly I'd like to be able to
decide at run time to have how nested levels to go (probably be on the
order of 50 or 60). I assume that there's a canonical manner in which
this should be handled (using closures I'd guess) but I can't
sufficiently summarize my issue to make it Google-able.
Any advice?
Many Thanks,
J.
.
- Follow-Ups:
- Re: Arbitrarily Many Nested Loops
- From: Tim Kazner
- Re: Arbitrarily Many Nested Loops
- From: David Formosa (aka ? the Platypus)
- Re: Arbitrarily Many Nested Loops
- From: John W. Krahn
- Re: Arbitrarily Many Nested Loops
- From: Jim Gibson
- Re: Arbitrarily Many Nested Loops
- From: A. Sinan Unur
- Re: Arbitrarily Many Nested Loops
- Prev by Date: Re: Finding String Within Page
- Next by Date: Re: Arbitrarily Many Nested Loops
- Previous by thread: for loop is not going to all array elements
- Next by thread: Re: Arbitrarily Many Nested Loops
- Index(es):
Relevant Pages
|
|