Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use NrRows and NrCols and mat[i,j] in more places #40

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 29 additions & 31 deletions lib/correlations.gi
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
local gens, F, d, set, g, set2;
gens:=GeneratorsOfMagmaWithInverses(G);
F:=gens[1]!.fld;
d:=Size(gens[1]!.mat)-1;
d:=NrRows(gens[1]!.mat)-1;

Check warning on line 203 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L203

Added line #L203 was not covered by tests
set:=AsSet(List(gens,g->g!.frob));
set2:=AsSet(List(gens,g->g!.psisom));
if set = AsSet([FrobeniusAutomorphism(F)^0]) and
Expand All @@ -220,7 +220,7 @@
local gens, F, d, set, g, set2;
gens:=GeneratorsOfMagmaWithInverses(G);
F:=gens[1]!.fld;
d:=Size(gens[1]!.mat)-1;
d:=NrRows(gens[1]!.mat)-1;

Check warning on line 223 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L223

Added line #L223 was not covered by tests
set2:=AsSet(List(gens,g->g!.psisom));
if set2 = AsSet([IdentityMappingOfElementsOfProjectiveSpace(PG(d,F))])
then return true;
Expand Down Expand Up @@ -414,7 +414,7 @@
IsField, IsStandardDualityOfProjectiveSpace],
function( m, frob, f, delta )
local el,cmat;
cmat := NewMatrix(IsCMatRep,f,Length(m[1]),m);
cmat := NewMatrix(IsCMatRep,f,NrCols(m),m);

Check warning on line 417 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L417

Added line #L417 was not covered by tests
el := rec( mat := cmat, fld := f, frob := frob, psisom := delta );
Objectify( ProjElsWithFrobWithPSIsomType, el );
return el;
Expand All @@ -435,9 +435,8 @@
[IsCMatRep and IsFFECollColl, IsRingHomomorphism and IsMultiplicativeElementWithInverse,
IsField],
function( m, frob, f )
local el,isom,q,n;
q := Size(f);
n := Length(m);
local el,isom,n;
n := NrRows(m);

Check warning on line 439 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L439

Added line #L439 was not covered by tests
isom := IdentityMappingOfElementsOfProjectiveSpace(ProjectiveSpace(n-1,f));
## I hope this works! was wrong, for godsake, don't tell Celle about this type of mistakes :-(
el := rec( mat := m, fld := f, frob := frob, psisom := isom);
Expand All @@ -458,10 +457,9 @@
[IsMatrix and IsFFECollColl, IsRingHomomorphism and IsMultiplicativeElementWithInverse,
IsField],
function( m, frob, f )
local el,isom,q,n,cmat;
q := Size(f);
n := Length(m);
cmat := NewMatrix(IsCMatRep,f,Length(m[1]),m);
local el,isom,n,cmat;
n := NrRows(m);
cmat := NewMatrix(IsCMatRep,f,NrCols(m),m);

Check warning on line 462 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L461-L462

Added lines #L461 - L462 were not covered by tests
isom := IdentityMappingOfElementsOfProjectiveSpace(ProjectiveSpace(n-1,f));
## I hope this works! was wrong, for godsake, don't tell Celle about this type of mistakes :-(
el := rec( mat := cmat, fld := f, frob := frob, psisom := isom);
Expand Down Expand Up @@ -502,7 +500,7 @@
IsField, IsGeneralMapping and IsSPGeneralMapping and IsOne],
function( m, frob, f, delta )
local el,cmat;
cmat := NewMatrix(IsCMatRep,f,Length(m[1]),m);
cmat := NewMatrix(IsCMatRep,f,NrCols(m),m);

Check warning on line 503 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L503

Added line #L503 was not covered by tests
el := rec( mat := cmat, fld := f, frob := frob, psisom := delta );
Objectify( ProjElsWithFrobWithPSIsomType, el );
return el;
Expand Down Expand Up @@ -1008,7 +1006,7 @@
"for a matrix and a finite field",
[ IsMatrix and IsFFECollColl, IsField],
function( mat, gf )
if Rank(mat) <> Size(mat) then
if Rank(mat) <> NrRows(mat) then

Check warning on line 1009 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L1009

Added line #L1009 was not covered by tests
Error("<mat> must not be singular");
fi;
return ProjElWithFrobWithPSIsom( mat, IdentityMapping(gf), gf);
Expand All @@ -1027,7 +1025,7 @@
[ IsMatrix and IsFFECollColl, IsRingHomomorphism and
IsMultiplicativeElementWithInverse, IsField],
function( mat, frob, gf )
if Rank(mat) <> Size(mat) then
if Rank(mat) <> NrRows(mat) then

Check warning on line 1028 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L1028

