def eta_p(q): ''' q: an instance of jordan_block.JordanBlocks. ''' p = q.p hasse_inv = q.hasse_invariant__OMeara() detb = q.Gram_det() n = q.dim() h1 = hilbert_symbol(detb, detb * (-1) ** ((n - 1) // 2), p) h2 = hilbert_symbol(-1, -1, p) return hasse_inv * h1 * h2 ** ((n ** 2 - 1) // 8)
def _invariants_2_even(b1, q2): n = q2.dim() + 2 m = b1.m q = b1 + q2 xi = xi_p(q) xi_dash = xi_to_xi_dash(xi) xi_hat = xi_p(q2) xi_hat_dash = xi_to_xi_dash(xi_hat) # Definition of eta_tilde if b1.type == 'u' and small_d(q2) % 2 == 0: _q = JordanBlocks([(m, b1._mat_prim[(1, 1)])], two) eta_tilde = eta_p(_q + q2) elif b1.type != 'u' and xi_hat != 0: eta_tilde = ((-1) ** (((n - 1) ** 2 - 1) // 8) * q2.hasse_invariant__OMeara() * hilbert_symbol(two ** m, (-1) ** (n // 2 - 1) * q2.Gram_det(), 2)) else: eta_tilde = ZZ(1) res = {"xi": xi, "xi_dash": xi_dash, "xi_hat": xi_hat, "xi_hat_dash": xi_hat_dash, "eta_tilde": eta_tilde} res.update(_invariants_2_common(b1, q2)) return res
def hasse_invariant__OMeara(self): p = self.p if p != 2: rational_diags = [p ** a * b for a, b in self.blocks] else: rational_diags = [] for a, b in self.blocks: if isinstance(b, str): rational_diags.extend( [p ** a * x for x in _hy_rational_diags[b]]) else: rational_diags.append(p ** a * b) n = len(rational_diags) res = ZZ(1) for i in range(n): for j in range(i + 1, n): res *= hilbert_symbol(rational_diags[i], rational_diags[j], p) return res * hilbert_symbol(self.Gram_det(), -1, p)