numpy.dot behavior with column vector and length 1 vector

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

Brendan Simons wrote:
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. ])
This is a dotblas bug. You can always tell by testing out the original dot function: from numpy.core.multiarray import dot as dot_ dot_(colVect, [5.3]) does not give this result. -Travis
participants (2)
-
Brendan Simons
-
Travis Oliphant