histogram-fill 0.6.0.1 → 0.6.1.0
raw patch · 4 files changed
+44/−19 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Histogram.Bin.Bin2D: toIndex2D :: (Bin binX, Bin binY) => Bin2D binX binY -> Int -> (Int, Int)
+ Data.Histogram.Bin.Bin2D: type :><: = Bin2D
Files
- Data/Histogram/Bin/Bin2D.hs +9/−1
- Data/Histogram/Generic.hs +11/−9
- README.markdown +5/−0
- histogram-fill.cabal +19/−9
Data/Histogram/Bin/Bin2D.hs view
@@ -1,10 +1,13 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE TypeOperators #-} module Data.Histogram.Bin.Bin2D ( Bin2D(..) , (><)+ , (:><:) , nBins2D+ , toIndex2D , fmapBinX , fmapBinY ) where@@ -27,9 +30,13 @@ (><) :: binX -> binY -> Bin2D binX binY (><) = Bin2D +-- | Type alias for Bin2D+type (:><:) = Bin2D++ instance (Bin binX, Bin binY) => Bin (Bin2D binX binY) where type BinValue (Bin2D binX binY) = (BinValue binX, BinValue binY)- toIndex !(Bin2D bx by) !(x,y)+ toIndex (Bin2D bx by) (x,y) | inRange bx x = toIndex bx x + toIndex by y * nBins bx | otherwise = maxBound fromIndex b@(Bin2D bx by) i = let (ix,iy) = toIndex2D b i@@ -37,6 +44,7 @@ inRange (Bin2D bx by) !(x,y) = inRange bx x && inRange by y nBins (Bin2D bx by) = nBins bx * nBins by {-# INLINE toIndex #-}+ {-# INLINE nBins #-} -- | Convert index into pair of indices for X and Y axes toIndex2D :: (Bin binX, Bin binY) => Bin2D binX binY -> Int -> (Int,Int)
Data/Histogram/Generic.hs view
@@ -64,7 +64,7 @@ import qualified Data.Vector.Generic as G import Data.Maybe (fromMaybe)-import Data.Typeable (Typeable(..),Typeable1(..),Typeable2(..),mkTyConApp,mkTyCon)+import Data.Typeable -- (Typeable(..),Typeable1(..),Typeable2(..),mkTyConApp,mkTyCon) import Data.Vector.Generic (Vector,(!)) import Text.Read import Prelude hiding (map,zip,foldl)@@ -282,22 +282,22 @@ i = histIndex bin a j = histIndex bin b --- | Rebin histogram+-- | Rebin histogram by joining @n@ adjacent bins. rebin :: (MergeableBin bin, Vector v a)- => CutDirection- -> Int + => CutDirection -- ^ On which side bins should be discarded+ -> Int -- ^ Number of bins to join -> (a -> a -> a) -- ^ Accumulation function -> Histogram v bin a -> Histogram v bin a rebin dir k f = rebinWorker dir k (G.foldl1' f) {-# INLINE rebin #-} --- | Rebin histogram+-- | Rebin histogram by joining @n@ adjacent bins. rebinFold :: (MergeableBin bin, Vector v a, Vector v b)- => CutDirection- -> Int - -> (b -> a -> b) -- ^ Accumulation function- -> b -- ^ Initial value+ => CutDirection -- ^ On which side bins should be discarded+ -> Int -- ^ Number of bins to join+ -> (b -> a -> b) -- ^ Accumulation function+ -> b -- ^ Initial value -> Histogram v bin a -> Histogram v bin b rebinFold dir k f x0 = rebinWorker dir k (G.foldl' f x0)@@ -384,6 +384,7 @@ reduceY f h@(Histogram (Bin2D bX _) _ _) = Histogram bX Nothing $ G.generate (nBins bX) (f . sliceAlongY h . Index) +-- | Transform X slices of histogram. liftX :: (Bin bX, Bin bY, Bin bX', BinEq bX', Vector v a, Vector v b) => (Histogram v bX a -> Histogram v bX' b) -> Histogram v (Bin2D bX bY) a@@ -396,6 +397,7 @@ Nothing (G.concat (histData <$> hs)) +-- | Transform Y slices of histogram. liftY :: (Bin bX, Bin bY, Bin bY', BinEq bY', Vector v a, Vector v b, Vector v Int) => (Histogram v bY a -> Histogram v bY' b) -> Histogram v (Bin2D bX bY ) a
+ README.markdown view
@@ -0,0 +1,5 @@+++This library for creation and filling histogams. It provides rich+composable interface for histogram builders and abstracts notion of+binning.
histogram-fill.cabal view
@@ -1,25 +1,35 @@ Name: histogram-fill-Version: 0.6.0.1-Cabal-Version: >= 1.6-License: BSD3-License-File: LICENSE-Author: Alexey Khudyakov-Maintainer: Alexey Khudyakov <alexey.skladnoy@gmail.com>-Homepage: http://bitbucket.org/Shimuuar/histogram-fill/-Category: Data-Build-Type: Simple+Version: 0.6.1.0 Synopsis: Library for histograms creation. Description: This is library for histograms filling. Its aim to provide convenient way to create and fill histograms. .+ Changes in 0.6.1.0+ .+ * Helper function and type synonym for Bin2D+ . Changes in 0.6.0.1 . * Fixed compilation with GHC 7.4 +Cabal-Version: >= 1.6+License: BSD3+License-File: LICENSE+Author: Alexey Khudyakov+Maintainer: Alexey Khudyakov <alexey.skladnoy@gmail.com>+Homepage: http://bitbucket.org/Shimuuar/histogram-fill/+Category: Data+Build-Type: Simple+extra-source-files:+ README.markdown+ source-repository head type: hg location: http://bitbucket.org/Shimuuar/histogram-fill+source-repository head+ type: git+ location: http://github.com/Shimuuar/histogram-fill Library Build-Depends: base >=3 && <5,