[Numpy-discussion] Is this a wheel?

John J. Lee phrxy at csv.warwick.ac.uk
Thu Feb 8 15:01:39 CST 2001


On Thu, 8 Feb 2001, David P Grote wrote:

> What I meant by "not contiguous" is that the  Numeric flag "contiguous"
> is set to false. This flag is only true when Numeric arrays have their
> strides in C ordering. Any rearrangement of the strides causes the flag
> to be set to false - a transpose for example. The data in the fortran
> arrays is contiguous in memory. Here's an example using ravel.
[...]

Oh, I see.

>  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.

I don't know about doing it with one of the Numeric functions, but it's
very easy to write in C -- just this week I wrote a max() that works on
(contiguous or not)  Numeric arrays.  I think I wrote it as a C function
(not callable from Python) for the function I was wrapping to use, but it
would be easy to change it to be a proper Python function.  I'll mail you
a copy if you like.


John





More information about the Numpy-discussion mailing list