def equal(A, B): "Returns true iff A is equal to B" assert A.D == B.D for k in keys(A, B): if A[k] != B[k]: return False return True
def equal(A, B): "Returns true iff A is equal to B" assert A.D == B.D for k in keys(A,B): if A[k] != B[k]: return False return True
def add(A, B): "Returns the sum of A and B" assert A.D == B.D ret = Mat(A.D, {}) for k in keys(A, B): ret[k] = A[k] + B[k] return ret
def add(A, B): "Returns the sum of A and B" assert A.D == B.D ret = Mat(A.D,{}) for k in keys(A,B): ret[k] = A[k]+B[k] return ret