histogram-fill-0.9.1.0: Library for histograms creation.

CopyrightCopyright (c) 2011 Alexey Khudyakov <alexey.skladnoy@gmail.com>
LicenseBSD3
MaintainerAlexey Khudyakov <alexey.skladnoy@gmail.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell98

Data.Histogram.Bin.Classes

Contents

Description

Type classes for binning algorithms. This is mapping from set of interest to integer indices and approximate reverse.

Synopsis

Bin type class

class Bin b where #

This type represent some abstract data binning algorithms. It maps sets/intervals of values of type 'BinValue b' to integer indices.

Following invariant is expected to hold:

toIndex . fromIndex == id

Minimal complete definition

toIndex, fromIndex, nBins

Associated Types

type BinValue b #

Type of value to bin

Methods

toIndex :: b -> BinValue b -> Int #

Convert from value to index. Function must not fail for any input and should produce out of range indices for invalid input.

fromIndex :: b -> Int -> BinValue b #

Convert from index to value. Returned value should correspond to center of bin. Definition of center is left for definition of instance. Funtion may fail for invalid indices but encouraged not to do so.

nBins :: b -> Int #

Total number of bins. Must be non-negative.

inRange :: b -> BinValue b -> Bool #

Check whether value in range. Have default implementation. Should satisfy: inRange b x ⇔ toIndex b x ∈ [0,nBins b)

Instances
Bin LogBinD # 
Instance details

Defined in Data.Histogram.Bin.LogBinD

Associated Types

type BinValue LogBinD :: * #

Bin BinInt # 
Instance details

Defined in Data.Histogram.Bin.BinInt

Associated Types

type BinValue BinInt :: * #

Bin BinI # 
Instance details

Defined in Data.Histogram.Bin.BinI

Associated Types

type BinValue BinI :: * #

Bin BinD # 
Instance details

Defined in Data.Histogram.Bin.BinF

Associated Types

type BinValue BinD :: * #

RealFrac f => Bin (BinF f) # 
Instance details

Defined in Data.Histogram.Bin.BinF

Associated Types

type BinValue (BinF f) :: * #

Methods

toIndex :: BinF f -> BinValue (BinF f) -> Int #

fromIndex :: BinF f -> Int -> BinValue (BinF f) #

nBins :: BinF f -> Int #

inRange :: BinF f -> BinValue (BinF f) -> Bool #

Enum a => Bin (BinEnum a) # 
Instance details

Defined in Data.Histogram.Bin.BinEnum

Associated Types

type BinValue (BinEnum a) :: * #

Bin b => Bin (BinPermute b) # 
Instance details

Defined in Data.Histogram.Bin.Extra

Associated Types

type BinValue (BinPermute b) :: * #

Enum2D i => Bin (BinEnum2D i) # 
Instance details

Defined in Data.Histogram.Bin.Extra

Associated Types

type BinValue (BinEnum2D i) :: * #

Bin bin => Bin (MaybeBin bin) # 
Instance details

Defined in Data.Histogram.Bin.MaybeBin

Associated Types

type BinValue (MaybeBin bin) :: * #

Methods

toIndex :: MaybeBin bin -> BinValue (MaybeBin bin) -> Int #

fromIndex :: MaybeBin bin -> Int -> BinValue (MaybeBin bin) #

nBins :: MaybeBin bin -> Int #

inRange :: MaybeBin bin -> BinValue (MaybeBin bin) -> Bool #

(Vector v a, Ord a, Fractional a) => Bin (BinVarG v a) # 
Instance details

Defined in Data.Histogram.Bin.BinVar

Associated Types

type BinValue (BinVarG v a) :: * #

Methods

toIndex :: BinVarG v a -> BinValue (BinVarG v a) -> Int #

fromIndex :: BinVarG v a -> Int -> BinValue (BinVarG v a) #

nBins :: BinVarG v a -> Int #

