histogram-fill-0.8.4.1: Library for histograms creation.

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

Data.Histogram

Contents

Description

Immutable histograms. This module export same APi as Generic but specialzed to unboxed vectors. Refer aforementioned module for documentation.

Synopsis

Immutable histogram

Immutable histograms

type Histogram bin a = Histogram Vector bin a Source

Immutable histogram. Histogram consists of binning algorithm, optional number of under and overflows, and data.

Constructors

histogram :: (Unbox a, Bin bin) => bin -> Vector a -> Histogram bin a Source

histogramUO :: (Unbox a, Bin bin) => bin -> Maybe (a, a) -> Vector a -> Histogram bin a Source

Conversion to other data types

asList :: (Unbox a, Bin bin) => Histogram bin a -> [(BinValue bin, a)] Source

asVector :: (Bin bin, Unbox a, Unbox (BinValue bin), Unbox (BinValue bin, a)) => Histogram bin a -> Vector (BinValue bin, a) Source

Serialization to strings

readHistogram :: (Read bin, Read a, Bin bin, Unbox a) => String -> Histogram bin a Source

readFileHistogram :: (Read bin, Read a, Bin bin, Unbox a) => FilePath -> IO (Histogram bin a) Source

Accessors

bins :: Histogram bin a -> bin Source

outOfRange :: Histogram bin a -> Maybe (a, a) Source

Indexing

data HistIndex b Source

Point inside histogram's domain. It could be either bin index or bin value. First and Last constructors are useful for histogram slicing.

Constructors

Index Int

Index for a bin

Value (BinValue b)

Value

First

Bin with index 0

Last

Bin maximum index.

Instances

Typeable (* -> *) HistIndex 

histIndex :: Bin b => b -> HistIndex b -> Int Source

Convert HistIndex to actual index

at :: (Bin bin, Unbox a) => Histogram bin a -> HistIndex bin -> a Source

atV :: (Bin bin, Unbox a) => Histogram bin a -> BinValue bin -> a Source

atI :: (Bin bin, Unbox a) => Histogram bin a -> Int -> a Source

Transformations

map :: (Unbox a, Unbox b) => (a -> b) -> Histogram bin a -> Histogram bin b Source

bmap :: (Unbox a, Unbox b, Bin bin) => (BinValue bin -> a -> b) -> Histogram bin a -> Histogram bin b Source

mapData :: (Unbox a, Unbox b, Bin bin) => (Vector a -> Vector b) -> Histogram bin a -> Histogram bin b Source

zip :: (Bin bin, BinEq bin, Unbox a, Unbox b, Unbox c) => (a -> b -> c) -> Histogram bin a -> Histogram bin b -> Histogram bin c Source

zipSafe :: (Bin bin, BinEq bin, Unbox a, Unbox b, Unbox c) => (a -> b -> c) -> Histogram bin a -> Histogram bin b -> Maybe (Histogram bin c) Source

Type conversion

convertBinning :: (ConvertBin bin bin', Unbox a) => Histogram bin a -> Histogram bin' a Source

Folding

foldl :: (Bin bin, Unbox a) => (b -> a -> b) -> b -> Histogram bin a -> b Source

bfoldl :: (Bin bin, Unbox a) => (b -> BinValue bin -> a -> b) -> b -> Histogram bin a -> b Source

Specialized folds

sum :: (Bin bin, Unbox a, Num a) => Histogram bin a -> a Source

minimum :: (Bin bin, Unbox a, Ord a) => Histogram bin a -> a Source

minimumBy :: (Bin bin, Unbox a) => (a -> a -> Ordering) -> Histogram bin a -> a Source

maximum :: (Bin bin, Unbox a, Ord a) => Histogram bin a -> a Source

maximumBy :: (Bin bin, Unbox a) => (a -> a -> Ordering) -> Histogram bin a -> a Source

minIndex :: (Bin bin, Ord a, Unbox a) => Histogram bin a -> Int Source

minIndexBy :: (Bin bin, Ord a, Unbox a) => (a -> a -> Ordering) -> Histogram bin a -> Int Source

maxIndex :: (Bin bin, Ord a, Unbox a) => Histogram bin a -> Int Source

maxIndexBy :: (Bin bin, Ord a, Unbox a) => (a -> a -> Ordering) -> Histogram bin a -> Int Source

minBin :: (Bin bin, Ord a, Unbox a) => Histogram bin a -> BinValue bin Source

minBinBy :: (Bin bin, Ord a, Unbox a) => (a -> a -> Ordering) -> Histogram bin a -> BinValue bin Source

maxBin :: (Bin bin, Ord a, Unbox a) => Histogram bin a -> BinValue bin Source

maxBinBy :: (Bin bin, Ord a, Unbox a) => (a -> a -> Ordering) -> Histogram bin a -> BinValue bin Source

Slicing & rebinning

slice :: (SliceableBin bin, Unbox a) => HistIndex bin -> HistIndex bin -> Histogram bin a -> Histogram bin a Source

rebin :: (MergeableBin bin, Unbox a) => CutDirection -> Int -> (a -> a -> a) -> Histogram bin a -> Histogram bin a Source

rebinFold :: (MergeableBin bin, Unbox a, Unbox b) => CutDirection -> Int -> (b -> a -> b) -> b -> Histogram bin a -> Histogram bin b Source

2D histograms

Slicing

sliceAlongX :: (Unbox a, Bin bX, Bin bY) => Histogram (Bin2D bX bY) a -> HistIndex bY -> Histogram bX a Source

sliceAlongY :: (Unbox a, Bin bX, Bin bY) => Histogram (Bin2D bX bY) a -> HistIndex bX -> Histogram bY a Source

listSlicesAlongX :: (Unbox a, Bin bX, Bin bY) => Histogram (Bin2D bX bY) a -> [(BinValue bY, Histogram bX a)] Source

listSlicesAlongY :: (Unbox a, Bin bX, Bin bY) => Histogram (Bin2D bX bY) a -> [(BinValue bX, Histogram bY a)] Source

Reducing along axis

reduceX :: (Unbox a, Unbox b, Bin bX, Bin bY) => (Histogram bX a -> b) -> Histogram (Bin2D bX bY) a -> Histogram bY b Source

breduceX :: (Unbox a, Unbox b, Bin bX, Bin bY) => (BinValue bY -> Histogram bX a -> b) -> Histogram (Bin2D bX bY) a -> Histogram bY b Source

reduceY :: (Unbox a, Unbox b, Bin bX, Bin bY) => (Histogram bY a -> b) -> Histogram (Bin2D bX bY) a -> Histogram bX b Source

breduceY :: (Unbox a, Unbox b, Bin bX, Bin bY) => (BinValue bX -> Histogram bY a -> b) -> Histogram (Bin2D bX bY) a -> Histogram bX b Source

Lift histogram transform to 2D

liftX :: (Bin bX, Bin bY, Bin bX', BinEq bX', Unbox a, Unbox b) => (Histogram bX a -> Histogram bX' b) -> Histogram (Bin2D bX bY) a -> Histogram (Bin2D bX' bY) b Source

liftY :: (Bin bX, Bin bY, Bin bY', BinEq bY', Unbox a, Unbox b) => (Histogram bY a -> Histogram bY' b) -> Histogram (Bin2D bX bY) a -> Histogram (Bin2D bX bY') b Source