[Numpy-discussion] inconsistent dot() behaviour

Chris Fonnesbeck fonnesbeck at gmail.com
Mon Mar 13 13:44:02 EST 2006


I notice that the dot() function does not behave consistently across
all sizes of arrays:

In [7]: dot(array([1.0]), array([-0.27163628]))
Out[7]: array([-0.27163628])

In [8]: dot(array([1.0,1.0]), array([-0.27163628,1.0]))
Out[8]: 0.72836371999999994

Why should a 1x1 dot product produce an array, while a 2x2 (or
greater) product produces a scalar?

Using recent svn build of numpy.

Thanks,
Chris

--
Chris Fonnesbeck + Atlanta, GA + http://trichech.us




More information about the NumPy-Discussion mailing list