472,986 Members | 2,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,986 software developers and data experts.

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[0];
  2. pagesize = dim[0]*dim[1];
  3.  
  4.     for(ix=1;ix<dim[0]-1;ix++) 
  5.         for(iy=1;iy<dim[1]-1;iy++) 
  6.             for(iz=1;iz<dim[2]-1;iz++) 
  7.             {
  8.                 index   = ix + iy*rows + iz*pagesize;
  9.                                if(MASK[index]==0)
  10.                                      Gradient[index]=0;
  11.                                else
  12.                                   (...)
  13.                         }
  14.  
  15.  
  16.  
I mean what is index exactly? MASK is an array of dimensions
dim[0] x dim[1] x dim[2] 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[1]))


EDIT: to be precise MASK is imported from Matlab in the following way:
in the mexfunction there is
Expand|Select|Wrap|Line Numbers
  1. MASK = mxGetPr(prhs[1]);
  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[0] x dim[1] x dim[2].

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

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Abdullah Khaidar | last post by:
Is there any iteration style we must use to get faster processing time? I've tried with some style to concat number in list. But I still don't know which one is the recommended style. >>> def...
12
by: Steven T. Hatton | last post by:
This is something I've been looking at because it is central to a currently broken part of the KDevelop new application wizard. I'm not complaining about it being broken, It's a CVS images. ...
24
by: David Mathog | last post by:
If this: int i,sum; int *array; for(sum=0, i=0; i<len; i++){ sum += array; } is converted to this (never mind why for the moment):
18
by: Daniel | last post by:
Hey guys I have an instance of an object say: List<Object> myList = new List<Object>(); Object myObject = new Object(); myObject.PositionVector = new Vector3(10,10,10); ...
17
by: christophe.chazeau | last post by:
Hi, I have a problem with a really simple chunk of code which should work but does obviously does not. This chunk of code is just a POC aimed at finding a bug in a larger project in which the...
14
by: Mohamed Mansour | last post by:
Hey there, this will be somewhat a long post, but any response is appreciated! I have done many PInvoke in the past from C++ to C#, but I did PInvoke within C# not C++/CLI. Can someone explain...
20
by: athar.mirchi | last post by:
..plz define it.
12
by: Philipp.Weissenbacher | last post by:
Hi all! This is most certainly a total newbie question, but why doesn't the following code cause a segfault? void insertion_sort(int a, int length) { int i; for (i=0; i < length; i++) { int...
9
by: xiao | last post by:
It always dumped when I tried to run it... But it compiles OK. What I want to do is to do a test: Read information from a .dat file and then write it to another file. The original DAT file is...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.