covariance 0.1.0.6 → 0.2.0.0
raw patch · 3 files changed
+21/−6 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Statistics.Covariance: rescaleWith :: Vector Double -> Matrix Double -> Matrix Double
+ Statistics.Covariance: rescalePWith :: Vector Double -> Matrix Double -> Matrix Double
+ Statistics.Covariance: rescaleSWith :: Vector Double -> Matrix Double -> Matrix Double
Files
- CHANGELOG.md +7/−0
- covariance.cabal +1/−1
- src/Statistics/Covariance.hs +13/−5
CHANGELOG.md view
@@ -5,6 +5,13 @@ ## Unreleased changes +## 0.2.0.0++- Rename `rescaleWith` to `rescaleSWith` to indicate the rescaling of+ covariance matrices.+- Add `rescalePWith` to rescale precision matrices.++ ## 0.1.0.5 - Tooling updates.
covariance.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: covariance-version: 0.1.0.6+version: 0.2.0.0 synopsis: Well-conditioned estimation of large-dimensional covariance matrices
src/Statistics/Covariance.hs view
@@ -29,7 +29,8 @@ -- * Helper functions scale,- rescaleWith,+ rescaleSWith,+ rescalePWith, ) where @@ -89,11 +90,18 @@ -- | Convert a correlation matrix with given standard deviations to original -- scale.-rescaleWith ::+rescaleSWith :: -- | Vector of standard deviations of length \(p\). L.Vector Double ->- -- | Correlation matrix of dimension \(p \times p\).+ -- | Normalized correlation matrix of dimension \(p \times p\). L.Matrix Double ->- -- | Covariance matrix of dimension \(p \times p\).+ -- | Covariance matrix of original scale and of dimension \(p \times p\). L.Matrix Double-rescaleWith ss = L.mapMatrixWithIndex (\(i, j) x -> x * (ss VS.! i) * (ss VS.! j))+rescaleSWith ss = L.mapMatrixWithIndex (\(i, j) x -> x * (ss VS.! i) * (ss VS.! j))++-- | See 'rescaleSWith' but for precision matrices.+rescalePWith ::+ L.Vector Double ->+ L.Matrix Double ->+ L.Matrix Double+rescalePWith ss = rescaleSWith (VS.map recip ss)