diff options
Diffstat (limited to 'packages/base/src/Internal/Algorithms.hs')
-rw-r--r-- | packages/base/src/Internal/Algorithms.hs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/packages/base/src/Internal/Algorithms.hs b/packages/base/src/Internal/Algorithms.hs index 70d65d7..23a5e13 100644 --- a/packages/base/src/Internal/Algorithms.hs +++ b/packages/base/src/Internal/Algorithms.hs | |||
@@ -20,13 +20,16 @@ imported from "Numeric.LinearAlgebra.LAPACK". | |||
20 | -} | 20 | -} |
21 | ----------------------------------------------------------------------------- | 21 | ----------------------------------------------------------------------------- |
22 | 22 | ||
23 | module Internal.Algorithms where | 23 | module Internal.Algorithms ( |
24 | module Internal.Algorithms, | ||
25 | UpLo(..) | ||
26 | ) where | ||
24 | 27 | ||
25 | import Internal.Vector | 28 | import Internal.Vector |
26 | import Internal.Matrix | 29 | import Internal.Matrix |
27 | import Internal.Element | 30 | import Internal.Element |
28 | import Internal.Conversion | 31 | import Internal.Conversion |
29 | import Internal.LAPACK as LAPACK | 32 | import Internal.LAPACK |
30 | import Internal.Numeric | 33 | import Internal.Numeric |
31 | import Data.List(foldl1') | 34 | import Data.List(foldl1') |
32 | import qualified Data.Array as A | 35 | import qualified Data.Array as A |
@@ -58,6 +61,7 @@ class (Numeric t, | |||
58 | mbLinearSolve' :: Matrix t -> Matrix t -> Maybe (Matrix t) | 61 | mbLinearSolve' :: Matrix t -> Matrix t -> Maybe (Matrix t) |
59 | linearSolve' :: Matrix t -> Matrix t -> Matrix t | 62 | linearSolve' :: Matrix t -> Matrix t -> Matrix t |
60 | cholSolve' :: Matrix t -> Matrix t -> Matrix t | 63 | cholSolve' :: Matrix t -> Matrix t -> Matrix t |
64 | triSolve' :: UpLo -> Matrix t -> Matrix t -> Matrix t | ||
61 | ldlPacked' :: Matrix t -> (Matrix t, [Int]) | 65 | ldlPacked' :: Matrix t -> (Matrix t, [Int]) |
62 | ldlSolve' :: (Matrix t, [Int]) -> Matrix t -> Matrix t | 66 | ldlSolve' :: (Matrix t, [Int]) -> Matrix t -> Matrix t |
63 | linearSolveSVD' :: Matrix t -> Matrix t -> Matrix t | 67 | linearSolveSVD' :: Matrix t -> Matrix t -> Matrix t |
@@ -83,6 +87,7 @@ instance Field Double where | |||
83 | linearSolve' = linearSolveR -- (luSolve . luPacked) ?? | 87 | linearSolve' = linearSolveR -- (luSolve . luPacked) ?? |
84 | mbLinearSolve' = mbLinearSolveR | 88 | mbLinearSolve' = mbLinearSolveR |
85 | cholSolve' = cholSolveR | 89 | cholSolve' = cholSolveR |
90 | triSolve' = triSolveR | ||
86 | linearSolveLS' = linearSolveLSR | 91 | linearSolveLS' = linearSolveLSR |
87 | linearSolveSVD' = linearSolveSVDR Nothing | 92 | linearSolveSVD' = linearSolveSVDR Nothing |
88 | eig' = eigR | 93 | eig' = eigR |
@@ -112,6 +117,7 @@ instance Field (Complex Double) where | |||
112 | linearSolve' = linearSolveC | 117 | linearSolve' = linearSolveC |
113 | mbLinearSolve' = mbLinearSolveC | 118 | mbLinearSolve' = mbLinearSolveC |
114 | cholSolve' = cholSolveC | 119 | cholSolve' = cholSolveC |
120 | triSolve' = triSolveC | ||
115 | linearSolveLS' = linearSolveLSC | 121 | linearSolveLS' = linearSolveLSC |
116 | linearSolveSVD' = linearSolveSVDC Nothing | 122 | linearSolveSVD' = linearSolveSVDC Nothing |
117 | eig' = eigC | 123 | eig' = eigC |
@@ -350,6 +356,10 @@ cholSolve | |||
350 | -> Matrix t -- ^ solution | 356 | -> Matrix t -- ^ solution |
351 | cholSolve = {-# SCC "cholSolve" #-} cholSolve' | 357 | cholSolve = {-# SCC "cholSolve" #-} cholSolve' |
352 | 358 | ||
359 | -- | Solve a triangular linear system. | ||
360 | triSolve :: Field t => UpLo -> Matrix t -> Matrix t -> Matrix t | ||
361 | triSolve = {-# SCC "triSolve" #-} triSolve' | ||
362 | |||
353 | -- | Minimum norm solution of a general linear least squares problem Ax=B using the SVD. Admits rank-deficient systems but it is slower than 'linearSolveLS'. The effective rank of A is determined by treating as zero those singular valures which are less than 'eps' times the largest singular value. | 363 | -- | Minimum norm solution of a general linear least squares problem Ax=B using the SVD. Admits rank-deficient systems but it is slower than 'linearSolveLS'. The effective rank of A is determined by treating as zero those singular valures which are less than 'eps' times the largest singular value. |
354 | linearSolveSVD :: Field t => Matrix t -> Matrix t -> Matrix t | 364 | linearSolveSVD :: Field t => Matrix t -> Matrix t -> Matrix t |
355 | linearSolveSVD = {-# SCC "linearSolveSVD" #-} linearSolveSVD' | 365 | linearSolveSVD = {-# SCC "linearSolveSVD" #-} linearSolveSVD' |