summaryrefslogtreecommitdiff
path: root/packages/base/src/Internal/Convolution.hs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base/src/Internal/Convolution.hs')
-rw-r--r--packages/base/src/Internal/Convolution.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/base/src/Internal/Convolution.hs b/packages/base/src/Internal/Convolution.hs
index 75fbef4..ae8ebc6 100644
--- a/packages/base/src/Internal/Convolution.hs
+++ b/packages/base/src/Internal/Convolution.hs
@@ -24,12 +24,13 @@ import Internal.Numeric
24import Internal.Element 24import Internal.Element
25import Internal.Conversion 25import Internal.Conversion
26import Internal.Container 26import Internal.Container
27import Foreign.Storable
27#if MIN_VERSION_base(4,11,0) 28#if MIN_VERSION_base(4,11,0)
28import Prelude hiding ((<>)) 29import Prelude hiding ((<>))
29#endif 30#endif
30 31
31 32
32vectSS :: Element t => Int -> Vector t -> Matrix t 33vectSS :: Storable t => Int -> Vector t -> Matrix t
33vectSS n v = fromRows [ subVector k n v | k <- [0 .. dim v - n] ] 34vectSS n v = fromRows [ subVector k n v | k <- [0 .. dim v - n] ]
34 35
35 36
@@ -82,7 +83,7 @@ corrMin ker v
82 83
83 84
84 85
85matSS :: Element t => Int -> Matrix t -> [Matrix t] 86matSS :: Storable t => Int -> Matrix t -> [Matrix t]
86matSS dr m = map (reshape c) [ subVector (k*c) n v | k <- [0 .. r - dr] ] 87matSS dr m = map (reshape c) [ subVector (k*c) n v | k <- [0 .. r - dr] ]
87 where 88 where
88 v = flatten m 89 v = flatten m
@@ -155,7 +156,7 @@ conv2 k m
155 empty = r == 0 || c == 0 156 empty = r == 0 || c == 0
156 157
157 158
158separable :: Element t => (Vector t -> Vector t) -> Matrix t -> Matrix t 159separable :: Storable t => (Vector t -> Vector t) -> Matrix t -> Matrix t
159-- ^ matrix computation implemented as separated vector operations by rows and columns. 160-- ^ matrix computation implemented as separated vector operations by rows and columns.
160separable f = fromColumns . map f . toColumns . fromRows . map f . toRows 161separable f = fromColumns . map f . toColumns . fromRows . map f . toRows
161 162