[SciPy-Dev] scipy.io.loadmat and matvec multiply

Stephan Hoyer shoyer at gmail.com
Sat Aug 26 13:10:52 EDT 2017


On Sat, Aug 26, 2017 at 12:09 AM, Jonathan Taylor <
jonathan.taylor at stanford.edu> wrote:

> So, matvec is just slower because of strides and where numpy retrieves
> data? Is there a simple way to do this besides a copy? I can easily afford
> the copy, just wondering.
>

No, the only way to change the strides of an array with the same data is to
make a copy.

Array operations will always be fastest when the smallest strides are along
the axis iterated over in the inner-most (summed) loop. So this existing
strides of your matrix are not sub-optimal in general, just for this
specific operation. They would be suitable, for example, in a vector-matrix
multiply.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20170826/61ff171c/attachment.html>


More information about the SciPy-Dev mailing list