diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-09-08 11:23:15 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-09-08 11:23:15 +0200 |
commit | 0c3bdccc5f3b91f3f9f100a9b3756c6b19c7f195 (patch) | |
tree | c4e82c395da963d2b6c9edb2174a545a0e999763 /packages/base/src/Numeric/LinearAlgebra/HMatrix.hs | |
parent | 225901798773228e73b4c98670d56e844c040b3d (diff) |
documentation, thanks
linearSolve examples, install, changelog
Diffstat (limited to 'packages/base/src/Numeric/LinearAlgebra/HMatrix.hs')
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/HMatrix.hs | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs b/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs index d2cae6c..c0cc622 100644 --- a/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs +++ b/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs | |||
@@ -194,7 +194,37 @@ mul :: Numeric t => Matrix t -> Matrix t -> Matrix t | |||
194 | mul = mXm | 194 | mul = mXm |
195 | 195 | ||
196 | 196 | ||
197 | -- | 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'. | 197 | {- | 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'. |
198 | |||
199 | @ | ||
200 | a = (2><2) | ||
201 | [ 1.0, 2.0 | ||
202 | , 3.0, 5.0 ] | ||
203 | @ | ||
204 | |||
205 | @ | ||
206 | b = (2><3) | ||
207 | [ 6.0, 1.0, 10.0 | ||
208 | , 15.0, 3.0, 26.0 ] | ||
209 | @ | ||
210 | |||
211 | >>> linearSolve a b | ||
212 | Just (2><3) | ||
213 | [ -1.4802973661668753e-15, 0.9999999999999997, 1.999999999999997 | ||
214 | , 3.000000000000001, 1.6653345369377348e-16, 4.000000000000002 ] | ||
215 | |||
216 | >>> let Just x = it | ||
217 | >>> disp 5 x | ||
218 | 2x3 | ||
219 | -0.00000 1.00000 2.00000 | ||
220 | 3.00000 0.00000 4.00000 | ||
221 | |||
222 | >>> a <> x | ||
223 | (2><3) | ||
224 | [ 6.0, 1.0, 10.0 | ||
225 | , 15.0, 3.0, 26.0 ] | ||
226 | |||
227 | -} | ||
198 | linearSolve m b = A.mbLinearSolve m b | 228 | linearSolve m b = A.mbLinearSolve m b |
199 | 229 | ||
200 | -- | return an orthonormal basis of the null space of a matrix. See also 'nullspaceSVD'. | 230 | -- | return an orthonormal basis of the null space of a matrix. See also 'nullspaceSVD'. |