Re: forpart of zero and fixed length
Max Alekseyev <[email protected]>
| Newsgroups | gmane.comp.mathematics.pari.user |
|---|---|
| Message-ID | <CAJkPp5P6to0WkJibmCQV_Vyf0GGDtjsr9NaRMcpNHo+qiqdB_g@mail.gmail.com> |
Hi Bill, I understand your explanation, but this design decision looks odd to me. You make a distinction between length and size, but personally I care only about size in your terminology. The somewhat ugly workaround for generating partitions of a given size whether or not amin is zero is forpart(p=n, print(p), [amin,amax], if(amin>0,[psize,psize],psize)) Also, there seems to be no simple way to generate all partitions with zero parts for a given range of sizes, as specifying the size range (oddly) disables the zero parts. Regards, Max On Tue, May 20, 2025 at 3:30 PM Bill Allombert < [email protected]> wrote: > On Tue, May 20, 2025 at 02:52:20PM -0400, Max Alekseyev wrote: > > On a related note, I do not understand why I'm getting different results > in > > the following two examples (fist one looks like a bug): > > > > ? forpart(p=5,print(p),[0,5],[2,2]) > > Vecsmall([1, 4]) > > Vecsmall([2, 3]) > > This is correct: the length is the number of nonzero entries. > > > ? forpart(p=5,print(p),[0,5],2) > > Vecsmall([0, 5]) > > Vecsmall([1, 4]) > > Vecsmall([2, 3]) > > > > Also, in the second case, shouldn't 2 be interpreted as nmax and > partitions > > with smaller parts (=1) be also generated? > > By default, parts are positive and we remove zero entries unless amin > <= 0, in which case we fix the size #X = nmax. > > Cheers, > Bill. > >