histogram-fill-0.1.0: Library for histograms creation.

Stabilityexperimental
MaintainerAlexey Khudyakov <alexey.skladnoy@gmail.com>

Data.Histogram.Fill

Contents

Description

Module with algorithms for histogram filling. This is pure wrapper around stateful histograms.

Synopsis

Type classes & wrappers

class HBuilderCl h whereSource

Histogram builder typeclass. Instance of this class contain instructions how to build histograms.

Methods

modifyIn :: (a' -> a) -> h a b -> h a' bSource

Convert input type of histogram from a to a'

modifyOut :: (b -> b') -> h a b -> h a b'Source

Convert output of histogram

runBuilder :: h a b -> ST s (Accum s a b)Source

Create stateful histogram from instructions. Histograms could be filled either in the ST monad or with createHistograms

data HBuilder a b Source

Abstract histogram builder. All real builders should be wrapper in this type

Instances

builderList :: [HBuilder a b] -> HBuilder a [b]Source

Wrap list of histogram builders into HBuilder.

builderListWrap :: [HBuilder a b] -> HBuilder a bSource

Wrap list of histogram builders into HBuilder and do not change return type.

Fill routines

createHistogramsSource

Arguments

:: Monoid b 
=> HBuilder a b

Instructions how to fill histograms

-> [a]

List of data to fill histogram with

-> b

Result

Create and fill histogram(s).

Histogram constructors

mkHistSource

Arguments

:: (Bin bin, UA 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. To set type of bin 'force*' function could be used.

mkHist1Source

Arguments

:: (Bin bin, UA 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. To set type of bin 'force*' function could be used.

mkHistWghSource

Arguments

:: (Bin bin, UA 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.

mkHistWgh1Source

Arguments

:: (Bin bin, UA 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.

mkHistMonoidSource

Arguments

:: (Bin bin, UA 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.

mkHistMonoid1Source

Arguments

:: (Bin bin, UA 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

forceInt :: Histogram bin Int -> Histogram bin IntSource

Function used to restrict type of histrogram.

forceDouble :: Histogram bin Double -> Histogram bin DoubleSource

Function used to restrict type of histrogram.

forceFloat :: Histogram bin Float -> Histogram bin FloatSource

Function used to restrict type of histrogram.

Internals

data HistBuilder a b Source

Generic histogram builder.