<div dir="ltr"><div>At some point, someone is going to make a single documentation page describing all of this, right? Tables, mathtex, and such? I get woozy whenever I see this discussion go on.<br><br></div>Ben Root<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 22, 2015 at 2:23 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=""><p dir="ltr">On May 22, 2015 11:00 AM, "Alexander Belopolsky" <<a href="mailto:ndarray@mac.com" target="_blank">ndarray@mac.com</a>> wrote:<br>
><br>
><br>
> On Thu, May 21, 2015 at 9:37 PM, Nathaniel Smith <<a href="mailto:njs@pobox.com" target="_blank">njs@pobox.com</a>> wrote:<br>
> ><br>
> > .. there's been some discussion of the possibility of<br>
><br>
> > adding specialized gufuncs for broadcasted vector-vector,<br>
> > vector-matrix, matrix-vector multiplication, which wouldn't do the<br>
> > magic vector promotion that dot and @ do.<br>
><br>
><br>
> This would be nice.  What I would like to see is some consistency between multi-matrix<br>
> support in linalg methods and dot.<br>
><br>
> For example, when A is a matrix and b is a vector and<br>
><br>
> a = linalg.solve(A, b)<br>
><br>
> then<br>
><br>
> dot(A, a) returns b, but if either or both A and b are stacks, this invariant does not hold.  I would like<br>
> to see a function (say xdot) that I can use instead of dot and have xdot(A, a) return b whenever a = linalg.solve(A, b).</p>
</span><p dir="ltr">I believe this equivalence holds if xdot(x, y) = x @ y, because solve() does follow the pep 465 semantics for shape handling. Or at least, it's intended to. Of course we will also expose pep 465 matmul semantics under some name that doesn't require the new syntax (probably not "xdot" though ;-)).</p><span class="">
<p dir="ltr">> Similarly, if w,v =  linalg.eig(A), then dot(A,v) returns w * v, but only if A is 2d.</p>
</span><p dir="ltr">Again A @ v I believe does the right thing, though I'm not positive -- you might need a swapaxes or matvec or something. Let us know if you work it out :-).</p>
<p dir="ltr">Note that it still won't be equivalent to w * v because w * v doesn't broadcast the way you want :-). You need w[..., np.newaxis, :] * v, I think.</p><span class="HOEnZb"><font color="#888888">
<p dir="ltr">-n</p></font></span><div class="HOEnZb"><div class="h5">
<p dir="ltr">><br>
><br>
> _______________________________________________<br>
> NumPy-Discussion mailing list<br>
> <a href="mailto:NumPy-Discussion@scipy.org" target="_blank">NumPy-Discussion@scipy.org</a><br>
> <a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
><br>
</p>
</div></div><br>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br></blockquote></div><br></div>