summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2016-10-27 20:55:03 +0200
committerGitHub <noreply@github.com>2016-10-27 20:55:03 +0200
commit155cac879362d2672a5504ba134728512b314c60 (patch)
treee72d8a63fd5b6f57f7f73ac22789c01b212d2164 /packages
parentb32b37472559f202995e894f9a627871737d4619 (diff)
parentc1fdf466a51401bb4e3a36a3398e155361477330 (diff)
Merge pull request #210 from kjslag/master
compactSVDTol doc and inline dim and subVector
Diffstat (limited to 'packages')
-rw-r--r--packages/base/src/Internal/Algorithms.hs2
-rw-r--r--packages/base/src/Internal/Vector.hs2
2 files changed, 3 insertions, 1 deletions
diff --git a/packages/base/src/Internal/Algorithms.hs b/packages/base/src/Internal/Algorithms.hs
index 7ead5b4..70d65d7 100644
--- a/packages/base/src/Internal/Algorithms.hs
+++ b/packages/base/src/Internal/Algorithms.hs
@@ -294,7 +294,7 @@ fromList [35.18264833189422,1.4769076999800903]
294compactSVD :: Field t => Matrix t -> (Matrix t, Vector Double, Matrix t) 294compactSVD :: Field t => Matrix t -> (Matrix t, Vector Double, Matrix t)
295compactSVD = compactSVDTol 1 295compactSVD = compactSVDTol 1
296 296
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. 297-- | @compactSVDTol r@ is similar to 'compactSVD' (for which @r=1@), but uses tolerance @tol=r*g*eps*(max rows cols)@ to distinguish nonzero singular values, where @g@ is the greatest singular value. If @g<r*eps@, then only one singular value is returned.
298compactSVDTol :: Field t => Double -> Matrix t -> (Matrix t, Vector Double, Matrix t) 298compactSVDTol :: Field t => Double -> Matrix t -> (Matrix t, Vector Double, Matrix t)
299compactSVDTol r m = (u', subVector 0 d s, v') where 299compactSVDTol 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/Vector.hs b/packages/base/src/Internal/Vector.hs
index c4a310d..67d0416 100644
--- a/packages/base/src/Internal/Vector.hs
+++ b/packages/base/src/Internal/Vector.hs
@@ -62,6 +62,7 @@ ti = fromIntegral
62-- | Number of elements 62-- | Number of elements
63dim :: (Storable t) => Vector t -> Int 63dim :: (Storable t) => Vector t -> Int
64dim = Vector.length 64dim = Vector.length
65{-# INLINE dim #-}
65 66
66 67
67-- C-Haskell vector adapter 68-- C-Haskell vector adapter
@@ -139,6 +140,7 @@ subVector :: Storable t => Int -- ^ index of the starting element
139 -> Vector t -- ^ source 140 -> Vector t -- ^ source
140 -> Vector t -- ^ result 141 -> Vector t -- ^ result
141subVector = Vector.slice 142subVector = Vector.slice
143{-# INLINE subVector #-}
142 144
143 145
144 146