[Numpy-discussion] LA improvements (was: dot function or dot notation, matrices, arrays?)

Anne Archibald peridot.faceted@gmail....
Wed Dec 23 14:49:17 CST 2009


2009/12/23 David Warde-Farley <dwf@cs.toronto.edu>:
> On 23-Dec-09, at 10:34 AM, Anne Archibald wrote:
>
>> The key idea would be that the "linear
>> algebra dimensions" would always be the last one(s); this is fairly
>> easy to arrange with rollaxis when it isn't already true, would tend
>> to reduce copying on input to LAPACK, and is what the gufunc API
>> wants.
>
> Would it actually reduce copying if you were using default C-ordered
> arrays? Maybe I'm mistaken but I thought one almost always had to copy
> in order to translate C to Fortran order except for a few functions
> that can take row-ordered stuff.

That's a good point. But even if you need to do a transpose, it'll be
faster to transpose data in a contiguous block than data scattered all
over memory. Maybe more to the point, broadcasting adds axes to the
beginning, so that (say) two-dimensional arrays can act as "matrix
scalars".

Anne


More information about the NumPy-Discussion mailing list