<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 15, 2014 at 3:29 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"><div class=""><p dir="ltr">> It would be nice if u@v@None, or some such, would evaluate as a dyad. Or else we will still need the concept of row and column 1-D matrices. I still think v.T should set a flag so that one can distinguish u@v.T (dyad) from u.T@v (inner product), where 1-D arrays are normally treated as column vectors.</p>


</div><p dir="ltr">This sounds important but I have no idea what any of it means :-) (What's a dyadic matrix?) Can you elaborate?</p></blockquote></div><div class="gmail_extra"><br></div>I assume dyadic means 2d.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">This discussion gave me an idea that is only tangentially relevant to the discussion at hand.  It looks like numpy operators commonly need to make a choice whether to treat an Nd array as a unit (atom) or as a list to broadcast itself over.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">APL-derived languages solve this problem by using operator modifiers.  Applied to our case, given a dot-product operator @, each[@] operator works on  2d arrays by "dotting" them pair-wise and returning a 1d array.  Similarly, eachleft[@] would operate on 2d, 1d operands by broadcasting itself over the left operand (incidentally reproducing the mat @ vec behavior) and eachright[@] would treat its left operand atomically and broadcast over the right operand.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">My idea is inspired by Guido's "use facade" suggestion.  We can define ndarray.each(axes=(0,)) method that would return a light-weigh proxy object so that</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">a each[@] b  is spelled a.each() @ b.each()</div><div class="gmail_extra">a eachleft[@] b is spelled a.each() @ b</div><div class="gmail_extra">a eachright[@] b is spelled a @ b.each()<br>
<br></div></div>