summaryrefslogtreecommitdiff
path: root/packages/gsl
diff options
context:
space:
mode:
authorPatrik Jansson <patrik.ja@gmail.com>2015-10-28 22:00:21 +0100
committerPatrik Jansson <patrik.ja@gmail.com>2015-10-28 22:00:21 +0100
commitef7283f6254422204c8f68c4cdde0094003e127f (patch)
treebe0ce12f6792414d9c847790f5ee61f893d63ab5 /packages/gsl
parent60421ac66146366c6acd984b89475ba10c13e6c6 (diff)
Following through the change of type in meanCov to the test and to gaussianSamle. Not tested.
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