fixed-vector-1.1.0.0: Generic vectors with statically known size.

Safe HaskellNone
LanguageHaskell98

Data.Vector.Fixed.Mutable

Contents

Description

Type classes for vectors which are implemented on top of the arrays and support in-place mutation. API is similar to one used in the vector package.

Synopsis

Mutable vectors

type Arity n = (ArityPeano (Peano n), KnownNat n, Peano (n + 1) ~ S (Peano n)) Source #

Type class for type level number for which we can defined operations over N-ary functions.

arity :: KnownNat n => proxy n -> Int Source #

Arity of function.

type family Mutable (v :: * -> *) :: * -> * -> * Source #

Mutable counterpart of fixed-length vector.

Instances

type Mutable (Vec n) Source # 
type Mutable (Vec n) = MVec n
type Mutable (Vec n) Source # 
type Mutable (Vec n) = MVec n
type Mutable (Vec n) Source # 
type Mutable (Vec n) = MVec n
type Mutable (Vec n) Source # 
type Mutable (Vec n) = MVec n

type family DimM (v :: * -> * -> *) :: Nat Source #

Dimension for mutable vector.

Instances

type DimM (MVec n) Source # 
type DimM (MVec n) = n
type DimM (MVec n) Source # 
type DimM (MVec n) = n
type DimM (MVec n) Source # 
type DimM (MVec n) = n
type DimM (MVec n) Source # 
type DimM (MVec n) = n

class Arity (DimM v) => MVector v a where Source #

Type class for mutable vectors.

Minimal complete definition

copy, move, new, unsafeRead, unsafeWrite

Methods

copy Source #

Arguments

:: PrimMonad m 
=> v (PrimState m) a

Target

-> v (PrimState m) a

Source

-> m () 

Copy vector. The two vectors may not overlap. Since vectors' length is encoded in the type there is no need in runtime checks.

move Source #

Arguments

:: PrimMonad m 
=> v (PrimState m) a

Target

-> v (PrimState m) a

Source

-> m () 

Copy vector. The two vectors may overlap. Since vectors' length is encoded in the type there is no need in runtime checks.

new :: PrimMonad m => m (v (PrimState m) a) Source #

Allocate new vector

unsafeRead :: PrimMonad m => v (PrimState m) a -> Int -> m a Source #

Read value at index without bound checks.

unsafeWrite :: PrimMonad m => v (PrimState m) a -> Int -> a -> m () Source #

Write value at index without bound checks.

Instances

Arity n => MVector (MVec n) a Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) a -> MVec n (PrimState m) a -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) a -> MVec n (PrimState m) a -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) a) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) a -> Int -> m a Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) a -> Int -> a -> m () Source #

(Arity n, Prim a) => MVector (MVec n) a Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) a -> MVec n (PrimState m) a -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) a -> MVec n (PrimState m) a -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) a) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) a -> Int -> m a Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) a -> Int -> a -> m () Source #

(Arity n, Storable a) => MVector (MVec n) a Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) a -> MVec n (PrimState m) a -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) a -> MVec n (PrimState m) a -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) a) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) a -> Int -> m a Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) a -> Int -> a -> m () Source #

Arity n => MVector (MVec n) All Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) All -> MVec n (PrimState m) All -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) All -> MVec n (PrimState m) All -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) All) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) All -> Int -> m All Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) All -> Int -> All -> m () Source #

Arity n => MVector (MVec n) Any Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) Any -> MVec n (PrimState m) Any -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) Any -> MVec n (PrimState m) Any -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) Any) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) Any -> Int -> m Any Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) Any -> Int -> Any -> m () Source #

Arity n => MVector (MVec n) Double Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) Double -> MVec n (PrimState m) Double -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) Double -> MVec n (PrimState m) Double -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) Double) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) Double -> Int -> m Double Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) Double -> Int -> Double -> m () Source #

Arity n => MVector (MVec n) Float Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) Float -> MVec n (PrimState m) Float -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) Float -> MVec n (PrimState m) Float -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) Float) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) Float -> Int -> m Float Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) Float -> Int -> Float -> m () Source #

