dph-examples 0.7.0.3 → 0.7.0.4
raw patch · 2 files changed
+19/−2 lines, 2 files
Files
dph-examples.cabal view
@@ -1,7 +1,7 @@ Name: dph-examples-Version: 0.7.0.3+Version: 0.7.0.4 License: BSD3 License-file: LICENSE Author: The DPH Team@@ -57,7 +57,7 @@ Executable dph-smoke-indices Build-depends: base == 4.6.*, vector == 0.10.*, random == 1.0.*, old-time == 1.1.*, containers == 0.5.*, dph-base == 0.7.*, dph-prim-par == 0.7.*, dph-lifted-vseg == 0.7.*, HUnit == 1.2.* Main-is: Main.hs- other-modules: Vectorised+ other-modules: Vectorised Vector hs-source-dirs: examples/smoke/sharing/Indices lib ghc-options: -eventlog -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fsimpl-tick-factor=1000
+ examples/smoke/sharing/Indices/Vector.hs view
@@ -0,0 +1,17 @@+{-# LANGUAGE BangPatterns #-}+module Vector (treeLookup) where+import Data.Vector.Unboxed (Vector)+import qualified Data.Vector.Unboxed as U+++treeLookup :: Vector Int -> Vector Int -> Vector Int+treeLookup table xx+ | U.length xx == 1+ = U.singleton (table U.! (xx U.! 0))+ + | otherwise+ = let len = U.length xx+ half = len `div` 2+ s1 = U.slice 0 half xx+ s2 = U.slice half half xx + in U.concat (map (treeLookup table) [s1, s2])