From ef7283f6254422204c8f68c4cdde0094003e127f Mon Sep 17 00:00:00 2001 From: Patrik Jansson Date: Wed, 28 Oct 2015 22:00:21 +0100 Subject: Following through the change of type in meanCov to the test and to gaussianSamle. Not tested. --- packages/gsl/src/Numeric/GSL/Random.hs | 5 ++--- 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 gaussianSample :: Seed -> Int -- ^ number of rows -> Vector Double -- ^ mean vector - -> Matrix Double -- ^ covariance matrix + -> Herm Double -- ^ covariance matrix -> Matrix Double -- ^ result gaussianSample seed n med cov = m where c = size med meds = konst 1 n `outer` med rs = reshape c $ randomVector seed Gaussian (c * n) - m = rs <> cholSH cov + meds + m = rs <> chol cov + meds -- | Obtains a matrix whose rows are pseudorandom samples from a multivariate -- uniform distribution. @@ -87,4 +87,3 @@ rand = randm Uniform -} randn :: Int -> Int -> IO (Matrix Double) randn = randm Gaussian - 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 2,4,0, -2,2,1] m = 3 |> [1,2,3] - c = a <> tr a + c = mTm a dat = gaussianSample 7 (10^6) m c randomTestUniform = c :~1~: snd (meanCov dat) where @@ -944,5 +944,3 @@ luBench_2 = do luBenchN_2 luSolve' luPacked' 500 (5::R) "luSolve'.luPacked' Double " luBenchN_2 luSolve' luPacked' 500 (5::Mod 9973 I) "luSolve'.luPacked' I mod 9973" luBenchN_2 luSolve' luPacked' 500 (5::Mod 9973 Z) "luSolve'.luPacked' Z mod 9973" - - -- cgit v1.2.3