summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/Algorithms.hs
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/Algorithms.hs
parentd0eb68801e7c8de0996f6799db5ea691588467fa (diff)
parentea4da824ebc0ad09431aa276d8d44e4908e542c0 (diff)
remove warnings in glpk and special (Bas van Dijk's method)
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Algorithms.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/Algorithms.hs10
1 files changed, 9 insertions, 1 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