[GiNaC-list] factor() hangs on a simple expression, randomly
Vitaly Magerya
vmagerya at gmail.com
Thu Nov 30 17:16:50 CET 2017
Hi, folks. I have this problem:
$ ginsh
ginsh - GiNaC Interactive Shell (GiNaC V1.7.2)
__, _______ Copyright (C) 1999-2017 Johannes Gutenberg University Mainz,
(__) * | Germany. This is free software with ABSOLUTELY NO WARRANTY.
._) i N a C | You are welcome to redistribute it under certain conditions.
<-------------' For details type `warranty;'.
Type ?? for a list of help topics.
> factor((2*x-l)^2*(-1+6*x-l)*(-1+3*x-l)*(-2+4*x-l)*(1+4*x-l)*(4*x-l)*(2+4*x-l));
At this point ginsh either hangs (80% of cases), or gives the correct
result (20% of cases).
As you can see the expression is already factored, so a hang is pretty
unexpected here. Note that if you'll drop two of the factors from that
expression, GiNaC won't hang anymore.
Here are the cumulative timings you'll typically see via 'perf top'
during this hang:
91.54% libginac.so.6.0.2 [.] GiNaC::(anonymous namespace)::factor_multivariate
81.32% libginac.so.6.0.2 [.] GiNaC::(anonymous namespace)::hensel_multivar
79.67% libginac.so.6.0.2 [.] GiNaC::(anonymous namespace)::multivar_diophant
79.67% libginac.so.6.0.2 [.] GiNaC::(anonymous namespace)::univar_diophant
79.67% libginac.so.6.0.2 [.] GiNaC::(anonymous namespace)::multiterm_eea_lift
72.77% libginac.so.6.0.2 [.] GiNaC::(anonymous namespace)::factor_sqrfree
66.18% libginac.so.6.0.2 [.] GiNaC::(anonymous namespace)::eea_lift
64.28% libginac.so.6.0.2 [.] GiNaC::factor
26.99% libginac.so.6.0.2 [.] GiNaC::(anonymous namespace)::operator*
23.67% ginsh [.] yyparse
23.67% ginsh [.] f_factor
16.91% libginac.so.6.0.2 [.] cln::cl_MI::~cl_MI
15.26% libginac.so.6.0.2 [.] cln::cl_I::~cl_I
13.66% libginac.so.6.0.2 [.] cln::cl_MI::cl_MI
13.55% libginac.so.6.0.2 [.] cln::cl_RA::~cl_RA
So, any ideas on the nature of this problem, and how to fix it?
More information about the GiNaC-list
mailing list