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

Safe Haskell Safe-Infered

Data.Array.Parallel.Lifted.Combinators

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

Identity function, used as the vectorised version of fromPArrayP.

Identity function, used as the vectorised version of toPArrayP.

Identity function, used as the vectorised version of fromNestedPArrayP

# Constructors

emptyPP :: PA a => PArray aSource

O(1). Construct an empty array.

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

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

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

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)Source

O(len result). Append two arrays.

# Projections

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

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

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

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

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

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

# Traversals

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

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))Source

Apply a worker function to every pair of two arrays.

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

# Filtering

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

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

# Concatenation

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

O(len result). Concatenate a nested array.

# Tuple functions

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

Zip a pair of arrays into an array of pairs.

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

Unzip an array of pairs into a pair of arrays.