Skip to content

Commit

Permalink
add missing file
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Apr 6, 2021
1 parent a082b3d commit 71c1ce1
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tst/testinstall/MatrixObj/testmatobj.g
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
TestIdentityMatrix := function(filt, ring, degree)
local i, j, mat, mat2;
mat := IdentityMatrix(filt, ring, degree);
Assert(0, filt(mat) = true);
Assert(0, NrRows(mat) = degree);
Assert(0, NrCols(mat) = degree);
Assert(0, BaseDomain(mat) = ring);
for i in [1..degree] do
for j in [1..degree] do
if i<>j and not IsZero(mat[i,j]) then
Error("entry ", i,",",j," is not zero");
elif i=j and not IsOne(mat[i,j]) then
Error("diagonal entry ", i,",",j," is not one");
fi;
od;
od;
Display(mat);
mat2 := IdentityMatrix(degree, mat);
if mat <> mat2 then Error("IdentityMatrix(degree, mat) differs"); fi;
mat2 := NewIdentityMatrix(filt, ring, degree);
if mat <> mat2 then Error("NewIdentityMatrix(filt, ring, degree) differs"); fi;
Assert(0, mat = mat2);
return mat;
end;

TestZeroMatrix := function(filt, ring, rows, cols)
local i, j, mat, mat2;
mat := ZeroMatrix(filt, ring, rows, cols);
Assert(0, filt(mat) = true);
Assert(0, NrRows(mat) = rows);
Assert(0, NrCols(mat) = cols);
Assert(0, BaseDomain(mat) = ring);
for i in [1..rows] do
for j in [1..cols] do
if not IsZero(mat[i,j]) then Error("entry ", i,",",j," is not zero"); fi;
od;
od;
Display(mat);
mat2 := ZeroMatrix(rows, cols, mat);
if mat <> mat2 then Error("ZeroMatrix(rows, cols, mat) differs"); fi;
mat2 := NewZeroMatrix(filt, ring, rows, cols);
if mat <> mat2 then Error("NewZeroMatrix(filt, ring, rows, cols) differs"); fi;
Assert(0, mat = mat2);
return mat;
end;

0 comments on commit 71c1ce1

Please sign in to comment.