summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-10-29 11:35:19 +0000
committerAlberto Ruiz <aruiz@um.es>2007-10-29 11:35:19 +0000
commitfd73d3eb9d671bd5be23024d4cc5eeb7b5fdeb58 (patch)
tree76144677c2092f283c67778b46e6c73b9f95ef50 /lib/Numeric/LinearAlgebra
parent29b9a4adfdcd624ecb1f67b7fba5830fa76260c9 (diff)
fixed economy svd
Diffstat (limited to 'lib/Numeric/LinearAlgebra')
-rw-r--r--lib/Numeric/LinearAlgebra/Algorithms.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs
index e115ec3..0683956 100644
--- a/lib/Numeric/LinearAlgebra/Algorithms.hs
+++ b/lib/Numeric/LinearAlgebra/Algorithms.hs
@@ -181,11 +181,10 @@ economy :: Field t
181 => (Matrix t -> (Matrix t, Vector Double, Matrix t)) -> Matrix t -> (Matrix t, Vector Double, Matrix t) 181 => (Matrix t -> (Matrix t, Vector Double, Matrix t)) -> Matrix t -> (Matrix t, Vector Double, Matrix t)
182economy svd m = (u', subVector 0 d s, v') where 182economy svd m = (u', subVector 0 d s, v') where
183 (u,s,v) = svd m 183 (u,s,v) = svd m
184 sl@(g:_) = toList (complex s) 184 sl@(g:_) = toList s
185 s' = fromList . filter rec $ sl 185 s' = fromList . filter (>tol) $ sl
186 rec x = magnitude x > magnitude g*tol
187 t = 1 186 t = 1
188 tol = (fromIntegral (max (rows m) (cols m)) * magnitude g * t * eps) 187 tol = (fromIntegral (max (rows m) (cols m)) * g * t * eps)
189 r = rows m 188 r = rows m
190 c = cols m 189 c = cols m
191 d = dim s' 190 d = dim s'