diff options
-rw-r--r-- | hssl.cabal | 9 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/Algorithms.hs | 7 |
2 files changed, 8 insertions, 8 deletions
@@ -5,12 +5,13 @@ License-file: LICENSE | |||
5 | Author: Alberto Ruiz | 5 | Author: Alberto Ruiz |
6 | Maintainer: Alberto Ruiz <aruiz@um.es> | 6 | Maintainer: Alberto Ruiz <aruiz@um.es> |
7 | Stability: provisional | 7 | Stability: provisional |
8 | Homepage: http://dis.um.es/~alberto/GSLHaskell | 8 | Homepage: http://alberrto.googlepages.com/gslhaskell |
9 | Synopsis: Simple Scientific Library | 9 | Synopsis: Simple Scientific Library |
10 | Description: A high level functional interface to some linear algebra computations | 10 | Description: 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> |
14 | Category: Numerical, Math | 15 | Category: Numerical, Math |
15 | tested-with: GHC ==6.6.1 | 16 | tested-with: GHC ==6.6.1 |
16 | Build-Depends: base, haskell98 | 17 | Build-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) |
182 | economy svd m = (u', subVector 0 d s, v') where | 182 | economy 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' |