Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Benchmark numpy with matrix multiplication
import numpy as np
from time import time
size = 4096
A, B = np.random.rand(size, size), np.random.rand(size, size)
N = 20
t = time()
for i in range(N):, B)
delta = time() - t
print('Dotted two %dx%d matrices in %0.2f s.' % (size, size, delta / N))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment