Stability | experimental |
---|---|
Maintainer | Alexey Khudyakov <alexey.skladnoy@gmail.com> |
Mutable histograms.
- data HistogramST s bin a where
- HistogramST :: (Bin bin, UA a) => bin -> MUArr a s -> MUArr a s -> HistogramST s bin a
- newHistogramST :: (Bin bin, UA a) => a -> bin -> ST s (HistogramST s bin a)
- fillOne :: Num a => HistogramST s bin a -> BinValue bin -> ST s ()
- fillOneW :: Num a => HistogramST s bin a -> (BinValue bin, a) -> ST s ()
- fillMonoid :: Monoid a => HistogramST s bin a -> (BinValue bin, a) -> ST s ()
- freezeHist :: HistogramST s bin a -> ST s (Histogram bin a)
- class Accumulator h where
- data Accum s a b where
- Accum :: Accumulator h => h s a b -> Accum s a b
- accumList :: [ST s (Accum s a b)] -> ST s (Accum s a b)
- accumHist :: Bin bin => (a -> HistogramST s bin val -> ST s ()) -> (Histogram bin val -> b) -> HistogramST s bin val -> ST s (Accum s a b)
- fillHistograms :: Monoid b => (forall s. ST s (Accum s a b)) -> [a] -> b
Mutable histograms
data HistogramST s bin a whereSource
Mutable histogram.
HistogramST :: (Bin bin, UA a) => bin -> MUArr a s -> MUArr a s -> HistogramST s bin a |
newHistogramST :: (Bin bin, UA a) => a -> bin -> ST s (HistogramST s bin a)Source
Create new mutable histogram. All bins are set to zero element as passed to function.
fillOne :: Num a => HistogramST s bin a -> BinValue bin -> ST s ()Source
Put one value into histogram
fillOneW :: Num a => HistogramST s bin a -> (BinValue bin, a) -> ST s ()Source
Put one value into histogram with weight
fillMonoid :: Monoid a => HistogramST s bin a -> (BinValue bin, a) -> ST s ()Source
Put one monoidal element
freezeHist :: HistogramST s bin a -> ST s (Histogram bin a)Source
Create immutable histogram from mutable one. This operation involve copying.
Accumulators
class Accumulator h whereSource
This is class with accumulation semantics. It's used to fill many histogram at once. It accept values of type a and return data of type b.
putOne :: h s a b -> a -> ST s ()Source
Put one element into accumulator
extract :: Monoid b => h s a b -> ST s bSource
Extract data from historam
Accumulator AccumHist | |
Accumulator AccumList | |
Accumulator Accum |
Abstract wrapper for histograms.
Accum :: Accumulator h => h s a b -> Accum s a b |
accumHist :: Bin bin => (a -> HistogramST s bin val -> ST s ()) -> (Histogram bin val -> b) -> HistogramST s bin val -> ST s (Accum s a b)Source
Accumulator for arbitrary HistogramST
based histogram
fillHistograms :: Monoid b => (forall s. ST s (Accum s a b)) -> [a] -> bSource
Put all values into histogram and return result