inRange :: BinVarG v a -> BinValue (BinVarG v a) -> Bool #

(Bin binX, Bin binY) => Bin (Bin2D binX binY) # 
Instance details

Defined in Data.Histogram.Bin.Bin2D

Associated Types

type BinValue (Bin2D binX binY) :: * #

Methods

toIndex :: Bin2D binX binY -> BinValue (Bin2D binX binY) -> Int #

fromIndex :: Bin2D binX binY -> Int -> BinValue (Bin2D binX binY) #

nBins :: Bin2D binX binY -> Int #

inRange :: Bin2D binX binY -> BinValue (Bin2D binX binY) -> Bool #

binsCenters :: (Bin b, Vector v (BinValue b)) => b -> v (BinValue b) #

Return vector of bin centers

Approximate equality

class Bin b => BinEq b where #

Approximate equality for bins. It's nessesary to define approximate equality since exact equality is ill defined for bins which work with floating point data. It's not safe to compare floating point numbers for exact equality

Minimal complete definition

binEq

Methods

binEq :: b -> b -> Bool #

Approximate equality

Instances
BinEq LogBinD # 
Instance details

Defined in Data.Histogram.Bin.LogBinD

Methods

binEq :: LogBinD -> LogBinD -> Bool #

BinEq BinInt # 
Instance details

Defined in Data.Histogram.Bin.BinInt

Methods

binEq :: BinInt -> BinInt -> Bool #

BinEq BinI # 
Instance details

Defined in Data.Histogram.Bin.BinI

Methods

binEq :: BinI -> BinI -> Bool #

BinEq BinD #

Equality is up to 3e-11 (2/3th of digits)

Instance details

Defined in Data.Histogram.Bin.BinF

Methods

binEq :: BinD -> BinD -> Bool #

RealFloat f => BinEq (BinF f) #

Equality is up to 2/3th of digits

Instance details

Defined in Data.Histogram.Bin.BinF

Methods

binEq :: BinF f -> BinF f -> Bool #

Enum a => BinEq (BinEnum a) # 
Instance details

Defined in Data.Histogram.Bin.BinEnum

Methods

binEq :: BinEnum a -> BinEnum a -> Bool #

BinEq bin => BinEq (MaybeBin bin) # 
Instance details

Defined in Data.Histogram.Bin.MaybeBin

Methods

binEq :: MaybeBin bin -> MaybeBin bin -> Bool #

(Vector v a, Vector v Bool, Ord a, Fractional a) => BinEq (BinVarG v a) #

Equality is up to 3e-11 (2/3th of digits)

Instance details

Defined in Data.Histogram.Bin.BinVar

Methods

binEq :: BinVarG v a -> BinVarG v a -> Bool #

(BinEq bx, BinEq by) => BinEq (Bin2D bx by) # 
Instance details

Defined in Data.Histogram.Bin.Bin2D

Methods

binEq :: Bin2D bx by -> Bin2D bx by -> Bool #

1D bins

class (Bin b, Ord (BinValue b)) => IntervalBin b where #

For binning algorithms which work with bin values which have some natural ordering and every bin is continous interval.

Minimal complete definition

binInterval

Methods

binInterval :: b -> Int -> (BinValue b, BinValue b) #

Interval for n'th bin

binsList :: Vector v (BinValue b, BinValue b) => b -> v (BinValue b, BinValue b) #

List of all bins. Could be overridden for efficiency.

Instances
IntervalBin LogBinD # 
Instance details

Defined in Data.Histogram.Bin.LogBinD

IntervalBin BinInt # 
Instance details

Defined in Data.Histogram.Bin.BinInt

IntervalBin BinI # 
Instance details

Defined in Data.Histogram.Bin.BinI

IntervalBin BinD # 
Instance details

Defined in Data.Histogram.Bin.BinF

RealFrac f => IntervalBin (BinF f) # 
Instance details

