Add constructive recognition for SL_n, take 2#371
Conversation
Make sure that the correct path of `regen_doc.g` is used when PackageManager builds the documentation.
preliminary fix in `makedoc.g`
If one wants to build the documentation with version 1.4.3 of PackageManager then also the calls of `OutputTextFile` require paths relative to `DirectoryCurrent()`.
... and add some comments (pointing out this needs documentation, and also an obvious bug in the code that would lead to an unexpected error if the code it is in was ever run)
... which made it depend on the characteristic. This corresponds to a change in our manuscript where it turned out we don't need this, and experiments validate this.
The GAP kernel already does that and this is way faster.
It is from Alnuth, and trivial to reimplement
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #371 +/- ##
==========================================
- Coverage 88.13% 81.55% -6.58%
==========================================
Files 45 50 +5
Lines 19023 21097 +2074
==========================================
+ Hits 16765 17205 +440
- Misses 2258 3892 +1634
🚀 New features to boost your workflow:
|
c4ddfcb to
a41b2dc
Compare
No offense intended, but Daniel didn't make substantial change here other than deleting or moving code
|
Good: tests pass, merge conflicts remove, future merging easier |
|
I'd like to help move this forward - what would be most useful to work on next? |
| Info(InfoRecog,4,"SL2: size is ",Size(S)); | ||
| return Size(S) mod (q*(q-1)*(q+1)) = 0; | ||
| # return Size(S) mod (q*(q-1)*(q+1)) = 0; | ||
| return Size(S) = (q*(q-1)*(q+1)); |
There was a problem hiding this comment.
This change is fishy. See also #487
I wonder why we need it. But if we do need it, then certainly there must be more; e.g. the code comment a few lines above references this code and thus must be adjusted.
Co-authored-by: Max Horn <max@quendi.de>
|
@Till-Eisen I've outlined a couple of things in the PR description that we ought to take care before merging this. I'll add some review comments soon. Happy to talk about this more next Tuesday. |
|
|
||
| factors := PrimeDivisors(q-1); | ||
| counter := 1; | ||
| F := GF(q); |
There was a problem hiding this comment.
For this (and all other future code) we should strive to pass around the field, not the size.
This is key first step towards supporting alternative field implementations (such as those from the StandardFF package).
Though in this case, really the field should be derived from G (i.e. the group G is generated by matrices which have a certain BaseDomain...). On the GAP side we are discussing adding a BaseDomain for matrix groups.
| G := GroupWithMemory(G); | ||
| fi; | ||
|
|
||
| one := One(G); |
There was a problem hiding this comment.
Better to use IsOne (it used to be that IsOne was super slow for matrices, but this was fixed some years ago)
| one := One(G); |
| # Step 1: Find random element of order q-1 | ||
| # foundEle := false; | ||
| # while not(foundEle) do | ||
| # A := PseudoRandom(G); | ||
| # if A^(q-1) = one then | ||
| # passed := true; | ||
| # for factor in factors do | ||
| # if A^((q-1)/factor) = one then | ||
| # passed := false; | ||
| # break; | ||
| # fi; | ||
| # od; | ||
| # if passed then | ||
| # foundEle := true; | ||
| # else | ||
| # counter := counter + 1; | ||
| # fi; | ||
| # else | ||
| # counter := counter +1; | ||
| # fi; | ||
| # if counter >= max then | ||
| # return fail; | ||
| # fi; | ||
| #od; | ||
|
|
There was a problem hiding this comment.
Any reason to keep this? Otherwise I'd rather delete this.
| # Step 1: Find random element of order q-1 | |
| # foundEle := false; | |
| # while not(foundEle) do | |
| # A := PseudoRandom(G); | |
| # if A^(q-1) = one then | |
| # passed := true; | |
| # for factor in factors do | |
| # if A^((q-1)/factor) = one then | |
| # passed := false; | |
| # break; | |
| # fi; | |
| # od; | |
| # if passed then | |
| # foundEle := true; | |
| # else | |
| # counter := counter + 1; | |
| # fi; | |
| # else | |
| # counter := counter +1; | |
| # fi; | |
| # if counter >= max then | |
| # return fail; | |
| # fi; | |
| #od; |
| # fi; | ||
| #od; | ||
|
|
||
| # Step 1: Find random element of order q-1 (first improvement based on magma code) |
There was a problem hiding this comment.
| # Step 1: Find random element of order q-1 (first improvement based on magma code) | |
| # Step 1: Find random element of order q-1 |
I don't mind crediting Magma, but this comment is super vague. If anyone knows what improvements this refers to...?
| foundEle := false; | ||
| while not(foundEle) do | ||
| A := PseudoRandom(G); | ||
| o := Order (A); | ||
| if (o mod (q - 1) = 0) then | ||
| A := A^(o/(q - 1)); | ||
| foundEle := true; | ||
| else | ||
| counter := counter +1; | ||
| fi; | ||
| if counter >= max then | ||
| return fail; | ||
| fi; | ||
| od; |
There was a problem hiding this comment.
can be simplified
| foundEle := false; | |
| while not(foundEle) do | |
| A := PseudoRandom(G); | |
| o := Order (A); | |
| if (o mod (q - 1) = 0) then | |
| A := A^(o/(q - 1)); | |
| foundEle := true; | |
| else | |
| counter := counter +1; | |
| fi; | |
| if counter >= max then | |
| return fail; | |
| fi; | |
| od; | |
| while true do | |
| A := PseudoRandom(G); | |
| o := Order (A); | |
| if (o mod (q - 1) = 0) then | |
| A := A^(o/(q - 1)); | |
| break; | |
| fi; | |
| counter := counter +1; | |
| if counter >= max then | |
| return fail; | |
| fi; | |
| od; |
Perhaps we should also use RandomElmOrd or so (see also #237, #462)
| repeat | ||
| s:=r^PseudoRandom(g); | ||
| nulls:=RECOG.FixspaceMat(s); | ||
| nullspaces:=VectorSpace(GF(q),nulls); |
There was a problem hiding this comment.
Same questions/suggestions as above
| shortr:=newr{[dim-3..dim]}{[dim-3..dim]}; | ||
| shorts:=news{[dim-3..dim]}{[dim-3..dim]}; |
There was a problem hiding this comment.
I assume this means we are looking at stingray matrices with the "head/body" at the bottom right (instead of top left)?
A comment should stat that, I guess.
| readydim4:=false; | ||
| readydim3:=false; | ||
| repeat | ||
| u:=PseudoRandom(h); | ||
| orderu:=Order(u); | ||
| if orderu mod ((q^4-1)/(q-1)) = 0 then | ||
| readydim4:=true; | ||
| elif Gcd(orderu,(q^2+q+1)/Gcd(3,q-1))>1 then | ||
| readydim3:=true; | ||
| fi; | ||
| if readydim4 = true and readydim3 = true then | ||
| ready:=true; | ||
| break; | ||
| fi; | ||
| count:=count+1; | ||
| until count=30; |
There was a problem hiding this comment.
What's the idea here? Is this meant to be a test ("naming") to verify we have
I also wonder if it is better / cheaper / faster than `RecogniseClassical(h,rec(case:="linear"));
|
|
||
|
|
||
| # Find random element s = r^PseudRandom(g) such that <r,s> is isomorphic to SL(4,q) | ||
| # and check whether they are isomorphic |
There was a problem hiding this comment.
What is meant by "they"? The group <r,s>, and... what?
|
|
||
| #g=SL(d,q), given as a subgroup of SL(dim,q) | ||
| #output: [SL(2,q), and a basis for the 2-dimensional subspace where it acts | ||
| RECOG.SLn_godownfromd:=function(g,q,d,dim) |
There was a problem hiding this comment.
It seems this is only ever called with d=4?
Is dim really necessary as an argument, can't we get that from DimensionOfMatrixGroup(g)?
Likewise for q, as Size(FieldOfMatrixGroup(g))
This is a successor for PR #330. The only difference for now is that the branch is now hosted in this repo, not in @danielrademacher's branch. This will make it easier for us here to work on it together.
The plan is to further reduce diffs between this and master, and then get it merged.
There will also soon be another PR / branch with the rest of Daniel's code.
TODOs for merging this:
gap/projective/classicalnatural.giand possibly remove or adjust it (see also PR MakeRECOG.IsThisSL2Naturalmore precise #487)contribsubdir (as part of this PR)