Safe Haskell | Safe-Infered |
---|
User level interface to vectorised parallel arrays.
WARNING: In the current implementation, the functionality provided in
this module is tied to the vectoriser pass of GHC, invoked by `-fvectorise`.
These functions will not work at all in unvectorised code. To operate on
parallel arrays in unvectorised code, use the functions in
Data.Array.Parallel.PArray and convert between array representations by
using fromPArrayP
and toPArrayP
from vectorised code.
- module Data.Array.Parallel.Prelude
- data PArray a
- fromPArrayP :: PArray a -> [:a:]
- toPArrayP :: [:a:] -> PArray a
- fromNestedPArrayP :: PArray (PArray a) -> [:[:a:]:]
- emptyP :: [:a:]
- singletonP :: a -> [:a:]
- replicateP :: Int -> a -> [:a:]
- appendP, (+:+) :: [:a:] -> [:a:] -> [:a:]
- concatP :: [:[:a:]:] -> [:a:]
- lengthP :: [:a:] -> Int
- indexP, (!:) :: [:a:] -> Int -> a
- sliceP :: Int -> Int -> [:a:] -> [:a:]
- mapP :: (a -> b) -> [:a:] -> [:b:]
- zipWithP :: (a -> b -> c) -> [:a:] -> [:b:] -> [:c:]
- crossMapP :: [:a:] -> (a -> [:b:]) -> [:(a, b):]
- filterP :: (a -> Bool) -> [:a:] -> [:a:]
- zipP :: [:a:] -> [:b:] -> [:(a, b):]
- unzipP :: [:(a, b):] -> ([:a:], [:b:])
Documentation
module Data.Array.Parallel.Prelude
Conversions
A parallel array consisting of a length field and some array data.
PA e => Array PArray e | |
(Eq a, PA a) => Eq (PArray a) | |
(Show (PDatas a), Show (PData a)) => Show (PDatas (PArray a)) | |
(Show (PDatas a), Show (PData a)) => Show (PData (PArray a)) | |
(Show a, PA a) => Show (PArray a) | |
PA a => PprPhysical (PArray a) | |
(PprVirtual a, PA a) => PprVirtual (PArray a) | |
PR a => PR (PArray a) | |
PA a => PA (PArray a) |
fromPArrayP :: PArray a -> [:a:]Source
O(1). Convert between PArray
and [::] array representations.
fromNestedPArrayP :: PArray (PArray a) -> [:[:a:]:]Source
O(1). Convert between PArray
and [::] array representations.
Constructors
singletonP :: a -> [:a:]Source
Construct an array with a single element.
replicateP :: Int -> a -> [:a:]Source
Construct an array by replicating the given element some number of times.
Projections
Traversals
zipWithP :: (a -> b -> c) -> [:a:] -> [:b:] -> [:c:]Source
Apply a worker function to every pair of two arrays.
crossMapP :: [:a:] -> (a -> [:b:]) -> [:(a, b):]Source
For every element a
apply the function to get an array of b
then,
and return an array of all the a
s and b
s.
Filtering
filterP :: (a -> Bool) -> [:a:] -> [:a:]Source
Filter an array, keeping only those elements that match the given predicate.