parts {partitions} | R Documentation |
Given an integer, return a matrix whose columns enumerate its partitions.
Function parts()
returns the unrestricted partions; function
diffparts()
returns the unequal partitions; function
restrictedparts()
returns the restricted partitions.
parts(n) diffparts(n) restrictedparts(n, m, include.zero=TRUE, decreasing=TRUE)
n |
Integer to be partitioned |
m |
In restrictedparts() , the order of the partition |
include.zero |
In restrictedparts() , Boolean with
default FALSE meaning to include only partitions of n
into exactly m parts; and TRUE meaning to
include partitions of n into at most m parts
(because zero parts are included) |
decreasing |
In restrictedparts() , Boolean with default
TRUE meaning to return partitions whose parts are in
decreasing order and FALSE meaning to return partitions in
lexicographical order, as appearing in Hindenburg's
algorithm. Note that setting to decreasing to FALSE
has the effect of making conjugate() return garbage. |
Function parts()
uses the algorithm in Andrews. Function
diffparts()
uses a very similar algorithm that I have not seen
elsewhere.
Function restrictedparts()
uses the algorithm in
Andrews, originally due to Hindenburg. For partitions into at most
m parts, the same Hindenburg's algorithm is used but with a
start vector of c(rep(0,m-1),n)
.
Robin K. S. Hankin
G. E. Andrews. “The Theory of Partitions”, Cambridge University Press, 1998
parts(5) diffparts(10) restrictedparts(9,4) restrictedparts(9,4,FALSE) restrictedparts(9,4,decreasing=TRUE)