summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/Algorithms.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Algorithms.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/Algorithms.hs23
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] 375m = (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
3791. 0. 0. 3811. 0. 0.
3800. 1. 0. 3820. 1. 0.
3810. 0. 10000000000. 3830. 0. 10000000000.
382\ -- 384
383\> pinvTol 1E8 m 385>>> pinvTol 1E8 m
3841. 0. 0. 3861. 0. 0.
3850. 1. 0. 3870. 1. 0.
3860. 0. 1.@ 3880. 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-}
606sqrtm :: Field t => Matrix t -> Matrix t 609sqrtm :: Field t => Matrix t -> Matrix t
607sqrtm = sqrtmInv 610sqrtm = sqrtmInv