From fd73d3eb9d671bd5be23024d4cc5eeb7b5fdeb58 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Mon, 29 Oct 2007 11:35:19 +0000 Subject: fixed economy svd --- hssl.cabal | 9 +++++---- lib/Numeric/LinearAlgebra/Algorithms.hs | 7 +++---- 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 Author: Alberto Ruiz Maintainer: Alberto Ruiz Stability: provisional -Homepage: http://dis.um.es/~alberto/GSLHaskell +Homepage: http://alberrto.googlepages.com/gslhaskell Synopsis: Simple Scientific Library -Description: A high level functional interface to some linear algebra computations - and other numerical routines, internally implemented using GSL, BLAS and LAPACK. +Description: A purely functional interface to basic linear algebra computations + and other numerical routines, internally implemented using + GSL, BLAS and LAPACK. . - More information: + More information: Category: Numerical, Math tested-with: GHC ==6.6.1 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 => (Matrix t -> (Matrix t, Vector Double, Matrix t)) -> Matrix t -> (Matrix t, Vector Double, Matrix t) economy svd m = (u', subVector 0 d s, v') where (u,s,v) = svd m - sl@(g:_) = toList (complex s) - s' = fromList . filter rec $ sl - rec x = magnitude x > magnitude g*tol + sl@(g:_) = toList s + s' = fromList . filter (>tol) $ sl t = 1 - tol = (fromIntegral (max (rows m) (cols m)) * magnitude g * t * eps) + tol = (fromIntegral (max (rows m) (cols m)) * g * t * eps) r = rows m c = cols m d = dim s' -- cgit v1.2.3