Generate Integer Partitions in Reverse Lexicographical Order
Generate Integer Partitions in Reverse Lexicographical Order
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.
ip_desc(k)
Arguments
k: An integer to be partitioned
Returns
A matrix where each row represents an integer partition of k. The partitions are listed in reverse lexicographical order.
Examples
# Example 1:ip_desc(3)# Example 2:ip_desc(5)
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