summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2011-12-25 19:14:17 +0100
committerAlberto Ruiz <aruiz@um.es>2011-12-25 19:14:17 +0100
commit66b17bce538f573fc37090ac1428d7fee8c8b959 (patch)
treedd71ef6deb5dbfa0b4d201514ce81dae59d37188 /lib/Numeric/LinearAlgebra
parentd0eb68801e7c8de0996f6799db5ea691588467fa (diff)
parentea4da824ebc0ad09431aa276d8d44e4908e542c0 (diff)
remove warnings in glpk and special (Bas van Dijk's method)
Diffstat (limited to 'lib/Numeric/LinearAlgebra')
-rw-r--r--lib/Numeric/LinearAlgebra/Algorithms.hs10
-rw-r--r--lib/Numeric/LinearAlgebra/LAPACK.hs2
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs
index 9806d6f..e2ecd4d 100644
--- a/lib/Numeric/LinearAlgebra/Algorithms.hs
+++ b/lib/Numeric/LinearAlgebra/Algorithms.hs
@@ -568,11 +568,19 @@ epslist = [ (fromIntegral k, golubeps k k) | k <- [1..]]
568 568
569geps delta = head [ k | (k,g) <- epslist, g<delta] 569geps delta = head [ k | (k,g) <- epslist, g<delta]
570 570
571
571{- | Matrix exponential. It uses a direct translation of Algorithm 11.3.1 in Golub & Van Loan, 572{- | Matrix exponential. It uses a direct translation of Algorithm 11.3.1 in Golub & Van Loan,
572 based on a scaled Pade approximation. 573 based on a scaled Pade approximation.
573-} 574-}
574expm :: Field t => Matrix t -> Matrix t 575expm :: Field t => Matrix t -> Matrix t
575expm m = iterate msq f !! j 576expm = expGolub
577
578expGolub :: ( Fractional t, Element t, Field t
579 , Normed Matrix t
580 , RealFrac (RealOf t)
581 , Floating (RealOf t)
582 ) => Matrix t -> Matrix t
583expGolub m = iterate msq f !! j
576 where j = max 0 $ floor $ logBase 2 $ pnorm Infinity m 584 where j = max 0 $ floor $ logBase 2 $ pnorm Infinity m
577 a = m */ fromIntegral ((2::Int)^j) 585 a = m */ fromIntegral ((2::Int)^j)
578 q = geps eps -- 7 steps 586 q = geps eps -- 7 steps
diff --git a/lib/Numeric/LinearAlgebra/LAPACK.hs b/lib/Numeric/LinearAlgebra/LAPACK.hs
index 14e121b..d1aa564 100644
--- a/lib/Numeric/LinearAlgebra/LAPACK.hs
+++ b/lib/Numeric/LinearAlgebra/LAPACK.hs
@@ -47,7 +47,7 @@ import Numeric.Conversion
47import Numeric.GSL.Vector(vectorMapValR, FunCodeSV(Scale)) 47import Numeric.GSL.Vector(vectorMapValR, FunCodeSV(Scale))
48 48
49import Foreign.Ptr(nullPtr) 49import Foreign.Ptr(nullPtr)
50import Foreign.C.Types(CInt(..)) 50import Foreign.C.Types
51import Control.Monad(when) 51import Control.Monad(when)
52import System.IO.Unsafe(unsafePerformIO) 52import System.IO.Unsafe(unsafePerformIO)
53 53