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

Data.Array.Parallel.PArray.Scalar

Contents

Description

Functions that work on parallel arrays of scalar elements. Unlike the functions defined in D.A.P.PArray, these only need Scalar dictionaries, instead of PR or PA dictionaries.

They are used when defining vectorised Prelude functions, eg in D.A.P.Prelude.Int and D.A.P.Prelude.Double.

The map and zipWith functions are also used by the vectoriser when vectorising uses of scalar operators like (+).

Synopsis

# Documentation

class (PA a, Elt a) => Scalar a whereSource

Class of Scalar data that can be converted to and from single unboxed vectors.

Methods

Instances

 Scalar Bool Scalar Double Scalar Int Scalar Integer Scalar Ordering Scalar Word8

# Conversions

fromUArray2 :: (Scalar a, Scalar b) => Array (a, b) -> PArray (a, b)Source

Convert an U.Array of pairs to a PArray.

# Maps and Zips

map :: (Scalar a, Scalar b) => (a -> b) -> PArray a -> PArray bSource

Apply a worker function to every element of an array, yielding a new array.

zipWith :: (Scalar a, Scalar b, Scalar c) => (a -> b -> c) -> PArray a -> PArray b -> PArray cSource

Zip two arrays, yielding a new array.

zipWith3 :: (Scalar a, Scalar b, Scalar c, Scalar d) => (a -> b -> c -> d) -> PArray a -> PArray b -> PArray c -> PArray dSource

Zip three arrays, yielding a new array.

zipWith4 :: (Scalar a, Scalar b, Scalar c, Scalar d, Scalar e) => (a -> b -> c -> d -> e) -> PArray a -> PArray b -> PArray c -> PArray d -> PArray eSource

Zip four arrays, yielding a new array.

zipWith5 :: (Scalar a, Scalar b, Scalar c, Scalar d, Scalar e, Scalar f) => (a -> b -> c -> d -> e -> f) -> PArray a -> PArray b -> PArray c -> PArray d -> PArray e -> PArray fSource

Zip five arrays, yielding a new array.

zipWith6 :: (Scalar a, Scalar b, Scalar c, Scalar d, Scalar e, Scalar f, Scalar g) => (a -> b -> c -> d -> e -> f -> g) -> PArray a -> PArray b -> PArray c -> PArray d -> PArray e -> PArray f -> PArray gSource

Zip six arrays, yielding a new array.

zipWith7 :: (Scalar a, Scalar b, Scalar c, Scalar d, Scalar e, Scalar f, Scalar g, Scalar h) => (a -> b -> c -> d -> e -> f -> g -> h) -> PArray a -> PArray b -> PArray c -> PArray d -> PArray e -> PArray f -> PArray g -> PArray hSource

Zip seven arrays, yielding a new array.

zipWith8 :: (Scalar a, Scalar b, Scalar c, Scalar d, Scalar e, Scalar f, Scalar g, Scalar h, Scalar i) => (a -> b -> c -> d -> e -> f -> g -> h -> i) -> PArray a -> PArray b -> PArray c -> PArray d -> PArray e -> PArray f -> PArray g -> PArray h -> PArray iSource

Eight seven arrays, yielding a new array.

# Folds

fold :: Scalar a => (a -> a -> a) -> a -> PArray a -> aSource

Left fold over an array.

folds :: (Scalar a, Elts a) => (a -> a -> a) -> a -> PArray (PArray a) -> PArray aSource

Segmented fold of an array of arrays.

fold1 :: Scalar a => (a -> a -> a) -> PArray a -> aSource

Left fold over an array, using the first element to initialise the state.

fold1s :: (Scalar a, Elts a) => (a -> a -> a) -> PArray (PArray a) -> PArray aSource

Segmented fold of an array of arrays, using the first element of each segment to initialse the state for that segment.

fold1Index :: Scalar a => ((Int, a) -> (Int, a) -> (Int, a)) -> PArray a -> IntSource

Left fold over an array, also passing the index of each element to the parameter function.

fold1sIndex :: Scalar a => ((Int, a) -> (Int, a) -> (Int, a)) -> PArray (PArray a) -> PArray IntSource

Segmented fold over an array, also passing the index of each element to the parameter function. TODO: fold the psegs then replicate, like in the other folds. this currently has the wrong complexity.

# Enumerations

Construct a range of integers.