repa-array-4.1.0.1: Bulk array representations and operators.

Safe HaskellNone
LanguageHaskell98

Data.Repa.Array.Meta.Delayed

Synopsis

Documentation

data D l Source

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.

Constructors

Delayed 

Fields

delayedLayout :: l
 

Instances

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.

delay :: Bulk l a => Array l a -> Array (D l) a Source

Wrap an existing array in a delayed one.

map :: Bulk l a => (a -> b) -> Array l a -> Array (D l) b Source

Apply a worker function to each element of an array, yielding a new array with the same extent.

The resulting array is delayed, meaning every time you index into it the element at that index is recomputed.

reverse :: BulkI l a => Array l a -> Array (D l) a Source

O(1). View the elements of a vector in reverse order.

> toList $ reverse $ fromList U [0..10 :: Int]
[10,9,8,7,6,5,4,3,2,1,0]