[Numpy-discussion] reshape and ravel methods of arrays now return views or raise error

Travis Oliphant oliphant at ee.byu.edu
Wed Mar 29 13:14:03 CST 2006


Christopher Barker wrote:

>>> Since fortran-strided arrays happen *all-the-time* (e.g. after a 
>>> transpose operation), 
>>
>
> I have to wonder if it's really a good idea to do this. Why not just 
> make a re-ordered copy on transpose, rather than making it Fortran 
> strided? Is the optimization really that important?

And optimization is important.  The _dotblas.c function for example now 
works much faster with very common transpose operations because the 
underlying blas knows how to deal with striding so it was a complete 
wasted to always use C-ordering and get a copy of a Fortran-strided array. 

On large arrays, avoiding the unnecessary copy can be very significant.

-Travis





More information about the Numpy-discussion mailing list