dph-examples 0.7.0.1 → 0.7.0.2
raw patch · 2 files changed
+18/−1 lines, 2 files
Files
dph-examples.cabal view
@@ -1,7 +1,7 @@ Name: dph-examples-Version: 0.7.0.1+Version: 0.7.0.2 License: BSD3 License-file: LICENSE Author: The DPH Team@@ -109,6 +109,7 @@ 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+ Vector Timing hs-source-dirs: examples/spectral/SMVM/dph lib ghc-options: -eventlog -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fsimpl-tick-factor=1000
+ examples/spectral/SMVM/dph/Vector.hs view
@@ -0,0 +1,16 @@+{-# LANGUAGE BangPatterns #-}++module Vector (smvm) where+import qualified Data.Vector as V+import qualified Data.Vector.Unboxed as U++{-# NOINLINE smvm #-}+smvm :: Int+ -> V.Vector (U.Vector (Int, Double))+ -> U.Vector Double+ -> U.Vector Double++smvm _ matrix vector+ = let term (ix, coeff) = coeff * (vector U.! ix)+ sumRow row = U.sum (U.map term row)+ in U.convert $ V.map sumRow matrix