diff options
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Algorithms.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Algorithms.hs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs index 7223cd9..7c1c032 100644 --- a/lib/Numeric/LinearAlgebra/Algorithms.hs +++ b/lib/Numeric/LinearAlgebra/Algorithms.hs | |||
@@ -371,19 +371,21 @@ pinv = pinvTol 1 | |||
371 | 371 | ||
372 | {- | @pinvTol r@ computes the pseudoinverse of a matrix with tolerance @tol=r*g*eps*(max rows cols)@, where g is the greatest singular value. | 372 | {- | @pinvTol r@ computes the pseudoinverse of a matrix with tolerance @tol=r*g*eps*(max rows cols)@, where g is the greatest singular value. |
373 | 373 | ||
374 | @\> let m = 'fromLists' [[1,0, 0] | 374 | @ |
375 | ,[0,1, 0] | 375 | m = (3><3) [ 1, 0, 0 |
376 | ,[0,0,1e-10]] | 376 | , 0, 1, 0 |
377 | \ -- | 377 | , 0, 0, 1e-10] :: Matrix Double |
378 | \> 'pinv' m | 378 | @ |
379 | |||
380 | >>> pinv m | ||
379 | 1. 0. 0. | 381 | 1. 0. 0. |
380 | 0. 1. 0. | 382 | 0. 1. 0. |
381 | 0. 0. 10000000000. | 383 | 0. 0. 10000000000. |
382 | \ -- | 384 | |
383 | \> pinvTol 1E8 m | 385 | >>> pinvTol 1E8 m |
384 | 1. 0. 0. | 386 | 1. 0. 0. |
385 | 0. 1. 0. | 387 | 0. 1. 0. |
386 | 0. 0. 1.@ | 388 | 0. 0. 1. |
387 | 389 | ||
388 | -} | 390 | -} |
389 | 391 | ||
@@ -598,10 +600,11 @@ It only works with invertible matrices that have a real solution. For diagonaliz | |||
598 | @m = (2><2) [4,9 | 600 | @m = (2><2) [4,9 |
599 | ,0,4] :: Matrix Double@ | 601 | ,0,4] :: Matrix Double@ |
600 | 602 | ||
601 | @\>sqrtm m | 603 | >>> sqrtm m |
602 | (2><2) | 604 | (2><2) |
603 | [ 2.0, 2.25 | 605 | [ 2.0, 2.25 |
604 | , 0.0, 2.0 ]@ | 606 | , 0.0, 2.0 ] |
607 | |||
605 | -} | 608 | -} |
606 | sqrtm :: Field t => Matrix t -> Matrix t | 609 | sqrtm :: Field t => Matrix t -> Matrix t |
607 | sqrtm = sqrtmInv | 610 | sqrtm = sqrtmInv |