使用什么方法可视化 4 维数组?

发布于 2024-09-01 22:25:57 字数 550 浏览 3 评论 0原文

数组(一行元素):

[ ][ ][ ][ ][ ][ ]

2-D 数组(一个表):

[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]

3-D 数组:

//Imagine the above table as a cube ( a table with depth )

如何可视化 4-D 数组?

我能想到的最接近的是多个立方体,所以对于 int[,,,] [5,10,2,7] 将是立方体 5,行 10,列 2,层(深度) 7。

我不确定这是否是不过,可视化 4 维数组的最佳方法...我不确定这是教授它的最佳方法...但是它确实具有可扩展的优点(行立方体,立方体表,立方体的立方体(6维数组)

时间立方体是我能想到的另一种方式,

我在这里走对了吗?

An Array ( a row of elements ):

[ ][ ][ ][ ][ ][ ]

A 2-D Array ( a table ):

[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]

A 3-D Array:

//Imagine the above table as a cube ( a table with depth )

How does one visualize a 4-D array?

The closest I can come is multiple cubes, so for int[,,,] [5,10,2,7] would be cube 5, row 10, column 2, layer(depth) 7.

I'm not sure if this is the best way to visualize a 4-D array, though... and I'm not sure it's the best way to teach it... however it does have the advantage of being extensible ( a row cubes, a table of cubes, a cube of cubes ( 6-d array )

Cubes through time is another way that I can think of it.

Am I on the right track here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(12

浊酒尽余欢 2024-09-08 22:25:58

Two nice multidimensional visualizations, neither specific to four dimensions, are Parallel Coordinates and Table Lens.

赠我空喜 2024-09-08 22:25:58

超立方体!但实际上,如果您需要可视化,请假设您从 3D 数组创建的每个盒子现在都有一个 in 内的数组。有点像弦论多维思想。

Hypercube! But really, if you need a visualization, assume that each box that you've created from the 3D array now has an array within in. Kinda like string theory multi-dimensional ideas.

憧憬巴黎街头的黎明 2024-09-08 22:25:58

一种可视化是从一个表面到另一个表面的地图。想象一下您的双手悬停在桌子上的不同点上:任何时候您移动任何手,您都会得到完全不同的值。

One visualization would be the maps from one surface to another surface. Imagine your hands hovering over different points on a table: any time you move either hand you get an entirely different value.

高冷爸爸 2024-09-08 22:25:58

旧线程,但这里有一个很好的链接,其中有一个很好的示例和漂亮的图片。可能对某人有用!

http://sp-products.zxq.net/c++%20tutorial2.html

Old thread, but here is a nice link with a nice example and nice pictures. May come handy to someone!

http://sp-productions.zxq.net/c++%20tutorial2.html

夜访吸血鬼 2024-09-08 22:25:58

如果您要将 4d 数组显示为 2d 表,则每个单元格都包含一个表。所以主表是第一个二维表,它的单元格是第二个二维表。

          | col 1    |   col 2  | col 3
___________________________________________
row 1     | 2d table | 2d table | 2d table 
-------------------------------------------
row 2     | ""  ""   | ""  ""   | "" ""

If you were to display that 4d array as a 2d table, then every cell contains a table. So the main table is the first 2d table, and it's cells are the 2nd 2d tables'.

          | col 1    |   col 2  | col 3
___________________________________________
row 1     | 2d table | 2d table | 2d table 
-------------------------------------------
row 2     | ""  ""   | ""  ""   | "" ""
心是晴朗的。 2024-09-08 22:25:57

如果您尝试向最终用户显示程序的输出,那么您就走在正确的轨道上。

如果你想教它,我会简单地使用这种方法,然后我会深入解释计算机如何将它们全部保存在连续的内存中 - http://www.plantation-productions.com/Webster/www.artofasm.com/Windows/HTML /Arraysa2.html。我认为这是最好的理解方式。


原始链接不再有效,但我在互联网档案馆中找到了它 - http://web.archive.org/web/20120410120743/http://webster.cs.ucr.edu/AoA/Windows/HTML/ Arraysa2.html


更新了第一段以显示更新的链接,感谢@OskensoKashi。

If you're trying to display output of a program for end users, then you are on the right track.

If you're trying to teach it, I'd briefly use that method, and then I'd go into depth explaining how the computer keeps them all in contiguous memory -- http://www.plantation-productions.com/Webster/www.artofasm.com/Windows/HTML/Arraysa2.html. I think this is the best way to understand it.


The original link is no longer working, but I found it up on the Internet Archive here -- http://web.archive.org/web/20120410120743/http://webster.cs.ucr.edu/AoA/Windows/HTML/Arraysa2.html


Updated first paragraph to show updated link, thanks to @OskensoKashi.

风透绣罗衣 2024-09-08 22:25:57

这就是我教它的方式:一排立方体。该行的位置(或立方体编号)是第四维。

如果您想要 5 维空间,现在可以想象立方体的列和行!

对于 6 维,想象立方体的行和列(对于 5 维),现在添加这些行和列的“层”。

...对于 7 个维度,想象一下以上所有内容 - 包含在单行的立方体中! ;)

是的,它一直向下都是立方体。

That's how I would teach it: a row of cubes. The position (or cube number) on this row is the 4th dimension.

And if you want 5-dimensions, now picture columns and rows - of cubes!

For 6 dimensions, picture the rows and columns of cubes (as for 5 dimensions), and now add "layers" of these rows and columns.

...For 7 dimensions, imagine all of the above - contained in cubes in a single row! ;)

