[Numpy-discussion] matrix default to column vector?

Tom K. tpk at kraussfamily.org
Sun Jun 7 15:13:10 EDT 2009

Olivier Verdier-2 wrote:
> There are two solutions to the A*B*C problem that are not quite
> comparable,
> and are not mutually exclusive either.
> 1) allow dot(A,B,C): this would be a great improvement over
> dot(dot(A,B),C),
> and it could virtually be done within a day. It is easy to implement, does
> not require a new syntax, and does not break BC
> 2) another solution, not incompatible with the first one, is to introduce
> a
> new operator in the python language. In the case that it be accepted by
> the
> python community at large (which is very unlikely, IMHO), be prepared to a
> very long time before it is actually implemented. We are talking about
> several years.
> I think that solution 1) is much more realistic than 2) (and again, they
> are
> not mutually exclusive, so implementing 1) does not preclude for a future
> implementation of 2)).
> Implementation of 1) would be quite nice when multiplication of several
> matrices is concerned.

I agree these are not mutually exclusive.  In other words, they are separate
issues.  So sure while I would not be *as* happy with a multi-input dot as I
would with a new operator that could overload dot, I don't mean to
discourage the multi-input dot from being pursued.  By all means, it seems
like a worthwhile addition if done correctly.  I just don't think it solves
the problem, that being how do we improve the semantics of numpy to be more
"matrix" based.  

It is a *requirement* that the package support * (or some binary infix
operator) for matrix mutliplication.  We do this with the matrix type.  But,
almost all experienced users drift away from matrix toward array as they
find the matrix class too limiting or strange - it seems only applicable for
new users and pedagogical purposes.  My own experience is that having two
ways to do things makes software confusing and overly complex.  It would be
preferable to have a single class that supports matrix multiplication
syntax.  If that takes a year or two until it "hits the street" as a numpy
release, so be it... we've got time.  I think your time estimate is correct,
although the actual time to implement and test the new python syntax would
probably be much shorter - it is not so much a technical issue as one of
socialization.  What do we want to do?  How can we convince the larger
python community that this is a good idea for them too?

  Tom K.
View this message in context: http://www.nabble.com/matrix-default-to-column-vector--tp23652920p23914277.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.

More information about the NumPy-Discussion mailing list