Arity n => MVector (MVec n) Char Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) Char -> MVec n (PrimState m) Char -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) Char -> MVec n (PrimState m) Char -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) Char) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) Char -> Int -> m Char Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) Char -> Int -> Char -> m () Source #

Arity n => MVector (MVec n) Word64 Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) Word64 -> MVec n (PrimState m) Word64 -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) Word64 -> MVec n (PrimState m) Word64 -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) Word64) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) Word64 -> Int -> m Word64 Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) Word64 -> Int -> Word64 -> m () Source #

Arity n => MVector (MVec n) Word32 Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) Word32 -> MVec n (PrimState m) Word32 -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) Word32 -> MVec n (PrimState m) Word32 -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) Word32) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) Word32 -> Int -> m Word32 Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) Word32 -> Int -> Word32 -> m () Source #

Arity n => MVector (MVec n) Word16 Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) Word16 -> MVec n (PrimState m) Word16 -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) Word16 -> MVec n (PrimState m) Word16 -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) Word16) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) Word16 -> Int -> m Word16 Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) Word16 -> Int -> Word16 -> m () Source #

Arity n => MVector (MVec n) Word8 Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) Word8 -> MVec n (PrimState m) Word8 -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) Word8 -> MVec n (PrimState m) Word8 -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) Word8) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) Word8 -> Int -> m Word8 Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) Word8 -> Int -> Word8 -> m () Source #

Arity n => MVector (MVec n) Word Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) Word -> MVec n (PrimState m) Word -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) Word -> MVec n (PrimState m) Word -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) Word) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) Word -> Int -> m Word Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) Word -> Int -> Word -> m () Source #

Arity n => MVector (MVec n) Int64 Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) Int64 -> MVec n (PrimState m) Int64 -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) Int64 -> MVec n (PrimState m) Int64 -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) Int64) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) Int64 -> Int -> m Int64 Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) Int64 -> Int -> Int64 -> m () Source #

Arity n => MVector (MVec n) Int32 Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) Int32 -> MVec n (PrimState m) Int32 -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) Int32 -> MVec n (PrimState m) Int32 -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) Int32) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) Int32 -> Int -> m Int32 Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) Int32 -> Int -> Int32 -> m () Source #

Arity n => MVector (MVec n) Int16 Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) Int16 -> MVec n (PrimState m) Int16 -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) Int16 -> MVec n (PrimState m) Int16 -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) Int16) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) Int16 -> Int -> m Int16 Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) Int16 -> Int -> Int16 -> m () Source #

Arity n => MVector (MVec n) Int8 Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) Int8 -> MVec n (PrimState m) Int8 -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) Int8 -> MVec n (PrimState m) Int8 -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) Int8) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) Int8 -> Int -> m Int8 Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) Int8 -> Int -> Int8 -> m () Source #

Arity n => MVector (MVec n) Int Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) Int -> MVec n (PrimState m) Int -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) Int -> MVec n (PrimState m) Int -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) Int) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) Int -> Int -> m Int Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) Int -> Int -> Int -> m () Source #

Arity n => MVector (MVec n) Bool Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) Bool -> MVec n (PrimState m) Bool -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) Bool -> MVec n (PrimState m) Bool -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) Bool) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) Bool -> Int -> m Bool Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) Bool -> Int -> Bool -> m () Source #

Arity n => MVector (MVec n) () Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) () -> MVec n (PrimState m) () -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) () -> MVec n (PrimState m) () -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) ()) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) () -> Int -> m () Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) () -> Int -> () -> m () Source #

Unbox n a => MVector (MVec n) (Product a) Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) (Product a) -> MVec n (PrimState m) (Product a) -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) (Product a) -> MVec n (PrimState m) (Product a) -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) (Product a)) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) (Product a) -> Int -> m (Product a) Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) (Product a) -> Int -> Product a -> m () Source #

