def test_sub(): a = [[ZZ(3), ZZ(7), ZZ(4)], [ZZ(2), ZZ(4), ZZ(5)], [ZZ(6), ZZ(2), ZZ(3)]] b = [[ZZ(5), ZZ(4), ZZ(9)], [ZZ(3), ZZ(7), ZZ(1)], [ZZ(12), ZZ(13), ZZ(14)]] c = [[ZZ(12)], [ZZ(17)], [ZZ(21)]] d = [[ZZ(3)], [ZZ(4)], [ZZ(5)]] e = [[ZZ(12), ZZ(78)], [ZZ(56), ZZ(79)]] f = [[ZZ.zero, ZZ.zero], [ZZ.zero, ZZ.zero]] assert sub(a, b, ZZ) == [[ZZ(-2), ZZ(3), ZZ(-5)], [ZZ(-1), ZZ(-3), ZZ(4)], [ZZ(-6), ZZ(-11), ZZ(-11)]] assert sub(c, d, ZZ) == [[ZZ(9)], [ZZ(13)], [ZZ(16)]] assert sub(e, f, ZZ) == e