[GiNaC-devel] factorization and stuff

Jens Vollinga jensv at nikhef.nl
Mon Aug 18 21:46:23 CEST 2008


Hi,

Richard B. Kreckel schrieb:
> Well, sometimes it fails to factor. In ginsh:
>> factor(expand((x+1)*(x+4)));
> 4+x^2+5*x

thanks! I fixed this bug. Your bug report is probably connected to your
question:

> Out of curiosity I had a short look at the code. One question: what
> is factor_sqrfree(const ex&) actually doing? As far as I can tell, it
> s not squarefree factorization of univariate polynomials. Is it? (I
> know it's static and inside an anonymous namespace so I'm not
> supposed to use it, but still.)

It is the modular square-free factorization, but it had a bug ... (the 
counter for the exponent of a possible factor was not always increased, 
so the modular sqrfree factorization of your polynomial was (x+1)^1 and 
not (x+1)^2; also a check for that exponent was missing at another place).

Since you already looked at the code I should maybe comment on it with 
respect to cln: there is quite some stuff in factor.cpp that actually 
could be part of cln. It is mainly the type/class for modular univariate 
polynomials. If you compare the features of my class with the equivalent 
type in cln you can see why I needed this additional type.

My plan was/is to finish first the code (including the multivariate case 
and additional algorithms for the univariate case) in GiNaC and to see 
exactly what features such a type needs, before I then ask the friendly 
cln developers to consider upgrading their type. :-)

Regards,
Jens


More information about the GiNaC-devel mailing list