primitive-extras-0.10.1.5: Extras for the "primitive" library
Safe HaskellNone
LanguageHaskell2010

PrimitiveExtras.PrimArray

Synopsis

Documentation

primitiveVector :: Prim a => Vector a -> PrimArray a Source #

Construct from a primitive vector. In case the vector is not a slice, it is an O(1) op.

oneHot Source #

Arguments

:: Prim a 
=> Int

Size

-> Int

Index

-> a 
-> PrimArray a 

generate :: Prim a => Int -> (Int -> IO a) -> IO (PrimArray a) Source #

replicate :: Prim a => Int -> IO a -> IO (PrimArray a) Source #

replicateM :: (Monad m, Prim element) => Int -> m element -> m (PrimArray element) Source #

Please notice that this function is highly untested

traverse_ :: (Applicative f, Prim a) => (a -> f b) -> PrimArray a -> f () Source #

traverseWithIndexInRange_ :: Prim a => PrimArray a -> Int -> Int -> (Int -> a -> IO ()) -> IO () Source #

toElementsUnfoldlM :: (Monad m, Prim prim) => PrimArray prim -> UnfoldlM m prim Source #

cerealGet :: Prim element => Get Int -> Get element -> Get (PrimArray element) Source #

cerealGetAsInMemory :: Prim element => Get Int -> Get (PrimArray element) Source #

cerealPut :: Prim element => Putter Int -> Putter element -> Putter (PrimArray element) Source #

indexCountsFold Source #

Arguments

:: (Integral count, Prim count) 
=> Int

Array size

-> Fold Int (PrimArray count) 

Given a size of the array, construct a fold, which produces an array of index counts.

elementsFoldM Source #

Arguments

:: Prim a 
=> Int

Array size

-> FoldM IO a (PrimArray a) 

Given a size of the array, construct a fold, which produces an array of elements.