[SciPy-User] Basic Question About numpy.dot

Scott Stephens stephens.js@gmail....
Sat Dec 11 15:15:54 CST 2010


Why does this work:

>>> import numpy as np
>>> np.dot(np.array([1.,2.]),np.array([[10.,20.],[0.1,0.2]]))
array([ 10.2,  20.4])

But this doesn't:

>>> import numpy as np
>>> np.dot(np.array([1.,2.]),np.array([[10.]]))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: matrices are not aligned

Thanks,

Scott


More information about the SciPy-User mailing list