R
Rahul
HI.
I want to compute dot product of two vectors stored as lists a and b.a
and b are of the same length.
one simple way is
sum(a*b for i in range(len(a)))
another simple way is
ans=0.0
for i in range(len(a)):
ans=ans+a*b
But is there any other way which is faster than any of the above. (By
the way profiling them i found that the second is faster by about 30%.)
rahul
I want to compute dot product of two vectors stored as lists a and b.a
and b are of the same length.
one simple way is
sum(a*b for i in range(len(a)))
another simple way is
ans=0.0
for i in range(len(a)):
ans=ans+a*b
But is there any other way which is faster than any of the above. (By
the way profiling them i found that the second is faster by about 30%.)
rahul