summaryrefslogtreecommitdiff
path: root/packages/base/src
diff options
context:
space:
mode:
authorJustin Le <justin@jle.im>2016-01-07 01:57:21 -0800
committerJustin Le <justin@jle.im>2016-01-07 01:57:21 -0800
commit190d0184a4cf487dbd140e8a1fab56ccb5af08ab (patch)
tree5a286a20d2c9435f1138512a3d7d8c409b019c9e /packages/base/src
parent087bb6d3e27442d985a8cda38a76e1abd323f5f0 (diff)
added meanCov to Static
Diffstat (limited to 'packages/base/src')
-rw-r--r--packages/base/src/Numeric/LinearAlgebra/Static.hs9
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)
75import qualified Numeric.LinearAlgebra as LA 75import qualified Numeric.LinearAlgebra as LA
76import qualified Numeric.LinearAlgebra.Devel as LA 76import qualified Numeric.LinearAlgebra.Devel as LA
77import Data.Proxy(Proxy(..)) 77import 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
482meanCov
483 :: forall m n . (KnownNat m, KnownNat n)
484 => L m n
485 -> (R n, Sym n)
486meanCov (extract -> vs) = mkR *** (Sym . mkL . LA.unSym) $ LA.meanCov vs
482 487
483-------------------------------------------------------------------------------- 488--------------------------------------------------------------------------------
484 489