-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Backend Interface for Data Parallel Haskell
--
-- Backend Interface for Data Parallel Haskell
@package dph-prim-interface
@version 0.5.1.1
-- | This module provides the API for the DPH backend.
--
-- These are the DPH array primitives that the vectoriser introduces when
-- transforming code. The actual code in this module is fake, in the
-- sense that is provides a partial reference implementation using lists
-- to represent arrays, but this code isn't acually used at runtime.
--
-- The actual code used by compiled programs depends on whether
-- -fdph-par or -fdph-seq is passed when compiling it.
-- Depending on the flag, the implementation in either the
-- dph-prim-par or dph-prim-seq packages is swapped in.
-- These packages export the same API, but use a more efficient, and
-- perhaps parallel implementation.
--
-- All three packages are forced to use the same API by the
-- DPH_Header.h and DPH_Interface.h include files in
-- dph-prim-interface/interface.
module Data.Array.Parallel.Unlifted
class Elt a
type Array a = [a]
-- | O(1). Take the number of elements in an array.
length :: Elt a => Array a -> Int
-- | An array with no elements.
empty :: Elt a => Array a
-- | O(n). Append two arrays.
(+:+) :: Elt a => Array a -> Array a -> Array a
-- | Generate a new array given its length and a function to compute each
-- element.
generate :: Elt a => Int -> (Int -> a) -> Array a
-- | O(n). Produce a new array by replicating a single element the given
-- number of times.
replicate :: Elt a => Int -> a -> Array a
-- | Produce an array by copying a portion of another array.
repeat :: Elt a => Int -> Int -> Array a -> Array a
-- | Tag each element of an array with its index.
--
-- Example: indexed [:42, 93, 13:] = [:(0, 42), (1, 93), (2,
-- 13):]
indexed :: Elt a => Array a -> Array (Int, a)
-- | Generate a range of Ints.
enumFromTo :: Int -> Int -> Array Int
enumFromThenTo :: Int -> Int -> Int -> Array Int
enumFromStepLen :: Int -> Int -> Int -> Array Int
enumFromStepLenEach :: Int -> Array Int -> Array Int -> Array Int -> Array Int
-- | O(1). Retrieve a numbered element from an array.
(!:) :: Elt a => Array a -> Int -> a
-- | O(n). Extract a subrange of elements from an array. Example:
-- extract [:23, 42, 93, 50, 27:] 1 3 = [:42, 93, 50:]
extract :: Elt a => Array a -> Int -> Int -> Array a
-- | O(n). Drop some elements from the front of an array, returning the
-- latter portion.
drop :: Elt a => Int -> Array a -> Array a
-- | Extract the elements from an array that match the given predicate.
filter :: Elt a => (a -> Bool) -> Array a -> Array a
-- | O(n). Forwards permutation of array elements.
permute :: Elt a => Array a -> Array Int -> Array a
-- | O(n). Backwards permutation of array elements.
--
-- Example bpermute [:50, 60, 20, 30:] 3 [:0, 3, 2:] = [:50, 30,
-- 20:]
bpermute :: Elt a => Array a -> Array Int -> Array a
-- | Combination of map and bpermute.
--
-- The advantage of using this combined version is that we dont need to
-- apply the parameter function to source elements that dont appear in
-- the result.
mbpermute :: (Elt a, Elt b) => (a -> b) -> Array a -> Array Int -> Array b
-- | Default backwards permutation.
--
--
-- - The values of the index-value pairs are written into the position
-- in the result array that is indicated by the corresponding index.
-- - All positions not covered by the index-value pairs will have the
-- value determined by the initialiser function for that index
-- position.
--
bpermuteDft :: Elt e => Int -> (Int -> e) -> Array (Int, e) -> Array e
-- | O(n). Copy the source array in the destination, using new values for
-- the given indices.
update :: Elt a => Array a -> Array (Int, a) -> Array a
-- | Extract elements of an array where the associated flag is true.
pack :: Elt a => Array a -> Array Bool -> Array a
-- | Combine two arrays, using a tag array to tell us where to get each
-- element from.
--
-- Example: combine [T,F,F,T,T,F] [1,2,3] [4,5,6] =
-- [1,4,5,2,3,6]
combine :: Elt a => Array Bool -> Array a -> Array a -> Array a
-- | Like combine, but use a precomputed selector to speed up the
-- process.
--
-- See
-- dph-prim-seq:Data.Array.Parallel.Unlifted.Sequential.Segmented.USel
-- for a description of how this works.
combine2 :: Elt a => Array Tag -> SelRep2 -> Array a -> Array a -> Array a
-- | Interleave the elements of two arrays.
--
-- Example: interleave [1,2,3] [4,5,6] = [1,4,2,5,3,6]
interleave :: Elt a => Array a -> Array a -> Array a
-- | Apply a worker function to each element of an array, yielding a new
-- array.
map :: (Elt a, Elt b) => (a -> b) -> Array a -> Array b
-- | zipWith generalises zip by zipping with the function given as the
-- first argument, instead of a tupling function.
zipWith :: (Elt a, Elt b, Elt c) => (a -> b -> c) -> Array a -> Array b -> Array c
zipWith3 :: (Elt a, Elt b, Elt c, Elt d) => (a -> b -> c -> d) -> Array a -> Array b -> Array c -> Array d
zipWith4 :: (Elt a, Elt b, Elt c, Elt d, Elt e) => (a -> b -> c -> d -> e) -> Array a -> Array b -> Array c -> Array d -> Array e
-- | O(1). Takes two arrays and returns an array of corresponding pairs. If
-- one array is short, excess elements of the longer array are discarded.
zip :: (Elt a, Elt b) => Array a -> Array b -> Array (a, b)
-- | O(1). Transform an array into an array of the first components, and an
-- array of the second components.
unzip :: (Elt a, Elt b) => Array (a, b) -> (Array a, Array b)
-- | O(1). Take the first elements of an array of pairs.
fsts :: (Elt a, Elt b) => Array (a, b) -> Array a
-- | O(1). Take the second elements of an array of pairs.
snds :: (Elt a, Elt b) => Array (a, b) -> Array b
-- | Left fold over an array.
fold :: Elt a => (a -> a -> a) -> a -> Array a -> a
-- | Left fold over an array, using the first element to initialise the
-- state.
fold1 :: Elt a => (a -> a -> a) -> Array a -> a
-- | Compute the conjunction of all elements in a boolean array.
and :: Array Bool -> Bool
-- | Compute the sum of an array of numbers.
sum :: (Num a, Elt a) => Array a -> a
-- | Similar to foldl but return an array of the intermediate
-- states, including the final state that is computed by foldl.
scan :: Elt a => (a -> a -> a) -> a -> Array a -> Array a
append_s :: Elt a => Segd -> Segd -> Array a -> Segd -> Array a -> Array a
replicate_s :: Elt a => Segd -> Array a -> Array a
replicate_rs :: Elt a => Int -> Array a -> Array a
fold_s :: Elt a => (a -> a -> a) -> a -> Segd -> Array a -> Array a
fold1_s :: Elt a => (a -> a -> a) -> Segd -> Array a -> Array a
fold_r :: Elt a => (a -> a -> a) -> a -> Int -> Array a -> Array a
sum_s :: (Num a, Elt a) => Segd -> Array a -> Array a
sum_r :: (Num a, Elt a) => Int -> Array a -> Array a
data Segd
indices_s :: Segd -> Array Int
lengthSegd :: Segd -> Int
lengthsSegd :: Segd -> Array Int
indicesSegd :: Segd -> Array Int
elementsSegd :: Segd -> Int
lengthsToSegd :: Array Int -> Segd
mkSegd :: Array Int -> Array Int -> Int -> Segd
plusSegd :: Segd -> Segd -> Segd
data Sel2
-- | O(1). Construct a selector. Selectors are used to speed up the
-- combine2 operation.
--
-- See
-- dph-prim-seq:Data.Array.Parallel.Unlifted.Sequential.Segmented.USel
-- for a description of how this works.
mkSel2 :: Array Tag -> Array Int -> Int -> Int -> SelRep2 -> Sel2
-- | O(1). Get the tags array of a selector.
tagsSel2 :: Sel2 -> Array Tag
-- | O(1). Get the indices array of a selector.
indicesSel2 :: Sel2 -> Array Int
-- | O(1). Get the number of elements that will be taken from the first
-- array.
elementsSel2_0 :: Sel2 -> Int
-- | O(1). Get the number of elements that will be taken from the second
-- array.
elementsSel2_1 :: Sel2 -> Int
repSel2 :: Sel2 -> SelRep2
-- | O(n), Compute a selector from a tags array.
tagsToSel2 :: Array Tag -> Sel2
mkSelRep2 :: Array Tag -> SelRep2
indicesSelRep2 :: Array Tag -> SelRep2 -> Array Int
elementsSelRep2_0 :: Array Tag -> SelRep2 -> Int
elementsSelRep2_1 :: Array Tag -> SelRep2 -> Int
-- | Select the elements of an array that have a corresponding tag.
--
--
-- packByTag [12, 24, 42, 93] [1, 0, 0, 1] 0
-- = [24, 42]
--
packByTag :: Elt a => Array a -> Array Tag -> Tag -> Array a
pick :: (Elt a, Eq a) => Array a -> a -> Array Bool
-- | Count the number of elements in array that are equal to the given
-- value.
count :: (Elt a, Eq a) => Array a -> a -> Int
-- | Count the number of elements in segments that are equal to the given
-- value.
count_s :: (Elt a, Eq a) => Segd -> Array a -> a -> Array Int
randoms :: (Elt a, Random a, RandomGen g) => Int -> g -> Array a
randomRs :: (Elt a, Random a, RandomGen g) => Int -> (a, a) -> g -> Array a
class Elt a => IOElt a
-- | Read an array from a file.
hGet :: IOElt a => Handle -> IO (Array a)
-- | Write an array to a file.
hPut :: IOElt a => Handle -> Array a -> IO ()
-- | Convert an array to a list of elements.
toList :: Elt a => Array a -> [a]
-- | Convert a list of elements to an array.
fromList :: Elt a => [a] -> Array a
instance Elt a => Elt [a]
instance (IOElt a, IOElt b) => IOElt (a, b)
instance IOElt Double
instance IOElt Int
instance (Elt a, Elt b) => Elt (a, b)
instance Elt Double
instance Elt Float
instance Elt Bool
instance Elt Word8
instance Elt Int