Example #1
0
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
Example #2
0
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
Example #3
0
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
Example #4
0
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