-
-
Save itamar121/0a2f28b4f3aef343e0ef93e578545a31 to your computer and use it in GitHub Desktop.
Python matrix multiplication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def matrix_multiply(a, b): | |
c = [[] for _ in range(len(a))] | |
for i in range(len(a)): | |
for j in range(len(a)): | |
sum = 0 | |
for k in range(len(a)): | |
sum += a[i][k] * b[k][j] | |
c[i].append(sum) | |
return c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment