Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Plane partitions. See eg. http://en.wikipedia.org/wiki/Plane_partition
Plane partitions are encoded as lists of lists of Z heights. For example the plane partition in the picture
is encoded as
PlanePart [ [5,4,3,3,1] , [4,4,2,1] , [3,2] , [2,1] , [1] , [1] ]
Synopsis
- newtype PlanePart = PlanePart [[Int]]
- fromPlanePart :: PlanePart -> [[Int]]
- isValidPlanePart :: [[Int]] -> Bool
- toPlanePart :: [[Int]] -> PlanePart
- planePartShape :: PlanePart -> Partition
- planePartZHeight :: PlanePart -> Int
- planePartWeight :: PlanePart -> Int
- singleLayer :: Partition -> PlanePart
- stackLayers :: [Partition] -> PlanePart
- unsafeStackLayers :: [Partition] -> PlanePart
- planePartLayers :: PlanePart -> [Partition]
- planePartitions :: Int -> [PlanePart]
the type of plane partitions
A plane partition encoded as a tablaeu (the "Z" heights are the numbers)
fromPlanePart :: PlanePart -> [[Int]] Source #
isValidPlanePart :: [[Int]] -> Bool Source #
toPlanePart :: [[Int]] -> PlanePart Source #
Throws an exception if the input is not a plane partition
planePartShape :: PlanePart -> Partition Source #
The XY projected shape of a plane partition, as an integer partition
planePartZHeight :: PlanePart -> Int Source #
The Z height of a plane partition
planePartWeight :: PlanePart -> Int Source #
constructing plane partitions
singleLayer :: Partition -> PlanePart Source #
stackLayers :: [Partition] -> PlanePart Source #
Stacks layers of partitions into a plane partition. Throws an exception if they do not form a plane partition.
unsafeStackLayers :: [Partition] -> PlanePart Source #
Stacks layers of partitions into a plane partition. This is unsafe in the sense that we don't check that the partitions fit on the top of each other.
planePartLayers :: PlanePart -> [Partition] Source #
The "layers" of a plane partition (in direction Z
). We should have
unsafeStackLayers (planePartLayers pp) == pp
generating plane partitions
planePartitions :: Int -> [PlanePart] Source #
Plane partitions of a given weight