Yup, it's cubes all the way down.

街角卖回忆 2024-09-08 22:25:57

我无法在这里绘制它,而是将其可视化为一行(或数组)立方体。

另一种方法是首先将立方体表示形式表示为三维数组。现在用孩子的木块< /a>,并将几个块彼此相邻排列。

I can't draw it here, but visualize it as a line (or array) of cubes.

Another way is to first take your cube representation for a three-dimensional array. Now replace the cube in your mind with a child's wooden block, and line up several of the blocks next to each other.

过期以后 2024-09-08 22:25:57

无论您多么努力,超过三个维度的可视化都不会很直观。但您走在正确的道路上 - 时变对象是可视化高维数据的常用方法。

三维物体可以通过物体在平面中移动时与平面的随时间变化的交点来可视化 - 例如,穿过平面的球体显示为从点到圆盘的圆,其半径与该圆盘的半径相同球体并再次缩小到一个点。

对于四维物体也可以做同样的事情。它们被可视化为物体与固定三维空间的交集,而物体沿着第四维度移动。

Visualizations in more than three dimension will not be very intuitive - no matter how hard you try. But you are on the right track - time-varying objects are a common method to visualize higher dimensional data.

A three dimensional object can be visualized with the time-varying intersection of the object with a plane while the object moves through the plane - for example a sphere passing through plane shows as a circle growing from a point to disc with the same radius as the sphere and shrinking to a point again.

The same can be done with four dimensional objects. They are visualized as the intersection of the object with a fixed three dimensional space while the object moves along the fourth dimension.

雾里花 2024-09-08 22:25:57

将 3 维可视化为立方体,将 4 维可视化为一行立方体是有意义的,但正如您所看到的,它很难扩展。我通常思考的方式是将可视化强制转化为二维。例如,这通常是考虑如何在 C 中存储数组的最简单方法。二维数组实际上只是一个指向更多数组的指针数组,或者是一个数组的数组。如果您确实被迫尝试以电子表格等二维格式呈现 3+ 维数据,那么这种思考方式也会派上用场。额外的维度必须添加为列中的列或行中的行。

实际上,想象它很快就会伤害你的眼睛,但至少它可以画在黑板上,而且不需要太多的想象力来添加额外的维度。

一维(数组)

[] [] [] []

2 维(数组的数组)

