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.

>>> from Numeric import *
>>> xx = ones((4,4))
>>> yy = ravel(xx)
>>> yy[2] = 6
>>> xx
array([[1, 1, 6, 1],
      [1, 1, 1, 1],
      [1, 1, 1, 1],
      [1, 1, 1, 1]])
>>> zz = transpose(xx)
>>> zz
array([[1, 1, 1, 1],
      [1, 1, 1, 1],
      [6, 1, 1, 1],
      [1, 1, 1, 1]])
>>> yy = ravel(zz)
>>> yy[2] = 10
>>> zz
array([[1, 1, 1, 1],
      [1, 1, 1, 1],
      [6, 1, 1, 1],
      [1, 1, 1, 1]])
>>> yy
array([ 1,  1, 10,  1,  1,  1,  1,  1,  6,  1,  1,  1,  1,  1,  1,  1])

As you can see, the second ravel has made a copy, whereas the first did not. I know this is a minor point, and I apologize for taking up bandwidth, but it would be nice if there were a way around this, short of writing my own C routines for min and max.
   Dave

John J. Lee wrote:
On Wed, 7 Feb 2001, David P Grote wrote:

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.

Aren't FORTRAN arrays just stored in the reverse order to C? Isn't this
just dealt with by having the stride lengths of your Numeric array in the
opposite order? Or does FORTRAN sometimes allocate multidimensional
arrays with gaps in memory?? I don't see why they should not be
contiguous.


John