diff options
author | Alberto Ruiz <aruiz@um.es> | 2015-10-29 11:39:46 +0100 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2015-10-29 11:39:46 +0100 |
commit | 3e5f71c9d711fabd0e0c45fc25c58bf34f88fe3b (patch) | |
tree | db5277cfc055cbe87aab1b06abc75d52d7d4b0ab /packages/gsl/src | |
parent | ebf8ce6595c6d11bcc3662e84a32822c2eaaa77a (diff) | |
parent | 83f6998b935829a54a5737632af18279adc7665a (diff) |
Merge pull request #157 from patrikja/master
meanCov type update to use Herm instead of Matrix
Diffstat (limited to 'packages/gsl/src')
-rw-r--r-- | packages/gsl/src/Numeric/GSL/Random.hs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/packages/gsl/src/Numeric/GSL/Random.hs b/packages/gsl/src/Numeric/GSL/Random.hs index 139c921..aad9ad9 100644 --- a/packages/gsl/src/Numeric/GSL/Random.hs +++ b/packages/gsl/src/Numeric/GSL/Random.hs | |||
@@ -39,13 +39,13 @@ type Seed = Int | |||
39 | gaussianSample :: Seed | 39 | gaussianSample :: Seed |
40 | -> Int -- ^ number of rows | 40 | -> Int -- ^ number of rows |
41 | -> Vector Double -- ^ mean vector | 41 | -> Vector Double -- ^ mean vector |
42 | -> Matrix Double -- ^ covariance matrix | 42 | -> Herm Double -- ^ covariance matrix |
43 | -> Matrix Double -- ^ result | 43 | -> Matrix Double -- ^ result |
44 | gaussianSample seed n med cov = m where | 44 | gaussianSample seed n med cov = m where |
45 | c = size med | 45 | c = size med |
46 | meds = konst 1 n `outer` med | 46 | meds = konst 1 n `outer` med |
47 | rs = reshape c $ randomVector seed Gaussian (c * n) | 47 | rs = reshape c $ randomVector seed Gaussian (c * n) |
48 | m = rs <> cholSH cov + meds | 48 | m = rs <> chol cov + meds |
49 | 49 | ||
50 | -- | Obtains a matrix whose rows are pseudorandom samples from a multivariate | 50 | -- | Obtains a matrix whose rows are pseudorandom samples from a multivariate |
51 | -- uniform distribution. | 51 | -- uniform distribution. |
@@ -87,4 +87,3 @@ rand = randm Uniform | |||
87 | -} | 87 | -} |
88 | randn :: Int -> Int -> IO (Matrix Double) | 88 | randn :: Int -> Int -> IO (Matrix Double) |
89 | randn = randm Gaussian | 89 | randn = randm Gaussian |
90 | |||