Raul,

In your new proposed explicit par, for my problem, m=. y-x-1.

This is assuming every partition must have at least one item.

Skip


Skip Cave
Cave Consulting LLC

​<<<>>>​

On Thu, Oct 26, 2017 at 10:39 AM, Raul Miller <[email protected]> wrote:

> Yes...
>
> Here's my current working draft - I really want to replace that ~./:"1
> phrase with something more analytic, but I just think too slowly:
>
> require'stats'
>
> par=:4 :0
>   x (1+y-x) P y
> )
>
> P=:1 :0
> :
>   NB. x: number of partitions
>   NB. m: maximum allowed partition size
>   NB. y: number of items to distribute across partitions
>   if. y>x*m do.i.0 0 return. end.
>   if.1=x do.,.<"1 m comb y return.end.
>   r=.i.0 0
>   for_n. 1+i.m do.
>     t=.(x-1) (m<.x-1) P y-n
>     c=.<"1 n comb y
>     r=.r, ~. /:~"1 ,/c ([,] ({L:0 ,) (i.y)-.S:0 [)"0 1/ t
>   end.
> )
>
> Basically, I need to be doing something just a bit different when
> dealing with a sequence of equal sized partitions.
>
> Any suggestions?
>
> Thanks,
>
> --
> Raul
>
>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to