diff options
Diffstat (limited to 'packages/base')
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Static.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/packages/base/src/Numeric/LinearAlgebra/Static.hs b/packages/base/src/Numeric/LinearAlgebra/Static.hs index 2e0e29f..e06474e 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Static.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Static.hs | |||
@@ -56,7 +56,7 @@ module Numeric.LinearAlgebra.Static( | |||
56 | Seed, RandDist(..), | 56 | Seed, RandDist(..), |
57 | randomVector, rand, randn, gaussianSample, uniformSample, | 57 | randomVector, rand, randn, gaussianSample, uniformSample, |
58 | -- * Misc | 58 | -- * Misc |
59 | mean, | 59 | mean, meanCov, |
60 | Disp(..), Domain(..), | 60 | Disp(..), Domain(..), |
61 | withVector, exactLength, withMatrix, exactDims, | 61 | withVector, exactLength, withMatrix, exactDims, |
62 | toRows, toColumns, | 62 | toRows, toColumns, |
@@ -71,7 +71,7 @@ import Numeric.LinearAlgebra hiding ( | |||
71 | (<\>),fromList,takeDiag,svd,eig,eigSH, | 71 | (<\>),fromList,takeDiag,svd,eig,eigSH, |
72 | eigenvalues,eigenvaluesSH,build, | 72 | eigenvalues,eigenvaluesSH,build, |
73 | qr,size,dot,chol,range,R,C,sym,mTm,unSym, | 73 | qr,size,dot,chol,range,R,C,sym,mTm,unSym, |
74 | randomVector,rand,randn,gaussianSample,uniformSample) | 74 | randomVector,rand,randn,gaussianSample,uniformSample,meanCov) |
75 | import qualified Numeric.LinearAlgebra as LA | 75 | import qualified Numeric.LinearAlgebra as LA |
76 | import qualified Numeric.LinearAlgebra.Devel as LA | 76 | import qualified Numeric.LinearAlgebra.Devel as LA |
77 | import Data.Proxy(Proxy(..)) | 77 | import Data.Proxy(Proxy(..)) |
@@ -479,6 +479,11 @@ uniformSample s (extract -> mins) (extract -> maxs) = | |||
479 | mkL $ LA.uniformSample s (fromInteger (natVal (Proxy :: Proxy m))) | 479 | mkL $ LA.uniformSample s (fromInteger (natVal (Proxy :: Proxy m))) |
480 | (zip (LA.toList mins) (LA.toList maxs)) | 480 | (zip (LA.toList mins) (LA.toList maxs)) |
481 | 481 | ||
482 | meanCov | ||
483 | :: forall m n . (KnownNat m, KnownNat n) | ||
484 | => L m n | ||
485 | -> (R n, Sym n) | ||
486 | meanCov (extract -> vs) = mkR *** (Sym . mkL . LA.unSym) $ LA.meanCov vs | ||
482 | 487 | ||
483 | -------------------------------------------------------------------------------- | 488 | -------------------------------------------------------------------------------- |
484 | 489 | ||