Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 5ea4d40ebc
Fetching contributors…

Cannot retrieve contributors at this time

27 lines (20 sloc) 0.71 kb
{-# LANGUAGE TypeOperators, ScopedTypeVariables #-}
import Data.Array.Accelerate as Acc
import Data.Array.Accelerate.Repa as Repa
import Data.Array.Accelerate.Interpreter as Interpreter
main :: IO ()
main = do
putStrLn $ Repa.run $
permute comb dftArr perm srcArr
-- comb :: Int -> Int -> Int
comb = (+)
perm :: Exp (Z:. Int:. Int) -> Exp (Z:. Int)
perm ix = let (Z:.y:.(x :: Exp Int)) = unlift ix
in
(?) (x Acc.==* 1) ((ignore), (index1 y))
dftArr :: Acc (Array DIM1 Int)
dftArr = generate (index1 5) (\_ -> 0)
srcArr :: Acc (Array DIM2 Int)
srcArr = generate (index2 (index1 5) 5) (\_ -> 1)
index2 :: Exp (Z:.Int) -> Int -> Exp (Z:.Int:.Int)
index2 sh x = lift (sh :.x)
Jump to Line
Something went wrong with that request. Please try again.