Hello list, we use GiNaC::factor in our program to factorize univariate and multivariate polynomials. This works quite well on our instances, however we encounter strange segfaults sometimes, e.g. in the following cases: factor(-5474155567807987/200000000000000+174247781/20000000*x^2-1989199947807987/200000000000000*x); factor(-5474155567807987/20000000000000+174247781/10000000*x^2-1989199947807987/200000000000000*x); factor(-5474155567807987/200000000000000+174247781/1000000*x^2-1989199947807987/200000000000000*x); factor(-5474155567807987/200000000000000+174247781/10*x^2-1989199947807987/200000000000000*x); factor(-5474155567807987/200000000000000+174247781/2*x^2-1989199947807987/200000000000000*x); factor(-5474155567807987+174247781/10000000*x^2-1989199947807987/200000000000000*x); factor(174247781/10000000*x^2-1989199947807987/200000000000000*x); factor(174247781*x^2-1989199947807987/200000000000000*x); The latter calls are just modifications of the original first call, but all of them fail. I did not manage to pinpoint a commonality which could give a clue to the actual cause of the error. With a debugger, we traced the error to a call to CLN's * operator (in factor.cpp:1512), in particular, the method the<cl_I>( ... ). However, the actual problem might already be in GiNaC. I suspect, there is a problem with computing the content of the input by GiNaC::unitcontprim 10 lines above the error occurrence, but I'm not sure. We used ginac-1.6.2 and cln-1.3.2-r1 on a Gentoo Linux machine. Does anyone have an idea what is going wrong here? Best regards, Ulrich.
Hi, thanks for reporting this problem. Yes, the problem is inside GiNaC, not CLN. Actually, there seems to be a quick fix: replace in line 1512 of factor.cpp the cl_I's by cl_R's ... But what I currently don't understand is what other implications this fix has. And why did this problem go unnoticed for so long? I have to investigate a little bit more. This may take some time. Regards, Jens On 19.11.2012 20:14, Ulrich Loup wrote:
Hello list,
we use GiNaC::factor in our program to factorize univariate and multivariate polynomials. This works quite well on our instances, however we encounter strange segfaults sometimes, e.g. in the following cases:
factor(-5474155567807987/200000000000000+174247781/20000000*x^2-1989199947807987/200000000000000*x); factor(-5474155567807987/20000000000000+174247781/10000000*x^2-1989199947807987/200000000000000*x); factor(-5474155567807987/200000000000000+174247781/1000000*x^2-1989199947807987/200000000000000*x); factor(-5474155567807987/200000000000000+174247781/10*x^2-1989199947807987/200000000000000*x); factor(-5474155567807987/200000000000000+174247781/2*x^2-1989199947807987/200000000000000*x); factor(-5474155567807987+174247781/10000000*x^2-1989199947807987/200000000000000*x); factor(174247781/10000000*x^2-1989199947807987/200000000000000*x); factor(174247781*x^2-1989199947807987/200000000000000*x);
The latter calls are just modifications of the original first call, but all of them fail. I did not manage to pinpoint a commonality which could give a clue to the actual cause of the error.
With a debugger, we traced the error to a call to CLN's * operator (in factor.cpp:1512), in particular, the method the<cl_I>( ... ). However, the actual problem might already be in GiNaC. I suspect, there is a problem with computing the content of the input by GiNaC::unitcontprim 10 lines above the error occurrence, but I'm not sure.
We used ginac-1.6.2 and cln-1.3.2-r1 on a Gentoo Linux machine.
Does anyone have an idea what is going wrong here?
Best regards,
Ulrich.
_______________________________________________ GiNaC-list mailing list GiNaC-list@ginac.de https://www.cebix.net/mailman/listinfo/ginac-list
Hi, Jens, On Mon, Nov 19, 2012 at 10:46 PM, Jens Vollinga <jens.vollinga@googlemail.com> wrote:
Yes, the problem is inside GiNaC, not CLN. Actually, there seems to be a quick fix: replace in line 1512 of factor.cpp the cl_I's by cl_R's ...
factor_unimodular() assumes the polynomial to be in Z[x] (so one can apply modular homomorphisms). Therefore the correct fix is to transform polynomials over rationals into ones over integers. I'll send a patch tomorrow.
And why did this problem go unnoticed for so long?
I guess nobody have ever tried to factor polynomials over rationals so far. Best regards, Alexei P.S. Sent from my phone, sorry for a broken formatting.
participants (3)
-
Alexei Sheplyakov
-
Jens Vollinga
-
Ulrich Loup