Hello community,
here is the log from the commit of package ghc-vector-algorithms for
openSUSE:Factory checked in at 2018-10-25 08:19:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-vector-algorithms (Old)
and /work/SRC/openSUSE:Factory/.ghc-vector-algorithms.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-vector-algorithms"
Thu Oct 25 08:19:16 2018 rev:9 rq:642903 version:0.8.0.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/ghc-vector-algorithms/ghc-vector-algorithms.changes
2018-09-03 10:35:09.752678695 +0200
+++
/work/SRC/openSUSE:Factory/.ghc-vector-algorithms.new/ghc-vector-algorithms.changes
2018-10-25 08:19:20.203991902 +0200
@@ -1,0 +2,6 @@
+Wed Oct 10 19:23:57 UTC 2018 - [email protected]
+
+- Update vector-algorithms to version 0.8.0.1.
+ Upstream does not provide a change log file.
+
+-------------------------------------------------------------------
Old:
----
vector-algorithms-0.7.0.4.tar.gz
New:
----
vector-algorithms-0.8.0.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-vector-algorithms.spec ++++++
--- /var/tmp/diff_new_pack.FyE2YU/_old 2018-10-25 08:19:20.695991685 +0200
+++ /var/tmp/diff_new_pack.FyE2YU/_new 2018-10-25 08:19:20.699991683 +0200
@@ -12,14 +12,14 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global pkg_name vector-algorithms
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 0.7.0.4
+Version: 0.8.0.1
Release: 0
Summary: Efficient algorithms for vector arrays
License: BSD-3-Clause
++++++ vector-algorithms-0.7.0.4.tar.gz -> vector-algorithms-0.8.0.1.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/vector-algorithms-0.7.0.4/bench/simple/Blocks.hs
new/vector-algorithms-0.8.0.1/bench/simple/Blocks.hs
--- old/vector-algorithms-0.7.0.4/bench/simple/Blocks.hs 2018-08-24
13:13:24.000000000 +0200
+++ new/vector-algorithms-0.8.0.1/bench/simple/Blocks.hs 2018-10-09
03:32:06.000000000 +0200
@@ -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
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/vector-algorithms-0.7.0.4/bench/simple/Main.hs
new/vector-algorithms-0.8.0.1/bench/simple/Main.hs
--- old/vector-algorithms-0.7.0.4/bench/simple/Main.hs 2018-08-24
13:13:24.000000000 +0200
+++ new/vector-algorithms-0.8.0.1/bench/simple/Main.hs 2018-10-09
03:32:06.000000000 +0200
@@ -5,8 +5,8 @@
import Prelude hiding (read, length)
import qualified Prelude as P
+import Control.Monad
import Control.Monad.ST
-import Control.Monad.Error
import Data.Char
import Data.Ord (comparing)
@@ -40,20 +40,21 @@
displayTime :: String -> Integer -> IO ()
displayTime s elapsed = putStrLn $
- s ++ " : " ++ show (fromIntegral elapsed / 1e12) ++ " seconds"
+ s ++ " : " ++ show (fromIntegral elapsed / (1e12 :: Double)) ++ " seconds"
run :: String -> IO Integer -> IO ()
run s t = t >>= displayTime s
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 ()
@@ -142,7 +143,6 @@
RadixSort -> sortSuite "radix sort" g n
radixSort
AmericanFlagSort -> sortSuite "flag sort" g n flagSort
TimSort -> sortSuite "tim sort" g n timSort
- _ -> putStrLn $ "Currently unsupported algorithm: " ++ show
alg
mergeSort :: MVector RealWorld Int -> IO ()
mergeSort v = M.sort v
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/vector-algorithms-0.7.0.4/src/Data/Vector/Algorithms/Merge.hs
new/vector-algorithms-0.8.0.1/src/Data/Vector/Algorithms/Merge.hs
--- old/vector-algorithms-0.7.0.4/src/Data/Vector/Algorithms/Merge.hs
2018-08-24 13:13:24.000000000 +0200
+++ new/vector-algorithms-0.8.0.1/src/Data/Vector/Algorithms/Merge.hs
2018-10-09 03:32:06.000000000 +0200
@@ -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)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/vector-algorithms-0.7.0.4/tests/properties/Properties.hs
new/vector-algorithms-0.8.0.1/tests/properties/Properties.hs
--- old/vector-algorithms-0.7.0.4/tests/properties/Properties.hs
2018-08-24 13:13:24.000000000 +0200
+++ new/vector-algorithms-0.8.0.1/tests/properties/Properties.hs
2018-10-09 03:32:06.000000000 +0200
@@ -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)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/vector-algorithms-0.7.0.4/tests/properties/Tests.hs
new/vector-algorithms-0.8.0.1/tests/properties/Tests.hs
--- old/vector-algorithms-0.7.0.4/tests/properties/Tests.hs 2018-08-24
13:13:24.000000000 +0200
+++ new/vector-algorithms-0.8.0.1/tests/properties/Tests.hs 2018-10-09
03:32:06.000000000 +0200
@@ -1,4 +1,4 @@
-{-# LANGUAGE ImpredicativeTypes, RankNTypes, TypeOperators, FlexibleContexts
#-}
+{-# LANGUAGE RankNTypes, TypeOperators, FlexibleContexts #-}
module Main (main) where
@@ -37,36 +37,40 @@
type SizeAlgo e r = forall s mv. MVector mv e => mv s e -> Int -> ST s r
type BoundAlgo e r = forall s mv. MVector mv e => mv s e -> Int -> Int -> ST s
r
+newtype WrappedAlgo e r = WrapAlgo { unWrapAlgo :: Algo e
r }
+newtype WrappedSizeAlgo e r = WrapSizeAlgo { unWrapSizeAlgo :: SizeAlgo e
r }
+newtype WrappedBoundAlgo e r = WrapBoundAlgo { unWrapBoundAlgo :: BoundAlgo e
r }
+
args = stdArgs
{ maxSuccess = 1000
, maxDiscardRatio = 2
}
check_Int_sort = forM_ algos $ \(name,algo) ->
- quickCheckWith args (label name . prop_fullsort algo)
+ quickCheckWith args (label name . prop_fullsort (unWrapAlgo algo))
where
- algos :: [(String, Algo Int ())]
- algos = [ ("introsort", INT.sort)
- , ("insertion sort", INS.sort)
- , ("merge sort", M.sort)
- , ("heapsort", H.sort)
- , ("timsort", T.sort)
+ algos :: [(String, WrappedAlgo Int ())]
+ algos = [ ("introsort", WrapAlgo INT.sort)
+ , ("insertion sort", WrapAlgo INS.sort)
+ , ("merge sort", WrapAlgo M.sort)
+ , ("heapsort", WrapAlgo H.sort)
+ , ("timsort", WrapAlgo T.sort)
]
check_Int_partialsort = forM_ algos $ \(name,algo) ->
- quickCheckWith args (label name . prop_partialsort algo)
+ quickCheckWith args (label name . prop_partialsort (unWrapSizeAlgo algo))
where
- algos :: [(String, SizeAlgo Int ())]
- algos = [ ("intro-partialsort", INT.partialSort)
- , ("heap partialsort", H.partialSort)
+ algos :: [(String, WrappedSizeAlgo Int ())]
+ algos = [ ("intro-partialsort", WrapSizeAlgo INT.partialSort)
+ , ("heap partialsort", WrapSizeAlgo H.partialSort)
]
check_Int_select = forM_ algos $ \(name,algo) ->
- quickCheckWith args (label name . prop_select algo)
+ quickCheckWith args (label name . prop_select (unWrapSizeAlgo algo))
where
- algos :: [(String, SizeAlgo Int ())]
- algos = [ ("intro-select", INT.select)
- , ("heap select", H.select)
+ algos :: [(String, WrappedSizeAlgo Int ())]
+ algos = [ ("intro-select", WrapSizeAlgo INT.select)
+ , ("heap select", WrapSizeAlgo H.select)
]
check_radix_sorts = do
@@ -142,16 +146,14 @@
qc $ label "flag W64" . prop_permutation (AF.sort :: Algo Word64 ())
qc $ label "flag Word" . prop_permutation (AF.sort :: Algo Word ())
qc $ label "flag ByteString" . prop_permutation (AF.sort :: Algo
B.ByteString ())
-{-
- qc $ label "intropartial" . prop_sized (const . prop_permutation)
+ qc $ label "intropartial" . prop_sized (\x -> const (prop_permutation x))
(INT.partialSort :: SizeAlgo Int ())
- qc $ label "introselect" . prop_sized (const . prop_permutation)
+ qc $ label "introselect" . prop_sized (\x -> const (prop_permutation x))
(INT.select :: SizeAlgo Int ())
- qc $ label "heappartial" . prop_sized (const . prop_permutation)
+ qc $ label "heappartial" . prop_sized (\x -> const (prop_permutation x))
(H.partialSort :: SizeAlgo Int ())
- qc $ label "heapselect" . prop_sized (const . prop_permutation)
- (H.select :: Algo Int ())
--}
+ qc $ label "heapselect" . prop_sized (\x -> const (prop_permutation x))
+ (H.select :: SizeAlgo Int ())
where
qc prop = quickCheckWith args prop
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/vector-algorithms-0.7.0.4/vector-algorithms.cabal
new/vector-algorithms-0.8.0.1/vector-algorithms.cabal
--- old/vector-algorithms-0.7.0.4/vector-algorithms.cabal 2018-08-24
13:13:24.000000000 +0200
+++ new/vector-algorithms-0.8.0.1/vector-algorithms.cabal 2018-10-09
03:32:06.000000000 +0200
@@ -1,5 +1,5 @@
name: vector-algorithms
-version: 0.7.0.4
+version: 0.8.0.1
license: BSD3
license-file: LICENSE
author: Dan Doel
@@ -32,7 +32,7 @@
flag bench
description: Build a benchmarking program to test vector-algorithms
performance
- default: False
+ default: True
flag properties
description: Enable the quickcheck tests
@@ -100,8 +100,9 @@
if flag(InternalChecks)
cpp-options: -DVECTOR_INTERNAL_CHECKS
-executable simple-bench
+benchmark simple-bench
hs-source-dirs: bench/simple
+ type: exitcode-stdio-1.0
if !flag(bench)
buildable: False
@@ -111,7 +112,7 @@
other-modules:
Blocks
- build-depends: base, mwc-random, vector, vector-algorithms, mtl
+ build-depends: base, mwc-random, vector, vector-algorithms
ghc-options: -Wall
-- Cabal/Hackage complains about these
@@ -138,7 +139,7 @@
base,
bytestring,
containers,
- QuickCheck >= 2,
+ QuickCheck > 2.9 && < 2.13,
vector,
vector-algorithms