Bill Allombert on Sat, 24 Feb 2018 22:44:38 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: forpart() behavior


On Sat, Feb 24, 2018 at 10:02:19PM +0100, Bill Allombert wrote:
> On Sat, Feb 24, 2018 at 09:16:03PM +0100, Bill Allombert wrote:
> > On Sat, Feb 24, 2018 at 12:06:39PM -0500, Max Alekseyev wrote:
> > > Hello!
> > > 
> > > In PARI/GP version Version 2.10.0 (development 21603-bef585b) I observe:
> > > 
> > > ===
> > > ? forpart(p=1,print(p),[0,5],3)
> > > Vecsmall([0, 0, 1])
> > > ? forpart(p=0,print(p),[0,5],3)
> > > ? forpart(p=1,print(p),[0,5],[3,4])
> > > Vecsmall([0, 1, 1, -1])
> > > ===
> > > 
> > > I believe "forpart(p=0,print(p),[0,5],3)" should produce "Vecsmall([0, 0, 0])",
> > > and "forpart(p=1,print(p),[0,5],[3,4])" should produce "Vecsmall([0,
> > > 0, 1])" and "Vecsmall([0, 0, 0, 1])".
> 
> No, see below:
> 
> > It is a bug I introduced a long time ago in commit 941833e2
> > 
> > Older version give correctly:
> > ? partitions(1,[0,5],[3,4])
> > %3 = [Vecsmall([0,0,0,1])]
> 
> Actually, this is wrong too. The doc says:
> the length is the number of nonzero entries.
> So the correct result is [].

This should be fixed in 4c860c11.

Cheers,
Bill