From: Jens Vollinga Date: Mon, 18 Aug 2008 19:10:48 +0000 (+0200) Subject: Fixed bug in modular square-free factorization. X-Git-Tag: release_1-5-0~85 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=f3eefbda588318e09dcb3180c6f039dc3fc30f87;hp=d08150300eb98c6435a4c464c057ba2967a19c8f Fixed bug in modular square-free factorization. --- 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);