Created
May 22, 2012 11:08
-
-
Save kfl/2768391 to your computer and use it in GitHub Desktop.
Generate a Array of powers with Accelerate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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