Skip to content

Instantly share code, notes, and snippets.

@kfl
Created May 22, 2012 11:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kfl/2768391 to your computer and use it in GitHub Desktop.
Save kfl/2768391 to your computer and use it in GitHub Desktop.
Generate a Array of powers with Accelerate
module AccExp where
import qualified Data.Array.Accelerate as A
import Data.Array.Accelerate (Z(..), (:.)(..),(!))
import qualified Data.Array.Accelerate.Interpreter as AI
pows :: A.Exp Double -> Int -> A.Acc(A.Vector Double)
pows u n =
A.generate (A.index1$ A.constant $ n+1) (\ix -> let i = A.unindex1 ix in u^i)
main = AI.run $ pows 23.5 42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment