diff options
author | Alberto Ruiz <aruiz@um.es> | 2011-12-25 19:14:17 +0100 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2011-12-25 19:14:17 +0100 |
commit | 66b17bce538f573fc37090ac1428d7fee8c8b959 (patch) | |
tree | dd71ef6deb5dbfa0b4d201514ce81dae59d37188 /lib/Numeric/LinearAlgebra/Algorithms.hs | |
parent | d0eb68801e7c8de0996f6799db5ea691588467fa (diff) | |
parent | ea4da824ebc0ad09431aa276d8d44e4908e542c0 (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.hs | 10 |
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 | ||
569 | geps delta = head [ k | (k,g) <- epslist, g<delta] | 569 | geps 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 | -} |
574 | expm :: Field t => Matrix t -> Matrix t | 575 | expm :: Field t => Matrix t -> Matrix t |
575 | expm m = iterate msq f !! j | 576 | expm = expGolub |
577 | |||
578 | expGolub :: ( Fractional t, Element t, Field t | ||
579 | , Normed Matrix t | ||
580 | , RealFrac (RealOf t) | ||
581 | , Floating (RealOf t) | ||
582 | ) => Matrix t -> Matrix t | ||
583 | expGolub 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 |