def _omega_pm_spectrum_odd_c(n: int, field: 'Field', sign: int) -> Iterable[int]: """Spectra of Omega^e_{2n}(q) for odd q. Based on [1, Corollary 8] and [3, Lemma 2.3] Point 3 of [1, Corollary 8] contains an error that was corrected in [3, Lemma 2.3] """ n //= 2 q = field.order p = field.char def nk(k): return (p ** (k - 1) + 3) // 2 # (1) a1 = [(q ** n - sign) // 2] # (2) a2 = SemisimpleElements(q, n, min_length=2, parity=sign) # (3) a3 = [] k = 1 while True: n_k = nk(k) if n_k >= n: break for delta in [1, -1]: dk = gcd(4, q ** n_k - sign * delta) // 2 a3.append( p ** k * lcm( dk, (q**(n - n_k) - delta) // dk ) ) k += 1 # (4) a4 = MixedElements(q, n, nk, lambda k: p ** k, min_length=2) # (5) a5 = [] for elem in SemisimpleElements(q, n - 2, min_length=2, parity=sign): a5.append(elem.lcm(SpectraElement(p, q, [1], [-1]))) a5.append(elem.lcm(SpectraElement(p, q, [1], [1]))) # (6) t = (q ** (n - 2) - sign) // 2 a6 = [p * lcm(q - 1, t), p * lcm(q + 1, t)] # (7) k = numeric.get_exponent(2 * n - 3, p) a7 = [] if k is None else [p * (2 * n - 3) * gcd(4, q ** n - sign) // 2] # (8) a8 = [p * (q * q - 1), p * (q * q + 1)] if n == 4 and sign == 1 else [] # (9) a9 = [9 * (q - 1), 9 * (q + 1)] if n == 4 and p == 3 and sign == 1 else [] return itertools.chain(a1, a2, a3, a4, a5, a6, a7, a8, a9)
def spectrum(n, field): n //= 2 q = field.order p = field.char # if gcd(4, q^n-e) != 4, then POmega = Omega b = (q % 4 == 3 and n % 2 == 1) if e == -1 else ( q % 4 == 1) # true iff gcd(4, q^n-e)=4 if not b: return _omega_pm_spectrum(e)(n * 2, field) nk = lambda k: (p**(k - 1) + 3) // 2 # (1) a1 = [(q**n - sign) // 4] # (2) a2 = [] for n1 in xrange(1, n): for e1 in [-1, 1]: a = q**n1 - e1 b = q**(n - n1) - e * e1 d = 2 if _equal_two_part(a, b) else 1 a2.append(lcm(a, b) // d) # (3) a3 = SemisimpleElements(q, n, min_length=3, parity=sign) # (4) a4 = [] k = 1 while True: n_k = nk(k) if n_k >= n: break a4.append(p**k * (q**(n - n_k) + 1) // 2) a4.append(p**k * (q**(n - n_k) - 1) // 2) k += 1 # (5) a5 = MixedElements(q, n, nk, lambda k: p**k, min_length=2) # (6) a6 = [] for elem in SemisimpleElements(q, n - 2, min_length=2, parity=sign): a6.append(elem.lcm(SpectraElement(p, q, [1], [-1]))) a6.append(elem.lcm(SpectraElement(p, q, [1], [1]))) # (7) t = (q**(n - 2) - sign) // 2 a7 = [p * lcm(q - 1, t), p * lcm(q + 1, t)] # (8) k = numeric.get_exponent(2 * n - 3, p) a8 = [] if k is None else [p * (2 * n - 3)] return itertools.chain(a1, a2, a3, a4, a5, a6, a7, a8)
def _omega_pm_spectrum_odd_c(n, field, sign): """Spectra of Omega^e_{2n}(q) for odd q. [1, Corollary 8] """ n //= 2 q = field.order p = field.char nk = lambda k: (p**(k - 1) + 3) // 2 # (1) a1 = [(q**n - sign) // 2] # (2) a2 = SemisimpleElements(q, n, min_length=2, parity=sign) # (3) a3 = [] k = 1 while True: n_k = nk(k) if n_k >= n: break dk = gcd(4, q**n_k - sign) // 2 a3.append(p**k * lcm(dk, (q**(n - n_k) + 1) // dk)) a3.append(p**k * lcm(dk, (q**(n - n_k) - 1) // dk)) k += 1 # (4) a4 = MixedElements(q, n, nk, lambda k: p**k, min_length=2) # (5) a5 = [] for elem in SemisimpleElements(q, n - 2, min_length=2, parity=sign): a5.append(elem.lcm(SpectraElement(p, q, [1], [-1]))) a5.append(elem.lcm(SpectraElement(p, q, [1], [1]))) # (6) t = (q**(n - 2) - sign) // 2 a6 = [p * lcm(q - 1, t), p * lcm(q + 1, t)] # (7) k = numeric.get_exponent(2 * n - 3, p) a7 = [] if k is None else [p * (2 * n - 3) * gcd(4, q**n - sign) // 2] # (8) a8 = [p * (q * q - 1), p * (q * q + 1)] if n == 4 and sign == 1 else [] # (9) a9 = [9 * (q - 1), 9 * (q + 1)] if n == 4 and p == 3 and sign == 1 else [] return itertools.chain(a1, a2, a3, a4, a5, a6, a7, a8, a9)
def spectrum(n: int, field: 'Field') -> Iterable[int]: q = field.order p = field.char # (1) eps = 1 if n % 2 == 0 else e a1 = [(q ** n - eps) // (q - e)] # (2) a2 = SemisimpleElements(q, n, min_length=2, sign=e) # (3) a3 = [] k = 1 d = gcd(n, q - e) while True: n1 = n - p ** (k - 1) - 1 if n1 < 1: break eps = 1 if n1 % 2 == 0 else e a3.append(p ** k * (q ** n1 - eps) // gcd(d, n1)) k += 1 # (4) a4 = MixedElements(q, n, lambda k: p ** (k - 1) + 1, lambda k: p ** k, min_length=2, sign=e) # (5) k = numeric.get_exponent(n - 1, p) a5 = [] if k is None else [p * (n - 1) * d] # (6) a6 = [p * gcd(2, q - 1) * (q + e)] if n == 4 else [] return itertools.chain(a1, a2, a3, a4, a5, a6)
def _omega_spectrum_odd_c(n: int, field: 'Field') -> Iterable[int]: """Spectra of groups \Omega_{2n+1}(q) for odd q. [1, Corollary 6] """ n = (n - 1) // 2 q = field.order p = field.char # (1) t = (q ** n - 1) // 2 a1 = [t, t + 1] # (2) a2 = SemisimpleElements(q, n, min_length=2) # (3) k = 1 a3 = [] while True: n1 = n - (p ** (k - 1) + 1) // 2 if n1 < 1: break t = (q ** n1 - 1) // 2 a3.extend([t * p ** k, (t + 1) * p ** k]) k += 1 # (4) a4 = MixedElements(q, n, lambda k: (p ** (k - 1) + 1) // 2, lambda k: p ** k, min_length=2) # (5) k = numeric.get_exponent(2 * n - 1, p) a5 = [] if k is None else [p * (2 * n - 1)] return itertools.chain(a1, a2, a3, a4, a5)
def _symplectic_spectrum_even_c(n, field): """Spectra of symplectic groups in characteristic 2. [2, Corollary 3] """ n //= 2 q = field.order # (1) a1 = SemisimpleElements(q, n) # (2) a2 = (2 * elem for elem in SemisimpleElements(q, n - 1)) # (3) a3 = MixedElements(q, n, lambda k: 2**(k - 1) + 1, lambda k: 2**(k + 1)) # (4) k = numeric.get_exponent(n - 1, 2) a4 = [] if k is None else [(n - 1) * 4] return itertools.chain(a1, a2, a3, a4)
def _omega_pm_spectrum_even_c(n: int, field: 'Field', sign: int) -> Iterable[int]: """Spectra for groups \Omega^{\pm}(2^k). [1, Corollary 4] """ n //= 2 q = field.order # (1) a1 = SemisimpleElements(q, n, parity=sign) # (2) a2 = MixedElements(q, n, lambda k: 2 ** (k - 1) + 2, lambda k: 2 ** (k + 1)) # (3) a3 = (2 * elem for elem in SemisimpleElements(q, n - 2)) # (4) a4 = [] for elem in SemisimpleElements(q, n - 2, parity=sign): a4.append(2 * lcm(q - 1, elem)) a4.append(2 * lcm(q + 1, elem)) # (5) a5 = [] signMod = 0 if sign == 1 else 1 for ni in FullBoundedSets(n - 3): if len(ni) % 2 != signMod: continue a5.append(4 * SpectraElement(q=q, partition=[1] + ni, signs=[-1] + [1] * len(ni))) # (6) a6 = (elem.lcm(SpectraElement(4, q, [1], [1])) for elem in SemisimpleElements(q, n - 3, parity=-sign)) # (7) k = numeric.get_exponent(n - 2, 2) a7 = [] if k is None else [4 * (n - 2)] return itertools.chain(a1, a2, a3, a4, a5, a6, a7)
def spectrum(n, field): n //= 2 q = field.order p = field.char # (1) a1 = SemisimpleElements(q, n, parity=e) # (2) a2 = MixedElements(q, n, lambda k: (p**(k - 1) + 3) // 2, lambda k: p**k) # (3) a3 = [] for elem in SemisimpleElements(q, n - 2, parity=e): a3.append(elem.lcm(SpectraElement(p, q, [1], [-1]))) a3.append(elem.lcm(SpectraElement(p, q, [1], [1]))) # (4) k = numeric.get_exponent(2 * n - 3, p) a4 = [] if k is None else [2 * p * (2 * n - 3)] return itertools.chain(a1, a2, a3, a4)
def spectrum(n, field): q = field.order p = field.char d = gcd(n, q - e) # (1) eps = 1 if n % 2 == 0 else e a1 = [(q**n - eps) // ((q - e) * d)] # (2) a2 = [] eps = lambda s: 1 if s % 2 == 0 else e for n1 in xrange(1, (n + 2) // 2): pair = (n1, n - n1) signs = (-eps(n1), -eps(n - n1)) a2.append( lcm(q**pair[0] + signs[0], q**pair[1] + signs[1]) // gcd(n // gcd(n1, n - n1), q - e)) # (3) a3 = SemisimpleElements(q, n, min_length=3, sign=e) # (4) a4 = [] k = 1 while True: n1 = n - p**(k - 1) - 1 if n1 < 1: break eps = 1 if n1 % 2 == 0 else e a4.append(p**k * (q**n1 - eps) / d) k += 1 # (5) a5 = MixedElements(q, n, lambda k: p**(k - 1) + 1, lambda k: p**k, min_length=2, sign=e) # (6) k = numeric.get_exponent(n - 1, p) a6 = [] if k is None else [p * (n - 1)] return itertools.chain(a1, a2, a3, a4, a5, a6)
def _symplectic_spectrum_odd_c(n, field): """Spectra of symplectic groups in odd characteristic. [1, Corollary 1] """ n //= 2 q = field.order p = field.char # (1) a1 = SemisimpleElements(q, n) # (2) a2 = MixedElements(q, n, lambda k: (p**(k - 1) + 1) // 2, lambda k: p**k) # (3) k = numeric.get_exponent(2 * n - 1, p) a3 = [] if k is None else [2 * p * (2 * n - 1)] return itertools.chain(a1, a2, a3)
def _special_orthogonal_odd_c_spectrum(n, field): """Spectra of groups SO_{2n+1}(q) for odd q. [1, Corollary 5] """ n = (n - 1) // 2 q = field.order p = field.char # (1) a1 = SemisimpleElements(q, n) # (2) a2 = MixedElements(q, n, lambda k: (p**(k - 1) + 1) // 2, lambda k: p**k) # (3) k = numeric.get_exponent(2 * n - 1, p) a3 = [] if k is None else [p * (2 * n - 1)] return itertools.chain(a1, a2, a3)
def spectrum(n: int, field: 'Field') -> Iterable[int]: q = field.order p = field.char # (1) eps = 1 if n % 2 == 0 else e a1 = [(q ** n - eps) // (q - e)] # (2) a2 = SemisimpleElements(q, n, min_length=2, sign=e) # (3) a3 = MixedElements(q, n, lambda k: p ** (k - 1) + 1, lambda k: p ** k, sign=e) # (4) k = numeric.get_exponent(n - 1, p) a4 = [] if k is None else [p * (n - 1)] return itertools.chain(a1, a2, a3, a4)
def test_minus(self, params): """ Test elements [q^{n_1}-1, ..., q^{n_k}-1] for all n_1+...+n_k=n """ n, q = params ss = SemisimpleElements(q, n, sign=1, verbose=False) divisible = set() for ni in Partitions(n): elem = evaluate(q, ni) found = False for x in ss: if x % elem == 0: if x == elem: divisible.add(x) found = True self.assertTrue(found, msg="element with base {}, partition {} = {} "\ "doesn't divide any of {}".format(str(q), str(ni), str(elem), str(ss))) self.assertSetEqual(divisible, set(ss))
def _projective_symplectic_spectrum_odd_c(n, field): """Spectra of projective symplectic groups in characteristic 2. [1, Corollary 2] """ n //= 2 q = field.order p = field.char # (1) t = (q**n - 1) // 2 a1 = [t, t + 1] # (2) a2 = SemisimpleElements(q, n, min_length=2) # (3) a3 = MixedElements(q, n, lambda k: (p**(k - 1) + 1) // 2, lambda k: p**k) # (4) k = numeric.get_exponent(2 * n - 1, p) a4 = [] if k is None else [p * (2 * n - 1)] return itertools.chain(a1, a2, a3, a4)
def all_semisimple(self, n, q, min_length=1, parity=0, sign=0): # very slow! For every partition of size n it calculates 2^n parity tuples. ss = list( SemisimpleElements(q, n, min_length=min_length, parity=parity, sign=sign, verbose=False)) signsMod = 0 if parity == 1 else 1 divisible = set() for ni in Partitions(n, min_length=min_length): if sign: signs = [[-sign**nk for nk in ni]] else: signs = Signs(len(ni)) for ei in signs: # skip needless signs if parity and ei.count(1) % 2 != signsMod: continue elem = evaluate(q, ni, ei) # every element must divide at least one of items in ss # also every item in ss must be equal to at least one element found = False for x in ss: if x % elem == 0: if x == elem: divisible.add(x) found = True #self.assertTrue(any(x % elem == 0 for x in ss), self.assertTrue(found, msg="element with base {}, partition {} and signs {} = {} "\ "doesn't divide any of {}".format(str(q), str(ni), str(ei), str(elem), str(set(ss)))) self.assertSetEqual(divisible, set(ss))