def test_dmp_ext_factor(): h = [QQ(1), QQ(0), QQ(-2)] K = QQ.algebraic_field(sqrt(2)) assert dmp_ext_factor([], 0, K) == (ANP([], h, QQ), []) assert dmp_ext_factor([[]], 1, K) == (ANP([], h, QQ), []) f = [[ANP([QQ(1)], h, QQ)], [ANP([QQ(1)], h, QQ)]] assert dmp_ext_factor(f, 1, K) == (ANP([QQ(1)], h, QQ), [(f, 1)]) g = [[ANP([QQ(2)], h, QQ)], [ANP([QQ(2)], h, QQ)]] assert dmp_ext_factor(g, 1, K) == (ANP([QQ(2)], h, QQ), [(f, 1)]) f = [[ANP([QQ(1)], h, QQ)], [], [ANP([QQ(-2)], h, QQ), ANP([], h, QQ), ANP([], h, QQ)]] assert dmp_ext_factor(f, 1, K) == \ (ANP([QQ(1)], h, QQ), [ ([[ANP([QQ(1)], h, QQ)], [ANP([QQ(-1),QQ(0)], h, QQ), ANP([], h, QQ)]], 1), ([[ANP([QQ(1)], h, QQ)], [ANP([QQ( 1),QQ(0)], h, QQ), ANP([], h, QQ)]], 1), ]) f = [[ANP([QQ(2)], h, QQ)], [], [ANP([QQ(-4)], h, QQ), ANP([], h, QQ), ANP([], h, QQ)]] assert dmp_ext_factor(f, 1, K) == \ (ANP([QQ(2)], h, QQ), [ ([[ANP([QQ(1)], h, QQ)], [ANP([QQ(-1),QQ(0)], h, QQ), ANP([], h, QQ)]], 1), ([[ANP([QQ(1)], h, QQ)], [ANP([QQ( 1),QQ(0)], h, QQ), ANP([], h, QQ)]], 1), ])
def test_dmp_ext_factor(): h = [QQ(1),QQ(0),QQ(-2)] K = QQ.algebraic_field(sqrt(2)) assert dmp_ext_factor([], 0, K) == (ANP([], h, QQ), []) assert dmp_ext_factor([[]], 1, K) == (ANP([], h, QQ), []) f = [[ANP([QQ(1)], h, QQ)], [ANP([QQ(1)], h, QQ)]] assert dmp_ext_factor(f, 1, K) == (ANP([QQ(1)], h, QQ), [(f, 1)]) g = [[ANP([QQ(2)], h, QQ)], [ANP([QQ(2)], h, QQ)]] assert dmp_ext_factor(g, 1, K) == (ANP([QQ(2)], h, QQ), [(f, 1)]) f = [[ANP([QQ(1)], h, QQ)], [], [ANP([QQ(-2)], h, QQ), ANP([], h, QQ), ANP([], h, QQ)]] assert dmp_ext_factor(f, 1, K) == \ (ANP([QQ(1)], h, QQ), [ ([[ANP([QQ(1)], h, QQ)], [ANP([QQ(-1),QQ(0)], h, QQ), ANP([], h, QQ)]], 1), ([[ANP([QQ(1)], h, QQ)], [ANP([QQ( 1),QQ(0)], h, QQ), ANP([], h, QQ)]], 1), ]) f = [[ANP([QQ(2)], h, QQ)], [], [ANP([QQ(-4)], h, QQ), ANP([], h, QQ), ANP([], h, QQ)]] assert dmp_ext_factor(f, 1, K) == \ (ANP([QQ(2)], h, QQ), [ ([[ANP([QQ(1)], h, QQ)], [ANP([QQ(-1),QQ(0)], h, QQ), ANP([], h, QQ)]], 1), ([[ANP([QQ(1)], h, QQ)], [ANP([QQ( 1),QQ(0)], h, QQ), ANP([], h, QQ)]], 1), ])