diff options
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Util/Convolution.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Util/Convolution.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Numeric/LinearAlgebra/Util/Convolution.hs b/lib/Numeric/LinearAlgebra/Util/Convolution.hs index 1043614..82de476 100644 --- a/lib/Numeric/LinearAlgebra/Util/Convolution.hs +++ b/lib/Numeric/LinearAlgebra/Util/Convolution.hs | |||
@@ -59,7 +59,7 @@ corrMin ker v = minEvery ss (asRow ker) <> ones | |||
59 | where | 59 | where |
60 | minEvery a b = cond a b a a b | 60 | minEvery a b = cond a b a a b |
61 | ss = vectSS (dim ker) v | 61 | ss = vectSS (dim ker) v |
62 | ones = konst' 1 (dim ker) | 62 | ones = konst 1 (dim ker) |
63 | 63 | ||
64 | 64 | ||
65 | 65 | ||
@@ -87,7 +87,7 @@ corr2 ker mat = dims | |||
87 | | otherwise = error $ "corr2: dim kernel ("++sz ker++") > dim matrix ("++sz mat++")" | 87 | | otherwise = error $ "corr2: dim kernel ("++sz ker++") > dim matrix ("++sz mat++")" |
88 | sz m = show (rows m)++"x"++show (cols m) | 88 | sz m = show (rows m)++"x"++show (cols m) |
89 | 89 | ||
90 | conv2 :: (Num a, Product a) => Matrix a -> Matrix a -> Matrix a | 90 | conv2 :: (Num a, Product a, Container Vector a) => Matrix a -> Matrix a -> Matrix a |
91 | -- ^ 2D convolution | 91 | -- ^ 2D convolution |
92 | conv2 k m = corr2 (fliprl . flipud $ k) pm | 92 | conv2 k m = corr2 (fliprl . flipud $ k) pm |
93 | where | 93 | where |
@@ -101,9 +101,9 @@ conv2 k m = corr2 (fliprl . flipud $ k) pm | |||
101 | c = cols k - 1 | 101 | c = cols k - 1 |
102 | h = rows m | 102 | h = rows m |
103 | w = cols m | 103 | w = cols m |
104 | z1 = konst' 0 (r,c) | 104 | z1 = konst 0 (r,c) |
105 | z2 = konst' 0 (r,w) | 105 | z2 = konst 0 (r,w) |
106 | z3 = konst' 0 (h,c) | 106 | z3 = konst 0 (h,c) |
107 | 107 | ||
108 | -- TODO: could be simplified using future empty arrays | 108 | -- TODO: could be simplified using future empty arrays |
109 | 109 | ||