Commit cab34a04 authored by Hans-Peter Deifel's avatar Hans-Peter Deifel 🐢

wta: Remove debug output

parent 15bde6cb
......@@ -9,13 +9,11 @@ import Data.Tuple
import Types
import Debug.Trace
newtype IndexedTransition = Index Integer
deriving (Show)
maxIndex :: WTASpec m -> IndexedTransition
maxIndex spec =
maxIndex spec =
let n = numStates spec
(t, _) = transitionsPerState spec
in Index (fromIntegral n * t)
......@@ -25,7 +23,7 @@ fromIndex spec (Index i) =
let n = numStates spec
(t, symbolSums) = transitionsPerState spec
(state, stateTransition) = traceShow i $ i `divMod` t
(state, stateTransition) = i `divMod` t
-- fromJust is justified (ho ho) here, since `stateTransition` should
-- never be greater than the total number of possible transitions for this
......@@ -36,8 +34,8 @@ fromIndex spec (Index i) =
symbolBounds :: Vector Int = V.cons (numSymbols spec V.! arity) (V.replicate arity n)
symbolDigits = decodeFromInt symbolBounds arityTransition
symbol = V.head symbolDigits
successors = V.tail symbolDigits
symbol = V.head symbolDigits
successors = V.tail symbolDigits
trans = Transition
......@@ -55,7 +53,7 @@ index spec state trans =
arity :: Int = summandArity spec (summand trans)
symbolBounds :: Vector Int = V.cons (numSymbols spec V.! arity) (V.replicate arity (numStates spec))
arityIdx :: Integer = encodeAsInt symbolBounds (V.cons (symbol trans) (V.map fromState $ successors trans))
arityIdx :: Integer = encodeAsInt symbolBounds (V.cons (symbol trans) (V.map fromState $ successors trans))
stateLocal :: Integer = symbolSums V.! arity + arityIdx
in Index $ (fromIntegral state) * t + stateLocal
......@@ -71,7 +69,7 @@ aritySummand spec arity =
in V.length (V.filter (/= 0) (V.take arity arities))
transitionsPerState :: WTASpec m -> (Integer, Vector Integer)
transitionsPerState spec =
transitionsPerState spec =
let n = numStates spec
tPerSymbol = (V.imap (\i syms -> fromIntegral $ syms * n ^ i) (numSymbols spec))
runningTotal = V.scanl' (+) 0 tPerSymbol
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment