[Numpy-discussion] untenable matrix behavior in SVN
Christopher Barker
Chris.Barker@noaa....
Tue Apr 29 17:03:51 CDT 2008
Gael Varoquaux wrote:
> However I would find it nice that, for linear algebra,
> x[i, :] == x[:, i].T
>
> This is the kind of behavior I expect, and we won't be getting it with 1D
> arrays.
But you WOULD get it with 1-d row/column objects.
I'm going to try to summarize what I think is clear from the discussion:
1) There are significant problems with the fact that the current matrix
object does not reduce rank with indexing.
2) people want a "row" or "column" extracted from a matrix to behave
like a linear algebra object, for example: M[:,i] * M[i,:] is an matrix
As far as I can see, the ONLY way to satisfy both of these is with a
row/column object of some sort.
You can get almost there by having M[i] return a 1-d array, while M[:,i]
and M[i,:] continue to return Matrices, but this gives an asymmetry
between extracting rows and columns, and, probably more important, breaks:
M[i] == M[i,:]
plus you don't get the benefit of being able to extract a row or column
and index the result with a scalar.
-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