From d71833a6737eae7d2485eeabcec1c5dfbe9d46de Mon Sep 17 00:00:00 2001 From: Kevin Slagle Date: Tue, 18 Oct 2016 23:42:09 -0700 Subject: document norm functions and fix compactSVDTol documentation --- packages/base/src/Internal/Algorithms.hs | 2 +- packages/base/src/Internal/Util.hs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'packages/base/src/Internal') diff --git a/packages/base/src/Internal/Algorithms.hs b/packages/base/src/Internal/Algorithms.hs index 1ccd3a2..7ead5b4 100644 --- a/packages/base/src/Internal/Algorithms.hs +++ b/packages/base/src/Internal/Algorithms.hs @@ -294,7 +294,7 @@ fromList [35.18264833189422,1.4769076999800903] compactSVD :: Field t => Matrix t -> (Matrix t, Vector Double, Matrix t) compactSVD = compactSVDTol 1 --- | @compactSVDTol r@ is similar to 'compactSVDTol', but uses tolerance @tol=r*g*eps*(max rows cols)@ to distinguish nonzero singular values, where @g@ is the greatest singular value. +-- | @compactSVDTol r@ is similar to 'compactSVD', but uses tolerance @tol=r*g*eps*(max rows cols)@ to distinguish nonzero singular values, where @g@ is the greatest singular value. compactSVDTol :: Field t => Double -> Matrix t -> (Matrix t, Vector Double, Matrix t) compactSVDTol r m = (u', subVector 0 d s, v') where (u,s,v) = thinSVD m diff --git a/packages/base/src/Internal/Util.hs b/packages/base/src/Internal/Util.hs index cf42961..7f52a9c 100644 --- a/packages/base/src/Internal/Util.hs +++ b/packages/base/src/Internal/Util.hs @@ -255,6 +255,7 @@ norm :: Vector Double -> Double -- ^ 2-norm of real vector norm = pnorm PNorm2 +-- | p-norm for vectors, operator norm for matrices class Normed a where norm_0 :: a -> R @@ -319,10 +320,11 @@ instance Normed (Vector (Complex Float)) norm_2 = norm_2 . double norm_Inf = norm_Inf . double - +-- | Frobenius norm (Schatten p-norm with p=2) norm_Frob :: (Normed (Vector t), Element t) => Matrix t -> R norm_Frob = norm_2 . flatten +-- | Sum of singular values (Schatten p-norm with p=1) norm_nuclear :: Field t => Matrix t -> R norm_nuclear = sumElements . singularValues -- cgit v1.2.3