Esempio n. 1
0
 def __latex__(self):
     if self._is_dual:
         s=" \bar{v_{\theta}} "
     else:
         s=" v_{\theta} "
     if self._character<>None and not self._character.is_trivial():
         s+=" \cdot "
         if self._character == kronecker_character(self._conductor):
             s+=" \left( \frac\{\cdot\}\{ {0} \}\right)".format(self._conductor)
         elif self._character == kronecker_character_upside_down(self._conductor):
             s+=" \left( \frac\{ {0} \}\{ \cdot \}\right)".format(self._conductor)
         else:
             s+=" \chi_\{ {0}, {1} \}".format(self._conductor,self._char_nr)
     return s
Esempio n. 2
0
    def __init__(self,group,dchar=(0,0),dual=False,is_trivial=False,dimension=1,**kwargs):
        r"""
        if dual is set to true we use the complex conjugate of the representation (we assume the representation is unitary)


        The pair dchar = (conductor,char_nr) gives the character.
        If char_nr = -1  = > kronecker_character
        If char_nr = -2  = > kronecker_character_upside_down
        """
        #print "kwargs0=",kwargs
        self._group = group
        self._dim = dimension
        self._ambient_rank=kwargs.get('ambient_rank',None)
        self._kwargs = kwargs
        self._verbose = kwargs.get("verbose",0)
        if self._verbose>0:
             print "Init multiplier system!"
        (conductor,char_nr)=dchar
        self._conductor=conductor
        self._char_nr=char_nr
        self._character = None
        self._level = group.generalised_level()
        if kwargs.has_key('character'):
            if str(type(kwargs['character'])).find('DirichletCharacter')>=0:
                self._character = kwargs['character']
                self._conductor=self._character.conductor()
                self._char_nr=list((self._character).parent()).index(self._character)
        elif group.is_congruence():
            if conductor<=0:
                    self._conductor=group.level(); self._char_nr=0
            if char_nr>=0:
                self._char_nr=char_nr
            
            if self._char_nr==0:
                self._character = trivial_character(self._conductor)
            elif self._char_nr==-1:                
                if self._conductor % 4 == 3:
                    self._character = kronecker_character(-self._conductor)
                elif self._conductor % 4 == 1:
                    self._character = kronecker_character(self._conductor)                    
                assert self._character.conductor()==self._conductor
            elif self._char_nr<=-2:
                self._character = kronecker_character_upside_down(self._conductor)    
            else:
                D = list(DirichletGroup(self._conductor))
                if self._char_nr <0 or self._char_nr>len(D):
                    self._char_nr=0
                self._character = D[self._char_nr]
        else:
            self._conductor = 1
            self._character = trivial_character(1)
        #if not hasattr(self._character,'is_trivial'):
        #    if isinstance(self._character,(int,Integer)) and group.is_congruence():
        #        j = self._character
        #        self._character = DirichletGroup(group.level())[j]
        ## Extract the class name for the reduce algorithm
        self._class_name=str(type(self))[1:-2].split(".")[-1]
        if not isinstance(dimension,(int,Integer)):
            raise ValueError,"Dimension must be integer!"
        self._is_dual = dual
        self._is_trivial=is_trivial and self._character.is_trivial()
        if is_trivial and self._character.order()<=2:
            self._is_real=True
        else:
            self._is_real=False
        self._character_values = [] ## Store for easy access
