[Haskell-cafe] maps over arrays that provide the position index for the array and accelerate libraries?

Rob Stewart robstewart57 at gmail.com
Tue Feb 9 11:25:41 UTC 2016


In vector library there's this useful function:

imap :: (Int -> a -> b) -> Vector a -> Vector b

And in Data.Map there's this similar function:

mapWithKey :: (k -> a -> b) -> Map k a -> Map k b

I'm looking for something similar in the array and accelerate libraries, i.e.

On arrays in Data.Array.IArray:

imap :: (IArray a e, IArray a e', Ix i) => (i -> e -> e') -> a i e -> a i e'

And on Accelerate arrays:

imap :: (Shape ix, Elt a, Elt b) => (Exp ix -> Exp a -> Exp b) -> Acc
(Array ix a) -> Acc (Array ix b)

Is anyone aware of such map implementations for arrays in the array
and accelerate libraries, that provide your mapped function not only
the element at a position, but also the index at that position?

Thanks,

--
Rob


More information about the Haskell-Cafe mailing list