Ravel does make a copy when the array is not contiguous. I asked this question before but didn't get any response - is there a way to get the argmax/min or max/min of a non-contiguous multi-dimensional array without making a contiguous copy? I use python as an interface to fortran code and so I am constantly dealing with arrays that are not contiguous, i.e. not with C ordering. Any help is appreciated.

Thanks,

Dave

Konrad Hinsen wrote:

element of a NumPy array. I seeked through the documentation and found the

argmax/argmin functions. However, they must be called recursively to find

the greatest(smallest) element of a multidimendional array. As I needed to

You could run it on Numeric.ravel(array) (which shouldn't make a

copy), and then reconstruct the multidimensional indices from the

single index into the flattened array. The additional overhead

should be minimal, and you don't need any C code.

Konrad