from typing import Set
import numpy as np
import time

'''
Assume m1 and m2 are both 3x3 matrices.
'''
def multiply(m1, m2):
    res = np.zeros((len(m1), len(m2[0])))

    i = 0
    while i < len(m1):
        j = 0
        while j < len(m2[0]):
            k = 0
            while k < len(m2):
                res[i][j] += m1[i][k] * m2[k][j]
                k += 1
            j += 1
        i += 1

    return res

m1 = np.random.rand(250, 250)
m2 = np.random.rand(250, 250)
print('m1', m1)
print('m2', m2)
t = time.time()
print(multiply(m1, m2))
t2 = time.time()
print(t2 - t, "s")
t = time.time()
print(np.matmul(m1, m2))
t2 = time.time()
print(t2 - t, "s")
