def test_contains_gen(self): x = self.x y = self.y z = self.z sm = SingularModule([[x, y + z, z**3 - 2 * y], [x, y, z]]) #Assert we contain our generators self.assertTrue(sm.contains([x, y + z, z**3 - 2 * y])) self.assertTrue(sm.contains([x, y, z]))
def test_contains_fail(self): x = self.x y = self.y z = self.z one = self.poly_ring.one() sm = SingularModule([[x, y + z, z**3 - 2 * y], [x, y, z]]) #Detect that certain vectors are not contained self.assertFalse(sm.contains([one, x, z])) self.assertFalse(sm.contains([y, y, y])) self.assertFalse(sm.contains([z, y, x]))
def test_intersect_contains(self): x = self.x y = self.y z = self.z sm1 = SingularModule([[x, y + z, z**3 - 2 * y], [x, y, z], [x, y, z**2]]) sm2 = SingularModule([[x, y**2, z**3]]) #Assert the intersection is contained in both modules gens = (sm1.intersection(sm2)).gens for gen in gens: self.assertTrue(sm1.contains(gen)) for gen in gens: self.assertTrue(sm2.contains(gen))
def test_contains_fail_multiple(self): x = self.x y = self.y z = self.z sm = SingularModule([[x**2, x * y, x * z]]) #Detect that this is not contianed even though a multiple is self.assertFalse(sm.contains([x, y, z]))
def test_contains_combination(self): x = self.x y = self.y z = self.z sm = SingularModule([[x, y + z, z**3 - 2 * y], [x, y, z]]) #Assert we contain a combination of the generorators self.assertTrue(sm.contains([2 * x, 2 * y + z, z**3 - 2 * y + z]))
def test_contains_zero(self): x = self.x y = self.y z = self.z sm = SingularModule([[x, y + z, z**3 - 2 * y], [x, y, z]]) zero = self.poly_ring.zero() #Assert we always contain zero self.assertTrue(sm.contains([zero, zero, zero]))
def test_contains_module(self): x = self.x y = self.y z = self.z zero = self.poly_ring.zero() smA = SingularModule([[x**2, x * y, y * z], [x, y, z]]) smB = SingularModule([[x**2 + x, x * y + y, y * z + z], [zero, zero, y * z - x * z]]) self.assertTrue(smA.contains(smB))