Re: [R] All nonnegative integer solution

2007-11-19 Thread Peter Dalgaard
Robin Hankin wrote: > Hello Amin > > The partitions library does this. > > If N=4 and k=3: > > > library(partitions) > > blockparts(rep(4,3),4) > > [1,] 4 3 2 1 0 3 2 1 0 2 1 0 1 0 0 > [2,] 0 1 2 3 4 0 1 2 3 0 1 2 0 1 0 > [3,] 0 0 0 0 0 1 1 1 1 2 2 2 3 3 4 > > > > The solutions are enumerated in

Re: [R] All nonnegative integer solution

2007-11-19 Thread Robin Hankin
Hello Amin The partitions library does this. If N=4 and k=3: > library(partitions) > blockparts(rep(4,3),4) [1,] 4 3 2 1 0 3 2 1 0 2 1 0 1 0 0 [2,] 0 1 2 3 4 0 1 2 3 0 1 2 0 1 0 [3,] 0 0 0 0 0 1 1 1 1 2 2 2 3 3 4 > The solutions are enumerated in the columns. HTH rksh On 19 Nov 2007