massiv-0.5.2.0: Massiv (Массив) is an Array Library.

Copyright(c) Alexey Kuleshevich 2018-2019
LicenseBSD3
MaintainerAlexey Kuleshevich <lehins@yandex.ru>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Massiv.Array.Manifest

Contents

Description

 
Synopsis

Manifest

class (Load r ix e, Source r ix e) => Manifest r ix e Source #

Manifest arrays are backed by actual memory and values are looked up versus computed as it is with delayed arrays. Because of this fact indexing functions (!), (!?), etc. are constrained to manifest arrays only.

Minimal complete definition

unsafeLinearIndexM

Instances
Index ix => Manifest M ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

unsafeLinearIndexM :: Array M ix e -> Int -> e Source #

(Unbox e, Index ix) => Manifest U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

unsafeLinearIndexM :: Array U ix e -> Int -> e Source #

(Index ix, Prim e) => Manifest P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

unsafeLinearIndexM :: Array P ix e -> Int -> e Source #

(Index ix, Storable e) => Manifest S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

unsafeLinearIndexM :: Array S ix e -> Int -> e Source #

(Index ix, NFData e) => Manifest N ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeLinearIndexM :: Array N ix e -> Int -> e Source #

Index ix => Manifest B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeLinearIndexM :: Array B ix e -> Int -> e Source #

toManifest :: Manifest r ix e => Array r ix e -> Array M ix e Source #

O(1) - Conversion of Manifest arrays to M representation.

data M Source #

General Manifest representation

Instances
Index ix => Resize M ix Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

unsafeResize :: Index ix' => Sz ix' -> Array M ix e -> Array M ix' e Source #

Index ix => Manifest M ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

unsafeLinearIndexM :: Array M ix e -> Int -> e Source #

(Index ix, Index (Lower ix), Elt M ix e ~ Array M (Lower ix) e) => Slice M ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

unsafeSlice :: MonadThrow m => Array M ix e -> ix -> Sz ix -> Dim -> m (Elt M ix e) Source #

Slice M Ix1 e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

unsafeSlice :: MonadThrow m => Array M Ix1 e -> Ix1 -> Sz Ix1 -> Dim -> m (Elt M Ix1 e) Source #

(Elt M ix e ~ Array M (Lower ix) e, Index ix, Index (Lower ix)) => InnerSlice M ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

unsafeInnerSlice :: Array M ix e -> (Sz (Lower ix), Sz Int) -> Int -> Elt M ix e Source #

InnerSlice M Ix1 e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

unsafeInnerSlice :: Array M Ix1 e -> (Sz (Lower Ix1), Sz Int) -> Int -> Elt M Ix1 e Source #

(Elt M ix e ~ Array M (Lower ix) e, Index ix, Index (Lower ix)) => OuterSlice M ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

unsafeOuterSlice :: Array M ix e -> Int -> Elt M ix e Source #

OuterSlice M Ix1 e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

unsafeOuterSlice :: Array M Ix1 e -> Int -> Elt M Ix1 e Source #

Index ix => StrideLoad M ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

loadArrayWithStrideM :: Monad m => Scheduler m () -> Stride ix -> Sz ix -> Array M ix e -> (Int -> e -> m ()) -> m () Source #

Index ix => Load M ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Associated Types

type R M :: Type Source #

Methods

getComp :: Array M ix e -> Comp Source #

size :: Array M ix e -> Sz ix Source #

loadArrayM :: Monad m => Scheduler m () -> Array M ix e -> (Int -> e -> m ()) -> m () Source #

defaultElement :: Array M ix e -> Maybe e Source #

maxSize :: Array M ix e -> Maybe (Sz ix) Source #

isEmpty :: Array M ix e -> Bool Source #

