summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/Util/Convolution.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2014-04-24 13:17:55 +0200
committerAlberto Ruiz <aruiz@um.es>2014-04-24 13:17:55 +0200
commitde0219353ca9631135a3f750cef05b9636bef232 (patch)
tree2943867ceca43bcf5037f60077a6269f589deff8 /lib/Numeric/LinearAlgebra/Util/Convolution.hs
parent3c1bbdd450304945c035a1e49cdb67871ea50451 (diff)
konst with bidirectional type inference
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Util/Convolution.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/Util/Convolution.hs10
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
90conv2 :: (Num a, Product a) => Matrix a -> Matrix a -> Matrix a 90conv2 :: (Num a, Product a, Container Vector a) => Matrix a -> Matrix a -> Matrix a
91-- ^ 2D convolution 91-- ^ 2D convolution
92conv2 k m = corr2 (fliprl . flipud $ k) pm 92conv2 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