Unbox n a => MVector (MVec n) (Sum a) Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) (Sum a) -> MVec n (PrimState m) (Sum a) -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) (Sum a) -> MVec n (PrimState m) (Sum a) -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) (Sum a)) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) (Sum a) -> Int -> m (Sum a) Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) (Sum a) -> Int -> Sum a -> m () Source #

Unbox n a => MVector (MVec n) (Dual a) Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) (Dual a) -> MVec n (PrimState m) (Dual a) -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) (Dual a) -> MVec n (PrimState m) (Dual a) -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) (Dual a)) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) (Dual a) -> Int -> m (Dual a) Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) (Dual a) -> Int -> Dual a -> m () Source #

Unbox n a => MVector (MVec n) (Down a) Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) (Down a) -> MVec n (PrimState m) (Down a) -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) (Down a) -> MVec n (PrimState m) (Down a) -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) (Down a)) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) (Down a) -> Int -> m (Down a) Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) (Down a) -> Int -> Down a -> m () Source #

Unbox n a => MVector (MVec n) (Identity a) Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) (Identity a) -> MVec n (PrimState m) (Identity a) -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) (Identity a) -> MVec n (PrimState m) (Identity a) -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) (Identity a)) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) (Identity a) -> Int -> m (Identity a) Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) (Identity a) -> Int -> Identity a -> m () Source #

(Arity n, MVector (MVec n) a) => MVector (MVec n) (Complex a) Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) (Complex a) -> MVec n (PrimState m) (Complex a) -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) (Complex a) -> MVec n (PrimState m) (Complex a) -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) (Complex a)) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) (Complex a) -> Int -> m (Complex a) Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) (Complex a) -> Int -> Complex a -> m () Source #

(Arity n, MVector (MVec n) a, MVector (MVec n) b) => MVector (MVec n) (a, b) Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) (a, b) -> MVec n (PrimState m) (a, b) -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) (a, b) -> MVec n (PrimState m) (a, b) -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) (a, b)) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) (a, b) -> Int -> m (a, b) Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) (a, b) -> Int -> (a, b) -> m () Source #

Unbox n a => MVector (MVec n) (Const k a b) Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) (Const k a b) -> MVec n (PrimState m) (Const k a b) -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) (Const k a b) -> MVec n (PrimState m) (Const k a b) -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) (Const k a b)) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) (Const k a b) -> Int -> m (Const k a b) Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) (Const k a b) -> Int -> Const k a b -> m () Source #

(Arity n, MVector (MVec n) a, MVector (MVec n) b, MVector (MVec n) c) => MVector (MVec n) (a, b, c) Source # 

Methods

copy :: PrimMonad m => MVec n (PrimState m) (a, b, c) -> MVec n (PrimState m) (a, b, c) -> m () Source #

move :: PrimMonad m => MVec n (PrimState m) (a, b, c) -> MVec n (PrimState m) (a, b, c) -> m () Source #

new :: PrimMonad m => m (MVec n (PrimState m) (a, b, c)) Source #

unsafeRead :: PrimMonad m => MVec n (PrimState m) (a, b, c) -> Int -> m (a, b, c) Source #

unsafeWrite :: PrimMonad m => MVec n (PrimState m) (a, b, c) -> Int -> (a, b, c) -> m () Source #

lengthM :: forall v s a. Arity (DimM v) => v s a -> Int Source #

Length of mutable vector. Function doesn't evaluate its argument.

read :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Int -> m a Source #

Read value at index with bound checks.

write :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Int -> a -> m () Source #

Write value at index with bound checks.

clone :: (PrimMonad m, MVector v a) => v (PrimState m) a -> m (v (PrimState m) a) Source #

Create copy of vector.

Immutable vectors

class (Dim v ~ DimM (Mutable v), MVector (Mutable v) a) => IVector v a where Source #

Type class for immutable vectors

Minimal complete definition

unsafeFreeze, unsafeThaw, unsafeIndex

Methods

unsafeFreeze :: PrimMonad m => Mutable v (PrimState m) a -> m (v a) Source #

