<div dir="ltr">Yes, it's a dense 2500x2000 matrix.<div><br></div><div>Loaded strides: (8, 16000)</div><div><br></div><div>Copied strides: (20000, 8)</div><div><br></div><div>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.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 25, 2017 at 11:41 PM, Nathaniel Smith <span dir="ltr"><<a href="mailto:njs@pobox.com" target="_blank">njs@pobox.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Aug 25, 2017 at 11:39 PM, Pauli Virtanen <<a href="mailto:pav@iki.fi">pav@iki.fi</a>> wrote:<br>
> pe, 2017-08-25 kello 23:08 -0700, Jonathan Taylor kirjoitti:<br>
>> I've got a largeish array that I have saved in a .MAT file that I<br>
>> need to<br>
>> use for<br>
>> matvec multiply several times.<br>
>><br>
>> It seems that if I copy the array before running the matvec I get a<br>
>> significant speedup. Is this known?<br>
><br>
> If you do the copy in a way such that the format of the matrix is<br>
> different (e.g. different sparse matrix format), then the speed can<br>
> differ. Check print(type(original_matrix), type(copied_matrix)).<br>
<br>
</span>If it's a dense matrix, then it's also possible that the original<br>
matrix gets Fortran layout, and the copy is C layout. To test that you<br>
want: print(original_matrix.strides, copied_matrix.strides)<br>
<span class="HOEnZb"><font color="#888888"><br>
-n<br>
<br>
--<br>
Nathaniel J. Smith -- <a href="https://vorpus.org" rel="noreferrer" target="_blank">https://vorpus.org</a><br>
</font></span><div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
SciPy-Dev mailing list<br>
<a href="mailto:SciPy-Dev@python.org">SciPy-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scipy-dev" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/scipy-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Jonathan Taylor <br>Dept. of Statistics <br>Sequoia Hall, 137 <br>390 Serra Mall<br>Stanford, CA 94305<br>Tel: 650.723.9230<br>Fax: 650.725.8977<br>Web: <a href="http://www-stat.stanford.edu/~jtaylo" target="_blank">http://www-stat.stanford.edu/~jtaylo</a></div>
</div>