Stuart Midgley wrote:
> inc = lb1
>
> do while (ii <= imax)
! Do the actual work in here
> do k = 2, ndims
> inc(k) = inc(k) + 1
> if (inc(k) <= ub2(k)) exit
> inc(k) = lb1(k)
> end do
> end do
> end do
This is the same basic trick that Yasuki Arasaki sent (you use k=2,ndims
instead of k=1,ndims?). I am guessing it an idiom known to compiler
folks who need to flatten out loop nests? It seems too cute to be a
coincidence you both offered the same solution...
Thanks,
Aleksandar
|