summaryrefslogtreecommitdiff
path: root/packages/gsl
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2015-10-29 11:39:46 +0100
committerAlberto Ruiz <aruiz@um.es>2015-10-29 11:39:46 +0100
commit3e5f71c9d711fabd0e0c45fc25c58bf34f88fe3b (patch)
treedb5277cfc055cbe87aab1b06abc75d52d7d4b0ab /packages/gsl
parentebf8ce6595c6d11bcc3662e84a32822c2eaaa77a (diff)
parent83f6998b935829a54a5737632af18279adc7665a (diff)
Merge pull request #157 from patrikja/master
meanCov type update to use Herm instead of Matrix
Diffstat (limited to 'packages/gsl')
-rw-r--r--packages/gsl/src/Numeric/GSL/Random.hs5
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
39gaussianSample :: Seed 39gaussianSample :: 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
44gaussianSample seed n med cov = m where 44gaussianSample 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-}
88randn :: Int -> Int -> IO (Matrix Double) 88randn :: Int -> Int -> IO (Matrix Double)
89randn = randm Gaussian 89randn = randm Gaussian
90