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

Alan G Isaac aisaac@american....
Fri Dec 18 19:31:51 CST 2009


On 12/18/2009 5:54 PM, Keith Goodman wrote:
> On Fri, Dec 18, 2009 at 2:51 PM, Wayne Watson
> <sierra_mtnview@sbcglobal.net>  wrote:
>> That should do it. Thanks. How do I get the scalar result by itself?
>
>>> np.dot(x.T,x)[0,0]
>     14
>
> or
>
>>> x = np.array([1,2,3])
>>> np.dot(x,x)
>     14


or np.dot(x.flat,x.flat)

fwiw,
Alan Isaac


More information about the NumPy-Discussion mailing list