packages feed

vector-algorithms 0.8.0.0 → 0.8.0.1

raw patch · 5 files changed

+30/−22 lines, 5 filesdep ~QuickCheckdep ~primitive

Dependency ranges changed: QuickCheck, primitive

Files

bench/simple/Blocks.hs view
@@ -46,12 +46,12 @@  where initial n = fill n >>= unsafeWrite arr n >> when (n > 0) (initial $ n - 1) {-# INLINE initialize #-} -speedTest :: (Unbox e) => Int+speedTest :: (Unbox e) => MVector RealWorld e+                       -> Int                        -> (Int -> IO e)                        -> (MVector RealWorld e -> IO ())                        -> IO Integer-speedTest n fill algo = do-  arr <- new n+speedTest arr n fill algo = do   initialize arr n fill   t0 <- clock   algo arr
bench/simple/Main.hs view
@@ -47,13 +47,14 @@  sortSuite :: String -> GenIO -> Int -> (MVector RealWorld Int -> IO ()) -> IO () sortSuite str g n sort = do+  arr <- new n   putStrLn $ "Testing: " ++ str-  run "Random            " $ speedTest n (rand g >=> modulo n) sort-  run "Sorted            " $ speedTest n ascend sort-  run "Reverse-sorted    " $ speedTest n (descend n) sort-  run "Random duplicates " $ speedTest n (rand g >=> modulo 1000) sort+  run "Random            " $ speedTest arr n (rand g >=> modulo n) sort+  run "Sorted            " $ speedTest arr n ascend sort+  run "Reverse-sorted    " $ speedTest arr n (descend n) sort+  run "Random duplicates " $ speedTest arr n (rand g >=> modulo 1000) sort   let m = 4 * (n `div` 4)-  run "Median killer     " $ speedTest m (medianKiller m) sort+  run "Median killer     " $ speedTest arr m (medianKiller m) sort  partialSortSuite :: String -> GenIO -> Int -> Int                  -> (MVector RealWorld Int -> Int -> IO ()) -> IO ()
src/Data/Vector/Algorithms/Merge.hs view
@@ -39,15 +39,22 @@  -- | Sorts an array using a custom comparison. sortBy :: (PrimMonad m, MVector v e) => Comparison e -> v (PrimState m) e -> m ()-sortBy cmp vec-  | len <= 1  = return ()-  | len == 2  = O.sort2ByOffset cmp vec 0-  | len == 3  = O.sort3ByOffset cmp vec 0-  | len == 4  = O.sort4ByOffset cmp vec 0-  | otherwise = do buf <- new len-                   mergeSortWithBuf cmp vec buf+sortBy cmp vec = if len <= 4+                    then if len <= 2+                            then if len /= 2+                                    then return ()+                                    else O.sort2ByOffset cmp vec 0+                            else if len == 3+                                    then O.sort3ByOffset cmp vec 0+                                    else O.sort4ByOffset cmp vec 0+                    else if len < threshold+                            then I.sortByBounds cmp vec 0 len+                            else do buf <- new halfLen+                                    mergeSortWithBuf cmp vec buf  where- len = length vec+ len     = length vec+ -- odd lengths have a larger half that needs to fit, so use ceiling, not floor+ halfLen = (len + 1) `div` 2 {-# INLINE sortBy #-}  mergeSortWithBuf :: (PrimMonad m, MVector v e)
tests/properties/Properties.hs view
@@ -27,7 +27,7 @@  import qualified Data.Map as M -import Test.QuickCheck+import Test.QuickCheck hiding (Sorted)  import Util @@ -104,7 +104,7 @@                           in V.all (\(e', i') -> e < e' || i < i') (V.tail arr)                             .&. stable (V.tail arr) -prop_stable_radix :: (forall e s mv. G.MVector mv e => Int -> Int -> (Int -> e -> Int) +prop_stable_radix :: (forall e s mv. G.MVector mv e => Int -> Int -> (Int -> e -> Int)                         -> mv s e -> ST s ())                   -> Vector Int -> Property prop_stable_radix algo arr =@@ -113,7 +113,7 @@  where  ix = V.fromList [1 .. V.length arr]  e = V.head arr- + prop_optimal :: Int              -> (forall e s mv. G.MVector mv e => Comparison e -> mv s e -> Int -> ST s ())              -> Property@@ -137,7 +137,7 @@  prop_permutation :: (Ord e) => (forall s mv. G.MVector mv e => mv s e -> ST s ())                  -> Vector e -> Property-prop_permutation algo arr = property $ +prop_permutation algo arr = property $                             toBag arr == toBag (modify algo arr)  newtype SortedVec e = Sorted (Vector e)
vector-algorithms.cabal view
@@ -1,5 +1,5 @@ name:              vector-algorithms-version:           0.8.0.0+version:           0.8.0.1 license:           BSD3 license-file:      LICENSE author:            Dan Doel@@ -139,7 +139,7 @@       base,       bytestring,       containers,-      QuickCheck > 2.9 && < 2.12,+      QuickCheck > 2.9 && < 2.13,       vector,       vector-algorithms