User level interface of parallel arrays.
The semantic difference between standard Haskell arrays (aka lazy arrays) and parallel arrays (aka strict arrays) is that the evaluation of two different elements of a lazy array is independent, whereas in a strict array either non or all elements are evaluated. In other words, when a parallel array is evaluated to WHNF, all its elements will be evaluated to WHNF. The name parallel array indicates that all array elements may, in general, be evaluated to WHNF in parallel without any need to resort to speculative evaluation. This parallel evaluation semantics is also beneficial in the sequential case, as it facilitates loop-based array processing as known from classic array-based languages, such as Fortran.
The interface of this module is essentially a variant of the list
component of the Prelude, but also includes some functions (such as
permutations) that are not provided for lists. The following list of
operations are not supported on parallel arrays, as they would require the
infinite parallel arrays: iterate
, repeat
, and cycle
.
WARNING: In the current implementation, the functionality provided in this module is tied to the vectoriser pass of GHC invoked by passing the `-fvectorise` option. Without vectorisation these functions will not work at all!
- module Data.Array.Parallel.Prelude
- emptyP :: [:a:]
- singletonP :: a -> [:a:]
- replicateP :: Int -> a -> [:a:]
- lengthP :: [:a:] -> Int
- (!:) :: [:a:] -> Int -> a
- (+:+) :: [:a:] -> [:a:] -> [:a:]
- concatP :: [:[:a:]:] -> [:a:]
- mapP :: (a -> b) -> [:a:] -> [:b:]
- filterP :: (a -> Bool) -> [:a:] -> [:a:]
- combineP :: [:a:] -> [:a:] -> [:Int:] -> [:a:]
- zipP :: [:a:] -> [:b:] -> [:(a, b):]
- unzipP :: [:(a, b):] -> ([:a:], [:b:])
- zipWithP :: (a -> b -> c) -> [:a:] -> [:b:] -> [:c:]
- bpermuteP :: [:a:] -> [:Int:] -> [:a:]
- updateP :: [:a:] -> [:(Int, a):] -> [:a:]
- indexedP :: [:a:] -> [:(Int, a):]
- sliceP :: Int -> Int -> [:e:] -> [:e:]
- crossMapP :: [:a:] -> (a -> [:b:]) -> [:(a, b):]
- fromPArrayP :: PArray a -> [:a:]
- toPArrayP :: [:a:] -> PArray a
- fromNestedPArrayP :: PArray (PArray a) -> [:[:a:]:]
Documentation
module Data.Array.Parallel.Prelude
Operations on parallel arrays '[::]'
singletonP :: a -> [:a:]Source
replicateP :: Int -> a -> [:a:]Source
Conversions
fromPArrayP :: PArray a -> [:a:]Source
fromNestedPArrayP :: PArray (PArray a) -> [:[:a:]:]Source