Convert a 3D Array to 2D array of vectors

@sdanisch, that is pretty advanced code and hard to grasp :slight_smile:

An alternative herein, using TensorCast.jl, which seems to use the same “black box technology” under the hood as StaticArrays, but thanks to a very logical and accessible syntax, one can get equivalent results in a more user-friendly way:

using TensorCast
@cast out2[i,j]{k} := vol[i,j,k]

NB: curly brackets allow different interpretation slices of the same memory, and assignment := returns views

1 Like