Created
July 31, 2013 20:37
-
-
Save apriori/6125930 to your computer and use it in GitHub Desktop.
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
sfold :: (Shape ix, Elt a) => (Exp a -> Exp a -> Exp a) -> Exp a -> Acc (Array ix a) -> Exp a | |
sfold f i a = let | |
iteratefunc :: (Elt a) => (Exp a -> Exp a -> Exp a) -> Exp a -> Acc (Vector a) -> Exp a | |
iteratefunc !f !i !ar = | |
((size ar) ==* 0) ? (i, | |
let | |
hd = A.take (constant 1) ar A.!! 0 | |
tl = A.tail ar | |
in | |
f hd (iteratefunc f i tl)) | |
in | |
iteratefunc f i (flatten a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment