[Numpy-discussion] dot function or dot notation, matrices, arrays?

Keith Goodman kwgoodman@gmail....
Fri Dec 18 15:57:48 CST 2009


On Fri, Dec 18, 2009 at 1:51 PM, Wayne Watson
<sierra_mtnview@sbcglobal.net> wrote:
> Is it possible to calculate a dot product in numpy by either notation
> (a ^ b, where ^ is a possible notation) or calling a dot function
> (dot(a,b)? I'm trying to use a column matrix for both "vectors".
> Perhaps, I need to somehow change them to arrays?

Does this do what you want?

>> x
matrix([[1],
        [2],
        [3]])

>> x.T * x
   matrix([[14]])
>> np.dot(x.T,x)
   matrix([[14]])


More information about the NumPy-Discussion mailing list