X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Ffactor.cpp;h=cb5be83624f297ab6aaee664acf5e28f0b12894a;hb=3b5611d85547f2e2da692f092812b3a40a969d27;hp=c82e74405658de2800cda0f8156f18df74163f81;hpb=59ec13895c97ffd74979a0b811a7571f6de56386;p=ginac.git diff --git a/ginac/factor.cpp b/ginac/factor.cpp index c82e7440..cb5be836 100644 --- a/ginac/factor.cpp +++ b/ginac/factor.cpp @@ -33,7 +33,7 @@ */ /* - * GiNaC Copyright (C) 1999-2009 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2015 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -737,7 +737,6 @@ public: } bool is_col_zero(size_t col) const { - mvec::const_iterator i = m.begin() + col; for ( size_t rr=0; rr(ex_to(cont).to_cl_N()); + + const numeric& cont_n = ex_to(cont); + cl_I i_cont; + if (cont_n.is_integer()) { + i_cont = the(cont_n.to_cl_N()); + } else { + // poly \in Q[x] => poly = q ipoly, ipoly \in Z[x], q \in Q + // factor(poly) \equiv q factor(ipoly) + i_cont = cl_I(1); + } + cl_I lc = lcoeff(prim)*i_cont; upvec factors; while ( trials < 2 ) { umodpoly modpoly; @@ -2109,8 +2118,9 @@ static ex put_factors_into_lst(const ex& e) return result; } if ( is_a(e) || is_a(e) ) { - result.append(1); - result.append(e); + ex icont(e.integer_content()); + result.append(icont); + result.append(e/icont); return result; } if ( is_a(e) ) {