[SciPy-Dev] scipy.io.loadmat and matvec multiply
Nathaniel Smith
njs at pobox.com
Sat Aug 26 02:41:08 EDT 2017
On Fri, Aug 25, 2017 at 11:39 PM, Pauli Virtanen <pav at iki.fi> wrote:
> pe, 2017-08-25 kello 23:08 -0700, Jonathan Taylor kirjoitti:
>> I've got a largeish array that I have saved in a .MAT file that I
>> need to
>> use for
>> matvec multiply several times.
>>
>> It seems that if I copy the array before running the matvec I get a
>> significant speedup. Is this known?
>
> If you do the copy in a way such that the format of the matrix is
> different (e.g. different sparse matrix format), then the speed can
> differ. Check print(type(original_matrix), type(copied_matrix)).
If it's a dense matrix, then it's also possible that the original
matrix gets Fortran layout, and the copy is C layout. To test that you
want: print(original_matrix.strides, copied_matrix.strides)
-n
--
Nathaniel J. Smith -- https://vorpus.org
More information about the SciPy-Dev
mailing list