diff options
author | idontgetoutmuch <dominic@steinitz.org> | 2018-12-02 11:41:18 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-02 11:41:18 +0000 |
commit | c4b80ef9951b533d6bbbb34df8109f3290546296 (patch) | |
tree | 7e1cf379a31fe3f83ae1ce5a3b1feaaad11223fa /packages/tests/src/Numeric/LinearAlgebra/Tests.hs | |
parent | 480c4db1585ed122dfc491bb15421565966dad66 (diff) | |
parent | f4124fa6209cbf8290fed2be51cec8464bf7f1b9 (diff) |
Merge pull request #286 from maksbotan/fix-#282
Fix #282
Diffstat (limited to 'packages/tests/src/Numeric/LinearAlgebra/Tests.hs')
-rw-r--r-- | packages/tests/src/Numeric/LinearAlgebra/Tests.hs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs index c0c151a..3c7863f 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs | |||
@@ -242,6 +242,29 @@ triDiagTest = utest "triDiagTest" (ok1 && ok2) where | |||
242 | 242 | ||
243 | --------------------------------------------------------------------- | 243 | --------------------------------------------------------------------- |
244 | 244 | ||
245 | triDiagRegression = utest "triDiagRegression" ok where | ||
246 | minusOnes, twos :: Vector R | ||
247 | minusOnes = fromList [-1, -1] | ||
248 | twos = fromList [2, 2, 2] | ||
249 | k :: Matrix R | ||
250 | k = (3><3) | ||
251 | [ 2, -1, 0 | ||
252 | , -1, 2, -1 | ||
253 | , 0, -1, 2 | ||
254 | ] | ||
255 | |||
256 | b :: Matrix R | ||
257 | b = (3><1) [10, 10, 10] | ||
258 | |||
259 | tridiag = triDiagSolve minusOnes twos minusOnes b | ||
260 | simple = linearSolve k b | ||
261 | |||
262 | ok = case simple of | ||
263 | Just m -> tridiag |~| m | ||
264 | Nothing -> False | ||
265 | |||
266 | --------------------------------------------------------------------- | ||
267 | |||
245 | randomTestGaussian = (unSym c) :~3~: unSym (snd (meanCov dat)) | 268 | randomTestGaussian = (unSym c) :~3~: unSym (snd (meanCov dat)) |
246 | where | 269 | where |
247 | a = (3><3) [1,2,3, | 270 | a = (3><3) [1,2,3, |
@@ -830,6 +853,7 @@ runTests n = do | |||
830 | , mbCholTest | 853 | , mbCholTest |
831 | , triTest | 854 | , triTest |
832 | , triDiagTest | 855 | , triDiagTest |
856 | , triDiagRegression | ||
833 | , utest "offset" offsetTest | 857 | , utest "offset" offsetTest |
834 | , normsVTest | 858 | , normsVTest |
835 | , normsMTest | 859 | , normsMTest |