Convert (N)D Array to (N-2)D Array of SMatrix elements

For those of us who are not as smart as Mason :sweat:, the TensorCast package is perhaps more within reach:

using TensorCast
A = rand(3,3,5,10)
@cast B[k,l]{i,j} := A[i,j,k,l] 

NB:
the curly brackets are used for the static array slices of desired output: 5x10 Matrix of SMatrix{3,3}

4 Likes