mwc-random 0.13.5.0 → 0.13.6.0
raw patch · 3 files changed
+14/−4 lines, 3 filesdep +math-functionsPVP ok
version bump matches the API change (PVP)
Dependencies added: math-functions
API changes (from Hackage documentation)
Files
- System/Random/MWC/CondensedTable.hs +6/−2
- changelog.md +5/−0
- mwc-random.cabal +3/−2
System/Random/MWC/CondensedTable.hs view
@@ -40,6 +40,7 @@ import qualified Data.Vector.Unboxed as U import qualified Data.Vector as V import Data.Vector.Generic (Vector)+import Numeric.SpecFunctions (logFactorial) import Prelude hiding ((++)) @@ -237,9 +238,11 @@ ++ U.tail (U.unfoldr unfoldBackward (pMax, nMax)) where -- Number with highest probability and its probability+ --+ -- FIXME: this is not ideal precision-wise. Check if code+ -- from statistics gives better precision. nMax = floor lam :: Int- pMax = let c = lam * exp( -lam / fromIntegral nMax )- in U.foldl' (\p i -> p * c / i) 1 (U.enumFromN 1 nMax)+ pMax = exp $ fromIntegral nMax * log lam - lam - logFactorial nMax -- Build probability list unfoldForward (p,i) | p < minP = Nothing@@ -252,6 +255,7 @@ | otherwise = Just ( (i,p) , (p / lam * fromIntegral i, i-1) )+ -- Minimal representable probability for condensed tables minP = 1.1641532182693481e-10 -- 2**(-33) -- | Create a lookup table for the binomial distribution.
changelog.md view
@@ -1,3 +1,8 @@+## Changes in 0.13.6.0++ * `tablePoisson` now can handle λ>1923, see #59 for details.+ That required intoduction of dependency on math-functions.+ ## Changes in 0.13.5.0 * `logCategorical` added
mwc-random.cabal view
@@ -1,5 +1,5 @@ name: mwc-random-version: 0.13.5.0+version: 0.13.6.0 synopsis: Fast, high quality pseudo random number generation description: This package contains code for generating high quality random@@ -44,7 +44,8 @@ base < 5, primitive, time,- vector >= 0.7+ vector >= 0.7,+ math-functions >= 0.2.1.0 if impl(ghc >= 6.10) build-depends: base >= 4