summaryrefslogtreecommitdiff
path: root/packages/base/src/Internal/Algorithms.hs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base/src/Internal/Algorithms.hs')
-rw-r--r--packages/base/src/Internal/Algorithms.hs14
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
23module Internal.Algorithms where 23module Internal.Algorithms (
24 module Internal.Algorithms,
25 UpLo(..)
26) where
24 27
25import Internal.Vector 28import Internal.Vector
26import Internal.Matrix 29import Internal.Matrix
27import Internal.Element 30import Internal.Element
28import Internal.Conversion 31import Internal.Conversion
29import Internal.LAPACK as LAPACK 32import Internal.LAPACK
30import Internal.Numeric 33import Internal.Numeric
31import Data.List(foldl1') 34import Data.List(foldl1')
32import qualified Data.Array as A 35import 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
351cholSolve = {-# SCC "cholSolve" #-} cholSolve' 357cholSolve = {-# SCC "cholSolve" #-} cholSolve'
352 358
359-- | Solve a triangular linear system.
360triSolve :: Field t => UpLo -> Matrix t -> Matrix t -> Matrix t
361triSolve = {-# 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.
354linearSolveSVD :: Field t => Matrix t -> Matrix t -> Matrix t 364linearSolveSVD :: Field t => Matrix t -> Matrix t -> Matrix t
355linearSolveSVD = {-# SCC "linearSolveSVD" #-} linearSolveSVD' 365linearSolveSVD = {-# SCC "linearSolveSVD" #-} linearSolveSVD'