summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/Algorithms.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Algorithms.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/Algorithms.hs16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs
index a6b4dae..e2ecd4d 100644
--- a/lib/Numeric/LinearAlgebra/Algorithms.hs
+++ b/lib/Numeric/LinearAlgebra/Algorithms.hs
@@ -3,6 +3,7 @@
3{-# LANGUAGE MultiParamTypeClasses #-} 3{-# LANGUAGE MultiParamTypeClasses #-}
4{-# LANGUAGE UndecidableInstances #-} 4{-# LANGUAGE UndecidableInstances #-}
5{-# LANGUAGE TypeFamilies #-} 5{-# LANGUAGE TypeFamilies #-}
6
6----------------------------------------------------------------------------- 7-----------------------------------------------------------------------------
7{- | 8{- |
8Module : Numeric.LinearAlgebra.Algorithms 9Module : Numeric.LinearAlgebra.Algorithms
@@ -82,7 +83,7 @@ import Data.Packed.Matrix
82import Numeric.LinearAlgebra.LAPACK as LAPACK 83import Numeric.LinearAlgebra.LAPACK as LAPACK
83import Data.List(foldl1') 84import Data.List(foldl1')
84import Data.Array 85import Data.Array
85import Numeric.ContainerBoot hiding ((.*),(*/)) 86import Numeric.ContainerBoot
86 87
87 88
88{- | Class used to define generic linear algebra computations for both real and complex matrices. Only double precision is supported in this version (we can 89{- | Class used to define generic linear algebra computations for both real and complex matrices. Only double precision is supported in this version (we can
@@ -567,6 +568,13 @@ epslist = [ (fromIntegral k, golubeps k k) | k <- [1..]]
567 568
568geps delta = head [ k | (k,g) <- epslist, g<delta] 569geps delta = head [ k | (k,g) <- epslist, g<delta]
569 570
571
572{- | Matrix exponential. It uses a direct translation of Algorithm 11.3.1 in Golub & Van Loan,
573 based on a scaled Pade approximation.
574-}
575expm :: Field t => Matrix t -> Matrix t
576expm = expGolub
577
570expGolub :: ( Fractional t, Element t, Field t 578expGolub :: ( Fractional t, Element t, Field t
571 , Normed Matrix t 579 , Normed Matrix t
572 , RealFrac (RealOf t) 580 , RealFrac (RealOf t)
@@ -592,12 +600,6 @@ expGolub m = iterate msq f !! j
592 (.*) = scale 600 (.*) = scale
593 (|+|) = add 601 (|+|) = add
594 602
595{- | Matrix exponential. It uses a direct translation of Algorithm 11.3.1 in Golub & Van Loan,
596 based on a scaled Pade approximation.
597-}
598expm :: Field t => Matrix t -> Matrix t
599expm = expGolub
600
601-------------------------------------------------------------- 603--------------------------------------------------------------
602 604
603{- | Matrix square root. Currently it uses a simple iterative algorithm described in Wikipedia. 605{- | Matrix square root. Currently it uses a simple iterative algorithm described in Wikipedia.