Defined in Data.Histogram.Bin.BinF

Methods

binInterval :: BinF f -> Int -> (BinValue (BinF f), BinValue (BinF f)) #

binsList :: Vector v (BinValue (BinF f), BinValue (BinF f)) => BinF f -> v (BinValue (BinF f), BinValue (BinF f)) #

(Enum a, Ord a) => IntervalBin (BinEnum a) # 
Instance details

Defined in Data.Histogram.Bin.BinEnum

IntervalBin b => IntervalBin (BinPermute b) # 
Instance details

Defined in Data.Histogram.Bin.Extra

(Vector v a, Ord a, Fractional a) => IntervalBin (BinVarG v a) # 
Instance details

Defined in Data.Histogram.Bin.BinVar

Methods

binInterval :: BinVarG v a -> Int -> (BinValue (BinVarG v a), BinValue (BinVarG v a)) #

binsList :: Vector v0 (BinValue (BinVarG v a), BinValue (BinVarG v a)) => BinVarG v a -> v0 (BinValue (BinVarG v a), BinValue (BinVarG v a)) #

class IntervalBin b => Bin1D b where #

IntervalBin which domain is single finite interval

Minimal complete definition

lowerLimit, upperLimit

Methods

lowerLimit :: b -> BinValue b #

Minimal accepted value of histogram

upperLimit :: b -> BinValue b #

Maximal accepted value of histogram

Instances
Bin1D LogBinD # 
Instance details

Defined in Data.Histogram.Bin.LogBinD

Bin1D BinInt # 
Instance details

Defined in Data.Histogram.Bin.BinInt

Bin1D BinI # 
Instance details

Defined in Data.Histogram.Bin.BinI

Bin1D BinD # 
Instance details

Defined in Data.Histogram.Bin.BinF

RealFrac f => Bin1D (BinF f) # 
Instance details

Defined in Data.Histogram.Bin.BinF

Methods

lowerLimit :: BinF f -> BinValue (BinF f) #

upperLimit :: BinF f -> BinValue (BinF f) #

(Enum a, Ord a) => Bin1D (BinEnum a) # 
Instance details

Defined in Data.Histogram.Bin.BinEnum

(Vector v a, Ord a, Fractional a) => Bin1D (BinVarG v a) # 
Instance details

Defined in Data.Histogram.Bin.BinVar

Methods

lowerLimit :: BinVarG v a -> BinValue (BinVarG v a) #

upperLimit :: BinVarG v a -> BinValue (BinVarG v a) #

class Bin b => SliceableBin b where #

Binning algorithm which support slicing.

Minimal complete definition

unsafeSliceBin

Methods

unsafeSliceBin :: Int -> Int -> b -> b #

Slice bin by indices. This function doesn't perform any checks and may produce invalid bin. Use sliceBin instead.

Instances
SliceableBin LogBinD # 
Instance details

Defined in Data.Histogram.Bin.LogBinD

Methods

unsafeSliceBin :: Int -> Int -> LogBinD -> LogBinD #

SliceableBin BinInt # 
Instance details

Defined in Data.Histogram.Bin.BinInt

Methods

unsafeSliceBin :: Int -> Int -> BinInt -> BinInt #

SliceableBin BinI # 
Instance details

Defined in Data.Histogram.Bin.BinI

Methods

unsafeSliceBin :: Int -> Int -> BinI -> BinI #

SliceableBin BinD # 
Instance details

Defined in Data.Histogram.Bin.BinF

Methods

unsafeSliceBin :: Int -> Int -> BinD -> BinD #

RealFrac f => SliceableBin (BinF f) # 
Instance details

Defined in Data.Histogram.Bin.BinF

Methods

unsafeSliceBin :: Int -> Int -> BinF f -> BinF f #

(Enum a, Ord a) => SliceableBin (BinEnum a) # 
Instance details

Defined in Data.Histogram.Bin.BinEnum

