-
-
Save itamar121/4b9a7505e3f74ced27bbd913a2ed4c44 to your computer and use it in GitHub Desktop.
Python matrix multiplication
This file contains hidden or 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