Added line #L1028 was not covered by tests
Error("<mat> must not be singular");
fi;
return ProjElWithFrobWithPSIsom( mat, frob, gf);
Expand All @@ -1045,7 +1043,7 @@
"for a matrix, a finite field, and a projective space isomorphism",
[ IsMatrix and IsFFECollColl, IsField, IsStandardDualityOfProjectiveSpace],
function( mat, gf, delta )
if Rank(mat) <> Size(mat) then
if Rank(mat) <> NrRows(mat) then

Check warning on line 1046 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L1046

Added line #L1046 was not covered by tests
Error("<mat> must not be singular");
fi;
if delta!.ps!.basefield <> gf then
Expand All @@ -1064,10 +1062,10 @@
"for a matrix, a finite field, and a projective space isomorphism",
[ IsMatrix and IsFFECollColl, IsField, IsIdentityMappingOfElementsOfProjectiveSpace],
function( mat, gf, delta )
if Rank(mat) <> Size(mat) then
if Rank(mat) <> NrRows(mat) then

Check warning on line 1065 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L1065

Added line #L1065 was not covered by tests
Error("<mat> must not be singular");
fi;
if Source(delta)!.geometry <> PG(Size(mat)-1,gf) then
if Source(delta)!.geometry <> PG(NrRows(mat)-1,gf) then

Check warning on line 1068 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L1068

Added line #L1068 was not covered by tests
Error("<delta> is not the identity mapping of the correct projective space");
fi;
return ProjElWithFrobWithPSIsom( mat, IdentityMapping(gf), gf, delta);
Expand All @@ -1085,7 +1083,7 @@
[ IsMatrix and IsFFECollColl, IsRingHomomorphism and IsMultiplicativeElementWithInverse, IsField,
IsStandardDualityOfProjectiveSpace],
function( mat, frob, gf, delta )
if Rank(mat) <> Size(mat) then
if Rank(mat) <> NrRows(mat) then

Check warning on line 1086 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L1086

Added line #L1086 was not covered by tests
Error("<mat> must not be singular");
fi;
if delta!.ps!.basefield <> gf then
Expand All @@ -1105,10 +1103,10 @@
[ IsMatrix and IsFFECollColl, IsRingHomomorphism and IsMultiplicativeElementWithInverse, IsField,
IsIdentityMappingOfElementsOfProjectiveSpace],
function( mat, frob, gf, delta )
if Rank(mat) <> Size(mat) then
if Rank(mat) <> NrRows(mat) then

Check warning on line 1106 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L1106

Added line #L1106 was not covered by tests
Error("<mat> must not be singular");
fi;
if Source(delta)!.geometry <> PG(Size(mat)-1,gf) then
if Source(delta)!.geometry <> PG(NrRows(mat)-1,gf) then

Check warning on line 1109 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L1109

Added line #L1109 was not covered by tests
Error("<delta> is not the identity mapping of the correct projective space");
fi;
return ProjElWithFrobWithPSIsom( mat, frob, gf, delta);
Expand All @@ -1125,7 +1123,7 @@
[ IsProjectiveSpace, IsMatrix and IsFFECollColl, IsRingHomomorphism and IsMultiplicativeElementWithInverse,
IsStandardDualityOfProjectiveSpace],
function( pg, mat, frob, delta )
if Dimension(pg)+1 <> Size(mat) then
if Dimension(pg)+1 <> NrRows(mat) then

Check warning on line 1126 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L1126

Added line #L1126 was not covered by tests
Error("The arguments <pg> and <mat> are not compatible");
fi;
return CorrelationOfProjectiveSpace( mat, frob, BaseField(pg), delta);
Expand All @@ -1142,7 +1140,7 @@
[ IsProjectiveSpace, IsMatrix and IsFFECollColl, IsRingHomomorphism and IsMultiplicativeElementWithInverse,
IsIdentityMappingOfElementsOfProjectiveSpace],
function( pg, mat, frob, delta )
if Dimension(pg)+1 <> Size(mat) then
if Dimension(pg)+1 <> NrRows(mat) then

Check warning on line 1143 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L1143

Added line #L1143 was not covered by tests
Error("The arguments <pg> and <mat> are not compatible");
fi;
if Source(delta)!.geometry <> pg then
Expand All @@ -1162,7 +1160,7 @@
[ IsProjectiveSpace, IsMatrix and IsFFECollColl, IsRingHomomorphism and IsMultiplicativeElementWithInverse,
IsStandardDualityOfProjectiveSpace],
function( pg, mat, frob, delta )
if Dimension(pg)+1 <> Size(mat) then
if Dimension(pg)+1 <> NrRows(mat) then

Check warning on line 1163 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L1163

