From 836421d363dd3d4a3be836f9da94eabfe7c049f5 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 23 Jun 2026 15:03:01 +0200 Subject: [PATCH] Add RECOG.FixspaceMat and RECOG.EigenspaceMat Taken from the SL_n branch, but useful already now. --- gap/projective/sl.gi | 15 +++++++-------- gap/utils.gi | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/gap/projective/sl.gi b/gap/projective/sl.gi index c310ab81e..905c17261 100644 --- a/gap/projective/sl.gi +++ b/gap/projective/sl.gi @@ -29,7 +29,7 @@ RECOG.FindStdGens_SL := function(sld) # RECOG.SLn_UpStep often enough. Finally it returns an slp such # that the SL(d,q) standard generators with respect to this basis are # expressed by the slp in terms of the original generators of sld. - local V,b,bas,basi,basit,d,data,ext,fakegens,id,nu,nu2,p,q,resl2,sl2,sl2gens, + local V,b,bas,basi,basit,d,data,ext,fakegens,nu,nu2,p,q,resl2,sl2,sl2gens, sl2gensf,sl2genss,sl2stdf,slp,slpsl2std,slptosl2,st,std,stdgens,i,ex,f; # Some setup: @@ -59,7 +59,7 @@ RECOG.FindStdGens_SL := function(sld) stdgens := RECOG.MakeSL_StdGens(p,ext,4,4).all; slpsl2std := RECOG.FindStdGensUsingBSGS(Group(sl2genss),stdgens, false,false); - nu := List(sl2gens,x->NullspaceMat(x-One(x))); + nu := List(sl2gens, RECOG.FixspaceMat); ex := SumIntersectionMat(nu[1],nu[2])[2]; for i in [3..Length(nu)] do ex := SumIntersectionMat(nu[3],ex); @@ -81,9 +81,8 @@ RECOG.FindStdGens_SL := function(sld) StripMemory(GeneratorsOfGroup(sl2))); # Extend basis by something invariant under SL2: - id := IdentityMat(d,f); - nu := NullspaceMat(StripMemory(st[1]-id)); - nu2 := NullspaceMat(StripMemory(st[2]-id)); + nu := RECOG.FixspaceMat(StripMemory(st[1])); + nu2 := RECOG.FixspaceMat(StripMemory(st[2])); Append(bas,SumIntersectionMat(nu,nu2)[2]); ConvertToMatrixRep(bas,q); basi := bas^-1; @@ -205,13 +204,13 @@ RECOG.SLn_constructsl4:=function(g,dim,q,r) local s,h,count,readydim4,readydim3,ready,u,orderu, nullr,nulls,nullspacer,nullspaces,int,intbasis,nullintbasis, newu,newbasis,newbasisinv,newr,news,outputu,mat,i,shorts,shortr; - nullr:=NullspaceMat(StripMemory(r)-One(StripMemory(r))); + nullr:=RECOG.FixspaceMat(StripMemory(r)); nullspacer:=VectorSpace(GF(q),nullr); mat:=One(r); ready:=false; repeat s:=r^PseudoRandom(g); - nulls:=NullspaceMat(StripMemory(s)-One(StripMemory(s))); + nulls:=RECOG.FixspaceMat(StripMemory(s)); nullspaces:=VectorSpace(GF(q),nulls); int:=Intersection(nullspacer,nullspaces); intbasis:=Basis(int); @@ -576,7 +575,7 @@ RECOG.SLn_UpStep := function(w) Vnc := VectorSpace(w.f,c{[1..w.n]}); sum1 := ClosureLeftModule(Vn,Vnc); if Dimension(sum1) = aimdim then - Fixc := VectorSpace(w.f,NullspaceMat(c-One(c))); + Fixc := VectorSpace(w.f,RECOG.FixspaceMat(c)); int1 := Intersection(Fixc,Vn); for i in [1..Dimension(int1)] do v := Basis(int1)[i]; diff --git a/gap/utils.gi b/gap/utils.gi index a549bd3fe..c1bb9fa9e 100644 --- a/gap/utils.gi +++ b/gap/utils.gi @@ -145,3 +145,20 @@ RECOG.CopySubVectorCompat := function(src, dst, from, to) fi; return dst; end; + +# compute the eigenspace of `mat` for the given eigenvalue lambda` +RECOG.EigenspaceMat := function(mat, lambda) + local i; + mat := MutableCopyMat( mat ); + # since mat is a copy, we can efficiently "subtract an identity matrix" + for i in [1..NrRows(mat)] do + mat[i,i] := mat[i,i] - lambda; + od; + # since mat is a copy we can use NullspaceMatDestructive instead of NullspaceMat + return NullspaceMatDestructive(mat); +end; + +# compute fixed space of mat, i.e. eigenspace for eigenvalue 1 +RECOG.FixspaceMat := function(mat) + return RECOG.EigenspaceMat(mat, 1); +end;