[Numpy-discussion] numpy release
Alan G Isaac
aisaac at american.edu
Fri Apr 25 12:04:27 EDT 2008
I think the use of the term 'vector' in this
thread is becoming a bit confusing.
An M by N matrix is a vector. (I.e., it is
an element of a vector space.)
Many people use the terms "row vector" and "column
vector" to refer to special matrices. What is
special is *not* that they are vectors (since
all matrices are) but that they are a single
row or a single column. Perhaps better
terminology would have been "row matrix" and
"column matrix". Using this terminology, we
clearly expect a row matrix and a column matrix
to have transposes. The question is, can their
elements be indexed by scalars. The answer in
all the proposals, I believe, is "yes".
I believe we are finding that this answer has
some problems.
x is a 2 by 2 matrix
x[0] is a 1 by 2 matrix
x[0][0] is x[0,0] GOOD!!
y = x[0] -> y is a 1 by 2 matrix
y[0][0] is a TypeError BAD!!
So I am becoming more and more persuaded that
for a matrix ``x``:
x[0] should be a 1d array (always!)
x[0,:] should be a matrix
The rule:
use non-scalar indexing to extract submatrices
fwiw,
Alan Isaac
More information about the NumPy-Discussion
mailing list