histogram-fill 0.5 → 0.5.1
raw patch · 6 files changed
+15/−10 lines, 6 filesdep ~vectorPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: vector
API changes (from Hackage documentation)
Files
- Data/Histogram/Bin/Classes.hs +4/−3
- Data/Histogram/Bin/Extra.hs +1/−1
- Data/Histogram/Fill.hs +2/−0
- Data/Histogram/Generic.hs +4/−2
- Data/Histogram/ST.hs +2/−2
- histogram-fill.cabal +2/−2
Data/Histogram/Bin/Classes.hs view
@@ -75,7 +75,7 @@ {-# INLINE binsList #-} --- | IntervalBin for which domain is single finite interval+-- | 'IntervalBin' which domain is single finite interval class IntervalBin b => Bin1D b where -- | Minimal accepted value of histogram lowerLimit :: b -> BinValue b@@ -93,9 +93,10 @@ where n = nBins b --- | Binning algorithm which individual +-- | Binning algorithm which allows to append and prepend bins. class Bin1D b => GrowBin b where- -- | Set numbers to zero. By convention bins are shrinked to lower bound+ -- | Set number of bins to zero. By convention bins are shrinked to+ -- lower bound. zeroBin :: b -> b -- | Append one bin at upper bound appendBin :: b -> b
Data/Histogram/Bin/Extra.hs view
@@ -138,7 +138,7 @@ -- Calculate inverse permutation invertPermutationTable :: U.Vector Int -> U.Vector Int-invertPermutationTable v = U.create $ do a <- M.newWith n (-1)+invertPermutationTable v = U.create $ do a <- M.replicate n (-1) forM_ [0..n-1] (writeInvert a) return a where
Data/Histogram/Fill.hs view
@@ -10,6 +10,7 @@ -- module Data.Histogram.Fill ( -- * Builder type class HistBuilder(..)+ -- ** Operators , (<<-) , (<<-|) , (<<?)@@ -100,6 +101,7 @@ (<<?) = flip addCut {-# INLINE (<<?) #-} +-- | Apply function which modify builder (<<-$) :: HistBuilder h => h a b -> (h a b -> h a' b) -> h a' b h <<-$ f = f h {-# INLINE (<<-$) #-}
Data/Histogram/Generic.hs view
@@ -140,11 +140,11 @@ outOfRange :: Histogram v bin a -> Maybe (a,a) outOfRange (Histogram _ uo _) = uo --- | Convert histogram to list.+-- | Convert histogram data to list. asList :: (Vector v a, Bin bin) => Histogram v bin a -> [(BinValue bin, a)] asList (Histogram bin _ arr) = map (fromIndex bin) [0..] `zip` G.toList arr --- | Convert histogram to vector+-- | Convert histogram data to vector asVector :: (Bin bin, Vector v a, Vector v (BinValue bin), Vector v (BinValue bin,a)) => Histogram v bin a -> v (BinValue bin, a) asVector (Histogram bin _ arr) = G.zip (G.generate (nBins bin) (fromIndex bin) ) arr@@ -187,10 +187,12 @@ f2 (x,x') (y,y') = (f x y, f x' y') +-- | Slice histogram using indices. sliceByIx :: (Bin1D bin, Vector v a) => Int -> Int -> Histogram v bin a -> Histogram v bin a sliceByIx i j (Histogram b _ v) = Histogram (sliceBin i j b) Nothing (G.slice i (j - i + 1) v) +-- | Slice histogram using bin values. Value will be included in range. sliceByVal :: (Bin1D bin, Vector v a) => BinValue bin -> BinValue bin -> Histogram v bin a -> Histogram v bin a sliceByVal x y h | inRange b x && inRange b y = sliceByIx (toIndex b x) (toIndex b y) h
Data/Histogram/ST.hs view
@@ -40,8 +40,8 @@ -- passed to function. newMHistogram :: (PrimMonad m, Bin bin, U.Unbox a) => a -> bin -> m (MHistogram (PrimState m) bin a) newMHistogram zero bin = do- uo <- MU.newWith 2 zero- a <- MU.newWith (nBins bin) zero+ uo <- MU.replicate 2 zero+ a <- MU.replicate (nBins bin) zero return $ MHistogram bin uo a {-# INLINE newMHistogram #-}
histogram-fill.cabal view
@@ -1,5 +1,5 @@ Name: histogram-fill-Version: 0.5+Version: 0.5.1 Cabal-Version: >= 1.6 License: BSD3 License-File: LICENSE@@ -20,7 +20,7 @@ Library Build-Depends: base >=3 && <5, primitive,- vector >= 0.6.0.2+ vector >= 0.7 -- monoid-statistics == 0.1.* Exposed-modules: Data.Histogram Data.Histogram.Generic