Copyright | (c) Sam Raker 2016 |
---|---|
License | BSD3 |
Maintainer | sam.raker@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
- data CountMarkovMap a = CMarkovMap (Vector a) (Vector (Vector Double))
- data MarkovMap a = MarkovMap {}
- vApply :: (a -> a -> b -> c) -> b -> Vector a -> c
- vidx :: Eq a => a -> Vector a -> Int
- ded :: Eq a => Vector a -> Vector a
- makeSlices :: Vector a -> Vector (Vector a)
- nrmlz :: Vector Double -> Vector Double
- sumP :: Vector Double -> Vector Double
- pix :: Double -> Vector Double -> Int
- getNext :: Eq a => a -> Double -> MarkovMap a -> a
- buildMap :: Eq a => Vector a -> MarkovMap a
- initMap :: Eq a => Vector a -> CountMarkovMap a
- updateMarkov :: Eq a => a -> a -> CountMarkovMap a -> CountMarkovMap a
- toMarkovMap :: CountMarkovMap a -> MarkovMap a
Data structures
data CountMarkovMap a Source #
Map of counts
CMarkovMap (Vector a) (Vector (Vector Double)) | Map of counts |
Map of frequencies
Helper functions
vApply :: (a -> a -> b -> c) -> b -> Vector a -> c Source #
Apply a function to the first two elements in a vector and a third thing
vidx :: Eq a => a -> Vector a -> Int Source #
Get the index of an element in a vector
WARNING: will throw an error if x
is not in v
nrmlz :: Vector Double -> Vector Double Source #
Normalize a vector of doubles by dividing each element by the sum of the vector
sumP :: Vector Double -> Vector Double Source #
Progressively sum elements in a vector of doubles, skipping over 0s
pix :: Double -> Vector Double -> Int Source #
Get the index of the first element in a vector of doubles that's less than or equal to a value
getNext :: Eq a => a -> Double -> MarkovMap a -> a Source #
Generate the next
element from a MarkovMap
updateMarkov :: Eq a => a -> a -> CountMarkovMap a -> CountMarkovMap a Source #
Update a CountMarkovMap
a
and b
should be sequential elements
toMarkovMap :: CountMarkovMap a -> MarkovMap a Source #
Convert a CountMarkovMap to a MarkovMap by normalizing and summing its elements