diff options
Diffstat (limited to 'lib/Numeric/LinearAlgebra')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Algorithms.hs | 7 |
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) |
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' |