has anyone used a n dimensional array where n is greater than 3. I have never seen a use for it. And how does everyone here picture that many dimensions. I think of it as a point with depth. I dont' know how to think of it past 4 though.
has anyone used a n dimensional array where n is greater than 3. I have never seen a use for it. And how does everyone here picture that many dimensions. I think of it as a point with depth. I dont' know how to think of it past 4 though.
The best picture I've seen of high dimensional arrays is to use a tree like view where each dimension is another branch level.
Ok this is a really bad attempt but its kinda like this:
Hope that helps youCode:arr[2][2][2][2] arr___arr[0]___arr[0][0]___arr[0][0][0]___arr[0][0][0][0] | | | |_arr[0][0][0][1] | | | | | |_arr[0][0][1]___arr[0][0][1][0] | | |_arr[0][0][1][1] | | | |_arr[0][1]___arr[0][1][0]___arr[0][1][0][0] | | |_arr[0][1][0][1] | | | |_arr[0][1][1]___arr[0][1][1][0] | |_arr[0][1][1][1] | |_arr[1]___arr[1][0]___arr[1][0][0]___arr[1][0][0][0] | | |_arr[1][0][0][1] | | | |_arr[1][0][1]___arr[1][0][1][0] | |_arr[1][0][1][1] | |_arr[1][1]___arr[1][1][0]___arr[1][1][0][0] | |_arr[1][1][0][1] | |_arr[1][1][1]___arr[1][1][1][0] |_arr[1][1][1][1]
Last edited by Thantos; 04-18-2004 at 02:45 PM. Reason: Adding in an example
I once read that an array w/ dimensions > 2 should be avoided, and an array w/ dimensions > 3 is an example of bad coding. I dont think I agree that it's really bad coding, but then again.. I've never seen a use for it.
Personally I hate it when someone says XYZ IS an example of bad coding since sometimes it can be the best solution.
Take the example of a video store which wants to keep the info of each video that is in a particular slot, on a particular shelf, on a particular unit, in a particular row. While there are many ways to orginize the data one really simple way is to use a four dimensional array. store[number of rows][number of units per row][number of shelves per unit][number of slots per shelf]
Personally I try to avoid true 2d or more arrays whenever possible and use array's of pointers in their stead.
In lots of data analysis you use >3 dimensions, i guess arrays might be used in programs that perform said analysis. I don't imagine it persay except by analogy of 2 dimensions to 3 dimensions.
Entia non sunt multiplicanda praeter necessitatem
Mathematically, I use greater than 3 dimensions with some frequency, but I usually just simulate the appropriate behavior in another structure (which usually uses a 1d array for its implementation).
Last edited by Zach L.; 04-20-2004 at 08:33 AM.
I have used 7 dimensions in a Fortran program some years ago where it was the best solution to my problem, (fluid dynamics application). I have heard of a researcher in Geophyisical Moddelling who used 66 dimensions also under Fortran.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.