summaryrefslogtreecommitdiff
path: root/packages/gsl/src/Numeric/GSL/Random.hs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gsl/src/Numeric/GSL/Random.hs')
-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