<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Aug 26, 2017 at 12:09 AM, Jonathan Taylor <span dir="ltr"><<a href="mailto:jonathan.taylor@stanford.edu" target="_blank">jonathan.taylor@stanford.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><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></blockquote><div><br></div><div>No, the only way to change the strides of an array with the same data is to make a copy.</div><div><br></div><div>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.</div></div></div></div>