Safe Haskell | Safe-Infered |
---|

Unvectorised parallel arrays.

- These operators may be used directly by unvectorised client programs.
- They are also used by the Data.Array.Parallel.Lifted.Combinators module to define the closure converted versions that vectorised code uses.
- In general, the operators here are all unsafe and don't do bounds checks. The lifted versions also don't check that each of the argument arrays have the same length.

- data PArray a
- class PR (PRepr a) => PA a
- valid :: PA a => PArray a -> Bool
- nf :: PA a => PArray a -> ()
- empty :: PA a => PArray a
- singleton :: PA a => a -> PArray a
- singletonl :: PA a => PArray a -> PArray (PArray a)
- replicate :: PA a => Int -> a -> PArray a
- replicatel :: PA a => PArray Int -> PArray a -> PArray (PArray a)
- replicates :: PA a => Segd -> PArray a -> PArray a
- replicates' :: PA a => PArray Int -> PArray a -> PArray a
- append :: PA a => PArray a -> PArray a -> PArray a
- appendl :: PA a => PArray (PArray a) -> PArray (PArray a) -> PArray (PArray a)
- concat :: PA a => PArray (PArray a) -> PArray a
- concatl :: PA a => PArray (PArray (PArray a)) -> PArray (PArray a)
- unconcat :: (PA a, PA b) => PArray (PArray a) -> PArray b -> PArray (PArray b)
- nestUSegd :: PA a => Segd -> PArray a -> PArray (PArray a)
- length :: PArray a -> Int
- lengthl :: PA a => PArray (PArray a) -> PArray Int
- index :: PA a => PArray a -> Int -> a
- indexl :: PA a => PArray (PArray a) -> PArray Int -> PArray a
- extract :: PA a => PArray a -> Int -> Int -> PArray a
- extracts :: PA a => Vector (PArray a) -> SSegd -> PArray a
- extracts' :: PA a => Vector (PArray a) -> PArray Int -> PArray Int -> PArray Int -> PArray a
- slice :: PA a => Int -> Int -> PArray a -> PArray a
- slicel :: PA a => PArray Int -> PArray Int -> PArray (PArray a) -> PArray (PArray a)
- takeUSegd :: PArray (PArray a) -> Segd
- pack :: PA a => PArray a -> PArray Bool -> PArray a
- packl :: PA a => PArray (PArray a) -> PArray (PArray Bool) -> PArray (PArray a)
- packByTag :: PA a => PArray a -> Array Tag -> Tag -> PArray a
- combine2 :: forall a. PA a => Sel2 -> PArray a -> PArray a -> PArray a
- enumFromTo :: Int -> Int -> PArray Int
- enumFromTol :: PArray Int -> PArray Int -> PArray (PArray Int)
- zip :: PArray a -> PArray b -> PArray (a, b)
- zipl :: (PA a, PA b) => PArray (PArray a) -> PArray (PArray b) -> PArray (PArray (a, b))
- zip3 :: PArray a -> PArray b -> PArray c -> PArray (a, b, c)
- zip4 :: PArray a -> PArray b -> PArray c -> PArray d -> PArray (a, b, c, d)
- zip5 :: PArray a -> PArray b -> PArray c -> PArray d -> PArray e -> PArray (a, b, c, d, e)
- unzip :: PArray (a, b) -> (PArray a, PArray b)
- unzipl :: PArray (PArray (a, b)) -> PArray (PArray a, PArray b)
- fromVector :: PA a => Vector a -> PArray a
- toVector :: PA a => PArray a -> Vector a
- fromList :: PA a => [a] -> PArray a
- toList :: PA a => PArray a -> [a]
- fromUArray :: Scalar a => Array a -> PArray a
- toUArray :: Scalar a => PArray a -> Array a
- fromUArray2 :: (Scalar a, Scalar b) => Array (a, b) -> PArray (a, b)

# Documentation

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) |

class PR (PRepr a) => PA a Source

A PA dictionary contains the functions that we use to convert a representable type to and from its generic representation.

The conversions methods should all be O(1).

PA Bool | |

PA Double | |

PA Int | |

PA Integer | |

PA Ordering | |

PA Word8 | |

PA () | |

PA Void | |

PA a => PA (PArray a) | |

(PR a, PR b) => PA (Either a b) | |

(PA a, PA b) => PA (a, b) | |

