X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Ffactor.cpp;h=da870d3daf079a2d202376177074dbbc897e84e2;hp=b71291356722f81a921b22796a75c854f2a753bb;hb=a12c1d88131c5a301d35767f0c4c947064703418;hpb=7b68fe1d835d84030d4a351c1a3c7665dc15e7e3 diff --git a/ginac/factor.cpp b/ginac/factor.cpp index b7129135..da870d3d 100644 --- a/ginac/factor.cpp +++ b/ginac/factor.cpp @@ -92,7 +92,7 @@ ostream& operator<<(ostream& o, const vector& v) } return o; } -ostream& operator<<(ostream& o, const vector& v) +static ostream& operator<<(ostream& o, const vector& v) { vector::const_iterator i = v.begin(), end = v.end(); while ( i != end ) { @@ -101,7 +101,7 @@ ostream& operator<<(ostream& o, const vector& v) } return o; } -ostream& operator<<(ostream& o, const vector& v) +static ostream& operator<<(ostream& o, const vector& v) { vector::const_iterator i = v.begin(), end = v.end(); while ( i != end ) { @@ -2237,13 +2237,8 @@ static ex factor_multivariate(const ex& poly, const exset& syms) const ex& x = *syms.begin(); // make polynomial primitive - ex p = poly.collect(x); - ex cont = p.lcoeff(x); - for ( int i=p.degree(x)-1; i>=p.ldegree(x); --i ) { - cont = gcd(cont, p.coeff(x,i)); - if ( cont == 1 ) break; - } - ex pp = expand(normal(p / cont)); + ex unit, cont, pp; + poly.unitcontprim(x, unit, cont, pp); if ( !is_a(cont) ) { return factor_sqrfree(cont) * factor_sqrfree(pp); } @@ -2427,7 +2422,7 @@ static ex factor_multivariate(const ex& poly, const exset& syms) // try Hensel lifting ex res = hensel_multivar(pp, x, epv, prime, l, modfactors, C); if ( res != lst() ) { - ex result = cont; + ex result = cont * unit; for ( size_t i=0; i