[Numpy-discussion] matrix default to column vector?

Alan G Isaac aisaac at american.edu
Sun Jun 7 20:12:42 EDT 2009

>> On Sun, Jun 7, 2009 at 04:44, Olivier Verdier <zelbier at gmail.com> wrote:
>>> Yes, I found the thread you are referring 
>>> to: http://mail.python.org/pipermail/python-dev/2008-July/081554.html 
>>> However, since A*B*C exists for matrices and actually computes (A*B)*C, why 
>>> not do the same with dot? I.e. why not decide that dot(A,B,C) does what 
>>> would A*B*C do, i.e., dot(dot(A,B),C)? 
>>> The performance and precision problems are the responsability of the user, 
>>> just as with the formula A*B*C. 

> Robert Kern wrote:
>> I'm happy to make the user responsible for performance and precision 
>> problems if he has the tools to handle them. The operator gives the 
>> user the easy ability to decide the precedence with parentheses. The 
>> function does not. 

On 6/7/2009 7:44 PM Eric Firing apparently wrote:
> The function could, with suitable parsing of the argument(s):
> (A*B)*C => dot( ((A,B),C) )     or  dot( (A,B), C )
> A*(B*C) => dot( (A, (B,C)) )    or  dot(  A, (B,C) )
> Effectively, the comma is becoming the operator. 

Horribly implicit and hard to read!

If something needs to be done to make ``dot``
approach the convenience of ``*``, I think that
adding ``dot`` as an array method looks

(A*B)*C => A.dot(B).dot(C)
A*(B*C) => A.dot( B.dot(C) )

But no matter how you slice it, the left
hand expression is more compact and
easier to read.

Alan Isaac

More information about the NumPy-Discussion mailing list