histogram-fill-0.1.0: Library for histograms creation.Source codeContentsIndex
Data.Histogram.Bin
Stabilityexperimental
MaintainerAlexey Khudyakov <alexey.skladnoy@gmail.com>
Contents
Type class
Integer bins
Floating point bins
2D bins
Description
Binning algorithms. This is mapping from set of interest to integer indices and approximate reverse.
Synopsis
class Bin b where
type BinValue b
toIndex :: b -> BinValue b -> Int
fromIndex :: b -> Int -> BinValue b
nBins :: b -> Int
data BinI = BinI !Int !Int
data BinF f
binF :: RealFrac f => f -> Int -> f -> BinF f
binFn :: RealFrac f => f -> f -> f -> BinF f
data Bin2D bin1 bin2 = Bin2D bin1 bin2
(><) :: bin1 -> bin2 -> Bin2D bin1 bin2
Type class
class Bin b whereSource

Abstract binning algorithm. Following invariant is expected to hold:

 toIndex . fromIndex == id

Reverse is not nessearily true.

Associated Types
type BinValue b Source
Type of value to bin
Methods
toIndex :: b -> BinValue b -> IntSource
Convert from value to index. No bound checking performed
fromIndex :: b -> Int -> BinValue bSource
Convert from index to value.
nBins :: b -> IntSource
Total number of bins
show/hide Instances
Bin BinI
Bin (BinF f)
(Bin bin1, Bin bin2) => Bin (Bin2D bin1 bin2)
Integer bins
data BinI Source
Integer bins. This is inclusive interval [from,to]
Constructors
BinI !Int !Int
show/hide Instances
Floating point bins
data BinF f Source
Floaintg point bins with equal sizes.
show/hide Instances
(Read f, RealFrac f) => Read (BinF f)
Show f => Show (BinF f)
Bin (BinF f)
binFSource
:: RealFrac f
=> fNumber of bins
-> IntUpper bound of range
-> f
-> BinF f
Create bins
binFnSource
:: RealFrac f
=> fSize of step
-> fApproximation of end of range
-> f
-> BinF f
Create bins. Note that actual upper bound can differ from specified.
2D bins
data Bin2D bin1 bin2 Source
2D bins. bin1 is binning along X axis and bin2 is one along Y axis.
Constructors
Bin2D bin1 bin2
show/hide Instances
(Read b1, Read b2) => Read (Bin2D b1 b2)
(Show b1, Show b2) => Show (Bin2D b1 b2)
(Bin bin1, Bin bin2) => Bin (Bin2D bin1 bin2)
(><) :: bin1 -> bin2 -> Bin2D bin1 bin2Source
Alias for Bin2D.
Produced by Haddock version 2.6.0