def testShortSeq(self): """ sequence has less dimension """ F5 = finitefield.FinitePrimeField.getInstance(5) f5 = F5.createElement ann = uniutil.polynomial({1: 1}, F5) self.assertEqual(ann, linrec.minpoly(map(f5, [3, 0, 0, 0, 0, 0]))) ann = uniutil.polynomial({2: 1}, F5) self.assertEqual(ann, linrec.minpoly(map(f5, [3, 1, 0, 0, 0, 0])))
def testAtti(self): """ This test case is taken from the paper of Atti et al. """ Q = rational.theRationalField rat = rational.Rational ann = uniutil.polynomial(enumerate([0, 1, 1, 1]), Q) self.assertEqual(ann, linrec.minpoly(map(rat, [1, 2, 7, -9, 2, 7])))
def testAtti_19(self): """ testAtti on F19 """ F19 = finitefield.FinitePrimeField.getInstance(19) f19 = F19.createElement ann = uniutil.polynomial(enumerate([0, 1, 1, 1]), F19) self.assertEqual(ann, linrec.minpoly(map(f19, [1, 2, 7, -9, 2, 7])))