def test_dup_cancel(): f = ZZ.map([2, 0, -2]) g = ZZ.map([1, -2, 1]) p = [ZZ(2), ZZ(2)] q = [ZZ(1), -ZZ(1)] assert dup_cancel(f, g, ZZ) == (p, q) assert dup_cancel(f, g, ZZ, include=False) == (ZZ(1), ZZ(1), p, q) f = [-ZZ(1), -ZZ(2)] g = [ZZ(3), -ZZ(4)] F = [ZZ(1), ZZ(2)] G = [-ZZ(3), ZZ(4)] assert dup_cancel(f, g, ZZ) == (f, g) assert dup_cancel(F, G, ZZ) == (f, g) assert dup_cancel([], [], ZZ) == ([], []) assert dup_cancel([], [], ZZ, include=False) == (ZZ(1), ZZ(1), [], []) assert dup_cancel([ZZ(1), ZZ(0)], [], ZZ) == ([ZZ(1)], []) assert dup_cancel([ZZ(1), ZZ(0)], [], ZZ, include=False) == (ZZ(1), ZZ(1), [ZZ(1)], []) assert dup_cancel([], [ZZ(1), ZZ(0)], ZZ) == ([], [ZZ(1)]) assert dup_cancel([], [ZZ(1), ZZ(0)], ZZ, include=False) == (ZZ(1), ZZ(1), [], [ZZ(1)])
def test_dup_cancel(): f = ZZ.map([2, 0, -2]) g = ZZ.map([1, -2, 1]) p = [ZZ(2), ZZ(2)] q = [ZZ(1), -ZZ(1)] assert dup_cancel(f, g, ZZ) == (p, q) assert dup_cancel(f, g, ZZ, include=False) == (ZZ(1), ZZ(1), p, q) f = [-ZZ(1), -ZZ(2)] g = [ ZZ(3), -ZZ(4)] F = [ ZZ(1), ZZ(2)] G = [-ZZ(3), ZZ(4)] assert dup_cancel(f, g, ZZ) == (f, g) assert dup_cancel(F, G, ZZ) == (f, g) assert dup_cancel([], [], ZZ) == ([], []) assert dup_cancel([], [], ZZ, include=False) == (ZZ(1), ZZ(1), [], []) assert dup_cancel([ZZ(1), ZZ(0)], [], ZZ) == ([ZZ(1)], []) assert dup_cancel( [ZZ(1), ZZ(0)], [], ZZ, include=False) == (ZZ(1), ZZ(1), [ZZ(1)], []) assert dup_cancel([], [ZZ(1), ZZ(0)], ZZ) == ([], [ZZ(1)]) assert dup_cancel( [], [ZZ(1), ZZ(0)], ZZ, include=False) == (ZZ(1), ZZ(1), [], [ZZ(1)])
def test_dup_cancel(): f = ZZ.map([2, 0, -2]) g = ZZ.map([1, -2, 1]) p = [ZZ(2), ZZ(2)] q = [ZZ(1), -ZZ(1)] assert dup_cancel(f, g, ZZ) == (p, q) assert dup_cancel(f, g, ZZ, multout=False) == (ZZ(1), ZZ(1), p, q) f = [-ZZ(1),-ZZ(2)] g = [ ZZ(3),-ZZ(4)] F = [ ZZ(1), ZZ(2)] G = [-ZZ(3), ZZ(4)] dup_cancel(f, g, ZZ) == (f, g) dup_cancel(F, G, ZZ) == (f, g)
def test_dup_cancel(): f = ZZ.map([2, 0, -2]) g = ZZ.map([1, -2, 1]) p = [ZZ(2), ZZ(2)] q = [ZZ(1), -ZZ(1)] assert dup_cancel(f, g, ZZ) == (p, q) assert dup_cancel(f, g, ZZ, multout=False) == (ZZ(1), ZZ(1), p, q) f = [-ZZ(1), -ZZ(2)] g = [ZZ(3), -ZZ(4)] F = [ZZ(1), ZZ(2)] G = [-ZZ(3), ZZ(4)] dup_cancel(f, g, ZZ) == (f, g) dup_cancel(F, G, ZZ) == (f, g)