Added line #L1163 was not covered by tests
Error("The arguments <pg> and <mat> are not compatible");
fi;
return CorrelationOfProjectiveSpace( mat, frob, BaseField(pg), delta);
Expand All @@ -1179,7 +1177,7 @@
[ IsProjectiveSpace, IsMatrix and IsFFECollColl, IsRingHomomorphism and IsMultiplicativeElementWithInverse,
IsIdentityMappingOfElementsOfProjectiveSpace],
function( pg, mat, frob, delta )
if Dimension(pg)+1 <> Size(mat) then
if Dimension(pg)+1 <> NrRows(mat) then

Check warning on line 1180 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L1180

Added line #L1180 was not covered by tests
Error("The arguments <pg> and <mat> are not compatible");
fi;
if Source(delta)!.geometry <> pg then
Expand Down Expand Up @@ -1361,7 +1359,7 @@
# Now start to investigate:
gens := GeneratorsOfGroup(g);
if Length(gens) > 0 then
return Length(gens[1]!.mat);
return NrRows(gens[1]!.mat);

Check warning on line 1362 in lib/correlations.gi

View check run for this annotation

Codecov / codecov/patch

lib/correlations.gi#L1362

Added line #L1362 was not covered by tests
fi;
Error("dimension could not be determined");
end );
Expand Down Expand Up @@ -1548,7 +1546,7 @@
fi;
mat := GramMatrix(form);
field := BaseField(form);
n := Size(mat);
n := NrRows(mat);
aut := CompanionAutomorphism(form);
v := field^n;
ps := ProjectiveSpace(n-1,field);
Expand All @@ -1570,7 +1568,7 @@
function(el)
local dim, field;
field := el!.fld;
dim := Size(el!.mat);
dim := NrRows(el!.mat);
Print("<polarity of PG(", dim-1, ", ", field, ")");
#ViewObj(el!.mat);
#if IsOne(el!.frob) then
Expand All @@ -1587,7 +1585,7 @@
function( f )
local dim, field;
field := f!.fld;
dim := Size(f!.mat);
dim := NrRows(f!.mat);
Print("<polarity of PG(", dim-1, ", ", field, ")>, underlying matrix\n");
PrintObj(f!.mat);
Print(",");
Expand All @@ -1599,7 +1597,7 @@
[IsPolarityOfProjectiveSpace and IsPolarityOfProjectiveSpaceRep],
function(f)
local dim, field;
dim := Size(f!.mat);
dim := NrRows(f!.mat);
field := f!.fld;
Print("<polarity of PG(", dim-1, ", ", field, ")>, underlying matrix\n");
Display(f!.mat);
Expand Down Expand Up @@ -1630,7 +1628,7 @@
[IsMatrix,IsField and IsFinite],
function(matrix,field)
local form;
if Rank(matrix) <> Size(matrix) then
if Rank(matrix) <> NrRows(matrix) then
Error("<matrix> must not be singular");
fi;
form := BilinearFormByMatrix(matrix,field);
Expand All @@ -1642,7 +1640,7 @@
[IsMatrix, IsFrobeniusAutomorphism, IsField and IsFinite],
function(matrix,frob,field)
local form;
if Rank(matrix) <> Size(matrix) then
if Rank(matrix) <> NrRows(matrix) then
Error("<matrix> must not be singular");
fi;
if Order(frob)<>2 then
Expand All @@ -1658,7 +1656,7 @@
[IsMatrix,IsField and IsFinite],
function(matrix,field)
local form;
if Rank(matrix) <> Size(matrix) then
if Rank(matrix) <> NrRows(matrix) then
Error("<matrix> must not be singular");
fi;
if not IsInt(Sqrt(Size(field))) then
Expand Down
18 changes: 9 additions & 9 deletions lib/diagram.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1511,24 +1511,24 @@
edges := diag!.edges;
mat := Drawing_Diagram( verts, edges, way );

for i in [1..Size(mat)] do
for j in [1..Size(mat[1])] do
if mat[i][j] = 0 then Print(" ");
for i in [1..NrRows(mat)] do
for j in [1..NrCols(mat)] do
if mat[i,j] = 0 then Print(" ");

Check warning on line 1516 in lib/diagram.gi

View check run for this annotation

Codecov / codecov/patch

lib/diagram.gi#L1514-L1516

Added lines #L1514 - L1516 were not covered by tests
# if IsOddInt(j) then Print( " " );
# else Print( " " );
# fi;
elif mat[i][j] = -1 then
elif mat[i,j] = -1 then

Check warning on line 1520 in lib/diagram.gi

View check run for this annotation

Codecov / codecov/patch

lib/diagram.gi#L1520

Added line #L1520 was not covered by tests
Print( "o" );
elif mat[i][j] = 1 then
elif mat[i,j] = 1 then

Check warning on line 1522 in lib/diagram.gi

View check run for this annotation

Codecov / codecov/patch

lib/diagram.gi#L1522

