From 355eae1c5dcd83be84ae6d3379480b98a675dc08 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Mon, 19 Mar 2012 12:24:53 +0100 Subject: orth --- lib/Numeric/LinearAlgebra/Algorithms.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/Numeric/LinearAlgebra/Algorithms.hs') diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs index 435cc5a..9ae5e32 100644 --- a/lib/Numeric/LinearAlgebra/Algorithms.hs +++ b/lib/Numeric/LinearAlgebra/Algorithms.hs @@ -64,6 +64,7 @@ module Numeric.LinearAlgebra.Algorithms ( nullspacePrec, nullVector, nullspaceSVD, + orth, -- * Norms Normed(..), NormType(..), relativeError, @@ -445,6 +446,13 @@ nullspacePrec t m = nullspaceSVD (Left (t*eps)) m (rightSV m) nullVector :: Field t => Matrix t -> Vector t nullVector = last . nullspacePrec 1 +orth :: Field t => Matrix t -> [Vector t] +-- ^ Return an orthonormal basis of the range space of a matrix +orth m = take r $ toColumns u + where + (u,s,_) = compactSVD m + r = ranksv eps (max (rows m) (cols m)) (toList s) + ------------------------------------------------------------------------ {- Pseudoinverse of a real matrix with the desired tolerance, expressed as a -- cgit v1.2.3