From d970ad3cf02a89563c5843d8fff750078b903dd1 Mon Sep 17 00:00:00 2001 From: Hans-Peter Deifel <hpd@hpdeifel.de> Date: Wed, 24 Oct 2018 09:37:33 +0200 Subject: [PATCH] main: Include size of partition restricted to sort 1 in stats This is especially useful for comparing the validity of the output to other implementation that only concern themselves with sort 1. --- src/MA/PartitionPrinter.hs | 11 ++++++++++- src/main/Main.hs | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/MA/PartitionPrinter.hs b/src/MA/PartitionPrinter.hs index 0278d6c..2d6470f 100644 --- a/src/MA/PartitionPrinter.hs +++ b/src/MA/PartitionPrinter.hs @@ -1,5 +1,6 @@ module MA.PartitionPrinter - ( printPartition + ( restrictPartitionToSort1 + , printPartition , writePartition , showPartition ) where @@ -24,6 +25,14 @@ import qualified Data.Partition as Partition import MA.Coalgebra.Parser (SymbolTable(..)) import MA.FunctorExpression.Sorts + +restrictPartitionToSort1 :: Encoding a (Sorted h1) -> Partition -> [[State]] +restrictPartitionToSort1 encoding partition = + let blocks = Partition.toBlocks partition + sort1 = statesWithSort1 encoding + in restrictBlocks blocks sort1 + + printPartition :: Encoding a (Sorted h1) -> SymbolTable -> Partition -> IO () printPartition enc symTab part = TLazyIO.putStr (Build.toLazyText (formatPartition enc symTab part)) diff --git a/src/main/Main.hs b/src/main/Main.hs index e42b8c4..6058ab9 100644 --- a/src/main/Main.hs +++ b/src/main/Main.hs @@ -311,6 +311,11 @@ main = do "final-partition-size" (tshow (Partition.numBlocks partition)) + logStat + stats + "explicit-final-partition-size" + (tshow (length (restrictPartitionToSort1 encoding partition))) + withTime stats "output-duration" (outputPartition (refineOutputFile r) encoding symbolTable partition) -- GitLab