fork download
  1. module Test where
  2.  
  3. import Data.Array.Repa hiding (map)
  4. import qualified Data.Array.Repa as R (map)
  5.  
  6.  
  7. type DIM1_U_D = Array U DIM1 Double
  8. type DIM1_D_D = Array D DIM1 Double
  9.  
  10.  
  11. calc :: DIM1_U_D -> DIM1_U_D -> DIM1_D_D
  12. calc k b = let sizeB = size (extent b)
  13. sizeK = size (extent k)
  14. p kp bp (Z:.ic) = sum $ map
  15. (\i -> kp (Z:.i) * bp (Z:.ic+i))
  16. [0..sizeK-1]
  17. in traverse2 k b (\_ _ -> Z:.sizeB-sizeK+1) p
  18.  
  19.  
  20. -- example
  21.  
  22. base, kernel :: DIM1_U_D
  23. base = fromListUnboxed (Z:.5) [3, 5, 2, 9, 4]
  24. kernel = fromListUnboxed (Z:.3) [6, 3, 5]
  25.  
  26. result = toList (calc kernel base) -- [43, 81, 59]
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.hs:4:17:
    Could not find module `Data.Array.Repa':
      Use -v to see a list of the files searched for.
stdout
Standard output is empty