Esempio n. 3
0
 def set_table_browsing(self, skip=[0, 0], limit=[(2, 16), (1, 50)], keys=['Weight', 'Level'], character=0, dimension_table=None, dimension_fun=dimension_new_cusp_forms, title='Dimension of newforms', check_db=True):
     r"""
     Table of Holomorphic modular forms spaces.
     Skip tells you how many chunks of data you want to skip (from the geginning) and limit tells you how large each chunk is.
     INPUT:
     - dimension_fun should be a function which gives you the desired dimensions, as functions of level N and weight k
     - character = 0 for trivial character and 1 for Kronecker symbol.
       set to 'all' for all characters.
     - check_db=True means, that we will only link to spaces which are in the database
     """
     self._keys = keys
     self._skip = skip
     self._limit = limit
     self._metadata = []
     self._title = ''
     self._cols = []
     self.table = {}
     self._character = character
     emf_logger.debug("skip= {0}".format(self._skip))
     emf_logger.debug("limit= {0}".format(self._limit))
     il = self._keys.index('Level')
     iwt = self._keys.index('Weight')
     level_len = self._limit[il][1] - self._limit[il][0] + 1
     level_ll = self._skip[il] * level_len + self._limit[il][0]
     level_ul = self._skip[il] * level_len + self._limit[il][1]
     wt_len = self._limit[iwt][1] - self._limit[iwt][0] + 1
     wt_ll = self._skip[iwt] * wt_len + self._limit[iwt][0]
     wt_ul = self._skip[iwt] * wt_len + self._limit[iwt][1]
     if level_ll < 1:
         level_l = 1
     self._table = {}
     self._table['rows'] = []
     self._table['col_heads'] = []  # range(wt_ll,wt_ul+1)
     self._table['row_heads'] = []  # range(level_ll,level_ul+1)
     emf_logger.debug("wt_range: {0} -- {1}".format(wt_ll, wt_ul))
     emf_logger.debug("level_range: {0} -- {1}".format(level_ll, level_ul))
     emf_logger.debug("character: {0}".format(character))
     self._table['characters'] = dict()
     if dimension_table is not None:
         dimension_fun = dimension_table.dimension
         is_data_in_db = dimension_table.is_in_db
     else:
         def is_data_in_db(N, k, character):
             return False
     # fixed level
     if level_ll == level_ul:
         N = level_ll
         # specific character =0,1
         if character == 0 or character == 1:
             self._table['rowhead'] = 'Weight'
             if character == 0:
                 xc = DirichletGroup_conrey(N)[1]
             else:
                 D = DirichletGroup_conrey(N)
                 for xc in D:
                     if xc.sage_character() == kronecker_character_upside_down(N):
                         break
             x = xc.sage_character()
             row = dict()
             row['head'] = "\(\chi_{" + str(N) + "}(" + str(xc.number()) + ",\cdot) \)"
             row['url'] = url_character(type='Dirichlet', modulus=N, number=xc.number())
             row['cells'] = list()
             for k in range(wt_ll, wt_ul + 1):
                 if character == 0 and is_odd(k):
                     continue
                 try:
                     if character == 0:
                         d = dimension_fun(N, k)
                     elif character == 1:
                         d = dimension_fun(x, k)
                 except Exception as ex:
                     emf_logger.critical("Exception: {0}. \n Could not compute the dimension with function {0}".format(ex, dimension_fun))
                 if (not check_db) or is_data_in_db(N, k, character):
                     url = url_for(
                         'emf.render_elliptic_modular_forms', level=N, weight=k, character=character)
                 else:
                     url = ''
                 if not k in self._table['col_heads']:
                     self._table['col_heads'].append(k)
                 row['cells'].append({'N': N, 'k': k, 'url': url, 'dim': d})
             self._table['rows'].append(row)
         else:
             D = DirichletGroup(N)
             G = D.galois_orbits()
             Greps = [X[0] for X in G]
             Dc = DirichletGroup_conrey(N)
             Gcreps = dict()
             # A security check, if we have at least weight 2 and trivial character,
             # otherwise don't show anything
             if check_db and not is_data_in_db(N, 2, 0):
                 emf_logger.debug("No data for level {0} and weight 2, trivial character".format(N))
                 self._table = None
                 return None
             Gc = dict()
             for xi, g in enumerate(G):
                 Gc[xi] = list()
             self._table['maxGalCount'] = 0
             for xc in Dc:
                 x = xc.sage_character()
                 xi = G.index(x.galois_orbit())
                 # emf_logger.debug('Dirichlet Character Conrey {0} = sage_char {1}, has
                 # Galois orbit nr. {2}'.format(xc,x,xi))
                 Gc[xi].append(xc)
                 if x == Greps[xi]:
                     Gcreps[xi] = xc
             emf_logger.debug('Gc={0}'.format(Gc))
             for xi in Gc:
                 g = Gc[xi]
                 if len(g) > self._table['maxGalCount']:
                     self._table['maxGalCount'] = len(g)
                 emf_logger.debug('xi,g={0},{1}'.format(xi, g))
                 x = Greps[xi]
                 xc = Gcreps[xi]
                 row = dict()
                 row['head'] = "\(\chi_{" + str(N) + "}(" + str(xc.number()) + ",\cdot) \)"
                 row['url'] = url_character(type='Dirichlet', modulus=N, number=xc.number())
                 row['galois_orbit'] = [
                     {'chi': str(xc.number()),
                      'url': url_character(type='Dirichlet', modulus=N, number=xc.number()) }
                     for xc in g]
                 row['cells'] = []
                 for k in range(wt_ll, wt_ul + 1):
                     if not k in self._table['col_heads']:
                         # emf_logger.debug("Adding to col_heads:{0}s".format(k))
                         self._table['col_heads'].append(k)
                     try:
                         d = dimension_fun(x, k)
                     except Exception as ex:
                         emf_logger.critical("Exception: {0} \n Could not compute the dimension with function {1}".format(ex, dimension_fun))
                     if (not check_db) or is_data_in_db(N, k, xi):
                         url = url_for(
                             'emf.render_elliptic_modular_forms', level=N, weight=k, character=xi)
                     else:
                         url = ''
                     row['cells'].append({'N': N, 'k': k, 'chi': xi, 'url': url, 'dim': d})
                 self._table['rows'].append(row)
     else:
         for k in range(wt_ll, wt_ul + 1):
             if character == 0 and is_odd(k):
                     continue
             row = []
             for N in range(level_ll, level_ul + 1):
                 if not N in self._table['col_heads']:
                     self._table['col_heads'].append(N)
                 try:
                     if character == 0:
                         d = dimension_fun(N, k)
                     elif character == 1:
                         x = kronecker_character_upside_down(N)
                         d = dimension_fun(x, k)
                     else:
                         d = dimension_fun(N, k)
                 except Exception as ex:
                     emf_logger.critical("Exception: {0}. \n Could not compute the dimension with function {0}".format(ex, dimension_fun))
                 # emf_logger.debug("N,k,char,dim: {0},{1},{2},{3}".format(N,k,character,d))
                 if character == 0 or character == 1:
                     if (not check_db) or is_data_in_db(N, k, character):
                         url = url_for(
                             'emf.render_elliptic_modular_forms', level=N, weight=k, character=character)
                     else:
                         url = ''
                 else:
                     url = url_for('emf.render_elliptic_modular_forms', level=N, weight=k)
                 if not k in self._table['row_heads']:
                     self._table['row_heads'].append(k)
                 row.append({'N': N, 'k': k, 'url': url, 'dim': d})
             self._table['rows'].append(row)