diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/gsl/src/Numeric/GSL/Random.hs | 5 | ||||
-rw-r--r-- | packages/tests/src/Numeric/LinearAlgebra/Tests.hs | 4 |
2 files changed, 3 insertions, 6 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 | |||
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs index 4b631cf..56546b6 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs | |||
@@ -137,7 +137,7 @@ randomTestGaussian = c :~1~: snd (meanCov dat) where | |||
137 | 2,4,0, | 137 | 2,4,0, |
138 | -2,2,1] | 138 | -2,2,1] |
139 | m = 3 |> [1,2,3] | 139 | m = 3 |> [1,2,3] |
140 | c = a <> tr a | 140 | c = mTm a |
141 | dat = gaussianSample 7 (10^6) m c | 141 | dat = gaussianSample 7 (10^6) m c |
142 | 142 | ||
143 | randomTestUniform = c :~1~: snd (meanCov dat) where | 143 | randomTestUniform = c :~1~: snd (meanCov dat) where |
@@ -944,5 +944,3 @@ luBench_2 = do | |||
944 | luBenchN_2 luSolve' luPacked' 500 (5::R) "luSolve'.luPacked' Double " | 944 | luBenchN_2 luSolve' luPacked' 500 (5::R) "luSolve'.luPacked' Double " |
945 | luBenchN_2 luSolve' luPacked' 500 (5::Mod 9973 I) "luSolve'.luPacked' I mod 9973" | 945 | luBenchN_2 luSolve' luPacked' 500 (5::Mod 9973 I) "luSolve'.luPacked' I mod 9973" |
946 | luBenchN_2 luSolve' luPacked' 500 (5::Mod 9973 Z) "luSolve'.luPacked' Z mod 9973" | 946 | luBenchN_2 luSolve' luPacked' 500 (5::Mod 9973 Z) "luSolve'.luPacked' Z mod 9973" |
947 | |||
948 | |||