Repository: LMFDB/lmfdb

Issue:
Projective Lie groups
Currently in the groups database, elements of Lie groups of a projective family are stored with code as if they are permutations instead of matrices.


Discussion:

Resolving patch:
diff --git a/lmfdb/groups/abstract/main.py b/lmfdb/groups/abstract/main.py
--- a/lmfdb/groups/abstract/main.py
+++ b/lmfdb/groups/abstract/main.py
@@ -2255,7 +2255,7 @@ def cc_data(gp, label, typ="complex"):
         else:
             gp_value = WebAbstractGroup(gp)
             if gp_value.representations.get("Lie"):
-                if gp_value.representations["Lie"][0]["family"][0] == "P":  #Problem with projective lie groups
+                if gp_value.representations["Lie"][0]["family"][0] == "P" and  gp_value.order < 2000:  #Problem with projective lie groups of order <2000
                     pass
                 else:
                     repn = gp_value.decode(wacc.representative, as_str=True)
diff --git a/lmfdb/groups/abstract/web_groups.py b/lmfdb/groups/abstract/web_groups.py
--- a/lmfdb/groups/abstract/web_groups.py
+++ b/lmfdb/groups/abstract/web_groups.py
@@ -1717,10 +1717,23 @@ def decode_as_perm(self, code, n=None, as_str=False):
 
     def _matrix_coefficient_data(self, rep_type, as_str=False):
         rep_data = self.representations[rep_type]
+        sq_flag = False # used later for certain groups
         if rep_type == "Lie":
-            rep_type = "GLFq"
             rep_data = rep_data[0]
-        d = rep_data["d"]
+            d = rep_data["d"]
+            rep_type = "GLFq"
+            fam = rep_data['family']
+            if fam in ["AGL", "ASL"]:
+                d += 1 #for AGL and ASL the matrices are in GL(d+1,q)
+            elif fam in ["CSU", "CU", "GU", "SU", "PSU", "PGU"]:
+                sq_flag = True # need q^2 instead of q
+            elif fam in ["Spin", "SpinPlus"]:
+                d = 2**(d//2)  # d even for SpinPlus, odd for Spin
+            elif fam == "SpinMinus":
+                d = 2**(d//2)  # d even
+                sq_flag = True  # also need q^2 instead of q in this case
+        else:
+            d = rep_data["d"]
         k = 1
         if rep_type == "GLZ":
             N = rep_data["b"]
@@ -1736,6 +1749,8 @@ def _matrix_coefficient_data(self, rep_type, as_str=False):
             R = rf"\Z/{N}\Z" if as_str else Zmod(N)
         elif rep_type == "GLFq":
             q = ZZ(rep_data["q"])
+            if sq_flag:
+                q = q**2
             R = rf"\F_{{{q}}}" if as_str else GF(q)
             N, k = q.is_prime_power(get_data=True)
             if k == 1:
@@ -1743,7 +1758,7 @@ def _matrix_coefficient_data(self, rep_type, as_str=False):
                 rep_type = "GLFp"
         return R, N, k, d, rep_type
 
-    def decode_as_matrix(self, code, rep_type, as_str=False):
+    def decode_as_matrix(self, code, rep_type, as_str=False, LieType=False):
         R, N, k, d, rep_type = self._matrix_coefficient_data(rep_type)
         L = ZZ(code).digits(N)
 
@@ -1757,6 +1772,9 @@ def pad(X, m):
             L = [c - shift for c in L]
         x = matrix(R, d, d, L)
         if as_str:
+            # for projective families, we add "[ ]"
+            if LieType and self.representations["Lie"][0]["family"][0] == "P":
+                return "\left[" + latex(x) + "\\right]"
             return latex(x)
         return x
 
@@ -1768,7 +1786,7 @@ def decode(self, code, rep_type=None, as_str=False):
         elif rep_type == "PC":
             return self.decode_as_pcgs(code, as_str=as_str)
         else:
-            return self.decode_as_matrix(code, rep_type=rep_type, as_str=as_str)
+            return self.decode_as_matrix(code, rep_type=rep_type, as_str=as_str, LieType=(rep_type=="Lie"))
 
     @lazy_attribute
     def pc_code(self):
@@ -1782,7 +1800,7 @@ def gens_used(self):
 
     def show_subgroup_flag(self):
         if self.representations.get("Lie"):
-            if self.representations["Lie"][0]["family"][0] == "P": 	# Issue with projective Lie groups
+            if self.representations["Lie"][0]["family"][0] == "P" and self.order < 2000: # Issue with projective Lie groups
                 return False
         return True
 
@@ -1941,14 +1959,7 @@ def representation_line(self, rep_type, skip_head=False):
         if rep_type != "PC":
             rdata = self.representations[rep_type]
         if rep_type == "Lie":
-            if self.element_repr_type == "Lie":
-                # Omit first description since it's used in the latex name
-                desc = "Other groups of " + display_knowl("group.lie_type", "Lie type")
-                rdata = rdata[1:]
-                if not rdata:
-                    return ""
-            else:
-                desc = "Groups of " + display_knowl("group.lie_type", "Lie type")
+            desc = "Groups of " + display_knowl("group.lie_type", "Lie type")
             reps = ", ".join([fr"$\{rep['family']}({rep['d']},{rep['q']})$" for rep in rdata])
             return f'<tr><td>{desc}:</td><td colspan="5">{reps}</td></tr>'
         elif rep_type == "PC":
@@ -2160,7 +2171,8 @@ def show_aut_group(self):
     def aut_order_factor(self):
         return latex(factor(self.aut_order))
 
-    def aut_gens_flag(self): #issue with Lie type when family is projective
+
+    def aut_gens_flag(self): #issue with Lie type when family is projective, auto stored as permutations often
         if self.aut_gens is None:
             return False
         elif self.element_repr_type == "Lie":


Test patch: