From 2ca163be0d77b6e2e9a53df6c990b1cd5661f6f5 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Sun, 28 Sep 2014 11:58:12 +0200 Subject: haddock example of matFunc sqrt --- packages/base/src/Numeric/LinearAlgebra/Algorithms.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/base/src/Numeric/LinearAlgebra/Algorithms.hs b/packages/base/src/Numeric/LinearAlgebra/Algorithms.hs index 25700bc..02ac6a0 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Algorithms.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Algorithms.hs @@ -809,7 +809,7 @@ expGolub m = iterate msq f !! j -------------------------------------------------------------- {- | Matrix square root. Currently it uses a simple iterative algorithm described in Wikipedia. -It only works with invertible matrices that have a real solution. For diagonalizable matrices you can try @matFunc sqrt@. +It only works with invertible matrices that have a real solution. @m = (2><2) [4,9 ,0,4] :: Matrix Double@ @@ -819,6 +819,13 @@ It only works with invertible matrices that have a real solution. For diagonaliz [ 2.0, 2.25 , 0.0, 2.0 ] +For diagonalizable matrices you can try 'matFunc' @sqrt@: + +>>> matFunc sqrt ((2><2) [1,0,0,-1]) +(2><2) + [ 1.0 :+ 0.0, 0.0 :+ 0.0 + , 0.0 :+ 0.0, 0.0 :+ 1.0 ] + -} sqrtm :: Field t => Matrix t -> Matrix t sqrtm = sqrtmInv -- cgit v1.2.3