Convert vector to immutable state. Mutable vector must not be modified afterwards.

unsafeThaw :: PrimMonad m => v a -> m (Mutable v (PrimState m) a) Source #

Convert immutable vector to mutable. Immutable vector must not be used afterwards.

unsafeIndex :: v a -> Int -> a Source #

Get element at specified index without bounds check.

Instances

Arity n => IVector (Vec n) a Source # 

Methods

unsafeFreeze :: PrimMonad m => Mutable (Vec n) (PrimState m) a -> m (Vec n a) Source #

unsafeThaw :: PrimMonad m => Vec n a -> m (Mutable (Vec n) (PrimState m) a) Source #

unsafeIndex :: Vec n a -> Int -> a Source #

(Arity n, Prim a) => IVector (Vec n) a Source # 

Methods

unsafeFreeze :: PrimMonad m => Mutable (Vec n) (PrimState m) a -> m (Vec n a) Source #

unsafeThaw :: PrimMonad m => Vec n a -> m (Mutable (Vec n) (PrimState m) a) Source #

unsafeIndex :: Vec n a -> Int -> a Source #

(Arity n, Storable a) => IVector (Vec n) a Source # 

Methods

unsafeFreeze :: PrimMonad m => Mutable (Vec n) (PrimState m) a -> m (Vec n a) Source #

unsafeThaw :: PrimMonad m => Vec n a -> m (Mutable (Vec n) (PrimState m) a) Source #

unsafeIndex :: Vec n a -> Int -> a Source #

Arity n => IVector (Vec n) All Source # 
Arity n => IVector (Vec n) Any Source # 
Arity n => IVector (Vec n) Double Source # 
Arity n => IVector (Vec n) Float Source # 
Arity n => IVector (Vec n) Char Source # 
Arity n => IVector (Vec n) Word64 Source # 
Arity n => IVector (Vec n) Word32 Source # 
Arity n => IVector (Vec n) Word16 Source # 
Arity n => IVector (Vec n) Word8 Source # 
Arity n => IVector (Vec n) Word Source # 
Arity n => IVector (Vec n) Int64 Source # 
Arity n => IVector (Vec n) Int32 Source # 
Arity n => IVector (Vec n) Int16 Source # 
Arity n => IVector (Vec n) Int8 Source # 
Arity n => IVector (Vec n) Int Source # 
Arity n => IVector (Vec n) Bool Source # 
Arity n => IVector (Vec n) () Source # 

Methods

unsafeFreeze :: PrimMonad m => Mutable (Vec n) (PrimState m) () -> m (Vec n ()) Source #

unsafeThaw :: PrimMonad m => Vec n () -> m (Mutable (Vec n) (PrimState m) ()) Source #

unsafeIndex :: Vec n () -> Int -> () Source #

Unbox n a => IVector (Vec n) (Product a) Source # 

Methods

unsafeFreeze :: PrimMonad m => Mutable (Vec n) (PrimState m) (Product a) -> m (Vec n (Product a)) Source #

unsafeThaw :: PrimMonad m => Vec n (Product a) -> m (Mutable (Vec n) (PrimState m) (Product a)) Source #

unsafeIndex :: Vec n (Product a) -> Int -> Product a Source #

Unbox n a => IVector (Vec n) (Sum a) Source # 

Methods

unsafeFreeze :: PrimMonad m => Mutable (Vec n) (PrimState m) (Sum a) -> m (Vec n (Sum a)) Source #

unsafeThaw :: PrimMonad m => Vec n (Sum a) -> m (Mutable (Vec n) (PrimState m) (Sum a)) Source #

unsafeIndex :: Vec n (Sum a) -> Int -> Sum a Source #

Unbox n a => IVector (Vec n) (Dual a) Source # 

Methods

unsafeFreeze :: PrimMonad m => Mutable (Vec n) (PrimState m) (Dual a) -> m (Vec n (Dual a)) Source #

