473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 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 1415
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.