Stability | experimental |
---|---|
Maintainer | Alexey Khudyakov <alexey.skladnoy@gmail.com> |
Module with algorithms for histogram filling. This is pure wrapper around stateful histograms.
- class HistBuilder h where
- data HBuilderST s a b
- feedOne :: HBuilderST s a b -> a -> ST s ()
- freezeHBuilderST :: HBuilderST s a b -> ST s b
- joinHBuilderST :: [HBuilderST s a b] -> HBuilderST s a [b]
- joinHBuilderSTList :: [HBuilderST s a [b]] -> HBuilderST s a [b]
- treeHBuilderST :: [HBuilderST s a b -> HBuilderST s a' b'] -> HBuilderST s a b -> HBuilderST s a' [b']
- data HBuilderIO a b
- feedOneIO :: HBuilderIO a b -> a -> IO ()
- freezeHBuilderIO :: HBuilderIO a b -> IO b
- joinHBuilderIO :: [HBuilderIO a b] -> HBuilderIO a [b]
- joinHBuilderIOList :: [HBuilderIO a [b]] -> HBuilderIO a [b]
- treeHBuilderIO :: [HBuilderIO a b -> HBuilderIO a' b'] -> HBuilderIO a b -> HBuilderIO a' [b']
- data HBuilder a b
- joinHBuilder :: [HBuilder a b] -> HBuilder a [b]
- joinHBuilderList :: [HBuilder a [b]] -> HBuilder a [b]
- treeHBuilder :: [HBuilder a b -> HBuilder a' b'] -> HBuilder a b -> HBuilder a' [b']
- toBuilderST :: HBuilder a b -> forall s. ST s (HBuilderST s a b)
- toBuilderIO :: HBuilder a b -> IO (HBuilderIO a b)
- builderSTtoIO :: HBuilderST RealWorld a b -> HBuilderIO a b
- fillBuilder :: HBuilder a b -> [a] -> b
- module Data.Histogram.Bin
- mkHist1 :: (Bin bin, Unbox val, Num val) => bin -> (Histogram bin val -> b) -> (a -> BinValue bin) -> HBuilder a b
- mkHist :: (Bin bin, Unbox val, Num val) => bin -> (Histogram bin val -> b) -> (a -> [BinValue bin]) -> HBuilder a b
- mkHistMaybe :: (Bin bin, Unbox val, Num val) => bin -> (Histogram bin val -> b) -> (a -> Maybe (BinValue bin)) -> HBuilder a b
- mkHistWgh1 :: (Bin bin, Unbox val, Num val) => bin -> (Histogram bin val -> b) -> (a -> (BinValue bin, val)) -> HBuilder a b
- mkHistWgh :: (Bin bin, Unbox val, Num val) => bin -> (Histogram bin val -> b) -> (a -> [(BinValue bin, val)]) -> HBuilder a b
- mkHistWghMaybe :: (Bin bin, Unbox val, Num val) => bin -> (Histogram bin val -> b) -> (a -> Maybe (BinValue bin, val)) -> HBuilder a b
- mkHistMonoid1 :: (Bin bin, Unbox val, Monoid val) => bin -> (Histogram bin val -> b) -> (a -> (BinValue bin, val)) -> HBuilder a b
- mkHistMonoid :: (Bin bin, Unbox val, Monoid val) => bin -> (Histogram bin val -> b) -> (a -> [(BinValue bin, val)]) -> HBuilder a b
- mkHistMonoidMaybe :: (Bin bin, Unbox val, Monoid val) => bin -> (Histogram bin val -> b) -> (a -> Maybe (BinValue bin, val)) -> HBuilder a b
- forceInt :: Histogram bin Int -> Histogram bin Int
- forceDouble :: Histogram bin Double -> Histogram bin Double
- forceFloat :: Histogram bin Float -> Histogram bin Float
Type classes
class HistBuilder h whereSource
Histogram builder typeclass. Instance of this class contain instructions how to build histograms.
modifyIn :: (a' -> a) -> h a b -> h a' bSource
Convert input type of histogram from a to a'
modifyMaybe :: h a b -> h (Maybe a) bSource
Make input function accept value only if it's Just a.
addCut :: (a -> Bool) -> h a b -> h a bSource
Add cut to histogram. Only put value histogram if condition is true.
modifyOut :: (b -> b') -> h a b -> h a b'Source
Convert output of histogram
Histogram builders
Stateful
data HBuilderST s a b Source
Stateful histogram builder.
HistBuilder (HBuilderST s) | |
Functor (HBuilderST s a) |
feedOne :: HBuilderST s a b -> a -> ST s ()Source
Put one value into histogram
freezeHBuilderST :: HBuilderST s a b -> ST s bSource
Create stateful histogram from instructions. Histograms could be filled either in the ST monad or with createHistograms
joinHBuilderST :: [HBuilderST s a b] -> HBuilderST s a [b]Source
Join list of builders into one builder
joinHBuilderSTList :: [HBuilderST s a [b]] -> HBuilderST s a [b]Source
Join list of builders into one builders
treeHBuilderST :: [HBuilderST s a b -> HBuilderST s a' b'] -> HBuilderST s a b -> HBuilderST s a' [b']Source
IO based
feedOneIO :: HBuilderIO a b -> a -> IO ()Source
Put one value into histogram
freezeHBuilderIO :: HBuilderIO a b -> IO bSource
Create stateful histogram from instructions. Histograms could be filled either in the ST monad or with createHistograms
joinHBuilderIO :: [HBuilderIO a b] -> HBuilderIO a [b]Source
Join list of builders into one builder
joinHBuilderIOList :: [HBuilderIO a [b]] -> HBuilderIO a [b]Source
Join list of builders into one builders
treeHBuilderIO :: [HBuilderIO a b -> HBuilderIO a' b'] -> HBuilderIO a b -> HBuilderIO a' [b']Source
Stateless
joinHBuilder :: [HBuilder a b] -> HBuilder a [b]Source
Join list of builders
joinHBuilderList :: [HBuilder a [b]] -> HBuilder a [b]Source
Join list of builders
Conversion between builders
toBuilderST :: HBuilder a b -> forall s. ST s (HBuilderST s a b)Source
toBuilderIO :: HBuilder a b -> IO (HBuilderIO a b)Source
Convert stateless builder to IO based one
builderSTtoIO :: HBuilderST RealWorld a b -> HBuilderIO a bSource
Convert ST base builder to IO based one
Fill histograms
fillBuilder :: HBuilder a b -> [a] -> bSource
Histogram constructors
module Data.Histogram.Bin
Fixed weigth histograms
:: (Bin bin, Unbox val, Num val) | |
=> bin | Bin information |
-> (Histogram bin val -> b) | Output function |
-> (a -> BinValue bin) | Input function |
-> HBuilder a b |
Create histogram builder which take single item as input. Each item has weight 1.
:: (Bin bin, Unbox val, Num val) | |
=> bin | Bin information |
-> (Histogram bin val -> b) | Output function |
-> (a -> [BinValue bin]) | Input function |
-> HBuilder a b |
Create histogram builder which take many items as input. Each item has weight 1.
:: (Bin bin, Unbox val, Num val) | |
=> bin | Bin information |
-> (Histogram bin val -> b) | Output function |
-> (a -> Maybe (BinValue bin)) | Input function |
-> HBuilder a b |
Create histogram builder which at most one item as input. Each item has weight 1.
Weighted histograms
:: (Bin bin, Unbox val, Num val) | |
=> bin | Bin information |
-> (Histogram bin val -> b) | Output function |
-> (a -> (BinValue bin, val)) | Input function |
-> HBuilder a b |
Create histogram with weighted bin. Takes one item at time.
:: (Bin bin, Unbox val, Num val) | |
=> bin | Bin information |
-> (Histogram bin val -> b) | Output function |
-> (a -> [(BinValue bin, val)]) | Input function |
-> HBuilder a b |
Create histogram with weighted bin. Takes many items at time.
:: (Bin bin, Unbox val, Num val) | |
=> bin | Bin information |
-> (Histogram bin val -> b) | Output function |
-> (a -> Maybe (BinValue bin, val)) | Input function |
-> HBuilder a b |
Create histogram with weighted bin. Takes many items at time.
Histograms with monoidal bins
:: (Bin bin, Unbox val, Monoid val) | |
=> bin | Bin information |
-> (Histogram bin val -> b) | Output function |
-> (a -> (BinValue bin, val)) | Input function |
-> HBuilder a b |
Create histogram with monoidal bins
:: (Bin bin, Unbox val, Monoid val) | |
=> bin | Bin information |
-> (Histogram bin val -> b) | Output function |
-> (a -> [(BinValue bin, val)]) | Input function |
-> HBuilder a b |
Create histogram with monoidal bins. Takes many items at time.
:: (Bin bin, Unbox val, Monoid val) | |
=> bin | Bin information |
-> (Histogram bin val -> b) | Output function |
-> (a -> Maybe (BinValue bin, val)) | Input function |
-> HBuilder a b |
Create histogram with monoidal bins
Auxillary functions
forceInt :: Histogram bin Int -> Histogram bin IntSource
Function used to restrict type of histrogram.