monte-carlo 0.4.1 → 0.4.2
raw patch · 4 files changed
+23/−5 lines, 4 filesdep ~vectorPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: vector
API changes (from Hackage documentation)
- Control.Monad.MC.Class: class HasRNG m where { type family RNG m; }
+ Control.Monad.MC.Class: class HasRNG m where type family RNG m
Files
- NEWS +7/−0
- lib/Control/Monad/MC/Base.hs +1/−1
- lib/Control/Monad/MC/Sample.hs +7/−1
- monte-carlo.cabal +8/−3
NEWS view
@@ -1,3 +1,10 @@+Changes in 0.4.2:++* gliptak added compile fixes for ghc 7.4++* Joyn Tyree added compile fixes for ghc 7.2++ Changes in 0.4.1: * Get project to compile with ghc7.
lib/Control/Monad/MC/Base.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeFamilies, PolyKinds #-} ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.MC.Base
lib/Control/Monad/MC/Sample.hs view
@@ -31,7 +31,8 @@ ) where import Control.Monad-import Control.Monad.ST+import Control.Monad.ST hiding (unsafeInterleaveST)+import Control.Monad.ST.Unsafe (unsafeInterleaveST) import Control.Monad.MC.Base import Control.Monad.MC.Repeat import Control.Monad.MC.Walker@@ -163,6 +164,7 @@ us <- randomIndices (n'-1) (k'-1) return (u:us) + sampleIntSubsetHelp :: MVector m Int -> [Int] -> Int -> ST m [Int] sampleIntSubsetHelp _ [] _ = return [] sampleIntSubsetHelp ints (u:us) n' = unsafeInterleaveST $ do i <- MV.unsafeRead ints u@@ -193,6 +195,7 @@ sequence_ [ MV.unsafeWrite ints i wj | (i,wj) <- zip [ 0.. ] wjs ] go ints n 1 us where+ go :: MVector m (Double, Int) -> Int -> Double -> [Double] -> ST m [Int] go ints n' w_sum us | null us = return [] | otherwise = let target = head us * w_sum@@ -205,6 +208,8 @@ js <- go ints n'' w_sum' us' return $ j:js + findTarget :: MVector m (Double, Int)+ -> Int -> Double -> Int -> Double -> ST m (Int, (Double, Int)) findTarget ints n' target i acc | i == n' - 1 = do wj <- MV.unsafeRead ints i@@ -216,6 +221,7 @@ then return (i,(w,j)) else findTarget ints n' target (i+1) acc' + shiftDown :: MVector m (Double, Int) -> Int -> Int -> ST m () shiftDown ints from to = forM_ [ from..to ] $ \i -> do wj <- MV.unsafeRead ints i
monte-carlo.cabal view
@@ -1,5 +1,5 @@ name: monte-carlo-version: 0.4.1+version: 0.4.2 license: BSD3 license-file: LICENSE author: Patrick Perry@@ -15,7 +15,7 @@ (GSL) is supported. build-type: Simple stability: experimental-cabal-version: >= 1.2.3+cabal-version: >= 1.6 extra-source-files: NEWS examples/Binomial.hs examples/Pi.lhs examples/Poker.hs examples/Queue.hs tests/Main.hs tests/Makefile@@ -46,7 +46,12 @@ build-depends: base >= 4 && < 5, gsl-random >= 0.4.3 && < 0.5, mtl >= 1.1 && < 3.0,- vector >= 0.6 && < 0.8+ vector >= 0.6 && < 0.10 hs-source-dirs: lib ghc-options: -Wall++source-repository head+ type: git+ location: https://github.com/patperry/hs-monte-carlo.git+