PSA: replacement of ind2sub/sub2ind in Julia 0.7+

Or even simpler (I think; untested):

ind2subv(shape, indices) = Tuple.(CartesianIndices(shape)[indices])
sub2indv(shape, indices) = LinearIndices(shape)[CartesianIndex.(indices)]
4 Likes