Safe Haskell | None |
---|---|
Language | Haskell98 |
- data D l = Delayed {
- delayedLayout :: l
- fromFunction :: l -> (Index l -> a) -> Array (D l) a
- toFunction :: Bulk l a => Array (D l) a -> (l, Index l -> a)
- delay :: Bulk l a => Array l a -> Array (D l) a
- map :: Bulk l a => (a -> b) -> Array l a -> Array (D l) b
- reverse :: BulkI l a => Array l a -> Array (D l) a
Documentation
Delayed arrays wrap functions from an index to element value.
The index space is specified by an inner layout, l
.
Every time you index into a delayed array the element at that position is recomputed.
Delayed | |
|
Eq (Name l) => Eq (Name (D l)) | |
Eq l => Eq (D l) | |
Show (Name l) => Show (Name (D l)) | |
Show l => Show (D l) | |
Layout l => Layout (D l) | Delayed arrays. |
Layout l => Bulk (D l) a | Delayed arrays. |
(Layout l1, Target l2 a) => Load (D l1) l2 a | |
data Name (D l) = D (Name l) | |
type Index (D l) = Index l | |
data Array (D l) = ADelayed !l (Index l -> a) |
fromFunction :: l -> (Index l -> a) -> Array (D l) a Source
Wrap a function as a delayed array.
> toList $ fromFunction (Linear 10) (* 2) = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
toFunction :: Bulk l a => Array (D l) a -> (l, Index l -> a) Source
Produce the extent of an array, and a function to retrieve an arbitrary element.