[Numpy-discussion] Detect subclass of ndarray
Anne Archibald
peridot.faceted@gmail....
Sat Mar 24 15:40:30 CDT 2007
On 24/03/07, Travis Oliphant <oliphant@ee.byu.edu> wrote:
> My opinion is that a 1-d array in matrix-multiplication should always be
> interpreted as a row vector. Is this not what is currently done? If
> not, then it is a bug in my mind.
An alternative approach, in line with the usual usage, is that a
vector should be interpreted as a row vector or a column vector as
necessary to make the expression work out. Of course this can be
ambiguous if there's no matrices in the expression, but that's not
relevant here. Certainly the *result* of such an operation should be a
matrix, not a vector, of the shape that would naturally result. So
mat(eye(2))*ones(2) should realize that the operation doesn't make
sense if it's a row vector, convert it to a column vector, do the
multiplication, and return a column vector. (Which is not what it does
now, it seems.) Note that taking a vector and left-multiplying it by a
matrix is a very natural operation that won't work any more if you
treat all vectors as if they were row vectors.
Are there instances where this makes matrix multiplication
non-associative? Where it is surprising?
I've never used numpy's matrices, so this is more here to make sure we
consider all the alternatives.
Anne
More information about the Numpy-discussion
mailing list