[Numpy-discussion] untenable matrix behavior in SVN

Christopher Barker Chris.Barker@noaa....
Tue Apr 29 16:55:38 CDT 2008


Bruce Southey wrote:
> The ability to treat vectors as matrices would be sufficient for my
> needs because these are almost always used in the context of
> vector-matrix multiplication. There is no additional benefit from
> having row or column shapes or metadata because the row/column nature
> is usually predetermined and would be represented by the shape of the
> corresponding matrix.

The benefit is that they can be indexed with a scalar and converted to a 
1-d array with r.A, and no reshaping. Also that indexing a matrix 
reduces its rank, which is expected in a lot of places.

> It really would be annoying to find that for an
> n by 1 vector/matrix, the product of X.T*X is a scalar or an error
> rather than an n by n matrix.

yes, it would, which is the whole point of the matrix object in the 
first place, and the point of the proposed row/column objects. They 
would provide 1-d object that behave as row an column vectors with * and **.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the Numpy-discussion mailing list