unsafeLoadIntoS :: (Mutable r' ix e, PrimMonad m) => MArray (PrimState m) r' ix e -> Array M ix e -> m (MArray (PrimState m) r' ix e)

unsafeLoadInto :: (Mutable r' ix e, MonadIO m) => MArray RealWorld r' ix e -> Array M ix e -> m (MArray RealWorld r' ix e)

Index ix => Source M ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

unsafeIndex :: Array M ix e -> ix -> e Source #

unsafeLinearIndex :: Array M ix e -> Int -> e Source #

unsafeLinearSlice :: Ix1 -> Sz1 -> Array M ix e -> Array M Ix1 e Source #

Index ix => Extract M ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

unsafeExtract :: ix -> Sz ix -> Array M ix e -> Array (R M) ix e Source #

Index ix => Stream M ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

toStream :: Array M ix e -> Steps Id e Source #

toStreamIx :: Array M ix e -> Steps Id (ix, e) Source #

Index ix => Foldable (Array M ix) Source #

Row-major sequentia folding over a Manifest array.

Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

fold :: Monoid m => Array M ix m -> m #

foldMap :: Monoid m => (a -> m) -> Array M ix a -> m #

foldr :: (a -> b -> b) -> b -> Array M ix a -> b #

foldr' :: (a -> b -> b) -> b -> Array M ix a -> b #

foldl :: (b -> a -> b) -> b -> Array M ix a -> b #

foldl' :: (b -> a -> b) -> b -> Array M ix a -> b #

foldr1 :: (a -> a -> a) -> Array M ix a -> a #

foldl1 :: (a -> a -> a) -> Array M ix a -> a #

toList :: Array M ix a -> [a] #

null :: Array M ix a -> Bool #

length :: Array M ix a -> Int #

elem :: Eq a => a -> Array M ix a -> Bool #

maximum :: Ord a => Array M ix a -> a #

minimum :: Ord a => Array M ix a -> a #

sum :: Num a => Array M ix a -> a #

product :: Num a => Array M ix a -> a #

(Eq e, Index ix) => Eq (Array M ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

(==) :: Array M ix e -> Array M ix e -> Bool #

(/=) :: Array M ix e -> Array M ix e -> Bool #

(Ord e, Index ix) => Ord (Array M ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

compare :: Array M ix e -> Array M ix e -> Ordering #

(<) :: Array M ix e -> Array M ix e -> Bool #

(<=) :: Array M ix e -> Array M ix e -> Bool #

(>) :: Array M ix e -> Array M ix e -> Bool #

(>=) :: Array M ix e -> Array M ix e -> Bool #

max :: Array M ix e -> Array M ix e -> Array M ix e #

min :: Array M ix e -> Array M ix e -> Array M ix e #

(Ragged L ix e, Show e) => Show (Array M ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

Methods

showsPrec :: Int -> Array M ix e -> ShowS #

show :: Array M ix e -> String #

showList :: [Array M ix e] -> ShowS #

type R M Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

type R M = M
data Array M ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Internal

data Array M ix e = MArray {}

Boxed

data B Source #

Array representation for Boxed elements. This structure is element and spine strict, but elements are strict to Weak Head Normal Form (WHNF) only.

Constructors

B 
Instances
Show B Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

showsPrec :: Int -> B -> ShowS #

show :: B -> String #

showList :: [B] -> ShowS #

Index ix => Resize B ix Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeResize :: Index ix' => Sz ix' -> Array B ix e -> Array B ix' e Source #

Index ix => Mutable B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Associated Types

data MArray s B ix e :: Type Source #

Methods

msize :: MArray s B ix e -> Sz ix Source #

unsafeThaw :: PrimMonad m => Array B ix e -> m (MArray (PrimState m) B ix e) Source #

unsafeFreeze :: PrimMonad m => Comp -> MArray (PrimState m) B ix e -> m (Array B ix e) Source #

unsafeNew :: PrimMonad m => Sz ix -> m (MArray (PrimState m) B ix e) Source #

unsafeLinearRead :: PrimMonad m => MArray (PrimState m) B ix e -> Int -> m e Source #

unsafeLinearWrite :: PrimMonad m => MArray (PrimState m) B ix e -> Int -> e -> m () Source #

initialize :: PrimMonad m => MArray (PrimState m) B ix e -> m () Source #

initializeNew :: PrimMonad m => Maybe e -> Sz ix -> m (MArray (PrimState m) B ix e) Source #

unsafeLinearSet :: PrimMonad m => MArray (PrimState m) B ix e -> Ix1 -> Sz1 -> e -> m () Source #

unsafeLinearCopy :: (Mutable B ix' e, PrimMonad m) => MArray (PrimState m) B ix' e -> Ix1 -> MArray (PrimState m) B ix e -> Ix1 -> Sz1 -> m () Source #

unsafeArrayLinearCopy :: (Mutable B ix' e, PrimMonad m) => Array B ix' e -> Ix1 -> MArray (PrimState m) B ix e -> Ix1 -> Sz1 -> m () Source #

unsafeLinearShrink :: PrimMonad m => MArray (PrimState m) B ix e -> Sz ix -> m (MArray (PrimState m) B ix e) Source #

unsafeLinearGrow :: PrimMonad m => MArray (PrimState m) B ix e -> Sz ix -> m (MArray (PrimState m) B ix e) Source #

Index ix => Manifest B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeLinearIndexM :: Array B ix e -> Int -> e Source #

Slice B Ix1 e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeSlice :: MonadThrow m => Array B Ix1 e -> Ix1 -> Sz Ix1 -> Dim -> m (Elt B Ix1 e) Source #

(Index ix, Index (Lower ix), Elt M ix e ~ Array M (Lower ix) e, Elt B ix e ~ Array M (Lower ix) e) => InnerSlice B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeInnerSlice :: Array B ix e -> (Sz (Lower ix), Sz Int) -> Int -> Elt B ix e Source #

(Index ix, Index (Lower ix), Elt M ix e ~ Array M (Lower ix) e, Elt B ix e ~ Array M (Lower ix) e) => OuterSlice B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeOuterSlice :: Array B ix e -> Int -> Elt B ix e Source #

Index ix => StrideLoad B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

loadArrayWithStrideM :: Monad m => Scheduler m () -> Stride ix -> Sz ix -> Array B ix e -> (Int -> e -> m ()) -> m () Source #

Index ix => Load B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Associated Types

type R B :: Type Source #

Methods

getComp :: Array B ix e -> Comp Source #

size :: Array B ix e -> Sz ix Source #

loadArrayM :: Monad m => Scheduler m () -> Array B ix e -> (Int -> e -> m ()) -> m () Source #

defaultElement :: Array B ix e -> Maybe e Source #

maxSize :: Array B ix e -> Maybe (Sz ix) Source #

isEmpty :: Array B ix e -> Bool Source #

unsafeLoadIntoS :: (Mutable r' ix e, PrimMonad m) => MArray (PrimState m) r' ix e -> Array B ix e -> m (MArray (PrimState m) r' ix e)

unsafeLoadInto :: (Mutable r' ix e, MonadIO m) => MArray RealWorld r' ix e -> Array B ix e -> m (MArray RealWorld r' ix e)

Index ix => Source B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeIndex :: Array B ix e -> ix -> e Source #

unsafeLinearIndex :: Array B ix e -> Int -> e Source #

unsafeLinearSlice :: Ix1 -> Sz1 -> Array B ix e -> Array B Ix1 e Source #

Index ix => Extract B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeExtract :: ix -> Sz ix -> Array B ix e -> Array (R B) ix e Source #

Index ix => Construct B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

setComp :: Comp -> Array B ix e -> Array B ix e Source #

makeArray :: Comp -> Sz ix -> (ix -> e) -> Array B ix e Source #

makeArrayLinear :: Comp -> Sz ix -> (Int -> e) -> Array B ix e Source #

Index ix => Stream B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

toStream :: Array B ix e -> Steps Id e Source #

toStreamIx :: Array B ix e -> Steps Id (ix, e) Source #

Index ix => Functor (Array B ix) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

fmap :: (a -> b) -> Array B ix a -> Array B ix b #

(<$) :: a -> Array B ix b -> Array B ix a #

Index ix => Foldable (Array B ix) Source #

Row-major sequential folding over a Boxed array.

Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

fold :: Monoid m => Array B ix m -> m #

foldMap :: Monoid m => (a -> m) -> Array B ix a -> m #

foldr :: (a -> b -> b) -> b -> Array B ix a -> b #

foldr' :: (a -> b -> b) -> b -> Array B ix a -> b #

foldl :: (b -> a -> b) -> b -> Array B ix a -> b #

foldl' :: (b -> a -> b) -> b -> Array B ix a -> b #

foldr1 :: (a -> a -> a) -> Array B ix a -> a #

foldl1 :: (a -> a -> a) -> Array B ix a -> a #

toList :: Array B ix a -> [a] #

null :: Array B ix a -> Bool #

length :: Array B ix a -> Int #

elem :: Eq a => a -> Array B ix a -> Bool #

maximum :: Ord a => Array B ix a -> a #

minimum :: Ord a => Array B ix a -> a #

sum :: Num a => Array B ix a -> a #

product :: Num a => Array B ix a -> a #

Index ix => Traversable (Array B ix) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

traverse :: Applicative f => (a -> f b) -> Array B ix a -> f (Array B ix b) #

sequenceA :: Applicative f => Array B ix (f a) -> f (Array B ix a) #

mapM :: Monad m => (a -> m b) -> Array B ix a -> m (Array B ix b) #

sequence :: Monad m => Array B ix (m a) -> m (Array B ix a) #

(IsList (Array L ix e), Nested LN ix e, Nested L ix e, Ragged L ix e) => IsList (Array B ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Associated Types

type Item (Array B ix e) :: Type #

Methods

fromList :: [Item (Array B ix e)] -> Array B ix e #

fromListN :: Int -> [Item (Array B ix e)] -> Array B ix e #

toList :: Array B ix e -> [Item (Array B ix e)] #

(Index ix, Eq e) => Eq (Array B ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

(==) :: Array B ix e -> Array B ix e -> Bool #

(/=) :: Array B ix e -> Array B ix e -> Bool #

(Index ix, Ord e) => Ord (Array B ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

compare :: Array B ix e -> Array B ix e -> Ordering #

(<) :: Array B ix e -> Array B ix e -> Bool #

(<=) :: Array B ix e -> Array B ix e -> Bool #

(>) :: Array B ix e -> Array B ix e -> Bool #

(>=) :: Array B ix e -> Array B ix e -> Bool #

max :: Array B ix e -> Array B ix e -> Array B ix e #

min :: Array B ix e -> Array B ix e -> Array B ix e #

(Ragged L ix e, Show e) => Show (Array B ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

showsPrec :: Int -> Array B ix e -> ShowS #

show :: Array B ix e -> String #

showList :: [Array B ix e] -> ShowS #

(Index ix, NFData e) => NFData (Array B ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

rnf :: Array B ix e -> () #

type R B Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

type R B = M
data Array B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

data Array B ix e = BArray {}
data MArray s B ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

data MArray s B ix e = MBArray !(Sz ix) !Int !(MutableArray s e)
type Item (Array B ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

type Item (Array B ix e) = Item (Array L ix e)

data N Source #

Array representation for Boxed elements. This structure is element and spine strict, and elements are always in Normal Form (NF), therefore NFData instance is required.

Constructors

N 
Instances
Show N Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

showsPrec :: Int -> N -> ShowS #

show :: N -> String #

showList :: [N] -> ShowS #

Index ix => Resize N ix Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeResize :: Index ix' => Sz ix' -> Array N ix e -> Array N ix' e Source #

(Index ix, NFData e) => Mutable N ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Associated Types

data MArray s N ix e :: Type Source #

Methods

msize :: MArray s N ix e -> Sz ix Source #

unsafeThaw :: PrimMonad m => Array N ix e -> m (MArray (PrimState m) N ix e) Source #

unsafeFreeze :: PrimMonad m => Comp -> MArray (PrimState m) N ix e -> m (Array N ix e) Source #

unsafeNew :: PrimMonad m => Sz ix -> m (MArray (PrimState m) N ix e) Source #

unsafeLinearRead :: PrimMonad m => MArray (PrimState m) N ix e -> Int -> m e Source #

unsafeLinearWrite :: PrimMonad m => MArray (PrimState m) N ix e -> Int -> e -> m () Source #

initialize :: PrimMonad m => MArray (PrimState m) N ix e -> m () Source #

initializeNew :: PrimMonad m => Maybe e -> Sz ix -> m (MArray (PrimState m) N ix e) Source #

unsafeLinearSet :: PrimMonad m => MArray (PrimState m) N ix e -> Ix1 -> Sz1 -> e -> m () Source #

unsafeLinearCopy :: (Mutable N ix' e, PrimMonad m) => MArray (PrimState m) N ix' e -> Ix1 -> MArray (PrimState m) N ix e -> Ix1 -> Sz1 -> m () Source #

unsafeArrayLinearCopy :: (Mutable N ix' e, PrimMonad m) => Array N ix' e -> Ix1 -> MArray (PrimState m) N ix e -> Ix1 -> Sz1 -> m () Source #

unsafeLinearShrink :: PrimMonad m => MArray (PrimState m) N ix e -> Sz ix -> m (MArray (PrimState m) N ix e) Source #

unsafeLinearGrow :: PrimMonad m => MArray (PrimState m) N ix e -> Sz ix -> m (MArray (PrimState m) N ix e) Source #

(Index ix, NFData e) => Manifest N ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeLinearIndexM :: Array N ix e -> Int -> e Source #

NFData e => Slice N Ix1 e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeSlice :: MonadThrow m => Array N Ix1 e -> Ix1 -> Sz Ix1 -> Dim -> m (Elt N Ix1 e) Source #

(NFData e, Index ix, Index (Lower ix), Elt M ix e ~ Array M (Lower ix) e, Elt N ix e ~ Array M (Lower ix) e) => InnerSlice N ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeInnerSlice :: Array N ix e -> (Sz (Lower ix), Sz Int) -> Int -> Elt N ix e Source #

(NFData e, Index ix, Index (Lower ix), Elt M ix e ~ Array M (Lower ix) e, Elt N ix e ~ Array M (Lower ix) e) => OuterSlice N ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeOuterSlice :: Array N ix e -> Int -> Elt N ix e Source #

(Index ix, NFData e) => StrideLoad N ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

loadArrayWithStrideM :: Monad m => Scheduler m () -> Stride ix -> Sz ix -> Array N ix e -> (Int -> e -> m ()) -> m () Source #

(Index ix, NFData e) => Load N ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Associated Types

type R N :: Type Source #

Methods

getComp :: Array N ix e -> Comp Source #

size :: Array N ix e -> Sz ix Source #

loadArrayM :: Monad m => Scheduler m () -> Array N ix e -> (Int -> e -> m ()) -> m () Source #

defaultElement :: Array N ix e -> Maybe e Source #

maxSize :: Array N ix e -> Maybe (Sz ix) Source #

isEmpty :: Array N ix e -> Bool Source #

unsafeLoadIntoS :: (Mutable r' ix e, PrimMonad m) => MArray (PrimState m) r' ix e -> Array N ix e -> m (MArray (PrimState m) r' ix e)

unsafeLoadInto :: (Mutable r' ix e, MonadIO m) => MArray RealWorld r' ix e -> Array N ix e -> m (MArray RealWorld r' ix e)

(Index ix, NFData e) => Source N ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeIndex :: Array N ix e -> ix -> e Source #

unsafeLinearIndex :: Array N ix e -> Int -> e Source #

unsafeLinearSlice :: Ix1 -> Sz1 -> Array N ix e -> Array N Ix1 e Source #

(Index ix, NFData e) => Extract N ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

unsafeExtract :: ix -> Sz ix -> Array N ix e -> Array (R N) ix e Source #

(Index ix, NFData e) => Construct N ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

setComp :: Comp -> Array N ix e -> Array N ix e Source #

makeArray :: Comp -> Sz ix -> (ix -> e) -> Array N ix e Source #

makeArrayLinear :: Comp -> Sz ix -> (Int -> e) -> Array N ix e Source #

(Index ix, NFData e) => Stream N ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

toStream :: Array N ix e -> Steps Id e Source #

toStreamIx :: Array N ix e -> Steps Id (ix, e) Source #

(NFData e, IsList (Array L ix e), Nested LN ix e, Nested L ix e, Ragged L ix e) => IsList (Array N ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Associated Types

type Item (Array N ix e) :: Type #

Methods

fromList :: [Item (Array N ix e)] -> Array N ix e #

fromListN :: Int -> [Item (Array N ix e)] -> Array N ix e #

toList :: Array N ix e -> [Item (Array N ix e)] #

(Index ix, NFData e, Eq e) => Eq (Array N ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

(==) :: Array N ix e -> Array N ix e -> Bool #

(/=) :: Array N ix e -> Array N ix e -> Bool #

(Index ix, NFData e, Ord e) => Ord (Array N ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

compare :: Array N ix e -> Array N ix e -> Ordering #

(<) :: Array N ix e -> Array N ix e -> Bool #

(<=) :: Array N ix e -> Array N ix e -> Bool #

(>) :: Array N ix e -> Array N ix e -> Bool #

(>=) :: Array N ix e -> Array N ix e -> Bool #

max :: Array N ix e -> Array N ix e -> Array N ix e #

min :: Array N ix e -> Array N ix e -> Array N ix e #

(Ragged L ix e, Show e, NFData e) => Show (Array N ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

showsPrec :: Int -> Array N ix e -> ShowS #

show :: Array N ix e -> String #

showList :: [Array N ix e] -> ShowS #

(Index ix, NFData e) => NFData (Array N ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

rnf :: Array N ix e -> () #

type R N Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

type R N = M
newtype Array N ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

newtype Array N ix e = NArray {}
newtype MArray s N ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

newtype MArray s N ix e = MNArray {}
type Item (Array N ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

type Item (Array N ix e) = Item (Array L ix e)

data Uninitialized Source #

An error that gets thrown when an unitialized element of a boxed array gets accessed. Can only happen when array was constructed with unsafeNew.

Constructors

Uninitialized 

Conversion

Important part of all conversions in this section is that the actual boxed Array, which holds the pointers to values isn't copied around, it is always kept as the same array. Conversion to Massiv boxed array will undergo evaluation during which computation strategies will be respected.

unwrapNormalForm :: Array N ix e -> Array B ix e Source #

O(n) - Compute all elements of a boxed array to NF (normal form)

Since: 0.5.0

evalNormalForm :: (Index ix, NFData e) => Array B ix e -> Array N ix e Source #

O(n) - Compute all elements of a boxed array to NF (normal form)

Since: 0.5.0

Primitive Boxed Array

unwrapArray :: Array B ix e -> Array e Source #

O(1) - Unwrap boxed array. This will discard any possible slicing that has been applied to the array.

Since: 0.2.1

evalArray Source #

Arguments

:: Comp

Computation strategy

-> Array e

Lazy boxed array from primitive package.

-> Array B Ix1 e 

O(n) - Wrap a boxed array and evaluate all elements to a WHNF.

Since: 0.2.1

unwrapMutableArray :: MArray s B ix e -> MutableArray s e Source #

O(1) - Unwrap mutable boxed array. This will discard any possible slicing that has been applied to the array.

Since: 0.2.1

evalMutableArray Source #

Arguments

:: PrimMonad m 
=> MutableArray (PrimState m) e

Mutable array that will get wrapped

-> m (MArray (PrimState m) B Ix1 e) 

O(n) - Wrap mutable boxed array and evaluate all elements to WHNF.

Since: 0.2.1

unwrapNormalFormArray :: Array N ix e -> Array e Source #

O(1) - Unwrap a fully evaluated boxed array. This will discard any possible slicing that has been applied to the array.

Since: 0.2.1

evalNormalFormArray Source #

Arguments

:: NFData e 
=> Comp

Computation strategy

-> Array e

Lazy boxed array

-> Array N Ix1 e 

O(n) - Wrap a boxed array and evaluate all elements to a Normal Form (NF).

Since: 0.2.1

unwrapNormalFormMutableArray :: MArray s N ix e -> MutableArray s e Source #

O(1) - Unwrap a fully evaluated mutable boxed array. This will discard any possible slicing that has been applied to the array.

Since: 0.2.1

evalNormalFormMutableArray :: (PrimMonad m, NFData e) => MutableArray (PrimState m) e -> m (MArray (PrimState m) N Ix1 e) Source #

O(n) - Wrap mutable boxed array and evaluate all elements to NF.

Since: 0.2.1

Boxed Vector

toBoxedVector :: Index ix => Array B ix a -> Vector a Source #

O(1) - Converts a boxed Array into a Vector.

Since: 0.5.0

toBoxedMVector :: Index ix => MArray s B ix a -> MVector s a Source #

O(1) - Converts a boxed MArray into a MVector.

Since: 0.5.0

evalBoxedVector :: Comp -> Vector a -> Array B Ix1 a Source #

O(n) - Convert a boxed vector and evaluate all elements to WHNF. Computation strategy will be respected during evaluation

Since: 0.5.0

evalBoxedMVector :: PrimMonad m => MVector (PrimState m) a -> m (MArray (PrimState m) B Ix1 a) Source #

O(n) - Convert mutable boxed vector and evaluate all elements to WHNF sequentially. Both keep pointing to the same memory

Since: 0.5.0

Primitive

data P Source #

Representation for Primitive elements

Constructors

P 
Instances
Show P Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

showsPrec :: Int -> P -> ShowS #

show :: P -> String #

showList :: [P] -> ShowS #

Index ix => Resize P ix Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

unsafeResize :: Index ix' => Sz ix' -> Array P ix e -> Array P ix' e Source #

(Index ix, Prim e) => Mutable P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Associated Types

data MArray s P ix e :: Type Source #

Methods

msize :: MArray s P ix e -> Sz ix Source #

unsafeThaw :: PrimMonad m => Array P ix e -> m (MArray (PrimState m) P ix e) Source #

unsafeFreeze :: PrimMonad m => Comp -> MArray (PrimState m) P ix e -> m (Array P ix e) Source #

unsafeNew :: PrimMonad m => Sz ix -> m (MArray (PrimState m) P ix e) Source #

unsafeLinearRead :: PrimMonad m => MArray (PrimState m) P ix e -> Int -> m e Source #

unsafeLinearWrite :: PrimMonad m => MArray (PrimState m) P ix e -> Int -> e -> m () Source #

initialize :: PrimMonad m => MArray (PrimState m) P ix e -> m () Source #

initializeNew :: PrimMonad m => Maybe e -> Sz ix -> m (MArray (PrimState m) P ix e) Source #

unsafeLinearSet :: PrimMonad m => MArray (PrimState m) P ix e -> Ix1 -> Sz1 -> e -> m () Source #

unsafeLinearCopy :: (Mutable P ix' e, PrimMonad m) => MArray (PrimState m) P ix' e -> Ix1 -> MArray (PrimState m) P ix e -> Ix1 -> Sz1 -> m () Source #

unsafeArrayLinearCopy :: (Mutable P ix' e, PrimMonad m) => Array P ix' e -> Ix1 -> MArray (PrimState m) P ix e -> Ix1 -> Sz1 -> m () Source #

unsafeLinearShrink :: PrimMonad m => MArray (PrimState m) P ix e -> Sz ix -> m (MArray (PrimState m) P ix e) Source #

unsafeLinearGrow :: PrimMonad m => MArray (PrimState m) P ix e -> Sz ix -> m (MArray (PrimState m) P ix e) Source #

(Index ix, Prim e) => Manifest P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

unsafeLinearIndexM :: Array P ix e -> Int -> e Source #

(Prim e, Index ix, Index (Lower ix), Elt P ix e ~ Elt M ix e, Elt M ix e ~ Array M (Lower ix) e) => Slice P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

unsafeSlice :: MonadThrow m => Array P ix e -> ix -> Sz ix -> Dim -> m (Elt P ix e) Source #

Prim e => Slice P Ix1 e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

unsafeSlice :: MonadThrow m => Array P Ix1 e -> Ix1 -> Sz Ix1 -> Dim -> m (Elt P Ix1 e) Source #

(Prim e, Index ix, Index (Lower ix), Elt M ix e ~ Array M (Lower ix) e, Elt P ix e ~ Array M (Lower ix) e) => InnerSlice P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

unsafeInnerSlice :: Array P ix e -> (Sz (Lower ix), Sz Int) -> Int -> Elt P ix e Source #

Prim e => InnerSlice P Ix1 e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

unsafeInnerSlice :: Array P Ix1 e -> (Sz (Lower Ix1), Sz Int) -> Int -> Elt P Ix1 e Source #

(Prim e, Index ix, Index (Lower ix), Elt M ix e ~ Array M (Lower ix) e, Elt P ix e ~ Array M (Lower ix) e) => OuterSlice P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

unsafeOuterSlice :: Array P ix e -> Int -> Elt P ix e Source #

Prim e => OuterSlice P Ix1 e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

unsafeOuterSlice :: Array P Ix1 e -> Int -> Elt P Ix1 e Source #

(Prim e, Index ix) => StrideLoad P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

loadArrayWithStrideM :: Monad m => Scheduler m () -> Stride ix -> Sz ix -> Array P ix e -> (Int -> e -> m ()) -> m () Source #

(Prim e, Index ix) => Load P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Associated Types

type R P :: Type Source #

Methods

getComp :: Array P ix e -> Comp Source #

size :: Array P ix e -> Sz ix Source #

loadArrayM :: Monad m => Scheduler m () -> Array P ix e -> (Int -> e -> m ()) -> m () Source #

defaultElement :: Array P ix e -> Maybe e Source #

maxSize :: Array P ix e -> Maybe (Sz ix) Source #

isEmpty :: Array P ix e -> Bool Source #

unsafeLoadIntoS :: (Mutable r' ix e, PrimMonad m) => MArray (PrimState m) r' ix e -> Array P ix e -> m (MArray (PrimState m) r' ix e)

unsafeLoadInto :: (Mutable r' ix e, MonadIO m) => MArray RealWorld r' ix e -> Array P ix e -> m (MArray RealWorld r' ix e)

(Prim e, Index ix) => Source P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

unsafeIndex :: Array P ix e -> ix -> e Source #

unsafeLinearIndex :: Array P ix e -> Int -> e Source #

unsafeLinearSlice :: Ix1 -> Sz1 -> Array P ix e -> Array P Ix1 e Source #

(Prim e, Index ix) => Extract P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

unsafeExtract :: ix -> Sz ix -> Array P ix e -> Array (R P) ix e Source #

(Prim e, Index ix) => Construct P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

setComp :: Comp -> Array P ix e -> Array P ix e Source #

makeArray :: Comp -> Sz ix -> (ix -> e) -> Array P ix e Source #

makeArrayLinear :: Comp -> Sz ix -> (Int -> e) -> Array P ix e Source #

(Prim e, Index ix) => Stream P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

toStream :: Array P ix e -> Steps Id e Source #

toStreamIx :: Array P ix e -> Steps Id (ix, e) Source #

(Prim e, IsList (Array L ix e), Nested LN ix e, Nested L ix e, Ragged L ix e) => IsList (Array P ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Associated Types

type Item (Array P ix e) :: Type #

Methods

fromList :: [Item (Array P ix e)] -> Array P ix e #

fromListN :: Int -> [Item (Array P ix e)] -> Array P ix e #

toList :: Array P ix e -> [Item (Array P ix e)] #

(Prim e, Eq e, Index ix) => Eq (Array P ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

(==) :: Array P ix e -> Array P ix e -> Bool #

(/=) :: Array P ix e -> Array P ix e -> Bool #

(Prim e, Ord e, Index ix) => Ord (Array P ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

compare :: Array P ix e -> Array P ix e -> Ordering #

(<) :: Array P ix e -> Array P ix e -> Bool #

(<=) :: Array P ix e -> Array P ix e -> Bool #

(>) :: Array P ix e -> Array P ix e -> Bool #

(>=) :: Array P ix e -> Array P ix e -> Bool #

max :: Array P ix e -> Array P ix e -> Array P ix e #

min :: Array P ix e -> Array P ix e -> Array P ix e #

(Ragged L ix e, Show e, Prim e) => Show (Array P ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

showsPrec :: Int -> Array P ix e -> ShowS #

show :: Array P ix e -> String #

showList :: [Array P ix e] -> ShowS #

Index ix => NFData (Array P ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

rnf :: Array P ix e -> () #

type R P Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

type R P = M
data Array P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

data Array P ix e = PArray {}
data MArray s P ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

data MArray s P ix e = MPArray !(Sz ix) !Int !(MutableByteArray s)
type Item (Array P ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

type Item (Array P ix e) = Item (Array L ix e)

class Prim a #

Class of types supporting primitive array operations. This includes interfacing with GC-managed memory (functions suffixed with ByteArray#) and interfacing with unmanaged memory (functions suffixed with Addr#). Endianness is platform-dependent.

Instances
Prim Char 
Instance details

Defined in Data.Primitive.Types

Prim Double 
Instance details

Defined in Data.Primitive.Types

Prim Float 
Instance details

Defined in Data.Primitive.Types

Prim Int 
Instance details

Defined in Data.Primitive.Types

Prim Int8 
Instance details

Defined in Data.Primitive.Types

Prim Int16 
Instance details

Defined in Data.Primitive.Types

Prim Int32 
Instance details

Defined in Data.Primitive.Types

Prim Int64 
Instance details

Defined in Data.Primitive.Types

Prim Word 
Instance details

Defined in Data.Primitive.Types

Prim Word8 
Instance details

Defined in Data.Primitive.Types

Prim Word16 
Instance details

Defined in Data.Primitive.Types

Prim Word32 
Instance details

Defined in Data.Primitive.Types

Prim Word64 
Instance details

Defined in Data.Primitive.Types

Prim CDev 
Instance details

Defined in Data.Primitive.Types

Prim CIno 
Instance details

Defined in Data.Primitive.Types

Prim CMode 
Instance details

Defined in Data.Primitive.Types

Prim COff 
Instance details

Defined in Data.Primitive.Types

Prim CPid 
Instance details

Defined in Data.Primitive.Types

Prim CSsize 
Instance details

Defined in Data.Primitive.Types

Prim CGid 
Instance details

Defined in Data.Primitive.Types

Prim CNlink 
Instance details

Defined in Data.Primitive.Types

Prim CUid 
Instance details

Defined in Data.Primitive.Types

Prim CCc 
Instance details

Defined in Data.Primitive.Types

Prim CSpeed 
Instance details

Defined in Data.Primitive.Types

Prim CTcflag 
Instance details

Defined in Data.Primitive.Types

Prim CRLim 
Instance details

Defined in Data.Primitive.Types

Prim CBlkSize 
Instance details

Defined in Data.Primitive.Types

Prim CBlkCnt 
Instance details

Defined in Data.Primitive.Types

Prim CClockId 
Instance details

Defined in Data.Primitive.Types

Prim CFsBlkCnt 
Instance details

Defined in Data.Primitive.Types

Prim CFsFilCnt 
Instance details

Defined in Data.Primitive.Types

Prim CId 
Instance details

Defined in Data.Primitive.Types

Prim CKey 
Instance details

Defined in Data.Primitive.Types

Prim CTimer 
Instance details

Defined in Data.Primitive.Types

Prim Fd 
Instance details

Defined in Data.Primitive.Types

Prim CChar 
Instance details

Defined in Data.Primitive.Types

Prim CSChar 
Instance details

Defined in Data.Primitive.Types

Prim CUChar 
Instance details

Defined in Data.Primitive.Types

Prim CShort 
Instance details

Defined in Data.Primitive.Types

Prim CUShort 
Instance details

Defined in Data.Primitive.Types

Prim CInt 
Instance details

Defined in Data.Primitive.Types

Prim CUInt 
Instance details

Defined in Data.Primitive.Types

Prim CLong 
Instance details

Defined in Data.Primitive.Types

Prim CULong 
Instance details

Defined in Data.Primitive.Types

Prim CLLong 
Instance details

Defined in Data.Primitive.Types

Prim CULLong 
Instance details

Defined in Data.Primitive.Types

Prim CBool 
Instance details

Defined in Data.Primitive.Types

Prim CFloat 
Instance details

Defined in Data.Primitive.Types

Prim CDouble 
Instance details

Defined in Data.Primitive.Types

Prim CPtrdiff 
Instance details

Defined in Data.Primitive.Types

Prim CSize 
Instance details

Defined in Data.Primitive.Types

Prim CWchar 
Instance details

Defined in Data.Primitive.Types

Prim CSigAtomic 
Instance details

Defined in Data.Primitive.Types

Prim CClock 
Instance details

Defined in Data.Primitive.Types

Prim CTime 
Instance details

Defined in Data.Primitive.Types

Prim CUSeconds 
Instance details

Defined in Data.Primitive.Types

Prim CSUSeconds 
Instance details

Defined in Data.Primitive.Types

Prim CIntPtr 
Instance details

Defined in Data.Primitive.Types

Prim CUIntPtr 
Instance details

Defined in Data.Primitive.Types

Prim CIntMax 
Instance details

Defined in Data.Primitive.Types

Prim CUIntMax 
Instance details

Defined in Data.Primitive.Types

Prim (StablePtr a) 
Instance details

Defined in Data.Primitive.Types

Prim (Ptr a) 
Instance details

Defined in Data.Primitive.Types

Prim (FunPtr a) 
Instance details

Defined in Data.Primitive.Types

Prim a => Prim (Min a)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Prim a => Prim (Max a)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Prim a => Prim (First a)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Prim a => Prim (Last a)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Prim a => Prim (Identity a)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Prim a => Prim (Dual a)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Prim a => Prim (Sum a)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Prim a => Prim (Product a)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Prim a => Prim (Down a)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Prim a => Prim (Const a b)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Methods

sizeOf# :: Const a b -> Int# #

alignment# :: Const a b -> Int# #

indexByteArray# :: ByteArray# -> Int# -> Const a b #

readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (#State# s, Const a b#) #

writeByteArray# :: MutableByteArray# s -> Int# -> Const a b -> State# s -> State# s #

setByteArray# :: MutableByteArray# s -> Int# -> Int# -> Const a b -> State# s -> State# s #

indexOffAddr# :: Addr# -> Int# -> Const a b #

readOffAddr# :: Addr# -> Int# -> State# s -> (#State# s, Const a b#) #

writeOffAddr# :: Addr# -> Int# -> Const a b -> State# s -> State# s #

setOffAddr# :: Addr# -> Int# -> Int# -> Const a b -> State# s -> State# s #

Conversion

Primitive ByteArray

toByteArray :: (Index ix, Prim e) => Array P ix e -> ByteArray Source #

O(n) - Ensure that the size matches the internal ByteArray. If not make a copy of the slice and return it as ByteArray

Since: 0.2.1

toByteArrayM :: (Prim e, Index ix, MonadThrow m) => Array P ix e -> m ByteArray Source #

O(1) - Unwrap Ensure that the size matches the internal ByteArray.

Since: 0.5.0

unwrapByteArray :: Array P ix e -> ByteArray Source #

O(1) - Extract the internal ByteArray. This will discard any possible slicing that has been applied to the array. Use toByteArray in order to preserve slicing.

Since: 0.5.0

fromByteArray :: forall e. Prim e => Comp -> ByteArray -> Array P Ix1 e Source #

O(1) - Construct a flat Array from ByteArray

Since: 0.4.0

fromByteArrayM :: (MonadThrow m, Index ix, Prim e) => Comp -> Sz ix -> ByteArray -> m (Array P ix e) Source #

O(1) - Construct a primitive array from the ByteArray. Will return Nothing if number of elements doesn't match.

Since: 0.3.0

toMutableByteArray :: forall ix e m. (Prim e, Index ix, PrimMonad m) => MArray (PrimState m) P ix e -> m (Bool, MutableByteArray (PrimState m)) Source #

O(n) - Try to cast a mutable array to MutableByteArray, if sizes do not match make a copy. Returns True if an array was converted without a copy, in which case it means tha the source at the resulting array are still pointing to the same location in memory.

Since: 0.5.0

unwrapMutableByteArray :: MArray s P ix e -> MutableByteArray s Source #

O(1) - Extract the internal MutableByteArray. This will discard any possible slicing that has been applied to the array.

Since: 0.5.0

fromMutableByteArray :: forall e s. Prim e => MutableByteArray s -> MArray s P Ix1 e Source #

O(1) - Construct a flat Array from MutableByteArray

Since: 0.4.0

fromMutableByteArrayM :: (MonadThrow m, Index ix, Prim e) => Sz ix -> MutableByteArray s -> m (MArray s P ix e) Source #

O(1) - Construct a primitive mutable array from the MutableByteArray. Will throw SizeElementsMismatchException if number of elements doesn't match.

Since: 0.3.0

Primitive Vector

toPrimitiveVector :: Index ix => Array P ix e -> Vector e Source #

O(1) - Cast a primitive array to a primitive vector.

Since: 0.5.0

toPrimitiveMVector :: Index ix => MArray s P ix e -> MVector s e Source #

O(1) - Cast a mutable primitive array to a mutable primitive vector.

Since: 0.5.0

fromPrimitiveVector :: Vector e -> Array P Ix1 e Source #

O(1) - Cast a primitive vector to a primitive array.

Since: 0.5.0

fromPrimitiveMVector :: MVector s e -> MArray s P Ix1 e Source #

O(1) - Cast a mutable primitive vector to a mutable primitive array.

Since: 0.5.0

Storable

data S Source #

Representation for Storable elements

Constructors

S 
Instances
Show S Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

showsPrec :: Int -> S -> ShowS #

show :: S -> String #

showList :: [S] -> ShowS #

Index ix => Resize S ix Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

unsafeResize :: Index ix' => Sz ix' -> Array S ix e -> Array S ix' e Source #

(Index ix, Storable e) => Mutable S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Associated Types

data MArray s S ix e :: Type Source #

Methods

msize :: MArray s S ix e -> Sz ix Source #

unsafeThaw :: PrimMonad m => Array S ix e -> m (MArray (PrimState m) S ix e) Source #

unsafeFreeze :: PrimMonad m => Comp -> MArray (PrimState m) S ix e -> m (Array S ix e) Source #

unsafeNew :: PrimMonad m => Sz ix -> m (MArray (PrimState m) S ix e) Source #

unsafeLinearRead :: PrimMonad m => MArray (PrimState m) S ix e -> Int -> m e Source #

unsafeLinearWrite :: PrimMonad m => MArray (PrimState m) S ix e -> Int -> e -> m () Source #

initialize :: PrimMonad m => MArray (PrimState m) S ix e -> m () Source #

initializeNew :: PrimMonad m => Maybe e -> Sz ix -> m (MArray (PrimState m) S ix e) Source #

unsafeLinearSet :: PrimMonad m => MArray (PrimState m) S ix e -> Ix1 -> Sz1 -> e -> m () Source #

unsafeLinearCopy :: (Mutable S ix' e, PrimMonad m) => MArray (PrimState m) S ix' e -> Ix1 -> MArray (PrimState m) S ix e -> Ix1 -> Sz1 -> m () Source #

unsafeArrayLinearCopy :: (Mutable S ix' e, PrimMonad m) => Array S ix' e -> Ix1 -> MArray (PrimState m) S ix e -> Ix1 -> Sz1 -> m () Source #

unsafeLinearShrink :: PrimMonad m => MArray (PrimState m) S ix e -> Sz ix -> m (MArray (PrimState m) S ix e) Source #

unsafeLinearGrow :: PrimMonad m => MArray (PrimState m) S ix e -> Sz ix -> m (MArray (PrimState m) S ix e) Source #

(Index ix, Storable e) => Manifest S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

unsafeLinearIndexM :: Array S ix e -> Int -> e Source #

Storable e => Slice S Ix1 e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

unsafeSlice :: MonadThrow m => Array S Ix1 e -> Ix1 -> Sz Ix1 -> Dim -> m (Elt S Ix1 e) Source #

(Storable e, Index ix, Index (Lower ix), Elt M ix e ~ Array M (Lower ix) e, Elt S ix e ~ Array M (Lower ix) e) => InnerSlice S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

unsafeInnerSlice :: Array S ix e -> (Sz (Lower ix), Sz Int) -> Int -> Elt S ix e Source #

(Storable e, Index ix, Index (Lower ix), Elt M ix e ~ Array M (Lower ix) e, Elt S ix e ~ Array M (Lower ix) e) => OuterSlice S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

unsafeOuterSlice :: Array S ix e -> Int -> Elt S ix e Source #

(Index ix, Storable e) => StrideLoad S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

loadArrayWithStrideM :: Monad m => Scheduler m () -> Stride ix -> Sz ix -> Array S ix e -> (Int -> e -> m ()) -> m () Source #

(Index ix, Storable e) => Load S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Associated Types

type R S :: Type Source #

Methods

getComp :: Array S ix e -> Comp Source #

size :: Array S ix e -> Sz ix Source #

loadArrayM :: Monad m => Scheduler m () -> Array S ix e -> (Int -> e -> m ()) -> m () Source #

defaultElement :: Array S ix e -> Maybe e Source #

maxSize :: Array S ix e -> Maybe (Sz ix) Source #

isEmpty :: Array S ix e -> Bool Source #

unsafeLoadIntoS :: (Mutable r' ix e, PrimMonad m) => MArray (PrimState m) r' ix e -> Array S ix e -> m (MArray (PrimState m) r' ix e)

unsafeLoadInto :: (Mutable r' ix e, MonadIO m) => MArray RealWorld r' ix e -> Array S ix e -> m (MArray RealWorld r' ix e)

(Storable e, Index ix) => Source S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

unsafeIndex :: Array S ix e -> ix -> e Source #

unsafeLinearIndex :: Array S ix e -> Int -> e Source #

unsafeLinearSlice :: Ix1 -> Sz1 -> Array S ix e -> Array S Ix1 e Source #

(Storable e, Index ix) => Extract S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

unsafeExtract :: ix -> Sz ix -> Array S ix e -> Array (R S) ix e Source #

(Storable e, Index ix) => Construct S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

setComp :: Comp -> Array S ix e -> Array S ix e Source #

makeArray :: Comp -> Sz ix -> (ix -> e) -> Array S ix e Source #

makeArrayLinear :: Comp -> Sz ix -> (Int -> e) -> Array S ix e Source #

(Index ix, Storable e) => Stream S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

toStream :: Array S ix e -> Steps Id e Source #

toStreamIx :: Array S ix e -> Steps Id (ix, e) Source #

(Storable e, IsList (Array L ix e), Nested LN ix e, Nested L ix e, Ragged L ix e) => IsList (Array S ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Associated Types

type Item (Array S ix e) :: Type #

Methods

fromList :: [Item (Array S ix e)] -> Array S ix e #

fromListN :: Int -> [Item (Array S ix e)] -> Array S ix e #

toList :: Array S ix e -> [Item (Array S ix e)] #

(Storable e, Eq e, Index ix) => Eq (Array S ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

(==) :: Array S ix e -> Array S ix e -> Bool #

(/=) :: Array S ix e -> Array S ix e -> Bool #

(Storable e, Ord e, Index ix) => Ord (Array S ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

compare :: Array S ix e -> Array S ix e -> Ordering #

(<) :: Array S ix e -> Array S ix e -> Bool #

(<=) :: Array S ix e -> Array S ix e -> Bool #

(>) :: Array S ix e -> Array S ix e -> Bool #

(>=) :: Array S ix e -> Array S ix e -> Bool #

max :: Array S ix e -> Array S ix e -> Array S ix e #

min :: Array S ix e -> Array S ix e -> Array S ix e #

(Ragged L ix e, Show e, Storable e) => Show (Array S ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

showsPrec :: Int -> Array S ix e -> ShowS #

show :: Array S ix e -> String #

showList :: [Array S ix e] -> ShowS #

NFData ix => NFData (Array S ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

rnf :: Array S ix e -> () #

type R S Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

type R S = M
data Array S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

data Array S ix e = SArray {}
data MArray s S ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

data MArray s S ix e = MSArray !(Sz ix) !(MVector s e)
type Item (Array S ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

type Item (Array S ix e) = Item (Array L ix e)

class Storable a #

The member functions of this class facilitate writing values of primitive types to raw memory (which may have been allocated with the above mentioned routines) and reading values from blocks of raw memory. The class, furthermore, includes support for computing the storage requirements and alignment restrictions of storable types.

Memory addresses are represented as values of type Ptr a, for some a which is an instance of class Storable. The type argument to Ptr helps provide some valuable type safety in FFI code (you can't mix pointers of different types without an explicit cast), while helping the Haskell type system figure out which marshalling method is needed for a given pointer.

All marshalling between Haskell and a foreign language ultimately boils down to translating Haskell data structures into the binary representation of a corresponding data structure of the foreign language and vice versa. To code this marshalling in Haskell, it is necessary to manipulate primitive data types stored in unstructured memory blocks. The class Storable facilitates this manipulation on all types for which it is instantiated, which are the standard basic types of Haskell, the fixed size Int types (Int8, Int16, Int32, Int64), the fixed size Word types (Word8, Word16, Word32, Word64), StablePtr, all types from Foreign.C.Types, as well as Ptr.

Minimal complete definition

sizeOf, alignment, (peek | peekElemOff | peekByteOff), (poke | pokeElemOff | pokeByteOff)

Instances
Storable Bool

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Bool -> Int #

alignment :: Bool -> Int #

peekElemOff :: Ptr Bool -> Int -> IO Bool #

pokeElemOff :: Ptr Bool -> Int -> Bool -> IO () #

peekByteOff :: Ptr b -> Int -> IO Bool #

pokeByteOff :: Ptr b -> Int -> Bool -> IO () #

peek :: Ptr Bool -> IO Bool #

poke :: Ptr Bool -> Bool -> IO () #

Storable Char

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Char -> Int #

alignment :: Char -> Int #

peekElemOff :: Ptr Char -> Int -> IO Char #

pokeElemOff :: Ptr Char -> Int -> Char -> IO () #

peekByteOff :: Ptr b -> Int -> IO Char #

pokeByteOff :: Ptr b -> Int -> Char -> IO () #

peek :: Ptr Char -> IO Char #

poke :: Ptr Char -> Char -> IO () #

Storable Double

Since: base-2.1

Instance details

Defined in Foreign.Storable

Storable Float

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Float -> Int #

alignment :: Float -> Int #

peekElemOff :: Ptr Float -> Int -> IO Float #

pokeElemOff :: Ptr Float -> Int -> Float -> IO () #

peekByteOff :: Ptr b -> Int -> IO Float #

pokeByteOff :: Ptr b -> Int -> Float -> IO () #

peek :: Ptr Float -> IO Float #

poke :: Ptr Float -> Float -> IO () #

Storable Int

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int -> Int #

alignment :: Int -> Int #

peekElemOff :: Ptr Int -> Int -> IO Int #

pokeElemOff :: Ptr Int -> Int -> Int -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int #

pokeByteOff :: Ptr b -> Int -> Int -> IO () #

peek :: Ptr Int -> IO Int #

poke :: Ptr Int -> Int -> IO () #

Storable Int8

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int8 -> Int #

alignment :: Int8 -> Int #

peekElemOff :: Ptr Int8 -> Int -> IO Int8 #

pokeElemOff :: Ptr Int8 -> Int -> Int8 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int8 #

pokeByteOff :: Ptr b -> Int -> Int8 -> IO () #

peek :: Ptr Int8 -> IO Int8 #

poke :: Ptr Int8 -> Int8 -> IO () #

Storable Int16

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int16 -> Int #

alignment :: Int16 -> Int #

peekElemOff :: Ptr Int16 -> Int -> IO Int16 #

pokeElemOff :: Ptr Int16 -> Int -> Int16 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int16 #

pokeByteOff :: Ptr b -> Int -> Int16 -> IO () #

peek :: Ptr Int16 -> IO Int16 #

poke :: Ptr Int16 -> Int16 -> IO () #

Storable Int32

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int32 -> Int #

alignment :: Int32 -> Int #

peekElemOff :: Ptr Int32 -> Int -> IO Int32 #

pokeElemOff :: Ptr Int32 -> Int -> Int32 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int32 #

pokeByteOff :: Ptr b -> Int -> Int32 -> IO () #

peek :: Ptr Int32 -> IO Int32 #

poke :: Ptr Int32 -> Int32 -> IO () #

Storable Int64

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int64 -> Int #

alignment :: Int64 -> Int #

peekElemOff :: Ptr Int64 -> Int -> IO Int64 #

pokeElemOff :: Ptr Int64 -> Int -> Int64 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int64 #

pokeByteOff :: Ptr b -> Int -> Int64 -> IO () #

peek :: Ptr Int64 -> IO Int64 #

poke :: Ptr Int64 -> Int64 -> IO () #

Storable Word

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Word -> Int #

alignment :: Word -> Int #

peekElemOff :: Ptr Word -> Int -> IO Word #

pokeElemOff :: Ptr Word -> Int -> Word -> IO () #

peekByteOff :: Ptr b -> Int -> IO Word #

pokeByteOff :: Ptr b -> Int -> Word -> IO () #

peek :: Ptr Word -> IO Word #

poke :: Ptr Word -> Word -> IO () #

Storable Word8

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Word8 -> Int #

alignment :: Word8 -> Int #

peekElemOff :: Ptr Word8 -> Int -> IO Word8 #

pokeElemOff :: Ptr Word8 -> Int -> Word8 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Word8 #

pokeByteOff :: Ptr b -> Int -> Word8 -> IO () #

peek :: Ptr Word8 -> IO Word8 #

poke :: Ptr Word8 -> Word8 -> IO () #

Storable Word16

Since: base-2.1

Instance details

Defined in Foreign.Storable

Storable Word32

Since: base-2.1

Instance details

Defined in Foreign.Storable

Storable Word64

Since: base-2.1

Instance details

Defined in Foreign.Storable

Storable ()

Since: base-4.9.0.0

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: () -> Int #

alignment :: () -> Int #

peekElemOff :: Ptr () -> Int -> IO () #

pokeElemOff :: Ptr () -> Int -> () -> IO () #

peekByteOff :: Ptr b -> Int -> IO () #

pokeByteOff :: Ptr b -> Int -> () -> IO () #

peek :: Ptr () -> IO () #

poke :: Ptr () -> () -> IO () #

Storable CChar 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CChar -> Int #

alignment :: CChar -> Int #

peekElemOff :: Ptr CChar -> Int -> IO CChar #

pokeElemOff :: Ptr CChar -> Int -> CChar -> IO () #

peekByteOff :: Ptr b -> Int -> IO CChar #

pokeByteOff :: Ptr b -> Int -> CChar -> IO () #

peek :: Ptr CChar -> IO CChar #

poke :: Ptr CChar -> CChar -> IO () #

Storable CSChar 
Instance details

Defined in Foreign.C.Types

Storable CUChar 
Instance details

Defined in Foreign.C.Types

Storable CShort 
Instance details

Defined in Foreign.C.Types

Storable CUShort 
Instance details

Defined in Foreign.C.Types

Storable CInt 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CInt -> Int #

alignment :: CInt -> Int #

peekElemOff :: Ptr CInt -> Int -> IO CInt #

pokeElemOff :: Ptr CInt -> Int -> CInt -> IO () #

peekByteOff :: Ptr b -> Int -> IO CInt #

pokeByteOff :: Ptr b -> Int -> CInt -> IO () #

peek :: Ptr CInt -> IO CInt #

poke :: Ptr CInt -> CInt -> IO () #

Storable CUInt 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CUInt -> Int #

alignment :: CUInt -> Int #

peekElemOff :: Ptr CUInt -> Int -> IO CUInt #

pokeElemOff :: Ptr CUInt -> Int -> CUInt -> IO () #

peekByteOff :: Ptr b -> Int -> IO CUInt #

pokeByteOff :: Ptr b -> Int -> CUInt -> IO () #

peek :: Ptr CUInt -> IO CUInt #

poke :: Ptr CUInt -> CUInt -> IO () #

Storable CLong 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CLong -> Int #

alignment :: CLong -> Int #

peekElemOff :: Ptr CLong -> Int -> IO CLong #

pokeElemOff :: Ptr CLong -> Int -> CLong -> IO () #

peekByteOff :: Ptr b -> Int -> IO CLong #

pokeByteOff :: Ptr b -> Int -> CLong -> IO () #

peek :: Ptr CLong -> IO CLong #

poke :: Ptr CLong -> CLong -> IO () #

Storable CULong 
Instance details

Defined in Foreign.C.Types

Storable CLLong 
Instance details

Defined in Foreign.C.Types

Storable CULLong 
Instance details

Defined in Foreign.C.Types

Storable CBool 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CBool -> Int #

alignment :: CBool -> Int #

peekElemOff :: Ptr CBool -> Int -> IO CBool #

pokeElemOff :: Ptr CBool -> Int -> CBool -> IO () #

peekByteOff :: Ptr b -> Int -> IO CBool #

pokeByteOff :: Ptr b -> Int -> CBool -> IO () #

peek :: Ptr CBool -> IO CBool #

poke :: Ptr CBool -> CBool -> IO () #

Storable CFloat 
Instance details

Defined in Foreign.C.Types

Storable CDouble 
Instance details

Defined in Foreign.C.Types

Storable CPtrdiff 
Instance details

Defined in Foreign.C.Types

Storable CSize 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CSize -> Int #

alignment :: CSize -> Int #

peekElemOff :: Ptr CSize -> Int -> IO CSize #

pokeElemOff :: Ptr CSize -> Int -> CSize -> IO () #

peekByteOff :: Ptr b -> Int -> IO CSize #

pokeByteOff :: Ptr b -> Int -> CSize -> IO () #

peek :: Ptr CSize -> IO CSize #

poke :: Ptr CSize -> CSize -> IO () #

Storable CWchar 
Instance details

Defined in Foreign.C.Types

Storable CSigAtomic 
Instance details

Defined in Foreign.C.Types

Storable CClock 
Instance details

Defined in Foreign.C.Types

Storable CTime 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CTime -> Int #

alignment :: CTime -> Int #

peekElemOff :: Ptr CTime -> Int -> IO CTime #

pokeElemOff :: Ptr CTime -> Int -> CTime -> IO () #

peekByteOff :: Ptr b -> Int -> IO CTime #

pokeByteOff :: Ptr b -> Int -> CTime -> IO () #

peek :: Ptr CTime -> IO CTime #

poke :: Ptr CTime -> CTime -> IO () #

Storable CUSeconds 
Instance details

Defined in Foreign.C.Types

Storable CSUSeconds 
Instance details

Defined in Foreign.C.Types

Storable CIntPtr 
Instance details

Defined in Foreign.C.Types

Storable CUIntPtr 
Instance details

Defined in Foreign.C.Types

Storable CIntMax 
Instance details

Defined in Foreign.C.Types

Storable CUIntMax 
Instance details

Defined in Foreign.C.Types

Storable WordPtr 
Instance details

Defined in Foreign.Ptr

Storable IntPtr 
Instance details

Defined in Foreign.Ptr

Storable Fingerprint

Since: base-4.4.0.0

Instance details

Defined in Foreign.Storable

(Storable a, Integral a) => Storable (Ratio a)

Since: base-4.8.0.0

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Ratio a -> Int #

alignment :: Ratio a -> Int #

peekElemOff :: Ptr (Ratio a) -> Int -> IO (Ratio a) #

pokeElemOff :: Ptr (Ratio a) -> Int -> Ratio a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Ratio a) #

pokeByteOff :: Ptr b -> Int -> Ratio a -> IO () #

peek :: Ptr (Ratio a) -> IO (Ratio a) #

poke :: Ptr (Ratio a) -> Ratio a -> IO () #

Storable (StablePtr a)

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: StablePtr a -> Int #

alignment :: StablePtr a -> Int #

peekElemOff :: Ptr (StablePtr a) -> Int -> IO (StablePtr a) #

pokeElemOff :: Ptr (StablePtr a) -> Int -> StablePtr a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (StablePtr a) #

pokeByteOff :: Ptr b -> Int -> StablePtr a -> IO () #

peek :: Ptr (StablePtr a) -> IO (StablePtr a) #

poke :: Ptr (StablePtr a) -> StablePtr a -> IO () #

Storable (Ptr a)

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Ptr a -> Int #

alignment :: Ptr a -> Int #

peekElemOff :: Ptr (Ptr a) -> Int -> IO (Ptr a) #

pokeElemOff :: Ptr (Ptr a) -> Int -> Ptr a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Ptr a) #

pokeByteOff :: Ptr b -> Int -> Ptr a -> IO () #

peek :: Ptr (Ptr a) -> IO (Ptr a) #

poke :: Ptr (Ptr a) -> Ptr a -> IO () #

Storable (FunPtr a)

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: FunPtr a -> Int #

alignment :: FunPtr a -> Int #

peekElemOff :: Ptr (FunPtr a) -> Int -> IO (FunPtr a) #

pokeElemOff :: Ptr (FunPtr a) -> Int -> FunPtr a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (FunPtr a) #

pokeByteOff :: Ptr b -> Int -> FunPtr a -> IO () #

peek :: Ptr (FunPtr a) -> IO (FunPtr a) #

poke :: Ptr (FunPtr a) -> FunPtr a -> IO () #

Storable a => Storable (Complex a)

Since: base-4.8.0.0

Instance details

Defined in Data.Complex

Methods

sizeOf :: Complex a -> Int #

alignment :: Complex a -> Int #

peekElemOff :: Ptr (Complex a) -> Int -> IO (Complex a) #

pokeElemOff :: Ptr (Complex a) -> Int -> Complex a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Complex a) #

pokeByteOff :: Ptr b -> Int -> Complex a -> IO () #

peek :: Ptr (Complex a) -> IO (Complex a) #

poke :: Ptr (Complex a) -> Complex a -> IO () #

Storable a => Storable (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

sizeOf :: Identity a -> Int #

alignment :: Identity a -> Int #

peekElemOff :: Ptr (Identity a) -> Int -> IO (Identity a) #

pokeElemOff :: Ptr (Identity a) -> Int -> Identity a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Identity a) #

pokeByteOff :: Ptr b -> Int -> Identity a -> IO () #

peek :: Ptr (Identity a) -> IO (Identity a) #

poke :: Ptr (Identity a) -> Identity a -> IO () #

Prim a => Storable (PrimStorable a) 
Instance details

Defined in Data.Primitive.Types

Storable a => Storable (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

sizeOf :: Const a b -> Int #

alignment :: Const a b -> Int #

peekElemOff :: Ptr (Const a b) -> Int -> IO (Const a b) #

pokeElemOff :: Ptr (Const a b) -> Int -> Const a b -> IO () #

peekByteOff :: Ptr b0 -> Int -> IO (Const a b) #

pokeByteOff :: Ptr b0 -> Int -> Const a b -> IO () #

peek :: Ptr (Const a b) -> IO (Const a b) #

poke :: Ptr (Const a b) -> Const a b -> IO () #

Conversion

Primitive Vector

toStorableVector :: Array S ix e -> Vector e Source #

O(1) - Unwrap storable array and pull out the underlying storable vector.

Since: 0.2.1

toStorableMVector :: MArray s S ix e -> MVector s e Source #

O(1) - Unwrap storable mutable array and pull out the underlying storable mutable vector.

Since: 0.2.1

fromStorableVector :: Storable e => Comp -> Vector e -> Array S Ix1 e Source #

O(1) - Cast a storable vector to a storable array.

Since: 0.5.0

fromStorableMVector :: MVector s e -> MArray s S Ix1 e Source #

O(1) - Cast a mutable storable vector to a mutable storable array.

Since: 0.5.0

Direct Pointer Access

withPtr :: (MonadUnliftIO m, Storable a) => MArray RealWorld S ix a -> (Ptr a -> m b) -> m b Source #

A pointer to the beginning of the mutable array.

Since: 0.1.3

Unboxed

data U Source #

Representation for Unboxed elements

Constructors

U 
Instances
Show U Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

showsPrec :: Int -> U -> ShowS #

show :: U -> String #

showList :: [U] -> ShowS #

Index ix => Resize U ix Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

unsafeResize :: Index ix' => Sz ix' -> Array U ix e -> Array U ix' e Source #

(Unbox e, Index ix) => Mutable U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Associated Types

data MArray s U ix e :: Type Source #

Methods

msize :: MArray s U ix e -> Sz ix Source #

unsafeThaw :: PrimMonad m => Array U ix e -> m (MArray (PrimState m) U ix e) Source #

unsafeFreeze :: PrimMonad m => Comp -> MArray (PrimState m) U ix e -> m (Array U ix e) Source #

unsafeNew :: PrimMonad m => Sz ix -> m (MArray (PrimState m) U ix e) Source #

unsafeLinearRead :: PrimMonad m => MArray (PrimState m) U ix e -> Int -> m e Source #

unsafeLinearWrite :: PrimMonad m => MArray (PrimState m) U ix e -> Int -> e -> m () Source #

initialize :: PrimMonad m => MArray (PrimState m) U ix e -> m () Source #

initializeNew :: PrimMonad m => Maybe e -> Sz ix -> m (MArray (PrimState m) U ix e) Source #

unsafeLinearSet :: PrimMonad m => MArray (PrimState m) U ix e -> Ix1 -> Sz1 -> e -> m () Source #

unsafeLinearCopy :: (Mutable U ix' e, PrimMonad m) => MArray (PrimState m) U ix' e -> Ix1 -> MArray (PrimState m) U ix e -> Ix1 -> Sz1 -> m () Source #

unsafeArrayLinearCopy :: (Mutable U ix' e, PrimMonad m) => Array U ix' e -> Ix1 -> MArray (PrimState m) U ix e -> Ix1 -> Sz1 -> m () Source #

unsafeLinearShrink :: PrimMonad m => MArray (PrimState m) U ix e -> Sz ix -> m (MArray (PrimState m) U ix e) Source #

unsafeLinearGrow :: PrimMonad m => MArray (PrimState m) U ix e -> Sz ix -> m (MArray (PrimState m) U ix e) Source #

(Unbox e, Index ix) => Manifest U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

unsafeLinearIndexM :: Array U ix e -> Int -> e Source #

(Unbox e, Index ix, Index (Lower ix), Elt U ix e ~ Elt M ix e, Elt M ix e ~ Array M (Lower ix) e) => Slice U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

unsafeSlice :: MonadThrow m => Array U ix e -> ix -> Sz ix -> Dim -> m (Elt U ix e) Source #

Unbox e => Slice U Ix1 e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

unsafeSlice :: MonadThrow m => Array U Ix1 e -> Ix1 -> Sz Ix1 -> Dim -> m (Elt U Ix1 e) Source #

(Unbox e, Index ix, Index (Lower ix), Elt U ix e ~ Elt M ix e, Elt M ix e ~ Array M (Lower ix) e) => InnerSlice U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

unsafeInnerSlice :: Array U ix e -> (Sz (Lower ix), Sz Int) -> Int -> Elt U ix e Source #

Unbox e => InnerSlice U Ix1 e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

unsafeInnerSlice :: Array U Ix1 e -> (Sz (Lower Ix1), Sz Int) -> Int -> Elt U Ix1 e Source #

(Unbox e, Index ix, Index (Lower ix), Elt U ix e ~ Elt M ix e, Elt M ix e ~ Array M (Lower ix) e) => OuterSlice U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

unsafeOuterSlice :: Array U ix e -> Int -> Elt U ix e Source #

Unbox e => OuterSlice U Ix1 e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

unsafeOuterSlice :: Array U Ix1 e -> Int -> Elt U Ix1 e Source #

(Unbox e, Index ix) => StrideLoad U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

loadArrayWithStrideM :: Monad m => Scheduler m () -> Stride ix -> Sz ix -> Array U ix e -> (Int -> e -> m ()) -> m () Source #

(Unbox e, Index ix) => Load U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Associated Types

type R U :: Type Source #

Methods

getComp :: Array U ix e -> Comp Source #

size :: Array U ix e -> Sz ix Source #

loadArrayM :: Monad m => Scheduler m () -> Array U ix e -> (Int -> e -> m ()) -> m () Source #

defaultElement :: Array U ix e -> Maybe e Source #

maxSize :: Array U ix e -> Maybe (Sz ix) Source #

isEmpty :: Array U ix e -> Bool Source #

unsafeLoadIntoS :: (Mutable r' ix e, PrimMonad m) => MArray (PrimState m) r' ix e -> Array U ix e -> m (MArray (PrimState m) r' ix e)

unsafeLoadInto :: (Mutable r' ix e, MonadIO m) => MArray RealWorld r' ix e -> Array U ix e -> m (MArray RealWorld r' ix e)

(Unbox e, Index ix) => Source U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

unsafeIndex :: Array U ix e -> ix -> e Source #

unsafeLinearIndex :: Array U ix e -> Int -> e Source #

unsafeLinearSlice :: Ix1 -> Sz1 -> Array U ix e -> Array U Ix1 e Source #

(Unbox e, Index ix) => Extract U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

unsafeExtract :: ix -> Sz ix -> Array U ix e -> Array (R U) ix e Source #

(Unbox e, Index ix) => Construct U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

setComp :: Comp -> Array U ix e -> Array U ix e Source #

makeArray :: Comp -> Sz ix -> (ix -> e) -> Array U ix e Source #

makeArrayLinear :: Comp -> Sz ix -> (Int -> e) -> Array U ix e Source #

(Index ix, Unbox e) => Stream U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

toStream :: Array U ix e -> Steps Id e Source #

toStreamIx :: Array U ix e -> Steps Id (ix, e) Source #

(Unbox e, IsList (Array L ix e), Nested LN ix e, Nested L ix e, Ragged L ix e) => IsList (Array U ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Associated Types

type Item (Array U ix e) :: Type #

Methods

fromList :: [Item (Array U ix e)] -> Array U ix e #

fromListN :: Int -> [Item (Array U ix e)] -> Array U ix e #

toList :: Array U ix e -> [Item (Array U ix e)] #

(Unbox e, Eq e, Index ix) => Eq (Array U ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

(==) :: Array U ix e -> Array U ix e -> Bool #

(/=) :: Array U ix e -> Array U ix e -> Bool #

(Unbox e, Ord e, Index ix) => Ord (Array U ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

compare :: Array U ix e -> Array U ix e -> Ordering #

(<) :: Array U ix e -> Array U ix e -> Bool #

(<=) :: Array U ix e -> Array U ix e -> Bool #

(>) :: Array U ix e -> Array U ix e -> Bool #

(>=) :: Array U ix e -> Array U ix e -> Bool #

max :: Array U ix e -> Array U ix e -> Array U ix e #

min :: Array U ix e -> Array U ix e -> Array U ix e #

(Ragged L ix e, Show e, Unbox e) => Show (Array U ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

showsPrec :: Int -> Array U ix e -> ShowS #

show :: Array U ix e -> String #

showList :: [Array U ix e] -> ShowS #

NFData ix => NFData (Array U ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

rnf :: Array U ix e -> () #

type R U Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

type R U = M
data Array U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

data Array U ix e = UArray {}
data MArray s U ix e Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

data MArray s U ix e = MUArray !(Sz ix) !(MVector s e)
type Item (Array U ix e) Source # 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

type Item (Array U ix e) = Item (Array L ix e)

class (Vector Vector a, MVector MVector a) => Unbox a #

Instances
Unbox Bool 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox Char 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox Double 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox Float 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox Int 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox Int8 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox Int16 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox Int32 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox Int64 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox Word 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox Word8 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox Word16 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox Word32 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox Word64 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox () 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox All 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox Any 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox Ix2 Source #

Unboxing of a Ix2.

Instance details

Defined in Data.Massiv.Core.Index.Ix

Unbox a => Unbox (Complex a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox a => Unbox (Min a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox a => Unbox (Max a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox a => Unbox (First a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox a => Unbox (Last a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox a => Unbox (WrappedMonoid a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox a => Unbox (Identity a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox a => Unbox (Dual a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox a => Unbox (Sum a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox a => Unbox (Product a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox a => Unbox (Down a) 
Instance details

Defined in Data.Vector.Unboxed.Base

(3 <= n, Unbox (Ix (n - 1))) => Unbox (IxN n) Source #

Unboxing of a IxN.

Instance details

Defined in Data.Massiv.Core.Index.Ix

(Unbox a, Unbox b) => Unbox (a, b) 
Instance details

Defined in Data.Vector.Unboxed.Base

(Unbox a, Unbox b) => Unbox (Arg a b) 
Instance details

Defined in Data.Vector.Unboxed.Base

(Unbox a, Unbox b, Unbox c) => Unbox (a, b, c) 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox a => Unbox (Const a b) 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox (f a) => Unbox (Alt f a) 
Instance details

Defined in Data.Vector.Unboxed.Base

(Unbox a, Unbox b, Unbox c, Unbox d) => Unbox (a, b, c, d) 
Instance details

Defined in Data.Vector.Unboxed.Base

(Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => Unbox (a, b, c, d, e) 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox (f (g a)) => Unbox (Compose f g a) 
Instance details

Defined in Data.Vector.Unboxed.Base

(Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => Unbox (a, b, c, d, e, f) 
Instance details

Defined in Data.Vector.Unboxed.Base

Conversion

toUnboxedVector :: Array U ix e -> Vector e Source #

O(1) - Unwrap unboxed array and pull out the underlying unboxed vector.

Since: 0.2.1

toUnboxedMVector :: MArray s U ix e -> MVector s e Source #

O(1) - Unwrap unboxed mutable array and pull out the underlying unboxed mutable vector.

Since: 0.2.1

fromUnboxedVector :: Unbox e => Vector e -> Array U Ix1 e Source #

O(1) - Wrap an unboxed vector and produce an unboxed flat array.

Since: 0.5.0

fromUnboxedMVector :: Unbox e => MVector s e -> MArray s U Ix1 e Source #

O(1) - Wrap an unboxed mutable vector and produce a mutable unboxed flat array.

Since: 0.5.0

ByteString Conversion

fromByteString Source #

Arguments

:: Comp

Computation strategy

-> ByteString

Strict ByteString to use as a source.

-> Array M Ix1 Word8 

O(1) - Convert a strict ByteString into a manifest array. Will return Nothing if length doesn't match the total number of elements of new array.

Since: 0.2.1

castFromByteString :: Comp -> ByteString -> Array S Ix1 Word8 Source #

O(1) - Cast a strict ByteString into a Storable array

Since: 0.3.0

toByteString Source #

Arguments

:: Load r ix Word8 
=> Array r ix Word8

Source array

-> ByteString 

O(n) - Convert any source array into a strict ByteString. In case when the source array is actually storable, no memory copy will occur.

Since: 0.2.1

castToByteString :: Array S ix Word8 -> ByteString Source #

O(1) - Cast a Storable array into a strict ByteString

Since: 0.3.0

toBuilder :: Source r ix e => (e -> Builder) -> Array r ix e -> Builder Source #

O(n) - Conversion of array monoidally into a ByteString Builder.

Since: 0.2.1

castToBuilder :: Array S ix Word8 -> Builder Source #

O(1) - Cast a storable array of Word8 to ByteString Builder.

Since: 0.5.0