![](https://secure.gravatar.com/avatar/6fdbe558d5fc70735afc27d41ef9abb7.jpg?s=120&d=mm&r=g)
8 Mar
2010
8 Mar
'10
11:02 a.m.
Is there a numpy function to convert corresponding array indices in flattened / nonflat multidimensional arrays for a given shape? E.g. for a = array([0,1,2,3,4,5]).reshape(2,3) I want some function that converts e.g. 1 to [0,1] and 5 to [1,2] if I tell it a.shape. For 2D it's of course easy to do it by hand, but I need something that is fast and works for arrays of any dimension.