-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MatrixObj: matrix manipulation ops for
IsMatrix
Before this, e.g. `SwapMatrixRows(IdentityMat(10,Integers), 1, 2)` resulted in a "no method found" error. In addition, use `InstallEarlyMethod` to provide fast methods for classical lists-of-list matrices. Before the new early methods (but after enabling everything for `IsMatrix`): gap> mat:=IdentityMat(10,Integers);; gap> for i in [1..1000000] do SwapMatrixRows(mat,1,2); od; time; 874 gap> for i in [1..1000000] do tmp:=mat[1];mat[1]:=mat[2];mat[2]:=tmp; od; time; 38 gap> mat:=IdentityMat(10,GF(2));; ConvertToMatrixRep(mat);; mat; <a 10x10 matrix over GF2> gap> for i in [1..1000000] do SwapMatrixRows(mat,1,2); od; time; 137 gap> for i in [1..1000000] do tmp:=mat[1];mat[1]:=mat[2];mat[2]:=tmp; od; time; 107 After: gap> mat:=IdentityMat(10,Integers);; gap> for i in [1..1000000] do SwapMatrixRows(mat,1,2); od; time; 132 gap> for i in [1..1000000] do tmp:=mat[1];mat[1]:=mat[2];mat[2]:=tmp; od; time; 37 gap> mat:=IdentityMat(10,GF(2));; ConvertToMatrixRep(mat);; mat; <a 10x10 matrix over GF2> gap> for i in [1..1000000] do SwapMatrixRows(mat,1,2); od; time; 163 gap> for i in [1..1000000] do tmp:=mat[1];mat[1]:=mat[2];mat[2]:=tmp; od; time; 102 Note that `SwapMatrixRows` got slightly slower for the compressed matrix over GF(2), due to the extra overhead caused by the early method. I think for now this is acceptable. If we are concerned about this, we could probably get rid of most or all of it by using a "classic" early method, i.e., a kernel one.
- Loading branch information
Showing
4 changed files
with
269 additions
and
37 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
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
Oops, something went wrong.