April 1st, 2003, 10:43 AM
Multidimensional data matrices under c++
I was happily writing in c++ today when I came across a problem. I need a 3D float number matrix to store results of calculations. So far I know of 1D and 2D matrices. Is there any way of creating a 3D one, for storing (xyz) coordinates for example? :confused:
I can think of one way but is requires recalculation of parameters and a lot of computation time to decode.
I am open to all suggestions
Thanks for all posts
April 1st, 2003, 12:23 PM
April 1st, 2003, 01:13 PM
hm, that was too simple for me to think out I guess. :eek:
Now a stupid question, does this work for float matrix [x][x][x][x] as well??
So far I have been decoding addresses into such a fashion:
x^3*firstadress+x^2*secondadress+x*thirdadress+fourthadress, where x is the maximal dimension of the matrix. This also works though I have to operate on one hell-of-a-long matrix and there is always much more operations with decodning addresses correctly.
Thanks for posts
April 1st, 2003, 01:57 PM
Yes, of course it does in just that fashion. I believe that you can go up to seven dimensions -- but check your compiler's documentation first.
April 1st, 2003, 02:03 PM
You can use dinamic mammory as
X is pointer X**
x is pointer X***
and so on.
April 1st, 2003, 02:15 PM
Thanks a lot :D
That really solves me a lot of unneccessary work.
You are the best :cool:
Best greets & thanks for all posts
April 2nd, 2003, 02:13 AM
and works really fine.
Now the program runs like gold and there are no problems with excessive position decoding. Thanks a lot guys :D