factorization with GiNaC (update)
Hello, I have updated the polynomial package over GiNaC, especially factorization: ftp://fourier.ujf-grenoble.fr/pub/hp48/giac.tgz Main changes: * 2 version are available: you can either use giac with the NTL univariate factorization library or standalone * the code is faster. Installation requires gmp, cln and GiNaC, optionnaly NTL. Some timimgs of the standalone version on a Celeron 533 Mhz (# Time 0 means <=0.01 sec) (c+x+b)*(b^2-c*x+x^2-c*b+c^2-x*b) # Time0 (x+y+z)*(x-y+z)*(x-y-z) # Time0.01 (-5+3*x+y-y^2)*(-1+3*x+x*y-y^2) # Time0.01 (x-3*y+y*z)*(2*x-z+x*y)*(1+x*z+x*y+6*x^3) # Time0.02 (x*y+y^2+x^2)*(-x*y+y^2+x^2)*(x-y)*(-x-y) # Time0.01 (2+x^3+13*x*y*z^2-21*x*y^3*z)*(1+x*z+x*y+6*x^3) # Time0.01 2+x^3+13*x*y*z^2-21*x*y^3*z # Time0.01 x^2*y^2*(-x+y)*z^5*(-x-y-z) # Time0.01 -x^3*y^2*z*(x-y-z)*(-x+y-z)*(-x-y-z) # Time0.01 (8+15*x)*(1+8*x)*(11+5*x)*(-31+30*x)*(-13+12*x)*(-209+120*x) # Time0.01 (1+x^5+x^20+x^10+x^15)*(1-x^5+x^20+x^10-x^15) # Time0.02 (1+x^35+x^5-x^20+x^40-x^25-x^15)*(1-x^35-x^5-x^20+x^40+x^25+x^15)*(1+x-x^4+x^8-x^5-x^3+x^7)*(1-x-x^4+x^8+x^5+x^3-x^7)*(1+x+x^2)*(1-x+x^2) # Time0.13 If you are factoring big polynomials, the NTL version should be used instead of the standalone version (since it does not include e.g. FFT polynomial multiplication ...) Bernard Parisse
Hi Bernard, That looks promising, though it usually needs tons of small manual fixes to get it compiled. Before diving deeper into this: Could the replication of GiNaC header files not be avoided? That makes maintening your code a nightmare. You seem to be accessing class power's basis and exponent, hence declaring them public. (I hope you don't write them in reference counted objects anywhere.) For accessing, you could simply use the .op(0) and .op(1) method. I haven't understood yet what you do with expairseq but I am under the impression that this can be dealt with in the same way? Regards -richy. -- Richard Kreckel <Richard.Kreckel@Uni-Mainz.DE> <http://wwwthep.physik.uni-mainz.de/~kreckel/>
Hi Bernard,
That looks promising, though it usually needs tons of small manual fixes to get it compiled.
Currently I did only tests on GNU/Linux, where it requires editing the Makefile to get the right path to GiNaC source.
Before diving deeper into this: Could the replication of GiNaC header files not be avoided? That makes maintening your code a nightmare. You seem to be accessing class power's basis and exponent, hence declaring them public. (I hope you don't write them in reference counted objects anywhere.) For accessing, you could simply use the .op(0) and .op(1) method. I haven't understood yet what you do with expairseq but I am under the impression that this can be dealt with in the same way?
Most certainly. I was not aware that I could use op(). Anyway, I believe that source code using the members names is much more readable than with op(). Why did you decide not to declare these members public? Well, maybe the main problem is that it seems impossible to declare a member accessible read-only in C++.
participants (3)
-
Bernard Parisse
-
Parisse Bernard
-
Richard B. Kreckel