summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric/LinearAlgebra')
-rw-r--r--lib/Numeric/LinearAlgebra/Algorithms.hs6
-rw-r--r--lib/Numeric/LinearAlgebra/Util/Convolution.hs10
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs
index a3f541b..7223cd9 100644
--- a/lib/Numeric/LinearAlgebra/Algorithms.hs
+++ b/lib/Numeric/LinearAlgebra/Algorithms.hs
@@ -484,7 +484,7 @@ zh k v = fromList $ replicate (k-1) 0 ++ (1:drop k xs)
484 where xs = toList v 484 where xs = toList v
485 485
486zt 0 v = v 486zt 0 v = v
487zt k v = vjoin [subVector 0 (dim v - k) v, konst 0 k] 487zt k v = vjoin [subVector 0 (dim v - k) v, konst' 0 k]
488 488
489 489
490unpackQR :: (Field t) => (Matrix t, Vector t) -> (Matrix t, Matrix t) 490unpackQR :: (Field t) => (Matrix t, Vector t) -> (Matrix t, Matrix t)
@@ -640,10 +640,10 @@ luFact (l_u,perm) | r <= c = (l ,u ,p, s)
640 c = cols l_u 640 c = cols l_u
641 tu = triang r c 0 1 641 tu = triang r c 0 1
642 tl = triang r c 0 0 642 tl = triang r c 0 0
643 l = takeColumns r (l_u |*| tl) |+| diagRect 0 (konst 1 r) r r 643 l = takeColumns r (l_u |*| tl) |+| diagRect 0 (konst' 1 r) r r
644 u = l_u |*| tu 644 u = l_u |*| tu
645 (p,s) = fixPerm r perm 645 (p,s) = fixPerm r perm
646 l' = (l_u |*| tl) |+| diagRect 0 (konst 1 c) r c 646 l' = (l_u |*| tl) |+| diagRect 0 (konst' 1 c) r c
647 u' = takeRows c (l_u |*| tu) 647 u' = takeRows c (l_u |*| tu)
648 (|+|) = add 648 (|+|) = add
649 (|*|) = mul 649 (|*|) = mul
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