A long discussion about this:
where the upshot (as I read it) is: If you really need linear indices, you can get them with:
ind2subv(shape, indices) = Tuple.(CartesianIndices(shape)[indices])
sub2indv(shape, indices) = LinearIndices(shape)[CartesianIndex.(indices)]
One question is, though, why do you need linear indices?
1 Like