Skip to content

Instantly share code, notes, and snippets.

@timurbakibayev
Created November 5, 2020 15:06
Show Gist options
  • Save timurbakibayev/9d43c824ccf071e9cca383fa9153f16d to your computer and use it in GitHub Desktop.
Save timurbakibayev/9d43c824ccf071e9cca383fa9153f16d to your computer and use it in GitHub Desktop.
Matrix Multiplication in Python
n = 300
a = np.ones((n,n))
b = np.ones((n,n))
c = np.zeros((n,n))
start_time = time.time()
for i in range(n):
for j in range(n):
for k in range(n):
c[i][j] += a[i][k] * b[k][j]
print(f"I did it in {time.time() - start_time} sec." )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment