summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/base/THANKS.md2
-rw-r--r--packages/base/hmatrix.cabal2
-rw-r--r--packages/base/src/Internal/Random.hs4
-rw-r--r--packages/gsl/hmatrix-gsl.cabal4
-rw-r--r--packages/tests/hmatrix-tests.cabal6
-rw-r--r--packages/tests/src/Numeric/LinearAlgebra/Tests.hs6
6 files changed, 14 insertions, 10 deletions
diff --git a/packages/base/THANKS.md b/packages/base/THANKS.md
index f331dea..55a428c 100644
--- a/packages/base/THANKS.md
+++ b/packages/base/THANKS.md
@@ -205,3 +205,5 @@ module reorganization, monadic mapVectorM, and many other improvements.
205- Vassil Keremidchiev fixed the cabal options for OpenBlas, fixed several installation 205- Vassil Keremidchiev fixed the cabal options for OpenBlas, fixed several installation
206 issues, and added support for stack-based build. 206 issues, and added support for stack-based build.
207 207
208- Patrik Jansson changed meanCov and gaussianSample to use Herm type. Fixed stack.yaml.
209
diff --git a/packages/base/hmatrix.cabal b/packages/base/hmatrix.cabal
index 0cfbd88..9fa3c4e 100644
--- a/packages/base/hmatrix.cabal
+++ b/packages/base/hmatrix.cabal
@@ -1,5 +1,5 @@
1Name: hmatrix 1Name: hmatrix
2Version: 0.17.0.2 2Version: 0.18.0.0
3License: BSD3 3License: BSD3
4License-file: LICENSE 4License-file: LICENSE
5Author: Alberto Ruiz 5Author: Alberto Ruiz
diff --git a/packages/base/src/Internal/Random.hs b/packages/base/src/Internal/Random.hs
index 8c792eb..60b2cef 100644
--- a/packages/base/src/Internal/Random.hs
+++ b/packages/base/src/Internal/Random.hs
@@ -31,13 +31,13 @@ import System.Random(randomIO)
31gaussianSample :: Seed 31gaussianSample :: Seed
32 -> Int -- ^ number of rows 32 -> Int -- ^ number of rows
33 -> Vector Double -- ^ mean vector 33 -> Vector Double -- ^ mean vector
34 -> Matrix Double -- ^ covariance matrix 34 -> Herm Double -- ^ covariance matrix
35 -> Matrix Double -- ^ result 35 -> Matrix Double -- ^ result
36gaussianSample seed n med cov = m where 36gaussianSample seed n med cov = m where
37 c = dim med 37 c = dim med
38 meds = konst' 1 n `outer` med 38 meds = konst' 1 n `outer` med
39 rs = reshape c $ randomVector seed Gaussian (c * n) 39 rs = reshape c $ randomVector seed Gaussian (c * n)
40 m = rs `mXm` cholSH cov `add` meds 40 m = rs `mXm` chol cov `add` meds
41 41
42-- | Obtains a matrix whose rows are pseudorandom samples from a multivariate 42-- | Obtains a matrix whose rows are pseudorandom samples from a multivariate
43-- uniform distribution. 43-- uniform distribution.
diff --git a/packages/gsl/hmatrix-gsl.cabal b/packages/gsl/hmatrix-gsl.cabal
index f288c64..d009994 100644
--- a/packages/gsl/hmatrix-gsl.cabal
+++ b/packages/gsl/hmatrix-gsl.cabal
@@ -1,5 +1,5 @@
1Name: hmatrix-gsl 1Name: hmatrix-gsl
2Version: 0.17.0.0 2Version: 0.18.0.0
3License: GPL 3License: GPL
4License-file: LICENSE 4License-file: LICENSE
5Author: Alberto Ruiz 5Author: Alberto Ruiz
@@ -25,7 +25,7 @@ flag onlygsl
25 25
26library 26library
27 27
28 Build-Depends: base<5, hmatrix>=0.17, array, vector, 28 Build-Depends: base<5, hmatrix>=0.18, array, vector,
29 process, random 29 process, random
30 30
31 31
diff --git a/packages/tests/hmatrix-tests.cabal b/packages/tests/hmatrix-tests.cabal
index 49e0640..d4c87aa 100644
--- a/packages/tests/hmatrix-tests.cabal
+++ b/packages/tests/hmatrix-tests.cabal
@@ -1,5 +1,5 @@
1Name: hmatrix-tests 1Name: hmatrix-tests
2Version: 0.5.0.0 2Version: 0.6.0.0
3License: BSD3 3License: BSD3
4License-file: LICENSE 4License-file: LICENSE
5Author: Alberto Ruiz 5Author: Alberto Ruiz
@@ -28,9 +28,9 @@ library
28 28
29 Build-Depends: base >= 4 && < 5, deepseq, 29 Build-Depends: base >= 4 && < 5, deepseq,
30 QuickCheck >= 2, HUnit, random, 30 QuickCheck >= 2, HUnit, random,
31 hmatrix >= 0.17 31 hmatrix >= 0.18
32 if flag(gsl) 32 if flag(gsl)
33 Build-Depends: hmatrix-gsl >= 0.17 33 Build-Depends: hmatrix-gsl >= 0.18
34 34
35 hs-source-dirs: src 35 hs-source-dirs: src
36 36
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs
index 56546b6..d9cc3b6 100644
--- a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs
+++ b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs
@@ -132,7 +132,8 @@ mbCholTest = utest "mbCholTest" (ok1 && ok2) where
132 132
133--------------------------------------------------------------------- 133---------------------------------------------------------------------
134 134
135randomTestGaussian = c :~1~: snd (meanCov dat) where 135randomTestGaussian = (unSym c) :~3~: unSym (snd (meanCov dat))
136 where
136 a = (3><3) [1,2,3, 137 a = (3><3) [1,2,3,
137 2,4,0, 138 2,4,0,
138 -2,2,1] 139 -2,2,1]
@@ -140,7 +141,8 @@ randomTestGaussian = c :~1~: snd (meanCov dat) where
140 c = mTm a 141 c = mTm a
141 dat = gaussianSample 7 (10^6) m c 142 dat = gaussianSample 7 (10^6) m c
142 143
143randomTestUniform = c :~1~: snd (meanCov dat) where 144randomTestUniform = c :~2~: unSym (snd (meanCov dat))
145 where
144 c = diag $ 3 |> map ((/12).(^2)) [1,2,3] 146 c = diag $ 3 |> map ((/12).(^2)) [1,2,3]
145 dat = uniformSample 7 (10^6) [(0,1),(1,3),(3,6)] 147 dat = uniformSample 7 (10^6) [(0,1),(1,3),(3,6)]
146 148