Copyright | (c) Christopher Chalmers |
---|---|
License | BSD3 |
Maintainer | Christopher Chalmers |
Stability | provisional |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Base module for multidimensional arrays. This module exports the
constructors for the Array
data type.
Also, to prevent this module becomming too large, only the data types and the functions nessesary for the instances are defined here. All other functions are defined in Data.Dense.Generic.
- data Array v f a = Array !(Layout f) !(v a)
- type Boxed v = v ~ Vector
- vector :: (Vector v a, Vector w b) => IndexedLens (Layout f) (Array v f a) (Array w f b) (v a) (w b)
- values :: (Shape f, Vector v a, Vector w b) => IndexedTraversal (f Int) (Array v f a) (Array w f b) a b
- unsafeThaw :: (PrimMonad m, Vector v a) => Array v f a -> m (MArray (Mutable v) f (PrimState m) a)
- unsafeFreeze :: (PrimMonad m, Vector v a) => MArray (Mutable v) f (PrimState m) a -> m (Array v f a)
- data Delayed f a = Delayed !(Layout f) (f Int -> a)
- delay :: (Vector v a, Shape f) => Array v f a -> Delayed f a
- manifest :: (Vector v a, Shape f) => Delayed f a -> Array v f a
- genDelayed :: Layout f -> (f Int -> a) -> Delayed f a
- indexDelayed :: Shape f => Delayed f a -> f Int -> a
- data Focused f a = Focused !(f Int) !(Delayed f a)
Array types
An Array
is a vector with a shape.
Lenses
vector :: (Vector v a, Vector w b) => IndexedLens (Layout f) (Array v f a) (Array w f b) (v a) (w b) Source #
values :: (Shape f, Vector v a, Vector w b) => IndexedTraversal (f Int) (Array v f a) (Array w f b) a b Source #
Indexed traversal over the elements of an array. The index is the current position in the array.
Conversion to/from mutable arrays
unsafeThaw :: (PrimMonad m, Vector v a) => Array v f a -> m (MArray (Mutable v) f (PrimState m) a) Source #
O(1) Unsafely convert an immutable array to a mutable one without copying. The immutable array may not be used after this operation.
unsafeFreeze :: (PrimMonad m, Vector v a) => MArray (Mutable v) f (PrimState m) a -> m (Array v f a) Source #
O(1) Unsafe convert a mutable array to an immutable one without copying. The mutable array may not be used after this operation.
Delayed
A delayed representation of an array. This useful for mapping over an array in parallel.
Shape f => HasLayout f (Delayed f a) Source # | The |
Functor (Delayed f) Source # | |
Shape f => Foldable (Delayed f) Source # |
|
Shape f => Traversable (Delayed f) Source # | |
Shape f => Metric (Delayed f) Source # | |
Shape f => Additive (Delayed f) Source # | |
Shape f => Apply (Delayed f) Source # | |
FunctorWithIndex (f Int) (Delayed f) Source # | |
Shape f => FoldableWithIndex (f Int) (Delayed f) Source # |
|
Shape f => TraversableWithIndex (f Int) (Delayed f) Source # | |
(Shape f, Show1 f, Show a) => Show (Delayed f a) Source # | |
Shape f => Ixed (Delayed f a) Source # | |
Shape f => AsEmpty (Delayed f a) Source # | |
Shape f => Each (Delayed f a) (Delayed f b) a b Source # | |
type Index (Delayed f a) Source # | |
type IxValue (Delayed f a) Source # | |
delay :: (Vector v a, Shape f) => Array v f a -> Delayed f a Source #
Turn a material array into a delayed one with the same shape.
manifest :: (Vector v a, Shape f) => Delayed f a -> Array v f a Source #
Parallel manifestation of a delayed array into a material one.
indexDelayed :: Shape f => Delayed f a -> f Int -> a Source #
Index a delayed array, returning a IndexOutOfBounds
exception if
the index is out of range.
Focused
A delayed representation of an array with a focus on a single
element. This element is the target of extract
.
Shape f => HasLayout f (Focused f a) Source # | The |
Functor (Focused f) Source # | |
Shape f => Foldable (Focused f) Source # | |
Shape f => Traversable (Focused f) Source # | |
Shape f => Comonad (Focused f) Source # | |
Shape f => Extend (Focused f) Source # | |
Shape f => ComonadStore (f Int) (Focused f) Source # | |
Shape f => FunctorWithIndex (f Int) (Focused f) Source # | Index relative to focus. |
Shape f => FoldableWithIndex (f Int) (Focused f) Source # | Index relative to focus. |
Shape f => TraversableWithIndex (f Int) (Focused f) Source # | Index relative to focus. |
(Shape f, Show1 f, Show a) => Show (Focused f a) Source # | |
Shape f => Ixed (Focused f a) Source # | Index relative to focus. |
type Index (Focused f a) Source # | |
type IxValue (Focused f a) Source # | |