DistanceTransform-0.1.2: Distance transform function.

DistanceTransform.Internal.Indexer

Description

Helpers for performing nested loop iteration. Includes variants for parallel computation.

Synopsis

Documentation

data Zipper a Source

We use a zipper on list to walk over dimensions of an array.

Constructors

 Zip [a] a [a]

toZipper :: a -> [a] -> Zipper aSource

Create a `Zipper` from a non-empty list, with the cursor on the leftmost element.

unsafeToZipper :: [a] -> Zipper aSource

Create a `Zipper` from a non-empty list, with the cursor on the leftmost element. An exception is thrown if the given list is empty.

fromZipper :: Zipper a -> [a]Source

Convert a `Zipper` to a list.

left :: Zipper a -> Maybe (Zipper a)Source

Move a `Zipper` to the left.

focus :: Zipper a -> aSource

Comonadic coreturn: produce the value a `Zipper` is currently focused upon.

rightmost :: Zipper a -> Zipper aSource

Slide a `Zipper` over until focused on its rightmost element.

zipSum :: Num a => Zipper a -> aSource

Since we are using `Zipper`s to track the size of multidemensional arrays, the sum of all zipper elements gives the size of the entire array.

zipStep :: Num a => Zipper a -> aSource

Computes the step between consective elements at the currently focused dimension. This involves stepping over all nested dimensions.

zipStride :: Num a => Zipper a -> aSource

Computes the stride between rows at the currently focused dimension. This involves stepping over the rest of the current row along all nested dimensions.

zipFoldM :: Monad m => Zipper Int -> (a -> Int -> m a) -> a -> [Int] -> m ()Source

parChunkMapM_ :: (a -> IO ()) -> [a] -> IO ()Source

parZipFoldM :: Zipper Int -> (a -> Int -> IO a) -> a -> [Int] -> IO ()Source

zipMapM_ :: Monad m => Zipper Int -> (Int -> m ()) -> [Int] -> m ()Source

zipFoldMAsYouDo :: Monad m => Zipper Int -> (Int -> Int -> m ()) -> m ()Source

parZipFoldMAsYouDo :: Zipper Int -> (Int -> Int -> IO ()) -> IO ()Source