dph-examples 0.6.1.1 → 0.6.1.2
raw patch · 2 files changed
+21/−2 lines, 2 files
Files
dph-examples.cabal view
@@ -1,7 +1,7 @@ Name: dph-examples-Version: 0.6.1.1+Version: 0.6.1.2 License: BSD3 License-file: LICENSE Author: The DPH Team@@ -73,7 +73,7 @@ Executable dph-smoke-reverse Build-depends: base == 4.5.*, vector == 0.9.*, random == 1.0.*, old-time == 1.1.*, containers == 0.4.*, HUnit == 1.2.*, dph-base == 0.6.1.*, dph-prim-par == 0.6.1.*, dph-lifted-vseg == 0.6.1.* Main-is: Main.hs- other-modules: Vectorised Randomish+ other-modules: Vectorised Randomish Vector hs-source-dirs: examples/smoke/sharing/Reverse lib ghc-options: -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fsimpl-tick-factor=1000
+ examples/smoke/sharing/Reverse/Vector.hs view
@@ -0,0 +1,19 @@++module Vector (treeReverse) where+import qualified Data.Vector.Unboxed as V+import Data.Vector.Unboxed (Vector)++-- | Reverse the elements in an array using a tree.+treeReverse :: Vector Int -> Vector Int+{-# NOINLINE treeReverse #-}+treeReverse xx+ | V.length xx == 1+ = xx+ + | otherwise+ = let len = V.length xx+ half = len `div` 2+ s1 = V.slice 0 half xx+ s2 = V.slice half half xx + in treeReverse s2 V.++ treeReverse s1+