diff options
author | Alberto Ruiz <aruiz@um.es> | 2010-09-20 17:08:34 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2010-09-20 17:08:34 +0000 |
commit | 05908719a7323110ba1955038d8341a8b7483351 (patch) | |
tree | f1f1fe28a8db64675dacc7eb4ec79d36e8174588 /lib/Numeric/LinearAlgebra | |
parent | 482b533c3fbfcd75d6c5c1d3ce32585bf9fc2ad7 (diff) |
generalized diagRect
Diffstat (limited to 'lib/Numeric/LinearAlgebra')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Algorithms.hs | 8 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/Tests/Instances.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/Tests/Properties.hs | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs index 4f6f54d..394a1d7 100644 --- a/lib/Numeric/LinearAlgebra/Algorithms.hs +++ b/lib/Numeric/LinearAlgebra/Algorithms.hs | |||
@@ -183,7 +183,7 @@ singularValues = {-# SCC "singularValues" #-} sv' | |||
183 | fullSVD :: Field t => Matrix t -> (Matrix t, Matrix Double, Matrix t) | 183 | fullSVD :: Field t => Matrix t -> (Matrix t, Matrix Double, Matrix t) |
184 | fullSVD m = (u,d,v) where | 184 | fullSVD m = (u,d,v) where |
185 | (u,s,v) = svd m | 185 | (u,s,v) = svd m |
186 | d = diagRect s r c | 186 | d = diagRect 0 s r c |
187 | r = rows m | 187 | r = rows m |
188 | c = cols m | 188 | c = cols m |
189 | 189 | ||
@@ -210,7 +210,7 @@ leftSV m | vertical m = let (u,s,_) = svd m in (u,s) | |||
210 | {-# DEPRECATED full "use fullSVD instead" #-} | 210 | {-# DEPRECATED full "use fullSVD instead" #-} |
211 | full svdFun m = (u, d ,v) where | 211 | full svdFun m = (u, d ,v) where |
212 | (u,s,v) = svdFun m | 212 | (u,s,v) = svdFun m |
213 | d = diagRect s r c | 213 | d = diagRect 0 s r c |
214 | r = rows m | 214 | r = rows m |
215 | c = cols m | 215 | c = cols m |
216 | 216 | ||
@@ -624,10 +624,10 @@ luFact (l_u,perm) | r <= c = (l ,u ,p, s) | |||
624 | c = cols l_u | 624 | c = cols l_u |
625 | tu = triang r c 0 1 | 625 | tu = triang r c 0 1 |
626 | tl = triang r c 0 0 | 626 | tl = triang r c 0 0 |
627 | l = takeColumns r (l_u |*| tl) |+| diagRect (konst 1 r) r r | 627 | l = takeColumns r (l_u |*| tl) |+| diagRect 0 (konst 1 r) r r |
628 | u = l_u |*| tu | 628 | u = l_u |*| tu |
629 | (p,s) = fixPerm r perm | 629 | (p,s) = fixPerm r perm |
630 | l' = (l_u |*| tl) |+| diagRect (konst 1 c) r c | 630 | l' = (l_u |*| tl) |+| diagRect 0 (konst 1 c) r c |
631 | u' = takeRows c (l_u |*| tu) | 631 | u' = takeRows c (l_u |*| tu) |
632 | (|+|) = add | 632 | (|+|) = add |
633 | (|*|) = mul | 633 | (|*|) = mul |
diff --git a/lib/Numeric/LinearAlgebra/Tests/Instances.hs b/lib/Numeric/LinearAlgebra/Tests/Instances.hs index 804c481..771739a 100644 --- a/lib/Numeric/LinearAlgebra/Tests/Instances.hs +++ b/lib/Numeric/LinearAlgebra/Tests/Instances.hs | |||
@@ -150,7 +150,7 @@ instance (ArbitraryField a) => Arbitrary (WC a) where | |||
150 | c = cols m | 150 | c = cols m |
151 | n = min r c | 151 | n = min r c |
152 | sv' <- replicateM n (choose (1,100)) | 152 | sv' <- replicateM n (choose (1,100)) |
153 | let s = diagRect (fromList sv') r c | 153 | let s = diagRect 0 (fromList sv') r c |
154 | return $ WC (u <> real s <> trans v) | 154 | return $ WC (u <> real s <> trans v) |
155 | 155 | ||
156 | #if MIN_VERSION_QuickCheck(2,0,0) | 156 | #if MIN_VERSION_QuickCheck(2,0,0) |
diff --git a/lib/Numeric/LinearAlgebra/Tests/Properties.hs b/lib/Numeric/LinearAlgebra/Tests/Properties.hs index 623b78c..a35f591 100644 --- a/lib/Numeric/LinearAlgebra/Tests/Properties.hs +++ b/lib/Numeric/LinearAlgebra/Tests/Properties.hs | |||
@@ -138,7 +138,7 @@ svdProp1 m = m |~| u <> real d <> trans v && unitary u && unitary v | |||
138 | 138 | ||
139 | svdProp1a svdfun m = m |~| u <> real d <> trans v && unitary u && unitary v where | 139 | svdProp1a svdfun m = m |~| u <> real d <> trans v && unitary u && unitary v where |
140 | (u,s,v) = svdfun m | 140 | (u,s,v) = svdfun m |
141 | d = diagRect s (rows m) (cols m) | 141 | d = diagRect 0 s (rows m) (cols m) |
142 | 142 | ||
143 | svdProp1b svdfun m = unitary u && unitary v where | 143 | svdProp1b svdfun m = unitary u && unitary v where |
144 | (u,_,v) = svdfun m | 144 | (u,_,v) = svdfun m |