LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multi dimensional array - Real life example

Solved!
Go to solution

Arrays.... easy to "visualize" upto say 3 D and maybe even 4D. But beyond that it gets a challenge to create an image in the mind. 

 

Playing around with this snippet gives some idea as to how the elements in the 4th dimension are handled ...

 

Array_Tryout.png

 

But beyond that visualizing say a 6 D array is virtually impossible ( for me atleast !). Came across a discussion in a blog which was trying to explain this and they took the example of a variable called YEAR which had 5 dimensions . ( For uniformity we assume all months have 28 days. ) So the variable is defined as 12months / 28days  / 24hours / 60minutes / 60seconds

 

YEAR[12][28][24][60][60]

 

Any more insights into this to make understanding better of dimensions beyond 4 ? 

 

 

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 1 of 9
(8,094 Views)
Solution
Accepted by topic author MogaRaghu

I am not quite sure what you are asking us for here.

 

One important thing with simplified my understanding when I started out is that if you are creating arrays in a loop using an auto-indexing tunnel, the last dimension to be written is the first dimension to be indexed when the array gets fed into a new auto-indexing terminal

Niatross_0-1590132493051.png

 

Beyond that the row-columb-page-book-volume-library analogy helps.

 

If you have more dimensions than that I would seriously question your design. Sounds like it just asking for memory leaks.

Message 2 of 9
(8,048 Views)
Solution
Accepted by topic author MogaRaghu

It's probably not much of a visualization aid, but one example of arrays of arbitrarily many dimensions is the numerical representation of a quantum wave function.

 

I suppose You are familiar with the general concept of a wave function as a scalar value, dependent on spatial coordinates of the wave medium and a time component. In QM, it is sometimes possible to ignore the time, so let's do that. The wave function of a single particle then is dependent on the spatial coordinates of the single particle. For the regular old particle in a box, this means three coordinates. If you want to represent the wave function, you could e.g. choose a three-dimensional grid and save the values of the wave function at each grid point, giving You a nice three-dimensional array - each dimension of the array corresponding to the value of a specific spatial coordinate of the particle, with the values in the array itself representing the values of the wave function for that specific configuration of the particle in the box.

 

Now add another particle to the box. The wave function must now respect both particles, leading to six spatial coordinates overall. The array now needs six dimensions to represent all configurations of two particles in your box. Each new particle adds its own three spatial coordinates. You could keep going as long as You have memory to spare. However, since memory is limited, almost noone uses this low-level approach to representing wave functions.

 

While typing this, I remembered the Grid Reference System for geographic locations, which uses nested layers of squares. I You will, You might then save the surface of the earth as a multidimensional array of locations.

 

The thing about these examples is that the memory requirement for such arrays grows exponentially with the number of dimensions. If You find Yourself asking whether You should represent a calender as a six-dimensional array, it might be time to take a step back and reexamine the problem to see if there are better solutions to be had.

 

 

0 Kudos
Message 3 of 9
(8,019 Views)
Solution
Accepted by topic author MogaRaghu

Hi Moga,

 


@MogaRaghu wrote:

But beyond that visualizing say a 6 D array is virtually impossible ( for me atleast !).

Any more insights into this to make understanding better of dimensions beyond 4 ?


A page contains chars in rows and columns: so you already defined a 3D array using a "book" of several pages.

4D: You can place several books into one row of a shelf.

5D: the shelf contains several rows.

6D: there are several shelf standing next to each other in a room.

7D: there are several rooms in the library.

8D: there is more than one library in the town…

 

Beside this: why do you even need arrays larger than 4D?

(A 6D array with each dimension taking 10 DBL entries already needs ~8MB in memory. With 50 elements in each dimension it explodes to ~116GB…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(7,989 Views)

The concept of dimension is not restricted to physical objects

https://en.wikipedia.org/wiki/Dimension

 



I once used a 3d dimensional LabView array to represent a 256x256x256 RGB color Cube,

each voxel representing a 24 Bit color value (in a U32...)

 

when doing stuff like this, be careful NOT to run out of memory.

 

0.PNG

 

 

 

I never used a 4 or 5 d array for anything - rather multi dimension datapoints ("0 dimension") in a 1d array

 

Message 5 of 9
(7,980 Views)

@Worle wrote:

I am not quite sure what you are asking us for here.

 

One important thing with simplified my understanding when I started out is that if you are creating arrays in a loop using an auto-indexing tunnel, the last dimension to be written is the first dimension to be indexed when the array gets fed into a new auto-indexing terminal

.....

 

Beyond that the row-columb-page-book-volume-library analogy helps.

 

Both good points ... the last to index out is the first to index in !! 

 

And the one about row/column/page/book/volume/library is a good example. 

 

Thanks 

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 6 of 9
(7,952 Views)

@alex

 

That color array was nice concept .... provides ample scope for experimenting !

 

And if we can work out an automated method of randomly varying the indexes you have an attractive color pattern generator 😃

 

Thanks

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 7 of 9
(7,945 Views)

@GerdW

 

Thanks for the clarification ... sure I don't ever need ( or so I think as of now ) an array past the 4th dimension. Just was curious to know if higher order arrays have a practical use in life ... I am sure there are many instances in scientific research !!

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 8 of 9
(7,941 Views)

PS:   Column is the first dimension, then row, page, book, ....

0 Kudos
Message 9 of 9
(7,897 Views)