sdr-0.1.0.12: A software defined radio library

Safe HaskellNone
LanguageHaskell2010

SDR.VectorUtils

Description

Various Vector based utility functions

Synopsis
  • mapAccumMV :: Monad m => (acc -> x -> m (acc, y)) -> acc -> Stream m x -> Stream m y
  • stride :: Vector v a => Int -> v a -> v a
  • fill :: (PrimMonad m, Functor m, MVector vm a) => Bundle v a -> vm (PrimState m) a -> m ()
  • copyInto :: (PrimMonad m, MVector vm a, Vector v a) => vm (PrimState m) a -> v a -> m ()
  • vUnfoldr :: Vector v x => Int -> (acc -> (x, acc)) -> acc -> (v x, acc)
  • vUnfoldrM :: (PrimMonad m, Vector v x) => Int -> (acc -> m (x, acc)) -> acc -> m (v x, acc)

Documentation

mapAccumMV Source #

Arguments

:: Monad m 
=> (acc -> x -> m (acc, y))

The function

-> acc

The initial accumulator

-> Stream m x

The input stream

-> Stream m y

The output stream

Like mapAccumL but monadic and over vectors. Doesn't return the accumulator at the end because it doesn't seem to be possible to do this with the Stream datatype, making this function pretty useless.

stride Source #

Arguments

:: Vector v a 
=> Int

The stride

-> v a

The input Vector

-> v a

The output Vector

Create a vector from another vector containing only the elements that occur every stride elements in the source vector.

fill Source #

Arguments

:: (PrimMonad m, Functor m, MVector vm a) 
=> Bundle v a

The input Stream

-> vm (PrimState m) a

The mutable Vector to stream into

-> m () 

Fill a mutable vector from a monadic stream. This appears to be missing from the Vector library.

copyInto Source #

Arguments

:: (PrimMonad m, MVector vm a, Vector v a) 
=> vm (PrimState m) a

The destination

-> v a

The source

-> m () 

Copy a Vector into a mutable vector

vUnfoldr Source #

Arguments

:: Vector v x 
=> Int

Generates a vector with this size

-> (acc -> (x, acc))

The generator function

-> acc

The initial value of the seed

-> (v x, acc)

The (vector, final value of seed) result

Similar to unfoldrN from the vector package but the generator function cannot terminate and it returns the final value of the seed in addition to the vector

vUnfoldrM Source #

Arguments

:: (PrimMonad m, Vector v x) 
=> Int

Generates a vector with this size

-> (acc -> m (x, acc))

The monadic generator function

-> acc

The initial value of the seed

-> m (v x, acc)

The (vector, final value of seed) result

The same as vUnfoldr but the generator function is monadic