summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2012-03-19 12:24:53 +0100
committerAlberto Ruiz <aruiz@um.es>2012-03-19 12:24:53 +0100
commit355eae1c5dcd83be84ae6d3379480b98a675dc08 (patch)
tree25b49789d04304e00a7e34e9e95e586eba5d747d
parentb0424cacf0453d8294fb37ab1325be256fd7be3e (diff)
orth
-rw-r--r--CHANGES.md5
-rw-r--r--lib/Numeric/LinearAlgebra/Algorithms.hs8
-rw-r--r--lib/Numeric/LinearAlgebra/Util.hs8
3 files changed, 20 insertions, 1 deletions
diff --git a/CHANGES.md b/CHANGES.md
index a5f6aee..2788c52 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -5,6 +5,11 @@
5 5
6- msadams and msbdf methods for ode 6- msadams and msbdf methods for ode
7 7
8- Numeric.LinearAlgebra.Util
9
10- (<\>) extended to multiple right-hand sides
11
12- orth
8 13
90.13.0.0 140.13.0.0
10-------- 15--------
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 (
64 nullspacePrec, 64 nullspacePrec,
65 nullVector, 65 nullVector,
66 nullspaceSVD, 66 nullspaceSVD,
67 orth,
67-- * Norms 68-- * Norms
68 Normed(..), NormType(..), 69 Normed(..), NormType(..),
69 relativeError, 70 relativeError,
@@ -445,6 +446,13 @@ nullspacePrec t m = nullspaceSVD (Left (t*eps)) m (rightSV m)
445nullVector :: Field t => Matrix t -> Vector t 446nullVector :: Field t => Matrix t -> Vector t
446nullVector = last . nullspacePrec 1 447nullVector = last . nullspacePrec 1
447 448
449orth :: Field t => Matrix t -> [Vector t]
450-- ^ Return an orthonormal basis of the range space of a matrix
451orth m = take r $ toColumns u
452 where
453 (u,s,_) = compactSVD m
454 r = ranksv eps (max (rows m) (cols m)) (toList s)
455
448------------------------------------------------------------------------ 456------------------------------------------------------------------------
449 457
450{- Pseudoinverse of a real matrix with the desired tolerance, expressed as a 458{- Pseudoinverse of a real matrix with the desired tolerance, expressed as a
diff --git a/lib/Numeric/LinearAlgebra/Util.hs b/lib/Numeric/LinearAlgebra/Util.hs
index 416b23f..79b8774 100644
--- a/lib/Numeric/LinearAlgebra/Util.hs
+++ b/lib/Numeric/LinearAlgebra/Util.hs
@@ -18,7 +18,8 @@ module Numeric.LinearAlgebra.Util(
18 col, 18 col,
19 (&),(!), (#), 19 (&),(!), (#),
20 rand, randn, 20 rand, randn,
21 cross 21 cross,
22 norm
22) where 23) where
23 24
24import Numeric.LinearAlgebra 25import Numeric.LinearAlgebra
@@ -96,3 +97,8 @@ cross x y | dim x == 3 && dim y == 3 = fromList [z1,z2,z3]
96 z2 = x3*y1-x1*y3 97 z2 = x3*y1-x1*y3
97 z3 = x1*y2-x2*y1 98 z3 = x1*y2-x2*y1
98 99
100norm :: Vector Double -> Double
101-- ^ 2-norm of real vectors
102norm = pnorm PNorm2
103
104