repa-array-4.2.3.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

Instances

Eq (Name l) => Eq (Name (D l)) Source # 

Methods

(==) :: Name (D l) -> Name (D l) -> Bool #

(/=) :: Name (D l) -> Name (D l) -> Bool #

Eq l => Eq (D l) Source # 

Methods

(==) :: D l -> D l -> Bool #

(/=) :: D l -> D l -> Bool #

Show (Name l) => Show (Name (D l)) Source # 

Methods

showsPrec :: Int -> Name (D l) -> ShowS #

show :: Name (D l) -> String #

showList :: [Name (D l)] -> ShowS #

Show l => Show (D l) Source # 

Methods

showsPrec :: Int -> D l -> ShowS #

show :: D l -> String #

showList :: [D l] -> ShowS #

Layout l => Layout (D l) Source #

Delayed arrays.

Associated Types

data Name (D l) :: * Source #

type Index (D l) :: * Source #

Methods

name :: Name (D l) Source #

create :: Name (D l) -> Index (D l) -> D l Source #

extent :: D l -> Index (D l) Source #

toIndex :: D l -> Index (D l) -> Int Source #

fromIndex :: D l -> Int -> Index (D l) Source #

Layout l => Bulk (D l) a Source #

Delayed arrays.

Associated Types

data Array (D l) a :: * Source #

Methods

layout :: Array (D l) a -> D l Source #

index :: Array (D l) a -> Index (D l) -> a Source #

(Layout l1, Target l2 a) => Load (D l1) l2 a Source # 

Methods

loadS :: Array (D l1) a -> Buffer l2 a -> IO () Source #

loadP :: Gang -> Array (D l1) a -> Buffer l2 a -> IO () Source #

data Name (D l) Source # 
data Name (D l) = D (Name l)
type Index (D l) Source # 
type Index (D l) = Index l
data Array (D l) Source # 
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 :: 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]