unsafeThaw :: PrimMonad m => Vec n (Dual a) -> m (Mutable (Vec n) (PrimState m) (Dual a)) Source #

unsafeIndex :: Vec n (Dual a) -> Int -> Dual a Source #

Unbox n a => IVector (Vec n) (Down a) Source # 

Methods

unsafeFreeze :: PrimMonad m => Mutable (Vec n) (PrimState m) (Down a) -> m (Vec n (Down a)) Source #

unsafeThaw :: PrimMonad m => Vec n (Down a) -> m (Mutable (Vec n) (PrimState m) (Down a)) Source #

unsafeIndex :: Vec n (Down a) -> Int -> Down a Source #

Unbox n a => IVector (Vec n) (Identity a) Source # 

Methods

unsafeFreeze :: PrimMonad m => Mutable (Vec n) (PrimState m) (Identity a) -> m (Vec n (Identity a)) Source #

unsafeThaw :: PrimMonad m => Vec n (Identity a) -> m (Mutable (Vec n) (PrimState m) (Identity a)) Source #

unsafeIndex :: Vec n (Identity a) -> Int -> Identity a Source #

(Arity n, IVector (Vec n) a) => IVector (Vec n) (Complex a) Source # 

Methods

unsafeFreeze :: PrimMonad m => Mutable (Vec n) (PrimState m) (Complex a) -> m (Vec n (Complex a)) Source #

unsafeThaw :: PrimMonad m => Vec n (Complex a) -> m (Mutable (Vec n) (PrimState m) (Complex a)) Source #

unsafeIndex :: Vec n (Complex a) -> Int -> Complex a Source #

(Arity n, IVector (Vec n) a, IVector (Vec n) b) => IVector (Vec n) (a, b) Source # 

Methods

unsafeFreeze :: PrimMonad m => Mutable (Vec n) (PrimState m) (a, b) -> m (Vec n (a, b)) Source #

unsafeThaw :: PrimMonad m => Vec n (a, b) -> m (Mutable (Vec n) (PrimState m) (a, b)) Source #

unsafeIndex :: Vec n (a, b) -> Int -> (a, b) Source #

Unbox n a => IVector (Vec n) (Const k a b) Source # 

Methods

unsafeFreeze :: PrimMonad m => Mutable (Vec n) (PrimState m) (Const k a b) -> m (Vec n (Const k a b)) Source #

unsafeThaw :: PrimMonad m => Vec n (Const k a b) -> m (Mutable (Vec n) (PrimState m) (Const k a b)) Source #

unsafeIndex :: Vec n (Const k a b) -> Int -> Const k a b Source #

(Arity n, Vector (Vec n) a, Vector (Vec n) b, Vector (Vec n) c, IVector (Vec n) a, IVector (Vec n) b, IVector (Vec n) c) => IVector (Vec n) (a, b, c) Source # 

Methods

unsafeFreeze :: PrimMonad m => Mutable (Vec n) (PrimState m) (a, b, c) -> m (Vec n (a, b, c)) Source #

unsafeThaw :: PrimMonad m => Vec n (a, b, c) -> m (Mutable (Vec n) (PrimState m) (a, b, c)) Source #

unsafeIndex :: Vec n (a, b, c) -> Int -> (a, b, c) Source #

index :: IVector v a => v a -> Int -> a Source #

freeze :: (PrimMonad m, IVector v a) => Mutable v (PrimState m) a -> m (v a) Source #

Safely convert mutable vector to immutable.

thaw :: (PrimMonad m, IVector v a) => v a -> m (Mutable v (PrimState m) a) Source #

Safely convert immutable vector to mutable.

Vector API

constructVec :: forall v a. (Arity (Dim v), IVector v a) => Fun (Peano (Dim v)) a (v a) Source #

Generic construct implementation for array-based vectors.

inspectVec :: forall v a b. (Arity (Dim v), IVector v a) => v a -> Fun (Peano (Dim v)) a b -> b Source #

Generic inspect implementation for array-based vectors.