HMarkov-1.0.0.3: Markov-generated sequences

Copyright(c) Sam Raker 2016
LicenseBSD3
Maintainersam.raker@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Data.Markov.HMarkov.Helpers

Contents

Description

 

Synopsis

Data structures

data CountMarkovMap a Source #

Map of counts

Constructors

CMarkovMap (Vector a) (Vector (Vector Double))

Map of counts

data MarkovMap a Source #

Map of frequencies

Constructors

MarkovMap 

Fields

Instances

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

ded :: Eq a => Vector a -> Vector a Source #

Deduplicate a vector

makeSlices :: Vector a -> Vector (Vector a) Source #

Make 2-element (vector) slices of a vector

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

buildMap :: Eq a => Vector a -> MarkovMap a Source #

Build a MarkovMap from a vector of elements

initMap :: Eq a => Vector a -> CountMarkovMap a Source #

Initialize a CountMarkovMap from a vector

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