storablevector-0.2.2: Fast, packed, strict storable arrays with a list interface like ByteString

Data.StorableVector.Lazy.Pattern

Description

Functions for StorableVector that allow control of the size of individual chunks.

This is import for an application like the following: You want to mix audio signals that are relatively shifted. The structure of chunks of three streams may be illustrated as:

 [____] [____] [____] [____] ...
   [____] [____] [____] [____] ...
     [____] [____] [____] [____] ...

When we mix the streams (zipWith3 (x y z -> x+y+z)) with respect to the chunk structure of the first signal, computing the first chunk requires full evaluation of all leading chunks of the stream. However the last value of the third leading chunk is much later in time than the last value of the first leading chunk. We like to reduce these dependencies using a different chunk structure, say

 [____] [____] [____] [____] ...
   [__] [____] [____] [____] ...
     [] [____] [____] [____] ...

Synopsis

Documentation

data Vector a Source

pack :: Storable a => LazySize -> [a] -> Vector aSource

unpack :: Storable a => Vector a -> [a]Source

packWith :: Storable b => LazySize -> (a -> b) -> [a] -> Vector bSource

unpackWith :: Storable a => (a -> b) -> Vector a -> [b]Source

unfoldrN :: Storable b => LazySize -> (a -> Maybe (b, a)) -> a -> (Vector b, Maybe a)Source

iterateN :: Storable a => LazySize -> (a -> a) -> a -> Vector aSource

cons :: Storable a => a -> Vector a -> Vector aSource

map :: (Storable x, Storable y) => (x -> y) -> Vector x -> Vector ySource

foldl :: Storable b => (a -> b -> a) -> a -> Vector b -> aSource

foldl' :: Storable b => (a -> b -> a) -> a -> Vector b -> aSource

any :: Storable a => (a -> Bool) -> Vector a -> BoolSource

all :: Storable a => (a -> Bool) -> Vector a -> BoolSource

maximum :: (Storable a, Ord a) => Vector a -> aSource

minimum :: (Storable a, Ord a) => Vector a -> aSource

viewL :: Storable a => Vector a -> Maybe (a, Vector a)Source

viewR :: Storable a => Vector a -> Maybe (Vector a, a)Source

switchL :: Storable a => b -> (a -> Vector a -> b) -> Vector a -> bSource

switchR :: Storable a => b -> (Vector a -> a -> b) -> Vector a -> bSource

scanl :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector aSource

mapAccumL :: (Storable a, Storable b) => (acc -> a -> (acc, b)) -> acc -> Vector a -> (acc, Vector b)Source

mapAccumR :: (Storable a, Storable b) => (acc -> a -> (acc, b)) -> acc -> Vector a -> (acc, Vector b)Source

crochetL :: (Storable x, Storable y) => (x -> acc -> Maybe (y, acc)) -> acc -> Vector x -> Vector ySource

dropMarginRem :: Storable a => Int -> Int -> Vector a -> (Int, Vector a)Source

dropMarginRem n m xs drops at most the first m elements of xs and ensures that xs still contains n elements. Additionally returns the number of elements that could not be dropped due to the margin constraint. That is dropMarginRem n m xs == (k,ys) implies length xs - m == length ys - k. Requires length xs >= n.

dropWhile :: Storable a => (a -> Bool) -> Vector a -> Vector aSource

takeWhile :: Storable a => (a -> Bool) -> Vector a -> Vector aSource

span :: Storable a => (a -> Bool) -> Vector a -> (Vector a, Vector a)Source

filter :: Storable a => (a -> Bool) -> Vector a -> Vector aSource

zipWith :: (Storable a, Storable b, Storable c) => (a -> b -> c) -> Vector a -> Vector b -> Vector cSource

zipWith3 :: (Storable a, Storable b, Storable c, Storable d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector dSource

zipWith4 :: (Storable a, Storable b, Storable c, Storable d, Storable e) => (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector eSource

zipWithSize :: (Storable a, Storable b, Storable c) => LazySize -> (a -> b -> c) -> Vector a -> Vector b -> Vector cSource

zipWithSize3 :: (Storable a, Storable b, Storable c, Storable d) => LazySize -> (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector dSource

zipWithSize4 :: (Storable a, Storable b, Storable c, Storable d, Storable e) => LazySize -> (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector eSource