The NumPy Fortran-ordering quiz
Charles R Harris
charlesr.harris at gmail.com
Wed Oct 18 15:10:16 EDT 2006
On 10/18/06, Tim Hochberg <tim.hochberg at ieee.org> wrote:
>
> Charles R Harris wrote:
> >
> >
> > On 10/18/06, *Tim Hochberg* <tim.hochberg at ieee.org
> > <mailto:tim.hochberg at ieee.org>> wrote:
> >
> > Charles R Harris wrote:
> >
> > [SNIP]
> > >
> > > I'm not talking about the keyword in the ravel call, I'm talking
> > about
> > > the flag in a. The question is: do we *need* a fortran flag. I am
> > > argueing not, because the only need is for fortran contiguous
> > arrays
> > > to pass to fortran function, or translation from fortran
> contiguous
> > > arrays to numpy arrays. What I am saying is that things are
> > > unnecessarily complicated. None of the LaPack stuff seems to use
> > the
> > > Fortran stuff, they just transpose and copy. I don't even think
> > I want
> > > to change that, because it is *clear* what is going on.
> > Interfacing to
> > > fortran is all about memory layout, nothing more or less.
> > >
> >
> > Chuck,
> >
> > There are two things here. One is the order keyword and one is the
> > FORTRAN flag. The latter is mainly an optimization for use at the
> > C-level so that one doesn't have to check whether a given array is
> in
> > contiguous FORTRAN order by examining the strides, in the same way
> > that
> > the CONTIGUOUS flag allows you to skip examining the strides when
> you
> > need a contiguous C-order matrix.
> >
> >
> > That sounds like the two flags should be named f-contiguous and
> > c-contiguous. Then they would be orthogonal and one could have all
> > four combinations. Is that the case now? Perhaps I am misunderstanding
> > the meaning of the flags.
> That is the case now. The flag names simply mirror their values in C.
> Why they have those names in something of a historical accident I
> believe. Take a look at this:
OK, that is good. I no longer have any objection to the flags, I just wish
the names were more descriptive of what they mean. In fact, it looks like
the following sort of construction will be useful in the linalg module.
In [17]:a = array([[1,2],[3,4]], dtype=int)
In [18]:b = array(a, dtype=double, order='f')
In [19]:b.flags
Out[19]:
CONTIGUOUS : False
FORTRAN : True
OWNDATA : True
WRITEABLE : True
ALIGNED : True
UPDATEIFCOPY : False
I've been a pain in the a** because I really want to know what is going on
down in the boiler room.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20061018/380c6fa3/attachment-0001.html>
-------------- next part --------------
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
-------------- next part --------------
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion
More information about the NumPy-Discussion
mailing list