Let's say you have a 4-D array. Then one dimension can be said to be
the outermost dimension and one is the innermost. If the array is
wired to a FOR-loop, it will iterato over the outermost dimesion.
Sometimes, it would be convenient to iterate over another dimension,
e.g. the innermost. Are there any "elegant" solutions to this; any
time tested design patterns?
(
In this particular case, I have a 2-D array with 4 x 131072
items. The "long" dimension is a time axis with samples, and contains
data from different parts and aspects of a hardware array
(chip). There is also repeated measurements, which should be
averaged. Presently, the averaging is in the innermost dimension of
the resulting 4-D array, because of how data is ext
racted from the
original array, in which the samples to be averaged are consecutive'
)
A related question is: is it possible to swap dimensions in a
multidimensional array, similarly to, but more general than, the
transpose array for 2D-arrays?