Rahul wrote:
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[i]*b[i] for i in range(len(a)))
btw, imho the most "Pythonic" would be:
sum(i*j for (i,j) in zip(a,b)) -- http://mail.python.org/mailman/listinfo/python-list