(PA a, PA b) => PA (:-> a b) | |

(PA a, PA b, PA c) => PA (a, b, c) | |

(PA a, PA b, PA c, PA d) => PA (a, b, c, d) | |

(PA a, PA b, PA c, PA d, PA e) => PA (a, b, c, d, e) |

# Constructors

singletonl :: PA a => PArray a -> PArray (PArray a)Source

O(n). Produce an array of singleton arrays.

replicate :: PA a => Int -> a -> PArray aSource

O(n). Define an array of the given size, that maps all elements to the same value. We require the replication count to be > 0 so that it's easier to maintain the validPR invariants for nested arrays.

replicatel :: PA a => PArray Int -> PArray a -> PArray (PArray a)Source

O(sum lengths). Lifted replicate.

replicates' :: PA a => PArray Int -> PArray a -> PArray aSource

O(sum lengths). Wrapper for segmented replicate that takes replication counts
and uses them to build the `Segd`

.

appendl :: PA a => PArray (PArray a) -> PArray (PArray a) -> PArray (PArray a)Source

Lifted append. Both arrays must have the same length

unconcat :: (PA a, PA b) => PArray (PArray a) -> PArray b -> PArray (PArray b)Source

Impose a nesting structure on a flat array

nestUSegd :: PA a => Segd -> PArray a -> PArray (PArray a)Source

Create a nested array from a segment descriptor and some flat data.
The segment descriptor must represent as many elements as present
in the flat data array, else `error`

# Projections

indexl :: PA a => PArray (PArray a) -> PArray Int -> PArray aSource

O(len indices). Lookup a several elements from several source arrays

extract :: PA a => PArray a -> Int -> Int -> PArray aSource

Extract a range of elements from an array.

:: PA a | |

=> Vector (PArray a) | |

-> PArray Int | id of source array for each segment. |

-> PArray Int | starting index of each segment in its source array. |

-> PArray Int | length of each segment. |

-> PArray a |

Wrapper for `extracts`

that takes arrays of sources, starts and lengths of
the segments, and uses these to build the `SSegd`

.
TODO: The lengths of the sources, starts and lengths arrays must be the same,
but this is not checked.
All sourceids must point to valid data arrays.
Segments must be within their corresponding source array.

slice :: PA a => Int -> Int -> PArray a -> PArray aSource

Extract a range of elements from an arrary.
Like `extract`

but with the parameters in a different order.

slicel :: PA a => PArray Int -> PArray Int -> PArray (PArray a) -> PArray (PArray a)Source

Extract some slices from some arrays. The arrays of starting indices and lengths must themselves have the same length.

takeUSegd :: PArray (PArray a) -> SegdSource

Take the segment descriptor from a nested array and demote it to a plain Segd. This is unsafe because it can cause index space overflow.

# Pack and Combine

pack :: PA a => PArray a -> PArray Bool -> PArray aSource

Select the elements of an array that have their tag set to True.

packByTag :: PA a => PArray a -> Array Tag -> Tag -> PArray aSource

Filter an array based on some tags.

combine2 :: forall a. PA a => Sel2 -> PArray a -> PArray a -> PArray aSource

Combine two arrays based on a selector.

# Enumerations

# Tuples

zip :: PArray a -> PArray b -> PArray (a, b)Source

O(1). Zip a pair of arrays into an array of pairs.
The two arrays must have the same length, else `error`

.

zipl :: (PA a, PA b) => PArray (PArray a) -> PArray (PArray b) -> PArray (PArray (a, b))Source

Lifted zip.

zip3 :: PArray a -> PArray b -> PArray c -> PArray (a, b, c)Source

O(1). Zip three arrays.
All arrays must have the same length, else `error`

.

zip4 :: PArray a -> PArray b -> PArray c -> PArray d -> PArray (a, b, c, d)Source

O(1). Zip four arrays.
All arrays must have the same length, else `error`

.

zip5 :: PArray a -> PArray b -> PArray c -> PArray d -> PArray e -> PArray (a, b, c, d, e)Source

O(1). Zip five arrays.
All arrays must have the same length, else `error`

.

unzip :: PArray (a, b) -> (PArray a, PArray b)Source

O(1). Unzip an array of pairs into a pair of arrays.

# Conversions

fromUArray :: Scalar a => Array a -> PArray aSource