multivariate factorization (ginac/ginsh)
Hi Jörg, Am 21.02.2010 08:59, schrieb Joerg Arndt:
[could someone please forward to ginac-devel, I am not subscribed there]
I am also reading cln-list :-)
# but it appears to do multivariate factorization as well:
yes it does.
# The following seems to take forever:
t; -E20^16*E4^8*E5^8*E1^16*q^4-(E10^24-E20^8*E5^16)*E4^16*E1^8+E2^24*E20^16*E5^8*q^4 factor(t);
# ctrl-C ginsh 815.46s user 3.39s system 94% cpu 14:26.22 total
Is the latter a huge-ish task or does ginac have a performance issue here?
I ran the example and I get an exception! So, it seems there is a bug somewhere. I'll have a look at it. Regards, Jens
Hello, On Sun, Feb 21, 2010 at 10:29:40AM +0100, Jens Vollinga wrote:
# The following seems to take forever:
t; -E20^16*E4^8*E5^8*E1^16*q^4-(E10^24-E20^8*E5^16)*E4^16*E1^8+E2^24*E20^16*E5^8*q^4 factor(t);
# ctrl-C ginsh 815.46s user 3.39s system 94% cpu 14:26.22 total
Is the latter a huge-ish task or does ginac have a performance issue here?
I ran the example and I get an exception! So, it seems there is a bug somewhere.
It looks like a bug in gcd routines. Proof: try computing gcd(expand(t), expand(diff(t, q))) I'll try to find out what's going on here. Best regards, Alexei
Hi Alexei, Am 21.02.2010 20:44, schrieb Alexei Sheplyakov:
It looks like a bug in gcd routines. Proof: try computing
gcd(expand(t), expand(diff(t, q)))
Another proof: gdb's output ;-)
I'll try to find out what's going on here.
thanks! I'll leave the bug to you, then. Regards, Jens
# The following seems to take forever:
t; -E20^16*E4^8*E5^8*E1^16*q^4-(E10^24-E20^8*E5^16)*E4^16*E1^8+E2^24*E20^16*E5^8*q^4 factor(t);
# ctrl-C ginsh 815.46s user 3.39s system 94% cpu 14:26.22 total
Is the latter a huge-ish task or does ginac have a performance issue here?
I ran the example and I get an exception! So, it seems there is a bug somewhere.
It looks like a bug in gcd routines. Proof: try computing
gcd(expand(t), expand(diff(t, q)))
The patch below should fix it. I'll post the proper patch (with a test case, explanatory commit message, and all that) tomorrow. diff --git a/ginac/polynomial/pgcd.cpp b/ginac/polynomial/pgcd.cpp index 6e5e6b2..ef3748d 100644 --- a/ginac/polynomial/pgcd.cpp +++ b/ginac/polynomial/pgcd.cpp @@ -121,6 +121,8 @@ ex pgcd(const ex& A, const ex& B, const exvector& vars, const long p) // evaluation point is bad. Skip it. continue; } + if (img_gcd_deg == 0) + return cont_gcd; // Image has the same degree as the previous one // (or at least not higher than the limit) @@ -145,8 +147,6 @@ ex pgcd(const ex& A, const ex& B, const exvector& vars, const long p) if (divide_in_z_p(Aprim, C, dummy1, vars, p) && divide_in_z_p(Bprim, C, dummy2, vars, p)) return (cont_gcd*C).expand().smod(pn); - else if (img_gcd_deg == 0) - return cont_gcd; // else continue building the candidate } } while(true); Best regards, Alexei
participants (2)
-
Alexei Sheplyakov
-
Jens Vollinga