[Numpy-discussion] numpy.dot behavior with column vector and length 1 vector

Brendan Simons brendansimons at yahoo.ca
Sat Jan 28 18:28:02 CST 2006


Is this behavior expected?  If so, why am I wrong in assuming these  
statements should all return the same result?

PyCrust 0.9.5 - The Flakiest Python Shell
Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import numpy
 >>> colVect = numpy.ones((3, 1))
 >>> colVect * 5.3
array([[ 5.3],
        [ 5.3],
        [ 5.3]])
 >>> numpy.dot(colVect, 5.3)
array([[ 5.3],
        [ 5.3],
        [ 5.3]])
 >>> colVect * [5.3]
array([[ 5.3],
        [ 5.3],
        [ 5.3]])
 >>> numpy.dot(colVect, [5.3])
array([ 5.3,  0. ,  0. ])


   Brendan
--
Brendan Simons
__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 





More information about the Numpy-discussion mailing list