diff options
Diffstat (limited to 'packages/base/src/Internal/Convolution.hs')
-rw-r--r-- | packages/base/src/Internal/Convolution.hs | 7 |
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 | |||
24 | import Internal.Element | 24 | import Internal.Element |
25 | import Internal.Conversion | 25 | import Internal.Conversion |
26 | import Internal.Container | 26 | import Internal.Container |
27 | import Foreign.Storable | ||
27 | #if MIN_VERSION_base(4,11,0) | 28 | #if MIN_VERSION_base(4,11,0) |
28 | import Prelude hiding ((<>)) | 29 | import Prelude hiding ((<>)) |
29 | #endif | 30 | #endif |
30 | 31 | ||
31 | 32 | ||
32 | vectSS :: Element t => Int -> Vector t -> Matrix t | 33 | vectSS :: Storable t => Int -> Vector t -> Matrix t |
33 | vectSS n v = fromRows [ subVector k n v | k <- [0 .. dim v - n] ] | 34 | vectSS 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 | ||
85 | matSS :: Element t => Int -> Matrix t -> [Matrix t] | 86 | matSS :: Storable t => Int -> Matrix t -> [Matrix t] |
86 | matSS dr m = map (reshape c) [ subVector (k*c) n v | k <- [0 .. r - dr] ] | 87 | matSS 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 | ||
158 | separable :: Element t => (Vector t -> Vector t) -> Matrix t -> Matrix t | 159 | separable :: 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. |
160 | separable f = fromColumns . map f . toColumns . fromRows . map f . toRows | 161 | separable f = fromColumns . map f . toColumns . fromRows . map f . toRows |
161 | 162 | ||