diff options
Diffstat (limited to 'packages/base/src')
-rw-r--r-- | packages/base/src/Internal/Algorithms.hs | 2 | ||||
-rw-r--r-- | packages/base/src/Internal/Util.hs | 4 |
2 files changed, 4 insertions, 2 deletions
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] | |||
294 | compactSVD :: Field t => Matrix t -> (Matrix t, Vector Double, Matrix t) | 294 | compactSVD :: Field t => Matrix t -> (Matrix t, Vector Double, Matrix t) |
295 | compactSVD = compactSVDTol 1 | 295 | compactSVD = compactSVDTol 1 |
296 | 296 | ||
297 | -- | @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. | 297 | -- | @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. |
298 | compactSVDTol :: Field t => Double -> Matrix t -> (Matrix t, Vector Double, Matrix t) | 298 | compactSVDTol :: Field t => Double -> Matrix t -> (Matrix t, Vector Double, Matrix t) |
299 | compactSVDTol r m = (u', subVector 0 d s, v') where | 299 | compactSVDTol r m = (u', subVector 0 d s, v') where |
300 | (u,s,v) = thinSVD m | 300 | (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 | |||
255 | -- ^ 2-norm of real vector | 255 | -- ^ 2-norm of real vector |
256 | norm = pnorm PNorm2 | 256 | norm = pnorm PNorm2 |
257 | 257 | ||
258 | -- | p-norm for vectors, operator norm for matrices | ||
258 | class Normed a | 259 | class Normed a |
259 | where | 260 | where |
260 | norm_0 :: a -> R | 261 | norm_0 :: a -> R |
@@ -319,10 +320,11 @@ instance Normed (Vector (Complex Float)) | |||
319 | norm_2 = norm_2 . double | 320 | norm_2 = norm_2 . double |
320 | norm_Inf = norm_Inf . double | 321 | norm_Inf = norm_Inf . double |
321 | 322 | ||
322 | 323 | -- | Frobenius norm (Schatten p-norm with p=2) | |
323 | norm_Frob :: (Normed (Vector t), Element t) => Matrix t -> R | 324 | norm_Frob :: (Normed (Vector t), Element t) => Matrix t -> R |
324 | norm_Frob = norm_2 . flatten | 325 | norm_Frob = norm_2 . flatten |
325 | 326 | ||
327 | -- | Sum of singular values (Schatten p-norm with p=1) | ||
326 | norm_nuclear :: Field t => Matrix t -> R | 328 | norm_nuclear :: Field t => Matrix t -> R |
327 | norm_nuclear = sumElements . singularValues | 329 | norm_nuclear = sumElements . singularValues |
328 | 330 | ||