# Does converting large 3D matrices to VERY large 2D matrices affect speed of operations done on the matix?

Novice question! Does the dimensionality of a matrix affect the speed of operations performed on it (or the speed of retrieval of values from it) IF the total number of elements in the matrices are the same? E.g. is it computationally more/less efficient to use a 3600 x 120 matrix vs a 60 x 60 x 120 matrix?

The simulations I'm working with have to repeatedly use values from the matrix to do some calculations. I could have tried out for myself, but changing the dimensionality of my current matrix would need me to restructure most of my code to run a comparison.

In general, are lists of more dimensions more expensive memory-wise? Or is it just the number of elements that matters?

There's no appreciable difference in memory usage, for either unpacked or for packed arrays:

(* UNPACKED *)
array = RandomReal[1, {3600, 120}];
array[[1, 1]] = 0; (* unpack it *)
array // ByteCount
(*  10628096  *)

array = RandomReal[1, {60, 60, 120}];
array[[1, 1, 1]] = 0; (* unpack it *)
array // ByteCount
(*  10631584  *)

(* PACKED *)
array = RandomReal[1, {3600, 120}];
array // ByteCount
(*  3456160  *)

array = RandomReal[1, {60, 60, 120}];
array // ByteCount
(*  3456168  *)


There are other odd efficiencies of unpacked arrays, since they are stored as linked lists. For instance if a is an array, then b = {a, a} uses a link to a and entails hardly any more memory usage...until you change a component as in b[[2, 1]] = 0.