[Numpy-discussion] try to solve issue #2649 and revisit #473

Alan G Isaac alan.isaac@gmail....
Wed Apr 3 15:03:26 CDT 2013


On 4/3/2013 3:18 PM, huangkandiy@gmail.com wrote:
> A 5*5 matrix multiplies another matrix, we expect answer to be error or a 5*? matrix, not a 1*5 matrix.


That is what happens.
But you are post"multiplying" a matrix by a one-dimensional list.
What should happen then?  That is the question.

One could argue that this should just raise an error,
or that the result should be 1d.
In my view, the result should be a 1d array,
the same as I.A.dot(x).

But the maintainers wanted operations with matrices to
return matrices whenever possible.  So instead of
returning x it returns np.matrix(x).

My related grievance is that I[0] is a matrix,
not an array.  There was a long discussion of
this a couple years ago.

Anyway, the bottom line is: don't mix matrices and
other objects.  The matrix object is really built
only to interact with other matrix objects.

Alan


More information about the NumPy-Discussion mailing list