diff options
Diffstat (limited to 'packages/base/src/Numeric/LinearAlgebra/Algorithms.hs')
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Algorithms.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/base/src/Numeric/LinearAlgebra/Algorithms.hs b/packages/base/src/Numeric/LinearAlgebra/Algorithms.hs index bbcc513..7e36978 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Algorithms.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Algorithms.hs | |||
@@ -26,6 +26,7 @@ module Numeric.LinearAlgebra.Algorithms ( | |||
26 | Field(), | 26 | Field(), |
27 | -- * Linear Systems | 27 | -- * Linear Systems |
28 | linearSolve, | 28 | linearSolve, |
29 | mbLinearSolve, | ||
29 | luSolve, | 30 | luSolve, |
30 | cholSolve, | 31 | cholSolve, |
31 | linearSolveLS, | 32 | linearSolveLS, |
@@ -102,6 +103,7 @@ class (Product t, | |||
102 | sv' :: Matrix t -> Vector Double | 103 | sv' :: Matrix t -> Vector Double |
103 | luPacked' :: Matrix t -> (Matrix t, [Int]) | 104 | luPacked' :: Matrix t -> (Matrix t, [Int]) |
104 | luSolve' :: (Matrix t, [Int]) -> Matrix t -> Matrix t | 105 | luSolve' :: (Matrix t, [Int]) -> Matrix t -> Matrix t |
106 | mbLinearSolve' :: Matrix t -> Matrix t -> Maybe (Matrix t) | ||
105 | linearSolve' :: Matrix t -> Matrix t -> Matrix t | 107 | linearSolve' :: Matrix t -> Matrix t -> Matrix t |
106 | cholSolve' :: Matrix t -> Matrix t -> Matrix t | 108 | cholSolve' :: Matrix t -> Matrix t -> Matrix t |
107 | linearSolveSVD' :: Matrix t -> Matrix t -> Matrix t | 109 | linearSolveSVD' :: Matrix t -> Matrix t -> Matrix t |
@@ -125,6 +127,7 @@ instance Field Double where | |||
125 | luPacked' = luR | 127 | luPacked' = luR |
126 | luSolve' (l_u,perm) = lusR l_u perm | 128 | luSolve' (l_u,perm) = lusR l_u perm |
127 | linearSolve' = linearSolveR -- (luSolve . luPacked) ?? | 129 | linearSolve' = linearSolveR -- (luSolve . luPacked) ?? |
130 | mbLinearSolve' = mbLinearSolveR | ||
128 | cholSolve' = cholSolveR | 131 | cholSolve' = cholSolveR |
129 | linearSolveLS' = linearSolveLSR | 132 | linearSolveLS' = linearSolveLSR |
130 | linearSolveSVD' = linearSolveSVDR Nothing | 133 | linearSolveSVD' = linearSolveSVDR Nothing |
@@ -151,6 +154,7 @@ instance Field (Complex Double) where | |||
151 | luPacked' = luC | 154 | luPacked' = luC |
152 | luSolve' (l_u,perm) = lusC l_u perm | 155 | luSolve' (l_u,perm) = lusC l_u perm |
153 | linearSolve' = linearSolveC | 156 | linearSolve' = linearSolveC |
157 | mbLinearSolve' = mbLinearSolveC | ||
154 | cholSolve' = cholSolveC | 158 | cholSolve' = cholSolveC |
155 | linearSolveLS' = linearSolveLSC | 159 | linearSolveLS' = linearSolveLSC |
156 | linearSolveSVD' = linearSolveSVDC Nothing | 160 | linearSolveSVD' = linearSolveSVDC Nothing |
@@ -234,6 +238,10 @@ luSolve = {-# SCC "luSolve" #-} luSolve' | |||
234 | linearSolve :: Field t => Matrix t -> Matrix t -> Matrix t | 238 | linearSolve :: Field t => Matrix t -> Matrix t -> Matrix t |
235 | linearSolve = {-# SCC "linearSolve" #-} linearSolve' | 239 | linearSolve = {-# SCC "linearSolve" #-} linearSolve' |
236 | 240 | ||
241 | -- | Solve a linear system (for square coefficient matrix and several right-hand sides) using the LU decomposition, returning Nothing for a singular system. For underconstrained or overconstrained systems use 'linearSolveLS' or 'linearSolveSVD'. | ||
242 | mbLinearSolve :: Field t => Matrix t -> Matrix t -> Maybe (Matrix t) | ||
243 | mbLinearSolve = {-# SCC "linearSolve" #-} mbLinearSolve' | ||
244 | |||
237 | -- | Solve a symmetric or Hermitian positive definite linear system using a precomputed Cholesky decomposition obtained by 'chol'. | 245 | -- | Solve a symmetric or Hermitian positive definite linear system using a precomputed Cholesky decomposition obtained by 'chol'. |
238 | cholSolve :: Field t => Matrix t -> Matrix t -> Matrix t | 246 | cholSolve :: Field t => Matrix t -> Matrix t -> Matrix t |
239 | cholSolve = {-# SCC "cholSolve" #-} cholSolve' | 247 | cholSolve = {-# SCC "cholSolve" #-} cholSolve' |