Bill Allombert on Tue, 20 May 2025 21:29:49 +0200


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

Re: forpart of zero and fixed length


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.