def matrix_equal()

in tutorials/LinearAlgebra/testing.py [0:0]


def matrix_equal(act, exp):
    if act == ... or exp == ...:
        return False
    
    h = len(act)
    w = len(act[0])
    # Check that sizes match
    if h != len(exp) or w != len(exp[0]):
        return False
    
    for i in range(h):
        # Check that the length of each row matches the expectation
        if w != len(act[i]):
            return False
        for j in range(w):
            if act[i][j] == ... or act[i][j] != approx(exp[i][j]):
                return False
    return True