def DC_char_to_gp_char(chi, G=None): """ If this function is to be called repeatedly with the same modulus it is better to precompute G and pass it, so save recomputation: """ if G is None: G = pari(chi.modulus()).znstar(1) return G.znconreylog(DC.number(chi))
def char_orbit_index_to_DC_number(N, o): """Returns the index in the Dirichlet-Conrey numbering of one character in orbit number o""" if o == 1: return 1 global char_table_dict if not char_table_dict: char_table_dict = {} try: chartab = open("chartab.txt") for L in chartab.readlines(): NN, oo, nn = [int(x) for x in L.split()] if not NN in char_table_dict: char_table_dict[NN] = {} char_table_dict[NN][oo] = nn chartab.close() except IOError: Chars = DirichletCharacterGaloisReps(N) return DC.number(Chars[o - 1]) try: return char_table_dict[N][o] except KeyError: # N too big for precomputed table Chars = DirichletCharacterGaloisReps(N) return DC.number(Chars[o - 1])
def primitivize(label): m, n = [ZZ(a) for a in label.split(".")] char = DirichletCharacter_conrey(DirGroup(m), n).primitive_character() return "%d.%d" % (char.modulus(), char.number())
def GP_DirichletCharacterGaloisReps(N): G = pari(N).znstar(1) return [ G.znconreylog(DC.number(chi)) for chi in DirichletCharacterGaloisReps(N) ]
def DC_char_to_gp_char(chi, G=None): if G == None: G = pari(chi.modulus()).znstar(1) return G.znconreylog(DC.number(chi))
def OrderedConreyLabels(N): return [DC.number(chi) for chi in DirichletCharacterGaloisReps(N)]