472,986 Members | 2,795 Online

# what does this iteration do? 84
I'm working on an existing code and don't understand what the following iteration iterates over:

Expand|Select|Wrap|Line Numbers
1. rows = dim;
2. pagesize = dim*dim;
3.
4.     for(ix=1;ix<dim-1;ix++)
5.         for(iy=1;iy<dim-1;iy++)
6.             for(iz=1;iz<dim-1;iz++)
7.             {
8.                 index   = ix + iy*rows + iz*pagesize;
11.                                else
12.                                   (...)
13.                         }
14.
15.
16.
I mean what is index exactly? MASK is an array of dimensions
dim x dim x dim but index doesnt seem to me to iterate ovaer all elements of MASK (this can for example seen by the fact the first iteration gives index=1+rows+pagesize=1+rows*(1+dim))

EDIT: to be precise MASK is imported from Matlab in the following way:
in the mexfunction there is
Expand|Select|Wrap|Line Numbers
2.
hence, Mask is a pointer to the second input element from the calling matlab function. And this calling Matlab function has as second argument an array of ones and zeros of the dimensions dim x dim x dim.

I hope it is clear.
Feb 8 '08 #1
1 1397 sanctus
84 Mo need to reply anymore, it took me an afternoon but I figured it out, thanks in case someone tried to understand
Feb 8 '08 #2