ip_desc {wishmom} | R Documentation |
Generate Integer Partitions in Reverse Lexicographical Order
Description
This function generates all integer partitions of a given integer k
in reverse lexicographical order.
The function is adapted from "Algorithm ZS1" described in Zoghbi and Stojmenovic (1998),
"Fast Algorithms for Generating Integer Partitions", International Journal of Computer Mathematics,
Volume 70, Issue 2, pages 319-332.
Usage
ip_desc(k)
Arguments
k |
An integer to be partitioned |
Value
A matrix where each row represents an integer partition of k
.
The partitions are listed in reverse lexicographical order.
References
Zoghbi, A., & Stojmenovic, I. (1998). Fast Algorithms for Generating Integer Partitions. International Journal of Computer Mathematics, 70(2), 319-332. DOI: 10.1080/00207169808804755
Examples
# Example 1:
ip_desc(3)
# Example 2:
ip_desc(5)
[Package wishmom version 1.1.0 Index]