[Numpy-discussion] Detect subclass of ndarray

Alan G Isaac aisaac@american....
Sat Mar 24 15:06:04 CDT 2007

On Sat, 24 Mar 2007, Travis Oliphant apparently 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. 

>>> N.__version__
>>> I
matrix([[ 1.,  0.],
        [ 0.,  1.]])
>>> I*N.ones(2)
matrix([[ 1.,  1.]])

If N.ones(2) were treated as a row vector,
matrix multiplication is not possible.
So the question is what should happen.
I would like an exception raised.
The current behavior is lmost certainly not desirable,
although it has the virute of matching ``dot``.

>>> N.dot(I,N.ones(2))
matrix([[ 1.,  1.]])

Alan Isaac

More information about the Numpy-discussion mailing list