import numpy as np
num = 10000000
a = np.random.random(num)
b = np.random.random(num)
import time
start = time.time()
c = np.dot(a,b)
end = time.time()
print(c)
print("Verctorize : " + str((end -start)*1000) + 'ms')
c =0
start = time.time()
for i in range(num):
c += a[i]*b[i]
end = time.time()
print(c)
print("Loop version : " + str((end -start)*1000) + 'ms')
On this page of the site you can watch the video online Vectorization vs Non-Vectorization Python implementation with a duration of hours minute second in good quality, which was uploaded by the user MyStudy 10 August 2017, share the link with friends and acquaintances, this video has already been watched 17,052 times on youtube and it was liked by 173 viewers. Enjoy your viewing!