def test_multiply_01(self): poly1 = Polynomial(4, sample_uniform(0, 30, 4)) poly2 = Polynomial(4, sample_uniform(0, 30, 4)) poly_prod = poly1.multiply_fft(poly2) poly_prod2 = poly1.multiply_naive(poly2) self.assertEqual(poly_prod.coeffs, poly_prod2.coeffs)
def test_multiply_fft(self): poly1 = Polynomial(4, [0, 1, 4, 5]) poly2 = Polynomial(4, [1, 2, 4, 3]) poly_prod = poly1.multiply_fft(poly2) actual_coeffs = [-29, -31, -9, 17] self.assertEqual(poly_prod.coeffs, actual_coeffs)