本文整理匯總了Python中polynomial.Polynomial._gffastdivmod方法的典型用法代碼示例。如果您正苦於以下問題:Python Polynomial._gffastdivmod方法的具體用法?Python Polynomial._gffastdivmod怎麽用?Python Polynomial._gffastdivmod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類polynomial.Polynomial
的用法示例。
在下文中一共展示了Polynomial._gffastdivmod方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_div_gffast
# 需要導入模塊: from polynomial import Polynomial [as 別名]
# 或者: from polynomial.Polynomial import _gffastdivmod [as 別名]
def test_div_gffast(self):
one = Polynomial(map(GF2int, [1,3,5,1])) # must be monic! (because the function is optimized for monic divisor polynomial)
two = Polynomial(map(GF2int, [5,3,1,1,6,8]))
q, r = two._gffastdivmod(one) # optimized for monic divisor polynomial
q2, r2 = two._fastdivmod(one)
self.assertEqual(q, q2)
self.assertEqual(r, r2)
self.assertEqual(list(q.coefficients), [5, 12, 4])
self.assertEqual(list(r.coefficients), [52, 30, 12])
# Make sure they multiply back out okay
self.assertEqual(q*one + r, two)