diff options
author | Alberto Ruiz <aruiz@um.es> | 2010-08-28 17:26:39 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2010-08-28 17:26:39 +0000 |
commit | ccff860bcd64a43a9144288a04d03e1366f80586 (patch) | |
tree | 9e9a3b954210b64a6f531ffb0ed2c95cd2f006b7 /lib/Numeric/LinearAlgebra/Algorithms.hs | |
parent | 693cae17c1e4ae3570f35324119f47ca6103f3cf (diff) |
conversion function names
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Algorithms.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Algorithms.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs index 8962c60..7e258de 100644 --- a/lib/Numeric/LinearAlgebra/Algorithms.hs +++ b/lib/Numeric/LinearAlgebra/Algorithms.hs | |||
@@ -82,7 +82,7 @@ import Data.List(foldl1') | |||
82 | import Data.Array | 82 | import Data.Array |
83 | 83 | ||
84 | -- | Auxiliary typeclass used to define generic computations for both real and complex matrices. | 84 | -- | Auxiliary typeclass used to define generic computations for both real and complex matrices. |
85 | class (Prod t, Normed (Matrix t), Linear Vector t, Linear Matrix t) => Field t where | 85 | class (AutoReal t, Prod t, Linear Vector t, Linear Matrix t) => Field t where |
86 | svd' :: Matrix t -> (Matrix t, Vector Double, Matrix t) | 86 | svd' :: Matrix t -> (Matrix t, Vector Double, Matrix t) |
87 | thinSVD' :: Matrix t -> (Matrix t, Vector Double, Matrix t) | 87 | thinSVD' :: Matrix t -> (Matrix t, Vector Double, Matrix t) |
88 | sv' :: Matrix t -> Vector Double | 88 | sv' :: Matrix t -> Vector Double |
@@ -588,8 +588,8 @@ diagonalize m = if rank v == n | |||
588 | -- | 588 | -- |
589 | -- @logm = matFunc log@ | 589 | -- @logm = matFunc log@ |
590 | -- | 590 | -- |
591 | matFunc :: Field t => (Complex Double -> Complex Double) -> Matrix t -> Matrix (Complex Double) | 591 | matFunc :: (Field t) => (Complex Double -> Complex Double) -> Matrix t -> Matrix (Complex Double) |
592 | matFunc f m = case diagonalize (complex m) of | 592 | matFunc f m = case diagonalize (complex'' m) of |
593 | Just (l,v) -> v `mXm` diag (mapVector f l) `mXm` inv v | 593 | Just (l,v) -> v `mXm` diag (mapVector f l) `mXm` inv v |
594 | Nothing -> error "Sorry, matFunc requires a diagonalizable matrix" | 594 | Nothing -> error "Sorry, matFunc requires a diagonalizable matrix" |
595 | 595 | ||
@@ -630,7 +630,7 @@ expGolub m = iterate msq f !! j | |||
630 | {- | Matrix exponential. It uses a direct translation of Algorithm 11.3.1 in Golub & Van Loan, | 630 | {- | Matrix exponential. It uses a direct translation of Algorithm 11.3.1 in Golub & Van Loan, |
631 | based on a scaled Pade approximation. | 631 | based on a scaled Pade approximation. |
632 | -} | 632 | -} |
633 | expm :: Field t => Matrix t -> Matrix t | 633 | expm :: (Normed (Matrix t), Field t) => Matrix t -> Matrix t |
634 | expm = expGolub | 634 | expm = expGolub |
635 | 635 | ||
636 | -------------------------------------------------------------- | 636 | -------------------------------------------------------------- |
@@ -646,7 +646,7 @@ It only works with invertible matrices that have a real solution. For diagonaliz | |||
646 | [ 2.0, 2.25 | 646 | [ 2.0, 2.25 |
647 | , 0.0, 2.0 ]@ | 647 | , 0.0, 2.0 ]@ |
648 | -} | 648 | -} |
649 | sqrtm :: Field t => Matrix t -> Matrix t | 649 | sqrtm :: (Normed (Matrix t), Field t) => Matrix t -> Matrix t |
650 | sqrtm = sqrtmInv | 650 | sqrtm = sqrtmInv |
651 | 651 | ||
652 | sqrtmInv x = fst $ fixedPoint $ iterate f (x, ident (rows x)) | 652 | sqrtmInv x = fst $ fixedPoint $ iterate f (x, ident (rows x)) |