Partitions. Partitions are nonincreasing sequences of positive integers.

- data Partition
- toPartition :: [Int] -> Partition
- toPartitionUnsafe :: [Int] -> Partition
- mkPartition :: [Int] -> Partition
- isPartition :: [Int] -> Bool
- fromPartition :: Partition -> [Int]
- height :: Partition -> Int
- width :: Partition -> Int
- heightWidth :: Partition -> (Int, Int)
- weight :: Partition -> Int
- _dualPartition :: [Int] -> [Int]
- dualPartition :: Partition -> Partition
- _partitions' :: (Int, Int) -> Int -> [[Int]]
- partitions' :: (Int, Int) -> Int -> [Partition]
- countPartitions' :: (Int, Int) -> Int -> Integer
- _partitions :: Int -> [[Int]]
- partitions :: Int -> [Partition]
- countPartitions :: Int -> Integer
- allPartitions' :: (Int, Int) -> [[Partition]]
- allPartitions :: Int -> [[Partition]]
- countAllPartitions' :: (Int, Int) -> Integer
- countAllPartitions :: Int -> Integer

# Type and basic stuff

The additional invariant enforced here is that partitions are monotone decreasing sequences of positive integers.

toPartition :: [Int] -> PartitionSource

Checks whether the input is a partition.

toPartitionUnsafe :: [Int] -> PartitionSource

Assumes that the input is decreasing.

mkPartition :: [Int] -> PartitionSource

Sorts the input.

isPartition :: [Int] -> BoolSource

fromPartition :: Partition -> [Int]Source

heightWidth :: Partition -> (Int, Int)Source

weight :: Partition -> IntSource

The weight of the partition (that is, the sum of the corresponding sequence).

_dualPartition :: [Int] -> [Int]Source

dualPartition :: Partition -> PartitionSource

The dual (or conjugate) partition.

# Generation

Partitions of d, fitting into a given rectangle, as lists.

Partitions of d, fitting into a given rectangle. The order is again lexicographic.

_partitions :: Int -> [[Int]]Source

Partitions of d, as lists

partitions :: Int -> [Partition]Source

Partitions of d.

countPartitions :: Int -> IntegerSource

All partitions fitting into a given rectangle.

allPartitions :: Int -> [[Partition]]Source

All partitions up to a given degree.

countAllPartitions' :: (Int, Int) -> IntegerSource

# = \binom { h+w } { h }