summaryrefslogtreecommitdiff
path: root/packages/base
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2015-07-03 14:39:29 +0200
committerAlberto Ruiz <aruiz@um.es>2015-07-03 14:39:29 +0200
commit04acd2ad79f7fddb1e6fa9029638378ac9fa8a66 (patch)
treeb55ec5a35cea858857e3ebf27b5c50b0f743ce28 /packages/base
parent0bdc40ca822e1b80089080da3fe03d0e31e7d927 (diff)
fix subMatrix tot and test
Diffstat (limited to 'packages/base')
-rw-r--r--packages/base/src/Internal/Matrix.hs1
-rw-r--r--packages/base/src/Internal/Modular.hs3
2 files changed, 3 insertions, 1 deletions
diff --git a/packages/base/src/Internal/Matrix.hs b/packages/base/src/Internal/Matrix.hs
index a7fcb47..792fe35 100644
--- a/packages/base/src/Internal/Matrix.hs
+++ b/packages/base/src/Internal/Matrix.hs
@@ -365,6 +365,7 @@ subMatrix :: Element a
365 -> Matrix a -- ^ input matrix 365 -> Matrix a -- ^ input matrix
366 -> Matrix a -- ^ result 366 -> Matrix a -- ^ result
367subMatrix (r0,c0) (rt,ct) m 367subMatrix (r0,c0) (rt,ct) m
368 | rt <= 0 || ct <= 0 = matrixFromVector RowMajor (max 0 rt) (max 0 ct) (fromList [])
368 | 0 <= r0 && 0 <= rt && r0+rt <= rows m && 369 | 0 <= r0 && 0 <= rt && r0+rt <= rows m &&
369 0 <= c0 && 0 <= ct && c0+ct <= cols m = res 370 0 <= c0 && 0 <= ct && c0+ct <= cols m = res
370 | otherwise = error $ "wrong subMatrix "++show ((r0,c0),(rt,ct))++" of "++shSize m 371 | otherwise = error $ "wrong subMatrix "++show ((r0,c0),(rt,ct))++" of "++shSize m
diff --git a/packages/base/src/Internal/Modular.hs b/packages/base/src/Internal/Modular.hs
index 1d8f761..64ed2bb 100644
--- a/packages/base/src/Internal/Modular.hs
+++ b/packages/base/src/Internal/Modular.hs
@@ -442,7 +442,7 @@ test = (ok, info)
442 , (checkGen (gen 5 :: Matrix R)) < 1E-15 442 , (checkGen (gen 5 :: Matrix R)) < 1E-15
443 , (checkGen (gen 5 :: Matrix Float)) < 2E-7 443 , (checkGen (gen 5 :: Matrix Float)) < 2E-7
444 , (checkGen (cgen 5 :: Matrix C)) < 1E-15 444 , (checkGen (cgen 5 :: Matrix C)) < 1E-15
445 , (checkGen (sgen 5 :: Matrix (Complex Float))) < 2E-7 445 , (checkGen (sgen 5 :: Matrix (Complex Float))) < 3E-7
446 , (checkGen (gen 5 :: Matrix (Mod 7 I))) == 0 446 , (checkGen (gen 5 :: Matrix (Mod 7 I))) == 0
447 , (checkGen (gen 5 :: Matrix (Mod 7 Z))) == 0 447 , (checkGen (gen 5 :: Matrix (Mod 7 Z))) == 0
448 , (checkLU (magnit 1E-10) (gen 5 :: Matrix R)) < 2E-15 448 , (checkLU (magnit 1E-10) (gen 5 :: Matrix R)) < 2E-15
@@ -461,6 +461,7 @@ test = (ok, info)
461 , gm <> gm == konst 0 (3,3) 461 , gm <> gm == konst 0 (3,3)
462 , lgm <> lgm == konst 0 (3,3) 462 , lgm <> lgm == konst 0 (3,3)
463 , invershur tmm == luSolve' (luPacked' tmm) (ident (rows tmm)) 463 , invershur tmm == luSolve' (luPacked' tmm) (ident (rows tmm))
464 , luSolve' (luPacked' (tr $ ident 5 :: Matrix (I ./. 2))) (ident 5) == ident 5
464 ] 465 ]
465 466
466 467