dph-lifted-vseg-0.7.0.1: Data Parallel Haskell lifted array combinators.

Safe HaskellNone

Data.Array.Parallel.Lifted.Combinators

Contents

Description

Closure converted lifted array combinators. The vectoriser produces code that uses these combinators directly.

All of the combinators in this module are polymorphic, work on PArray, and take PA dictionaries. Combinators that are specific to a certain element type, like Int, are defined in the corresponding prelude module, eg Data.Array.Parallel.Prelude.Int.

Synopsis

Conversions

fromPArrayPP :: PA a => PArray a :-> PArray a

Identity function, used as the vectorised version of fromPArrayP.

toPArrayPP :: PA a => PArray a :-> PArray a

Identity function, used as the vectorised version of toPArrayP.

fromNestedPArrayPP :: PA a => PArray (PArray a) :-> PArray (PArray a)

Identity function, used as the vectorised version of fromNestedPArrayP

Constructors

emptyPP :: PA a => PArray a

O(1). Construct an empty array.

singletonPP :: PA a => a :-> PArray a

O(1). Construct an array containing a single element.

replicatePP :: PA a => Int :-> (a :-> PArray a)

O(n). Construct an array of the given size, that maps all elements to the same value.

appendPP :: PA a => PArray a :-> (PArray a :-> PArray a)

O(len result). Append two arrays.

Projections

lengthPP :: PA a => PArray a :-> Int

O(1). Take the number of elements in an array.

indexPP :: PA a => PArray a :-> (Int :-> a)

O(1). Lookup a single element from the source array.

slicePP :: PA a => Int :-> (Int :-> (PArray a :-> PArray a))

O(len slice). Extract a range of elements from an array.

Traversals

mapPP :: (PA a, PA b) => (a :-> b) :-> (PArray a :-> PArray b)

Apply a worker function to every element of an array.

zipWithPP :: (PA a, PA b, PA c) => (a :-> (b :-> c)) :-> (PArray a :-> (PArray b :-> PArray c))

Apply a worker function to every pair of two arrays.

crossMapPP :: (PA a, PA b) => PArray a :-> ((a :-> PArray b) :-> PArray (a, b))

Filtering

filterPP :: PA a => (a :-> Bool) :-> (PArray a :-> PArray a)

Extract the elements from an array that match the given predicate.

Concatenation

concatPP :: PA a => PArray (PArray a) :-> PArray a

O(len result). Concatenate a nested array.

Tuple functions

zipPP :: (PA a, PA b) => PArray a :-> (PArray b :-> PArray (a, b))

Zip a pair of arrays into an array of pairs.

unzipPP :: (PA a, PA b) => PArray (a, b) :-> (PArray a, PArray b)

Unzip an array of pairs into a pair of arrays.