histogram-fill-0.1.0: Library for histograms creation.

Stability experimental Alexey Khudyakov

Data.Histogram.Bin

Description

Binning algorithms. This is mapping from set of interest to integer indices and approximate reverse.

Synopsis

# 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

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

Instances

 Read BinI Show BinI Bin BinI

# Floating point bins

data BinF f Source

Floaintg point bins with equal sizes.

Instances

 (Read f, RealFrac f) => Read (BinF f) Show f => Show (BinF f) Bin (BinF f)

Arguments

 :: RealFrac f => f Lower bound of range -> Int Number of bins -> f Upper bound of range -> BinF f

Create bins

Arguments

 :: RealFrac f => f Begin of range -> f Size of step -> f Approximation of end of range -> 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

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`.