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

Robert Kern robert.kern at gmail.com
Mon Aug 28 13:26:55 EDT 2017


On Mon, Aug 28, 2017 at 10:13 AM, Jonathan Taylor <
jonathan.taylor at stanford.edu> wrote:
>
> Thanks for all the help.
>
> That said, I'm not sure it is an issue of the strides. I can easily
recreate the slowdown as in the above gist (
https://gist.github.com/da7b2ef6ef109511af06a9cebbfc8ed1 ). Also, modifying
the flags of a user-created ndarray so they agree with the loaded one is
still noticably faster than using the array from `scipy.io.loadmat`

Ah yeah, if the data is aligned, then that might end up faster. Your
optimized BLAS will be able to use certain CPU instructions that require
aligned data. Setting the ALIGNED flag to false won't actually make the
data unaligned; your BLAS checks the data itself, not the numpy flag.

> For my purposes, a copy is just fine, but I think this might be an issue
that could be looked into. Perhaps I should file an issue on github?

It might be worth checking if scipy.io.loadmat() can be made to ensure that
it always creates aligned arrays. There isn't anything to be done about
.dot(), though.

--
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20170828/9fc1a87a/attachment.html>


More information about the SciPy-Dev mailing list