summaryrefslogtreecommitdiff
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
parent29b9a4adfdcd624ecb1f67b7fba5830fa76260c9 (diff)
fixed economy svd
-rw-r--r--hssl.cabal9
-rw-r--r--lib/Numeric/LinearAlgebra/Algorithms.hs7
2 files changed, 8 insertions, 8 deletions
diff --git a/hssl.cabal b/hssl.cabal
index 6905a6a..acacf4c 100644
--- a/hssl.cabal
+++ b/hssl.cabal
@@ -5,12 +5,13 @@ License-file: LICENSE
5Author: Alberto Ruiz 5Author: Alberto Ruiz
6Maintainer: Alberto Ruiz <aruiz@um.es> 6Maintainer: Alberto Ruiz <aruiz@um.es>
7Stability: provisional 7Stability: provisional
8Homepage: http://dis.um.es/~alberto/GSLHaskell 8Homepage: http://alberrto.googlepages.com/gslhaskell
9Synopsis: Simple Scientific Library 9Synopsis: Simple Scientific Library
10Description: A high level functional interface to some linear algebra computations 10Description: A purely functional interface to basic linear algebra computations
11 and other numerical routines, internally implemented using GSL, BLAS and LAPACK. 11 and other numerical routines, internally implemented using
12 GSL, BLAS and LAPACK.
12 . 13 .
13 More information: <http://dis.um.es/~alberto/GSLHaskell> 14 More information: <http://alberrto.googlepages.com/gslhaskell>
14Category: Numerical, Math 15Category: Numerical, Math
15tested-with: GHC ==6.6.1 16tested-with: GHC ==6.6.1
16Build-Depends: base, haskell98 17Build-Depends: base, haskell98
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'