From f3eefbda588318e09dcb3180c6f039dc3fc30f87 Mon Sep 17 00:00:00 2001 From: Jens Vollinga Date: Mon, 18 Aug 2008 21:10:48 +0200 Subject: [PATCH] Fixed bug in modular square-free factorization. --- ginac/factor.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ginac/factor.cpp b/ginac/factor.cpp index 3a012405..18e7c04c 100644 --- a/ginac/factor.cpp +++ b/ginac/factor.cpp @@ -574,9 +574,10 @@ static void sqrfree_main(const UniPoly& a, UniFactorVec& fvec) gcd(w, c, y); div(w, y, z); if ( !is_one(z) ) { - UniFactor uf(z, i++); + UniFactor uf(z, i); fvec.factors.push_back(uf); } + ++i; w = y; UniPoly cbuf(a.R); div(c, y, cbuf); @@ -1026,7 +1027,7 @@ static ex factor_univariate(const ex& poly, const ex& x) UniPoly modpoly(R, prim, x); UniFactorVec sqrfree_ufv; squarefree(modpoly, sqrfree_ufv); - if ( sqrfree_ufv.factors.size() == 1 ) break; + if ( sqrfree_ufv.factors.size() == 1 && sqrfree_ufv.factors.front().exp == 1 ) break; } p = next_prime(p); R = find_modint_ring(p); -- 2.45.0