Haskell Repa meaning of BoundFixed?

In the Repa package, there is a Boundary datatype:

data Boundary a
        = BoundFixed !a
        | BoundConst !a
        | BoundClamp
        deriving (Show)

I understand what is meant by BoundConst (cells outside of the array are treated as single value), and I understand what is meant by BoundClamp (cells outside of the array are the same values as the closest array cell).

What is meant by BoundFixed ? The description is Use a fixed value for border regions. What is the "border region"? Are these all the edge cells?


Reading through the source code for mapStencil2 and partitionForStencil , it looks like the border region is any cell whose value would be computed using cells outside the input array. BoundConst uses a constant value outside the array as the input to the convolution when sampling cells outside the array. BoundFixed uses a constant value as the result any time the convolution would depend on a value outside the array.

You could easily test this with a 3x3 identity convolution on a small image. BoundConst and BoundClamp shouldn't change the image at all. BoundFixed a would draw one cell a border on the image. BoundFixed with a 2x2 identity convolution should draw the border on only two sides of the image. I can't recommend using BoundFixed for anything other than drawing borders, since the same convolution would produce different results just because of the stencil size.

链接地址: http://www.djcxy.com/p/59986.html

上一篇: 在调试器中正确地使你的.NET语言步骤正确

下一篇: Haskell Repa BoundFixed的含义?