module Main where
--------------------------------------------------------------------------------
import Math.Combinat.LatticePaths
import Math.Combinat.Tableaux
import Math.Combinat.Tableaux.Skew
import Math.Combinat.Partitions.Integer
import Math.Combinat.Partitions.NonCrossing
import Math.Combinat.Partitions.Plane
import Math.Combinat.Partitions.Skew
import Math.Combinat.Trees.Binary
import Math.Combinat.Diagrams
import Diagrams.Core
import Diagrams.Prelude
import Diagrams.Backend.SVG
--------------------------------------------------------------------------------
svgSize = mkWidth 1000
vcatSep = vcat' (with & sep .~ 1)
hcatSep = hcat' (with & sep .~ 1)
boxSep xs = myPad 1.10 $ vcatSep $ map hcatSep $ yys where
nn = length xs
m = max 1 (ceiling $ sqrt $ (fromIntegral $ length xs :: Double))
yys = go xs where
go [] = []
go zs = take m zs : go (drop m zs)
myPad s = pad s . centerXY
main = do
renderSVG "svg/dyckpaths.svg" svgSize $ boxSep $ map drawLatticePath $ dyckPaths 5
renderSVG "svg/latpaths.svg" svgSize $ boxSep $ map (drawLatticePath' UpRight blue True) $ latticePaths (9,3)
renderSVG "svg/partitions.svg" svgSize $ boxSep $ map (drawFerrersDiagram' EnglishNotationCCW red True) $ partitions 7
let part = mkPartition [4,3,1]
renderSVG "svg/tableaux.svg" svgSize $ boxSep $ map (drawTableau' EnglishNotation red) $ standardYoungTableaux part
renderSVG "svg/tableau1.svg" svgSize $ boxSep $ map (drawTableau' EnglishNotation red) $
[ [[123,57,9,8,88],[99,6,66,2],[1,17,3]]
, [[1,2,3,4,5],[6,7,8],[9,10]]
]
renderSVG "svg/noncrossing.svg" svgSize $ boxSep $ map (drawNonCrossingCircleDiagram' green True) $ nonCrossingPartitions 5
renderSVG "svg/planepart.svg" svgSize $ boxSep $ map drawPlanePartition3D $
[ PlanePart [[5,4,3,3,1],[4,4,2,1],[3,2],[2,1],[1],[1],[1]]
, PlanePart [[6,2,2,1,1],[3,1,1,1],[1]]
, PlanePart [[2,1,1,1,1],[1,1,1,1],[1]]
, PlanePart [[2,1],[1]]
, PlanePart [[1,1,1,1,1],[1,1,1,1],[1]]
, PlanePart [[6,2,2,1,1],[3,1,1,1],[1]]
, PlanePart [[1]]
]
renderSVG "svg/bintree.svg" svgSize $ boxSep $ map (drawBinTree_) $ binaryTrees 5
let skew1 = mkSkewPartition (Partition [8,7,3,2,2,1] , Partition [5,3,3])
skew2 = mkSkewPartition (Partition [9,7,3,2,2,1] , Partition [5,3,2,1])
renderSVG "svg/skew.svg" svgSize $ boxSep $
[ drawSkewFerrersDiagram skew1
, drawSkewFerrersDiagram' FrenchNotation green True (True,True) skew1
, drawSkewPartitionBoxes EnglishNotationCCW skew1
, drawSkewFerrersDiagram skew2
, drawSkewFerrersDiagram' FrenchNotation green True (True,True) skew2
, drawSkewPartitionBoxes EnglishNotationCCW skew2
]
let skewtableau = (semiStandardSkewTableaux 7 skew2) !! 123
skewtableau2 = (semiStandardSkewTableaux 6 skew1) !! 223
renderSVG "svg/skewtableau.svg" svgSize $ boxSep $
[ drawSkewTableau skewtableau
, drawSkewTableau' FrenchNotation red True skewtableau2
]