I have an array of dimension 5. But, I can't figure out how to visualize that array?
int[][][][][] array = new int[4][4][4][6][2].
Is there a good way to visualize arrays with dimension counts of 3 or more?
closed as not a real question by Steven A. Lowe, Walter, Dynamic, World Engineer♦, gnat Dec 23 '12 at 20:37It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question. |
|||||||||||||||||
|
I don't think it makes sense to visualize array in any sort of real 'spatial' sense. Ultimately, it's all getting mapped to 'flat' memory addresses. If you really had to do it - maybe something like this?
Still, I'd just avoid trying to think of it as anything physical. Because....well, it isn't. If you think of it as an array of arrays (...of arrays...) you can describe any nd array. A two dimensional array is just an array where each element represent it's own array. |
|||
|
That really depends on the content of cells. But if you really want to visualize the content, you don't need to see at once 5D array of high precision values. Define few (2-5) efficiently different ranges to where could belong values. And make 2 of your dimensions as x and y, and other three - interpret as colors - R,G,B. And in every point (x,y,r,g,b) you can have a value of the range. Of course, a looker needs time to understand the image, but he would need it for every sort of 5D image. |
||||
|
"Visualizing" beyond 3 dimensions is very difficult, if not impossible to do spatially (although I have friends who swear they can do 4). But if you want a good idea of how to think of a 5d or even n-d matrix represents data, think of an html source tree. You have:
|
|||
|
If you look for a graphical way to represent it in a 3D space what @whatsisname said is the solution. Or the other way around: a cube in which each element is a matrix. It depends on what your data represents. If you just want to check the data, an expandable 5-level tree should do just fine. |
|||
|
Think of each level of multi-D array access as an address with meaning that leads to something specific.
This could represent whatever's at the space coords x-0, y-1, z-7. But nobody said it had to be spatial. It could also be what you get when you select choice 0 on the first menu, 1 on the second menu and 7 on the next. Multi-D arrays are ultimately simply about using arrays to create chained numeric mappings to specific values. In the end it's always only the last array in the chain that actually holds values rather than arrays. The indeces can have any meaning we want to give them. |
|||
|
A 2d array of 3d cubes would visualize it, although there's no good general way to show all the data at once in any meaningful way. |
|||
|