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

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

Data.Massiv.Array.Unsafe

Contents

Description

 

Synopsis

Creation

unsafeMakeArray :: Construct r ix e => Comp -> ix -> (ix -> e) -> Array r ix e Source #

Construct an array. No size validation is performed.

unsafeGenerateArray :: Mutable r ix e => ix -> (ix -> e) -> Array r ix e Source #

Create an array sequentially using mutable interface

unsafeGenerateArrayP :: Mutable r ix e => [Int] -> ix -> (ix -> e) -> Array r ix e Source #

Create an array in parallel using mutable interface

unsafeGenerateM :: (Ragged r ix e, Monad m) => Comp -> ix -> (ix -> m e) -> m (Array r ix e) Source #

Indexing

unsafeIndex :: Source r ix e => Array r ix e -> ix -> e Source #

Lookup element in the array. No bounds check is performed and access of arbitrary memory is possible when invalid index is supplied.

unsafeLinearIndex :: Source r ix e => Array r ix e -> Int -> e Source #

Lookup element in the array using flat index in a row-major fasion. No bounds check is performed

unsafeLinearIndexM :: Manifest r ix e => Array r ix e -> Int -> e Source #

Manipulations

unsafeBackpermute :: (Source r' ix' e, Index ix) => ix -> (ix -> ix') -> Array r' ix' e -> Array D ix e Source #

unsafeTraverse :: (Source r1 ix1 e1, Index ix) => ix -> ((ix1 -> e1) -> ix -> e) -> Array r1 ix1 e1 -> Array D ix e Source #

unsafeTraverse2 :: (Source r1 ix1 e1, Source r2 ix2 e2, Index ix) => ix -> ((ix1 -> e1) -> (ix2 -> e2) -> ix -> e) -> Array r1 ix1 e1 -> Array r2 ix2 e2 -> Array D ix e Source #

unsafeResize :: (Size r ix e, Index ix') => ix' -> Array r ix e -> Array r ix' e Source #

O(1) - Change the size of an array. New size is not validated.

unsafeExtract :: Size r ix e => ix -> ix -> Array r ix e -> Array (EltRepr r ix) ix e Source #

O(1) - Extract a portion of an array. Staring index and new size are not validated.

Slicing

unsafeSlice :: Slice r ix e => Array r ix e -> ix -> ix -> Dim -> Maybe (Elt r ix e) Source #

unsafeOuterSlice :: OuterSlice r ix e => Array r ix e -> Int -> Elt r ix e Source #

O(1) - Take a slice out of an array from the outside

unsafeInnerSlice :: InnerSlice r ix e => Array r ix e -> (Lower ix, Int) -> Int -> Elt r ix e Source #

Mutable interface

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

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

unsafeNew :: (Mutable r ix e, PrimMonad m) => ix -> m (MArray (PrimState m) r ix e) Source #

Create new mutable array, leaving it's elements uninitialized. Size isn't validated either.

unsafeNewZero :: (Mutable r ix e, PrimMonad m) => ix -> m (MArray (PrimState m) r ix e) Source #

Create new mutable array, leaving it's elements uninitialized. Size isn't validated either.

unsafeRead :: (Mutable r ix e, PrimMonad m) => MArray (PrimState m) r ix e -> ix -> m e Source #

Read an array element

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

unsafeWrite :: (Mutable r ix e, PrimMonad m) => MArray (PrimState m) r ix e -> ix -> e -> m () Source #

Write an element into array

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