<html><head></head><body><br>
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.<br>
<br>
>>> from Numeric import *<br>
>>> xx = ones((4,4))<br>
>>> yy = ravel(xx)<br>
>>> yy[2] = 6<br>
>>> xx<br>
array([[1, 1, 6, 1],<br>
       [1, 1, 1, 1],<br>
       [1, 1, 1, 1],<br>
       [1, 1, 1, 1]])<br>
>>> zz = transpose(xx)<br>
>>> zz<br>
array([[1, 1, 1, 1],<br>
       [1, 1, 1, 1],<br>
       [6, 1, 1, 1],<br>
       [1, 1, 1, 1]])<br>
>>> yy = ravel(zz)<br>
>>> yy[2] = 10 <br>
>>> zz<br>
array([[1, 1, 1, 1],<br>
       [1, 1, 1, 1],<br>
       [6, 1, 1, 1],<br>
       [1, 1, 1, 1]])<br>
>>> yy<br>
array([ 1,  1, 10,  1,  1,  1,  1,  1,  6,  1,  1,  1,  1,  1,  1,  1])<br>
<br>
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.<br>
    Dave<br>
<br>
John J. Lee wrote:<br>
<blockquote type="cite" cite="mid:Pine.SOL.4.30.0102080853350.936-100000@mimosa.csv.warwick.ac.uk"><pre wrap="">On Wed, 7 Feb 2001, David P Grote wrote:<br><br></pre>
  <blockquote type="cite"><pre wrap="">Ravel does make a copy when the array is not contiguous. I asked this<br>question before but didn't get any response - is there a way to get the<br>argmax/min or max/min of a non-contiguous multi-dimensional array without<br>making a contiguous copy? I use python as an interface to fortran code<br>and so I am constantly dealing with arrays that are not contiguous, i.e.<br>not with C ordering. Any help is appreciated.<br></pre></blockquote>
    <pre wrap=""><!----><br>Aren't FORTRAN arrays just stored in the reverse order to C?  Isn't this<br>just dealt with by having the stride lengths of your Numeric array in the<br>opposite order?  Or does FORTRAN sometimes allocate multidimensional<br>arrays with gaps in memory??  I don't see why they should not be<br>contiguous.<br><br><br>John<br><br></pre>
    </blockquote>
    <br>
</body></html>