From: David P G. <dp...@lb...> - 2001-02-07 19:42:53
|
<html><head></head><body><br> 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.<br> Thanks,<br> Dave<br> <br> Konrad Hinsen wrote:<br> <blockquote type="cite" cite="mid:200...@ch..."> <blockquote type="cite"><pre wrap="">element of a NumPy array. I seeked through the documentation and found the<br>argmax/argmin functions. However, they must be called recursively to find<br>the greatest(smallest) element of a multidimendional array. As I needed to<br></pre></blockquote> <pre wrap=""><!----><br>You could run it on Numeric.ravel(array) (which shouldn't make a<br>copy), and then reconstruct the multidimensional indices from the<br>single index into the flattened array. The additional overhead<br>should be minimal, and you don't need any C code.<br><br>Konrad<br></pre> </blockquote> <br> </body></html> |