Mapping a window function over a repa array with a boundary case

Skip to first unread message

Rob Stewart

May 15, 2014, 3:23:25 PM5/15/14

Using the FAQ guidelines for asking questions, I first posted this question on SO and there doesn't appear to be an obvious answer. I'm looking for a repa combinator that will:

1. Take a 2D array and two integers specifying a window size
2. In each window of the given size over the 2D array, calculate a new value e.g. the small value in this particular window.

I'd like to take advantages of the boundary condition support in Data.Array.Repa.Stencil, though not I don't think this can be problem can be solved with stencils. Such a function might look like this:

f  :: Source r a
  => Boundary a            -- ^ How to handle the boundary of the array.
  -> (Int,Int)             -- ^ window size in the X and Y direction.
  -> (Array r DIM2 a -> b) -- ^ function over window e.g. to return the minimum value.
  -> Array r DIM2 a        -- ^ Array to apply function to.
  -> Array r DIM2 b

Here's the question on SO:


Reply all
Reply to author
0 new messages