Safe Haskell | Safe-Infered |
---|
Parallel operations on unlifted arrays
- This is an internal API and shouldn't need to be used directly. Client programs should use Data.Array.Parallel.Unlifted
- lengthUP :: Unbox e => Vector e -> Int
- nullUP :: Unbox e => Vector e -> Bool
- emptyUP :: Unbox e => Vector e
- indexedUP :: (DT e, Unbox e) => Vector e -> Vector (Int, e)
- replicateUP :: Unbox e => Int -> e -> Vector e
- repeatUP :: Unbox e => Int -> Vector e -> Vector e
- interleaveUP :: Unbox e => Vector e -> Vector e -> Vector e
- mapUP :: (Unbox a, Unbox b) => (a -> b) -> Vector a -> Vector b
- filterUP :: Unbox a => (a -> Bool) -> Vector a -> Vector a
- packUP :: Unbox e => Vector e -> Vector Bool -> Vector e
- combineUP :: Unbox a => Vector Bool -> Vector a -> Vector a -> Vector a
- combine2UP :: Unbox a => Vector Tag -> UPSelRep2 -> Vector a -> Vector a -> Vector a
- zipWithUP :: (Unbox a, Unbox b, Unbox c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c
- foldUP :: (Unbox a, DT a) => (a -> a -> a) -> a -> Vector a -> a
- fold1UP :: (DT a, Unbox a) => (a -> a -> a) -> Vector a -> a
- foldlUP :: (DT a, Unbox a) => (a -> a -> a) -> a -> Vector a -> a
- foldl1UP :: (DT a, Unbox a) => (a -> a -> a) -> Vector a -> a
- scanUP :: (DT a, Unbox a) => (a -> a -> a) -> a -> Vector a -> Vector a
- enumFromToUP :: (Unbox a, Enum a) => a -> a -> Vector a
- enumFromThenToUP :: (Unbox a, Enum a) => a -> a -> a -> Vector a
- enumFromStepLenUP :: Int -> Int -> Int -> Vector Int
- enumFromStepLenEachUP :: Int -> Vector Int -> Vector Int -> Vector Int -> Vector Int
- bpermuteUP :: Unbox a => Vector a -> Vector Int -> Vector a
- updateUP :: forall a. Unbox a => Vector a -> Vector (Int, a) -> Vector a
- replicateRSUP :: Unbox a => Int -> Vector a -> Vector a
- appendSUP :: Unbox a => UPSegd -> UPSegd -> Vector a -> UPSegd -> Vector a -> Vector a
- foldRUP :: (Unbox a, Unbox b) => (b -> a -> b) -> b -> Int -> Vector a -> Vector b
- sumRUP :: (Num e, Unbox e) => Int -> Vector e -> Vector e
- indexsFromVector :: Unbox a => Vector a -> Vector Int -> Vector a
- indexsFromVectorsUPVSegd :: (Unbox a, Unboxes a) => Vectors a -> UPVSegd -> Vector (Int, Int) -> Vector a
- extractsFromNestedUPSSegd :: Unbox a => UPSSegd -> Vector (Vector a) -> Vector a
- extractsFromVectorsUPSSegd :: (Unbox a, Unboxes a) => UPSSegd -> Vectors a -> Vector a
- extractsFromVectorsUPVSegd :: (Unbox a, Unboxes a) => UPVSegd -> Vectors a -> Vector a
- dropUP :: Unbox e => Int -> Vector e -> Vector e
- andUP :: Vector Bool -> Bool
- orUP :: Vector Bool -> Bool
- allUP :: Unbox e => (e -> Bool) -> Vector e -> Bool
- anyUP :: Unbox e => (e -> Bool) -> Vector e -> Bool
- sumUP :: (Unbox a, DT a, Num a) => Vector a -> a
- productUP :: (DT e, Num e, Unbox e) => Vector e -> e
- maximumUP :: (DT e, Ord e, Unbox e) => Vector e -> e
- maximumByUP :: (DT e, Unbox e) => (e -> e -> Ordering) -> Vector e -> e
- maximumIndexByUP :: (DT e, Unbox e) => (e -> e -> Ordering) -> Vector e -> Int
Basics
indexedUP :: (DT e, Unbox e) => Vector e -> Vector (Int, e)Source
Associate each element of the array with its index
replicateUP :: Unbox e => Int -> e -> Vector eSource
Yield an array where all elements contain the same value
Combinators
mapUP :: (Unbox a, Unbox b) => (a -> b) -> Vector a -> Vector bSource
Apply a worker to all elements of an array.
filterUP :: Unbox a => (a -> Bool) -> Vector a -> Vector aSource
Keep elements that match the given predicate.
packUP :: Unbox e => Vector e -> Vector Bool -> Vector eSource
Take elements of an array where a flag value is true, and pack them into the result.
- The souce and flag arrays must have the same length, but this is not checked.
combineUP :: Unbox a => Vector Bool -> Vector a -> Vector a -> Vector aSource
Combine two vectors based on a selector. If the selector is true then take the element from the first vector, otherwise take it from the second.
- The data vectors must have enough elements to satisfy the flag vector, but this is not checked.
combine2UP :: Unbox a => Vector Tag -> UPSelRep2 -> Vector a -> Vector a -> Vector aSource
Combine two vectors based on a selector.
- The data vectors must have enough elements to satisfy the selector, but this is not checked.
zipWithUP :: (Unbox a, Unbox b, Unbox c) => (a -> b -> c) -> Vector a -> Vector b -> Vector cSource
Apply a worker function to correponding elements of two arrays.
foldUP :: (Unbox a, DT a) => (a -> a -> a) -> a -> Vector a -> aSource
Undirected fold. Note that this function has more constraints on its parameters than the standard fold function from the Haskell Prelude.
- The worker function must be associative.
- The provided starting element must be neutral with respect to the worker. For example 0 is neutral wrt (+) and 1 is neutral wrt (*).
We need these constraints so that we can partition the fold across several threads. Each thread folds a chunk of the input vector, then we fold together all the results in the main thread.
foldlUP :: (DT a, Unbox a) => (a -> a -> a) -> a -> Vector a -> aSource
Left fold over an array.
- If the vector is empty then this returns the provided neural element.
- The worker function must be associative.
- The provided starting element must be neutral with respect to the worker,
see
foldUP
for discussion.
foldl1UP :: (DT a, Unbox a) => (a -> a -> a) -> Vector a -> aSource
Left fold over an array, using the first element of the vector as the neural element.
- If the vector contains no elements then you'll get a bounds-check error.
- The worker function must be associative.
- The provided starting element must be neutral with respect to the worker,
see
foldUP
for discussion.
scanUP :: (DT a, Unbox a) => (a -> a -> a) -> a -> Vector a -> Vector aSource
Prefix scan. Similar to fold, but produce an array of the intermediate states.
- The worker function must be associative.
- The provided starting element must be neutral with respect to the worker,
see
foldUP
for discussion.
Enum
enumFromToUP :: (Unbox a, Enum a) => a -> a -> Vector aSource
enumFromThenToUP :: (Unbox a, Enum a) => a -> a -> a -> Vector aSource
Permute
updateUP :: forall a. Unbox a => Vector a -> Vector (Int, a) -> Vector aSource
Update elements in an array.
Segmented
replicateRSUP :: Unbox a => Int -> Vector a -> Vector aSource
Segmented replication. Each element in the vector is replicated the given number of times.
replicateRSUP 2 [1, 2, 3, 4, 5] = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]
appendSUP :: Unbox a => UPSegd -> UPSegd -> Vector a -> UPSegd -> Vector a -> Vector aSource
Segmented append.
foldRUP :: (Unbox a, Unbox b) => (b -> a -> b) -> b -> Int -> Vector a -> Vector bSource
Regular segmented fold.
Index and Extracts
indexsFromVector :: Unbox a => Vector a -> Vector Int -> Vector aSource
Lookup elements from a Vector
.
TODO: make this parallel.
indexsFromVectorsUPVSegd :: (Unbox a, Unboxes a) => Vectors a -> UPVSegd -> Vector (Int, Int) -> Vector aSource
extractsFromNestedUPSSegd :: Unbox a => UPSSegd -> Vector (Vector a) -> Vector aSource
Copy segments from a nested vectors and concatenate them into a new array.
extractsFromVectorsUPSSegd :: (Unbox a, Unboxes a) => UPSSegd -> Vectors a -> Vector aSource
TODO: make this parallel.
extractsFromVectorsUPVSegd :: (Unbox a, Unboxes a) => UPVSegd -> Vectors a -> Vector aSource
TODO: make this parallel.
Subarrays
dropUP :: Unbox e => Int -> Vector e -> Vector eSource
Drop a the element at the provided index from a vector.
Sums
allUP :: Unbox e => (e -> Bool) -> Vector e -> BoolSource
Check whether all the elements in a array meet the given predicate.
anyUP :: Unbox e => (e -> Bool) -> Vector e -> BoolSource
Check whether any of the elements in a array meet the given predicate.
productUP :: (DT e, Num e, Unbox e) => Vector e -> eSource
Compute the product of all the elements of an array.
maximumUP :: (DT e, Ord e, Unbox e) => Vector e -> eSource
Determine the maximum element in an array.