Exemple #1
0
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)
Exemple #2
0
def _omega_pm_spectrum_even_c(n, field, sign):
    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)
Exemple #3
0
    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)
Exemple #4
0
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)
Exemple #5
0
 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)
Exemple #6
0
    def spectrum(n, field):
        n //= 2
        q = field.order
        p = field.char
        # if gcd(4, q^n-e) != 4, then POmega = Omega
        b = n % 2 == 1 and q % 4 == 3  # true iff gcd(4, q^n+1)=4
        if not ((b and e == -1) or q % 2 == 1):
            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 lcm(self, other):
     """Returns lcm of this and other. 'q' must be the same. Quotients are
     multiplied.
     """
     elem = long.__new__(SpectraElement, numeric.lcm(self, other))
     quotient = self._quotient * other._quotient
     elem.__init__(quotient=quotient, q=self._q,
         partition=list(self._partition) + list(other._partition),
         signs=list(self._signs) + list(other._signs))
     return elem
Exemple #8
0
 def lcm(self, other):
     """Returns lcm of this and other. 'q' must be the same. Quotients are
     multiplied.
     """
     elem = long.__new__(SpectraElement, numeric.lcm(self, other))
     quotient = self._quotient * other._quotient
     elem.__init__(quotient=quotient,
                   q=self._q,
                   partition=list(self._partition) + list(other._partition),
                   signs=list(self._signs) + list(other._signs))
     return elem
Exemple #9
0
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)
Exemple #10
0
def _omega_pm_spectrum_odd_c(n, field, sign):
    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)
Exemple #11
0
    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)