Bill Allombert on Fri, 10 Feb 2012 22:33:23 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Please test pari-2.5.1 prerelease 2 |
On Fri, Feb 10, 2012 at 09:34:52PM +0100, Bill Allombert wrote: > On Fri, Feb 10, 2012 at 07:37:02PM +0100, Leonardo Cangelmi wrote: > > > > I tested pari-2.5.1 (the prerelease 2 and then the stable version). There > > are no problems in compilation and tests. However, the total time taken by > > test-all is longer than in version 2.5.0 (see the attached bench files). > > Thanks for your careful tests! > > Note that when we fix a bug in 2.5.1, we generally add a new test, so it is > expected that the new testsuite takes more time. However, in this case the > difference is large and is indeed a regression. > > The largest slowdown is in test-resultant. It was introduced by > the commit 5301c466d2 which fixes this bug: > 18- subst(Y/X,X,x) -> 0 > > We will try to address that in 2.5.2. I found out that the unstable branch is not affected due to the second half of 961d38a24ef improving substvec speed tremendously. Unfortunately I only applied the first half to PARI 2.5.1 (since the second half is not a bug fix). Please find a patch which apply the second half, which I am considering to apply to 2.5.2. Cheers, Bill.
>From c325dedd4d680dd95a6e8622d4d69c04135f40c2 Mon Sep 17 00:00:00 2001 From: Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr> Date: Tue, 23 Aug 2011 13:19:27 +0000 Subject: [PATCH] improve substvec speed. --- src/basemath/gen3.c | 27 ++++++++++++++++----------- 1 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/basemath/gen3.c b/src/basemath/gen3.c index 4f86849..5673bc1 100644 --- a/src/basemath/gen3.c +++ b/src/basemath/gen3.c @@ -1453,24 +1453,29 @@ GEN gsubstvec(GEN e, GEN v, GEN r) { pari_sp ltop=avma; - long i,l=lg(v); + long i, j, l = lg(v); GEN w,z; - if ( !is_vec_t(typ(v)) || !is_vec_t(typ(r)) ) - pari_err(typeer,"substvec"); + if ( !is_vec_t(typ(v)) || !is_vec_t(typ(r)) ) pari_err(typeer,"substvec"); if (lg(r)!=l) pari_err(talker,"different number of variables and values in substvec"); - w=cgetg(l,t_VECSMALL); - z=cgetg(l,t_VECSMALL); - for(i=1;i<l;i++) + w = cgetg(l,t_VECSMALL); + z = cgetg(l,t_VECSMALL); + for(i=j=1;i<l;i++) { GEN T = gel(v,i); if (!gcmpX(T)) pari_err(talker,"not a variable in substvec (%Ps)", T); - w[i]=varn(T); - z[i]=fetch_var(); + if (gvar(gel(r,i)) == NO_VARIABLE) /* no need to take precautions */ + e = gsubst(e, varn(T), gel(r,i)); + else + { + w[j]=varn(T); + z[j]=fetch_var(); + j++; + } } - for(i=1;i<l;i++) e = gsubst(e,w[i],pol_x(z[i])); - for(i=1;i<l;i++) e = gsubst(e,z[i],gel(r,i)); - for(i=1;i<l;i++) (void)delete_var(); + for(i=1;i<j;i++) e = gsubst(e,w[i],pol_x(z[i])); + for(i=1;i<j;i++) e = gsubst(e,z[i],gel(r,i)); + for(i=1;i<j;i++) (void)delete_var(); return gerepileupto(ltop,e); } -- 1.7.2.5