[ [] [] ]  [ [] [] ]  [ [] [] ]  [ [] [] ]

3 维(数组的数组的数组)

[  [ [] [] ]  [ [] [] ]  ]   [  [ [] [] ]  [ [] [] ]  ]

Visualizing 3 dimensions as cubes and 4 dimensions as a line of cubes makes sense, but as you can see it's difficult to extend. The way that I usually think about it is to force the visualization into 2 dimensions. This is usually the easiest way to think of how arrays are stored in C, for example. A 2-dimensional array is really just an array of pointers to more arrays or, an array of arrays. Thinking of it this way comes in handy too if you really are forced to try and present 3+ dimensional data in a 2-dimensional format like a spreadsheet. Extra dimensions must be added as columns within columns or rows within rows.

Actually visualizing it hurts your eyes quickly, but at least it can be drawn on a chalkboard and it doesn't require a whole lot of imagination to add additional dimensions.

1-Dimensional (Array)

[] [] [] []

2-Dimensional (Array of Arrays)

[ [] [] ]  [ [] [] ]  [ [] [] ]  [ [] [] ]

3-Dimensional (Array of Arrays of Arrays)

[  [ [] [] ]  [ [] [] ]  ]   [  [ [] [] ]  [ [] [] ]  ]
灯角 2024-09-08 22:25:57

这取决于您想要可视化的数据类型。对于某些情况,我之前遇到过 2D/3D 图像 + RGB 颜色效果很好。 2D 图像形成二维,而用于绘制点的红、绿、蓝颜色通道又增加了 3 个维度。

例如,看一下游戏开发中使用的法线贴图。它将表面 (2D) 可视化,每个点 (3D) 都有一个法向量。向量用颜色分量 x~red、y~green、z~blue 表示,这些分量移动了 127,以便能够存储负值。

It depends on what kind of data you're trying to visualize. For some situations I have had before 2D/3D image + RGB color worked fine. 2D picture forms two dimensions and Red, Green, Blue channels of color that is used to paint the point add another 3 dimensions.

For example take a look at normal maps used in game development. It visualizes a surface (2D) with a normal vector at each point (3D). Vectors are denoted with color components x~red, y~green, z~blue shifted on 127 to be able to store negative values.

那片花海 2024-09-08 22:25:57

写了一些东西来帮助自己理解它。https://medium .com/@theformingunion/visualizing-multiDimensionarrays-4d-arrays-and-beyond-ae6ae536f07f

基本思想是每个附加数组都会在电子表格/矩阵的其他行/列中添加一行/列。
所以你的 AZ 的顶行/数组
对于 A 的每个实例。
其中还有一个 az 数组
可以与1-256交叉引用。 (第二维)。
这是 2D 平面上的 3D 数组。

对于 [2][2][2][2][2] 的简单 5D 数组,

位置 1,1 包含最后 3 个数组中的所有 8 个数据空间。 (所以如果你看下面的图片,你可以看到“A1”,并注意到有一个 A1 的单个盒子,并且有 8 个单数盒子。

这就像俄罗斯娃娃。每个数组包含它后面的所有数组。

这很重要通过图像更容易理解:)

5d 数组

Wrote something to help myself understand it.https://medium.com/@thegrowingunion/visualizing-multidimensionalarrays-4d-arrays-and-beyond-ae6ae536f07f

Basic idea is that each additional array adds a row/column WITHIN the other row/columns to spreadsheet/matrix.
So your top row/array of A-Z
For every instance of A.
There is another array within it of a-z
Which can be cross referenced with 1-256. (The second dimension).
So that's a 3D array on a 2D Plane.

For a simple 5D array of [2][2][2][2][2]

The position 1,1 CONTAINS all 8 of the data spaces in the last 3 arrays. (So if you look at the image below, you can see "A1" and notice that there is one single box of A1 AND there are 8 singular boxes.

It's like Russian dolls. Each array contains all the arrays after it.

This is much easier to understand with the image. :)

5d Array

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文