Methods

unsafeSliceBin :: Int -> Int -> BinEnum a -> BinEnum a #

(Vector v a, Ord a, Fractional a) => SliceableBin (BinVarG v a) # 
Instance details

Defined in Data.Histogram.Bin.BinVar

Methods

unsafeSliceBin :: Int -> Int -> BinVarG v a -> BinVarG v a #

sliceBin #

Arguments

:: SliceableBin b 
=> Int

Index of first bin

-> Int

Index of last bin

-> b 
-> b 

Slice bin using indices

class Bin b => MergeableBin b where #

Bin which support rebinning.

Minimal complete definition

unsafeMergeBins

Methods

unsafeMergeBins :: CutDirection -> Int -> b -> b #

N consecutive bins are joined into single bin. If number of bins isn't multiple of N remaining bins with highest or lowest index are dropped. This function doesn't do any checks. Use mergeBins instead.

Instances
MergeableBin LogBinD # 
Instance details

Defined in Data.Histogram.Bin.LogBinD

MergeableBin BinInt # 
Instance details

Defined in Data.Histogram.Bin.BinInt

MergeableBin BinD # 
Instance details

Defined in Data.Histogram.Bin.BinF

RealFrac f => MergeableBin (BinF f) # 
Instance details

Defined in Data.Histogram.Bin.BinF

Methods

unsafeMergeBins :: CutDirection -> Int -> BinF f -> BinF f #

data CutDirection #

How index should be dropped

Constructors

CutLower

Drop bins with smallest index

CutHigher

Drop bins with bigger index

Instances
Data CutDirection # 
Instance details

Defined in Data.Histogram.Bin.Classes

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CutDirection -> c CutDirection #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CutDirection #

toConstr :: CutDirection -> Constr #

dataTypeOf :: CutDirection -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CutDirection) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CutDirection) #

gmapT :: (forall b. Data b => b -> b) -> CutDirection -> CutDirection #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CutDirection -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CutDirection -> r #

gmapQ :: (forall d. Data d => d -> u) -> CutDirection -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CutDirection -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CutDirection -> m CutDirection #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CutDirection -> m CutDirection #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CutDirection -> m CutDirection #

Show CutDirection # 
Instance details

Defined in Data.Histogram.Bin.Classes

Generic CutDirection # 
Instance details

Defined in Data.Histogram.Bin.Classes

Associated Types

type Rep CutDirection :: * -> * #

type Rep CutDirection # 
Instance details

Defined in Data.Histogram.Bin.Classes

type Rep CutDirection = D1 (MetaData "CutDirection" "Data.Histogram.Bin.Classes" "histogram-fill-0.9.1.0-cqo83hCr1GDd9gkaTO5gI" False) (C1 (MetaCons "CutLower" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "CutHigher" PrefixI False) (U1 :: * -> *))

mergeBins :: MergeableBin b => CutDirection -> Int -> b -> b #

N consecutive bins are joined into single bin. If number of bins isn't multiple of N remaining bins with highest or lowest index are dropped. If N is larger than number of bins all bins are merged into single one.

Sizes of bin

class Bin b => VariableBin b where #

1D binning algorithms with variable bin size

Minimal complete definition

binSizeN

Methods

binSizeN :: b -> Int -> BinValue b #

Size of n'th bin.

Instances
VariableBin LogBinD # 
Instance details

Defined in Data.Histogram.Bin.LogBinD

VariableBin BinInt # 
Instance details

Defined in Data.Histogram.Bin.BinInt

VariableBin BinI # 
Instance details

Defined in Data.Histogram.Bin.BinI

Methods

binSizeN :: BinI -> Int -> BinValue BinI #

VariableBin BinD # 
Instance details

Defined in Data.Histogram.Bin.BinF

Methods

binSizeN :: BinD -> Int -> BinValue BinD #

RealFrac f => VariableBin (BinF f) # 
Instance details

