-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve InverseMatMod with integer modulus
Before: gap> m2:=RandomUnimodularMat(100);; gap> for i in [1..100] do x:=InverseMatMod(m2,2); od; time; 277 gap> for i in [1..100] do x:=InverseMatMod(m2,251); od; time; 1564 gap> for i in [1..100] do x:=InverseMatMod(m2,65537); od; time; Error, reached the pre-set memory limit After: gap> m2:=RandomUnimodularMat(100);; gap> for i in [1..100] do x:=InverseMatMod(m2,2); od; time; 273 gap> for i in [1..100] do x:=InverseMatMod(m2,251); od; time; 1249 gap> for i in [1..100] do x:=InverseMatMod(m2,65537); od; time; 1226
- Loading branch information
1 parent
a729238
commit b3fafa2
Showing
2 changed files
with
23 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
gap> START_TEST("InverseMatMod.tst"); | ||
|
||
# | ||
gap> for d in [1..10] do | ||
> id:=IdentityMat(d); | ||
> m:=RandomUnimodularMat(d); | ||
> for p in [2, 251, 65537] do | ||
> x:=InverseMatMod(m, p); | ||
> Assert(0, (x*m mod p) = id); | ||
> od; | ||
> od; | ||
|
||
# | ||
gap> STOP_TEST("InverseMatMod.tst", 1); |