histogram-fill-0.9.1.0: 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 exports the same API as Generic but specialized to unboxed vectors. Please refer to the aforementioned module for detailed documentation.

Synopsis

Immutable histograms

type Histogram bin a = Histogram Vector bin a Source #

Immutable histogram. A histogram consists of a binning algorithm, an 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, 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.

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 :: (BinEq bin, Unbox a, Unbox b, Unbox c) => (a -> b -> c) -> Histogram bin a -> Histogram bin b -> Histogram bin c Source #

zipSafe :: (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 :: 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 :: (Unbox a, Num a) => Histogram bin a -> a Source #

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

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

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

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

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

minIndexBy :: Unbox a => (a -> a -> Ordering) -> Histogram bin a -> Int Source #

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

maxIndexBy :: 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, 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, 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, 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, BinEq bY', Unbox a, Unbox b) => (Histogram bY a -> Histogram bY' b) -> Histogram (Bin2D bX bY) a -> Histogram (Bin2D bX bY') b Source #