Skip to content

Instantly share code, notes, and snippets.

@itamar121
itamar121 / matrix_multiply.py
Created November 9, 2020 00:22 — forked from mahdavipanah/matrix_multiply.py
Python matrix multiplication
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
@itamar121
itamar121 / matrix_multiply.py
Created November 9, 2020 00:22 — forked from mahdavipanah/matrix_multiply.py
Python matrix multiplication
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