Reputation: 9793
I am trying to find the value of the dot product of x, which is 1.17794933^2 + (-0.07446217)^2 = 1.3931. I tried x.dot(x)
but that did not seem to work. Is there another way to perform dot product when x
is of type numpy.ndarray
?
Upvotes: 1
Views: 37
Reputation: 25239
For your desired output, You may try einsum
In [1254]: np.einsum('ij,ij',x,x)
Out[1254]: 1.3931092388085575
Upvotes: 1