combinat-0.2.10.1: Generate and manipulate various combinatorial objects.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Math.Combinat.Partitions.Set

Description

Synopsis

The type of set partitions

Forgetting the set structure

setPartitionShape :: SetPartition -> Partition Source #

The "shape" of a set partition is the partition we get when we forget the set structure, keeping only the cardinalities.

Generating set partitions

setPartitionsWithKParts Source #

Arguments

:: Int

k = number of parts

-> Int

n = size of the set

-> [SetPartition] 

Synonym for setPartitionsWithKPartsNaive

sort (setPartitionsWithKParts k n) == sort [ p | p <- setPartitions n , numberOfParts p == k ]

setPartitionsNaive :: Int -> [SetPartition] Source #

List all set partitions of [1..n], naive algorithm

setPartitionsWithKPartsNaive Source #

Arguments

:: Int

k = number of parts

-> Int

n = size of the set

-> [SetPartition] 

Set partitions of the set [1..n] into k parts

countSetPartitions :: Int -> Integer Source #

Set partitions are counted by the Bell numbers

countSetPartitionsWithKParts Source #

Arguments

:: Int

k = number of parts

-> Int

n = size of the set

-> Integer 

Set partitions of size k are counted by the Stirling numbers of second kind