Skip to content

Commit

Permalink
Use NrRows and NrCols and mat[i,j] in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Jul 27, 2023
1 parent 030f5bc commit bfbedcd
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 181 deletions.
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 @@ InstallMethod( IsProjectivityGroup, [ IsProjGroupWithFrobWithPSIsom ],
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;
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 @@ InstallMethod( IsCollineationGroup, [ IsProjGroupWithFrobWithPSIsom ],
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;
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 @@ InstallMethod( ProjElWithFrobWithPSIsom,
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);
el := rec( mat := cmat, fld := f, frob := frob, psisom := delta );
Objectify( ProjElsWithFrobWithPSIsomType, el );
return el;
Expand All @@ -435,9 +435,8 @@ InstallMethod( ProjElWithFrobWithPSIsom,
[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);
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 @@ InstallMethod( ProjElWithFrobWithPSIsom,
[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);
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 @@ InstallMethod( ProjElWithFrobWithPSIsom,
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);
el := rec( mat := cmat, fld := f, frob := frob, psisom := delta );
Objectify( ProjElsWithFrobWithPSIsomType, el );
return el;
Expand Down Expand Up @@ -1008,7 +1006,7 @@ InstallMethod( CorrelationOfProjectiveSpace,
"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
Error("<mat> must not be singular");
fi;
return ProjElWithFrobWithPSIsom( mat, IdentityMapping(gf), gf);
Expand All @@ -1027,7 +1025,7 @@ InstallMethod( CorrelationOfProjectiveSpace,
[ IsMatrix and IsFFECollColl, IsRingHomomorphism and
IsMultiplicativeElementWithInverse, IsField],
function( mat, frob, gf )
if Rank(mat) <> Size(mat) then
if Rank(mat) <> NrRows(mat) then
Error("<mat> must not be singular");
fi;
return ProjElWithFrobWithPSIsom( mat, frob, gf);
Expand All @@ -1045,7 +1043,7 @@ InstallMethod( CorrelationOfProjectiveSpace,
"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
Error("<mat> must not be singular");
fi;
if delta!.ps!.basefield <> gf then
Expand All @@ -1064,10 +1062,10 @@ InstallMethod( CorrelationOfProjectiveSpace,
"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
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
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 @@ InstallMethod( CorrelationOfProjectiveSpace,
[ 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
Error("<mat> must not be singular");
fi;
if delta!.ps!.basefield <> gf then
Expand All @@ -1105,10 +1103,10 @@ InstallMethod( CorrelationOfProjectiveSpace,
[ 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
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
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 @@ InstallMethod( CorrelationOfProjectiveSpace,
[ 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
Error("The arguments <pg> and <mat> are not compatible");
fi;
return CorrelationOfProjectiveSpace( mat, frob, BaseField(pg), delta);
Expand All @@ -1142,7 +1140,7 @@ InstallMethod( CorrelationOfProjectiveSpace,
[ 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
Error("The arguments <pg> and <mat> are not compatible");
fi;
if Source(delta)!.geometry <> pg then
Expand All @@ -1162,7 +1160,7 @@ InstallMethod( Correlation,
[ 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
Error("The arguments <pg> and <mat> are not compatible");
fi;
return CorrelationOfProjectiveSpace( mat, frob, BaseField(pg), delta);
Expand All @@ -1179,7 +1177,7 @@ InstallMethod( Correlation,
[ 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
Error("The arguments <pg> and <mat> are not compatible");
fi;
if Source(delta)!.geometry <> pg then
Expand Down Expand Up @@ -1361,7 +1359,7 @@ InstallMethod( Dimension,
# Now start to investigate:
gens := GeneratorsOfGroup(g);
if Length(gens) > 0 then
return Length(gens[1]!.mat);
return NrRows(gens[1]!.mat);
fi;
Error("dimension could not be determined");
end );
Expand Down Expand Up @@ -1537,7 +1535,7 @@ InstallMethod(PolarityOfProjectiveSpaceOp,
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 @@ -1559,7 +1557,7 @@ InstallMethod( ViewObj,
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 @@ -1576,7 +1574,7 @@ InstallMethod( PrintObj,
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 @@ -1588,7 +1586,7 @@ InstallMethod( Display, "for a projective group element with Frobenius with proj
[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 @@ -1619,7 +1617,7 @@ InstallMethod(PolarityOfProjectiveSpace,
[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 @@ -1631,7 +1629,7 @@ InstallMethod(PolarityOfProjectiveSpace,
[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 @@ -1647,7 +1645,7 @@ InstallMethod(HermitianPolarityOfProjectiveSpace,
[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 @@ InstallMethod( Display, [ IsDiagram and IsDiagramRep ],
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(" ");
# if IsOddInt(j) then Print( " " );
# else Print( " " );
# fi;
elif mat[i][j] = -1 then
elif mat[i,j] = -1 then
Print( "o" );
elif mat[i][j] = 1 then
elif mat[i,j] = 1 then
Print( "-" );
elif mat[i][j] = 2 then
elif mat[i,j] = 2 then
Print( "|" );
elif mat[i][j] = 3 then
elif mat[i,j] = 3 then
Print( " /" );
elif mat[i][j] = 4 then
elif mat[i,j] = 4 then
Print( " \\" );
else
Print( mat[i][j] );
Print( mat[i,j] );
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 @@ InstallMethod( GeneralisedPolygonByBlocks,

#############################################################################
#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 @@ InstallMethod( GeneralisedPolygonByIncidenceMatrix,
function( mat )
## Rows represent blocks and columns represent points...
local v, q, row, blocks, gp;
v := Size(mat);
v := NrRows(mat);
#if not ForAll(mat, t->Size(t)=v) then
# Error("Matrix is not square");
#fi;
Expand Down Expand Up @@ -1428,7 +1428,7 @@ InstallGlobalFunction( SplitCayleyPointToPlane,
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);
vec := SumIntersectionMat(spacevec, int)[2];
return vec{[1..3]}{[1..7]};
end );
Expand Down Expand Up @@ -3730,7 +3730,7 @@ InstallMethod( BLTSetByqClan,
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]]);
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 @@ InstallMethod( EGQByBLTSet,
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;
return m;
end;
bas := AsList(Basis(f));
Expand Down Expand Up @@ -4319,7 +4319,7 @@ InstallMethod( FlockGQByqClan, [ IsqClanObj ],
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;
return m;
end;
bas := AsList(Basis(f));
Expand Down
Loading

0 comments on commit bfbedcd

Please sign in to comment.