Added line #L1522 was not covered by tests
Print( "-" );
elif mat[i][j] = 2 then
elif mat[i,j] = 2 then

Check warning on line 1524 in lib/diagram.gi

View check run for this annotation

Codecov / codecov/patch

lib/diagram.gi#L1524

Added line #L1524 was not covered by tests
Print( "|" );
elif mat[i][j] = 3 then
elif mat[i,j] = 3 then

Check warning on line 1526 in lib/diagram.gi

View check run for this annotation

Codecov / codecov/patch

lib/diagram.gi#L1526

Added line #L1526 was not covered by tests
Print( " /" );
elif mat[i][j] = 4 then
elif mat[i,j] = 4 then

Check warning on line 1528 in lib/diagram.gi

View check run for this annotation

Codecov / codecov/patch

lib/diagram.gi#L1528

Added line #L1528 was not covered by tests
Print( " \\" );
else
Print( mat[i][j] );
Print( mat[i,j] );

Check warning on line 1531 in lib/diagram.gi

View check run for this annotation

Codecov / codecov/patch

lib/diagram.gi#L1531

Added line #L1531 was not covered by tests
fi;
od;
Print("\n");
Expand Down
12 changes: 6 additions & 6 deletions lib/gpolygons.gi
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@

#############################################################################
#O GeneralisedPolygonByIncidenceMatrix( <matrix> )
# returns a GP. points are [1..Size(matrix)], blocks are sets of entries equal to one.
# returns a GP. points are [1..NrRows(matrix)], blocks are sets of entries equal to one.
# Blocks are then used through GeneralisedPolygonByBlocks.
# the commented out check dates from the times that this was only use to construct
# projective planes.
Expand All @@ -248,7 +248,7 @@
function( mat )
## Rows represent blocks and columns represent points...
local v, q, row, blocks, gp;
v := Size(mat);
v := NrRows(mat);

Check warning on line 251 in lib/gpolygons.gi

View check run for this annotation

Codecov / codecov/patch

lib/gpolygons.gi#L251

Added line #L251 was not covered by tests
#if not ForAll(mat, t->Size(t)=v) then
# Error("Matrix is not square");
#fi;
Expand Down Expand Up @@ -1428,7 +1428,7 @@
Add(z,[0,0,0,1,0,0,0,1]*One(f));
spacevec := NullspaceMat(TransposedMat(z));
int := IdentityMat(8,f){[1..7]};
int[4][8] := -One(f);
int[4,8] := -One(f);

Check warning on line 1431 in lib/gpolygons.gi

View check run for this annotation

Codecov / codecov/patch

lib/gpolygons.gi#L1431

Added line #L1431 was not covered by tests
vec := SumIntersectionMat(spacevec, int)[2];
return vec{[1..3]}{[1..7]};
end );
Expand Down Expand Up @@ -3730,7 +3730,7 @@
f := clan!.basefield;
q := Size(f);
i := One(f);
blt := List(clan!.matrices, t -> [i, t[2][2], -t[1][2], t[1][1], t[1][2]^2 -t[1][1]*t[2][2]]);
blt := List(clan!.matrices, t -> [i, t[2,2], -t[1,2], t[1,1], t[1,2]^2 -t[1,1]*t[2,2]]);

Check warning on line 3733 in lib/gpolygons.gi

View check run for this annotation

Codecov / codecov/patch

lib/gpolygons.gi#L3733

Added line #L3733 was not covered by tests
Add(blt, [0,0,0,0,1]*i); ## last point is distinguished point.
for x in blt do
ConvertToVectorRepNC(x,f);
Expand Down Expand Up @@ -4035,7 +4035,7 @@
local m;
m := IdentityMat(6, f);
m[6]{[1..5]} := [e,d,c,-b,-a];
m[2][1] := a; m[3][1] := b; m[4][1] := c; m[5][1] := d;
m[2,1] := a; m[3,1] := b; m[4,1] := c; m[5,1] := d;

Check warning on line 4038 in lib/gpolygons.gi

View check run for this annotation

Codecov / codecov/patch

lib/gpolygons.gi#L4038

Added line #L4038 was not covered by tests
return m;
end;
bas := AsList(Basis(f));
Expand Down Expand Up @@ -4319,7 +4319,7 @@
local m;
m := IdentityMat(6, f);
m[6]{[1..5]} := [e,d,c,-b,-a];
m[2][1] := a; m[3][1] := b; m[4][1] := c; m[5][1] := d;
m[2,1] := a; m[3,1] := b; m[4,1] := c; m[5,1] := d;

Check warning on line 4322 in lib/gpolygons.gi

View check run for this annotation

Codecov / codecov/patch

lib/gpolygons.gi#L4322

Added line #L4322 was not covered by tests
return m;
end;
bas := AsList(Basis(f));
Expand Down
Loading