Defined in Data.Histogram.Bin.BinF

Methods

binSizeN :: BinF f -> Int -> BinValue (BinF f) #

VariableBin b => VariableBin (BinPermute b) # 
Instance details

Defined in Data.Histogram.Bin.Extra

Methods

binSizeN :: BinPermute b -> Int -> BinValue (BinPermute b) #

VariableBin bin => VariableBin (MaybeBin bin) # 
Instance details

Defined in Data.Histogram.Bin.MaybeBin

Methods

binSizeN :: MaybeBin bin -> Int -> BinValue (MaybeBin bin) #

(Vector v a, Ord a, Fractional a) => VariableBin (BinVarG v a) # 
Instance details

Defined in Data.Histogram.Bin.BinVar

Methods

binSizeN :: BinVarG v a -> Int -> BinValue (BinVarG v a) #

class VariableBin b => UniformBin b where #

1D binning algorithms with constant size bins. Constant sized bins could be thought as specialization of variable-sized bins therefore a superclass constraint.

Methods

binSize :: b -> BinValue b #

Size of bin. Default implementation just uses 0th bin.

Instances
UniformBin BinInt # 
Instance details

Defined in Data.Histogram.Bin.BinInt

UniformBin BinI # 
Instance details

Defined in Data.Histogram.Bin.BinI

Methods

binSize :: BinI -> BinValue BinI #

UniformBin BinD # 
Instance details

Defined in Data.Histogram.Bin.BinF

Methods

binSize :: BinD -> BinValue BinD #

RealFrac f => UniformBin (BinF f) # 
Instance details

Defined in Data.Histogram.Bin.BinF

Methods

binSize :: BinF f -> BinValue (BinF f) #

UniformBin b => UniformBin (BinPermute b) # 
Instance details

Defined in Data.Histogram.Bin.Extra

Conversion

class (Bin b, Bin b') => ConvertBin b b' where #

Class for conversion between binning algorithms.

Minimal complete definition

convertBin

Methods

convertBin :: b -> b' #

Convert bins

Instances
ConvertBin BinInt BinD # 
Instance details

Defined in Data.Histogram.Bin

Methods

convertBin :: BinInt -> BinD #

ConvertBin BinI BinInt # 
Instance details

Defined in Data.Histogram.Bin

Methods

convertBin :: BinI -> BinInt #

ConvertBin BinI BinD # 
Instance details

Defined in Data.Histogram.Bin

Methods

convertBin :: BinI -> BinD #

RealFrac f => ConvertBin BinInt (BinF f) # 
Instance details

Defined in Data.Histogram.Bin

Methods

convertBin :: BinInt -> BinF f #

RealFrac f => ConvertBin BinI (BinF f) # 
Instance details

Defined in Data.Histogram.Bin

Methods

convertBin :: BinI -> BinF f #

(Bin1D b, Vector v (BinValue b), Vector v Bool, a ~ BinValue b, Fractional a) => ConvertBin b (BinVarG v a) # 
Instance details

Defined in Data.Histogram.Bin.BinVar

Methods

convertBin :: b -> BinVarG v a #

(ConvertBin bx bx', ConvertBin by by') => ConvertBin (Bin2D bx by) (Bin2D bx' by') # 
Instance details

Defined in Data.Histogram.Bin

Methods

convertBin :: Bin2D bx by -> Bin2D bx' by' #

(ConvertBin by by', Bin bx) => ConvertBin (Bin2D bx by) (Bin2D bx by') # 
Instance details

Defined in Data.Histogram.Bin

Methods

convertBin :: Bin2D bx by -> Bin2D bx by' #

(ConvertBin bx bx', Bin by) => ConvertBin (Bin2D bx by) (Bin2D bx' by) # 
Instance details

Defined in Data.Histogram.Bin

Methods

convertBin :: Bin2D bx by -> Bin2D bx' by #