packages feed

probability 0.2.4.1 → 0.2.5

raw patch · 4 files changed

+19/−12 lines, 4 filesdep ~transformersPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: transformers

API changes (from Hackage documentation)

+ Numeric.Probability.Distribution: below :: (Num prob, Ord prob, Ord a) => prob -> T prob a -> T prob (Select a)
+ Numeric.Probability.Distribution: select :: (Num prob, Ord prob, Ord a) => (prob -> Bool) -> T prob a -> T prob (Select a)
+ Numeric.Probability.Distribution: sortPDesc :: Ord prob => [(a, prob)] -> [(a, prob)]
+ Numeric.Probability.Random: below :: (Num prob, Ord prob, Ord a) => prob -> Distribution prob a -> Distribution prob (Select a)

Files

probability.cabal view
@@ -1,5 +1,5 @@ Name:               probability-Version:            0.2.4.1+Version:            0.2.5 License:            BSD3 License-File:       COPYRIGHT Author:             Martin Erwig <erwig@eecs.oregonstate.edu>, Steve Kollmansberger@@ -28,7 +28,7 @@ Source-Repository this   type:     darcs   location: http://code.haskell.org/~thielema/probability/-  tag:      0.2.4.1+  tag:      0.2.5   Flag splitBase@@ -37,7 +37,7 @@ Library   Build-Depends:     utility-ht >=0.0.6 && <0.1,-    transformers >=0.0.1 && <0.4+    transformers >=0.0.1 && <0.5   If flag(splitBase)     Build-Depends:       containers >=0.1 && <0.6,
src/Numeric/Probability/Distribution.hs view
@@ -146,6 +146,9 @@ sortP :: Ord prob => [(a,prob)] -> [(a,prob)] sortP = List.sortBy (comparing snd) +sortPDesc :: Ord prob => [(a,prob)] -> [(a,prob)]+sortPDesc = List.sortBy (flip $ comparing snd)+ sortElem :: Ord a => [(a,prob)] -> [(a,prob)] sortElem = List.sortBy (comparing fst) @@ -175,7 +178,7 @@    let w = maximum (List.map (length.show.fst) xs)    in  concatMap           (\(x,p) -> showR w x++' ': showProb p++"\n")-          (sortP (norm' xs))+          (sortPDesc (norm' xs))  infix 0 //% @@ -186,7 +189,7 @@       Show (T prob a) where    showsPrec p (Cons xs) =       showParen (p>10)-         (showString "fromFreqs " . showsPrec 11 (sortP (norm' xs)))+         (showString "fromFreqs " . showsPrec 11 (sortPDesc (norm' xs)))   {- |@@ -349,10 +352,15 @@ data Select a = Case a | Other                 deriving (Eq,Ord,Show) -above :: (Num prob, Ord prob, Ord a) =>+above, below :: (Num prob, Ord prob, Ord a) =>    prob -> T prob a -> T prob (Select a)-above p (Cons d) =-   let (d1,d2) = Map.partition (>=p) $ Map.fromListWith (+) d+above p = select (>=p)+below p = select (<=p)++select :: (Num prob, Ord prob, Ord a) =>+   (prob -> Bool) -> T prob a -> T prob (Select a)+select condp (Cons d) =+   let (d1,d2) = Map.partition condp $ Map.fromListWith (+) d    in  Cons $           (Other, Fold.sum d2) :           List.map (mapFst Case) (Map.toAscList d1)
src/Numeric/Probability/Object.hs view
@@ -12,8 +12,6 @@ and for generating random values according to the distribution. The latter one is of course more efficient and may be used for approximation of the distribution by simulation.--Maybe a better name is @Experiment@. -} module Numeric.Probability.Object where 
src/Numeric/Probability/Random.hs view
@@ -64,9 +64,10 @@ -- | Randomized distribution type Distribution prob a = T (Dist.T prob a) -above :: (Num prob, Ord prob, Ord a) =>+above, below :: (Num prob, Ord prob, Ord a) =>    prob -> Distribution prob a -> Distribution prob (Dist.Select a)-above p rd = fmap (Dist.above p) rd+above p = fmap (Dist.above p)+below p = fmap (Dist.below p)  {- | 'dist' converts a list of randomly generated values into