Hello,
I’d like to use a Package and the underlying arrays are 2-D. I’m hoping make a new type that uses these 2-D based types, but I’d like the usage of my types to be N-dimensional.
I think I can do this with sub2ind and ind2sub, but it seems like there might be a better way with Base.reindex or possibly view.
As an example, if I have
A = randn(50,24)
But I want a new SubArray (or something) called B, that represents the 2nd dimension of A to represent 3 dimensions of size (2,3,4). Such that
B[2, 2, 2, 2] == A[2, 10]
The above example corresponds with:
julia> sub2ind((2,3,4), 2, 2, 2)
10
Should I just define sub2ind / ind2sub on my type or is there a cleaner way to do this?