Exemplo n.º 1
0
Arquivo: main.py Projeto: cscmnu/lmfdb
def lf_formatfield(coef):
    coef = string2list(coef)
    thefield = WebNumberField.from_coeffs(coef)
    thepoly = '$%s$' % latex(coeff_to_poly(coef))
    if thefield._data is None:
        return thepoly
    return nf_display_knowl(thefield.get_label(), thepoly)
Exemplo n.º 2
0
    def make_torsion_growth(self):
        if self.tor_gro is None:
            self.torsion_growth_data_exists = False
            return
        tor_gro = self.tor_gro
        self.torsion_growth_data_exists = True
        self.tg = tg = {}
        tg['data'] = tgextra = []
        # find all base-changes of this curve in the database, if any
        bcs = list(db.ec_nfcurves.search({'base_change': {'$contains': [self.lmfdb_label]}}, projection='label'))
        bcfs = [lab.split("-")[0] for lab in bcs]
        for F, T in tor_gro.items():
            tg1 = {}
            tg1['bc'] = "Not in database"
            if ":" in F:
                F = F.replace(":",".")
                field_data = nf_display_knowl(F, field_pretty(F))
                deg = int(F.split(".")[0])
                bcc = [x for x,y in zip(bcs, bcfs) if y==F]
                if bcc:
                    from lmfdb.ecnf.main import split_full_label
                    F, NN, I, C = split_full_label(bcc[0])
                    tg1['bc'] = bcc[0]
                    tg1['bc_url'] = url_for('ecnf.show_ecnf', nf=F, conductor_label=NN, class_label=I, number=C)
            else:
                field_data = web_latex_split_on_pm(coeff_to_poly(string2list(F)))
                deg = F.count(",")
            tg1['d'] = deg
            tg1['f'] = field_data
            tg1['t'] = '\(' + ' \\times '.join(['\Z/{}\Z'.format(n) for n in T.split(",")]) + '\)'
            tg1['m'] = 0
            tgextra.append(tg1)

        tgextra.sort(key = lambda x: x['d'])
        tg['n'] = len(tgextra)
        lastd = 1
        for tg1 in tgextra:
            d = tg1['d']
            if d!=lastd:
                tg1['m'] = len([x for x in tgextra if x['d']==d])
                lastd = d

        ## Hard-code this for now.  While something like
        ## max(db.ec_curves.search({},projection='tor_degs')) might
        ## work, since 'tor_degs' is in the extra table it is very
        ## slow.  Note that the *only* place where this number is used
        ## is in the ec-curve template where it says "The number
        ## fields ... of degree up to {{data.tg.maxd}} such that...".
        
        tg['maxd'] = 7
Exemplo n.º 3
0
    def make_torsion_growth(self):
        if self.tor_gro is None:
            self.torsion_growth_data_exists = False
            return
        tor_gro = self.tor_gro
        self.torsion_growth_data_exists = True
        self.tg = tg = {}
        tg['data'] = tgextra = []
        # find all base-changes of this curve in the database, if any
        bcs = list(db.ec_nfcurves.search({'base_change': {'$contains': [self.lmfdb_label]}}, projection='label'))
        bcfs = [lab.split("-")[0] for lab in bcs]
        for F, T in tor_gro.items():
            tg1 = {}
            tg1['bc'] = "Not in database"
            if ":" in F:
                F = F.replace(":",".")
                field_data = nf_display_knowl(F, field_pretty(F))
                deg = int(F.split(".")[0])
                bcc = [x for x,y in zip(bcs, bcfs) if y==F]
                if bcc:
                    from lmfdb.ecnf.main import split_full_label
                    F, NN, I, C = split_full_label(bcc[0])
                    tg1['bc'] = bcc[0]
                    tg1['bc_url'] = url_for('ecnf.show_ecnf', nf=F, conductor_label=NN, class_label=I, number=C)
            else:
                field_data = web_latex_split_on_pm(coeff_to_poly(string2list(F)))
                deg = F.count(",")
            tg1['d'] = deg
            tg1['f'] = field_data
            tg1['t'] = '\(' + ' \\times '.join(['\Z/{}\Z'.format(n) for n in T.split(",")]) + '\)'
            tg1['m'] = 0
            tgextra.append(tg1)

        tgextra.sort(key = lambda x: x['d'])
        tg['n'] = len(tgextra)
        lastd = 1
        for tg1 in tgextra:
            d = tg1['d']
            if d!=lastd:
                tg1['m'] = len([x for x in tgextra if x['d']==d])
                lastd = d
        ## Hard code for now
        #tg['maxd'] = max(db.ec_curves.stats.get_oldstat('torsion_growth')['degrees'])
        tg['maxd'] = 7
Exemplo n.º 4
0
    def make_torsion_growth(self):
        try:
            tor_gro = self.tor_gro
        except AttributeError:  # for curves with norsion growth data
            tor_gro = None
        if tor_gro is None:
            self.torsion_growth_data_exists = False
            return
        self.torsion_growth_data_exists = True
        self.tg = tg = {}
        tg['data'] = tgextra = []
        # find all base-changes of this curve in the database, if any
        bcs = list(
            db.ec_nfcurves.search(
                {'base_change': {
                    '$contains': [self.lmfdb_label]
                }},
                projection='label'))
        bcfs = [lab.split("-")[0] for lab in bcs]
        for F, T in tor_gro.items():
            tg1 = {}
            tg1['bc'] = "Not in database"
            # mongo did not allow "." in a dict key so we changed (e.g.) '3.1.44.1' to '3:1:44:1'
            # Here we change it back (but this code also works in case the fields already use ".")
            F = F.replace(":", ".")
            if "." in F:
                field_data = nf_display_knowl(F, field_pretty(F))
                deg = int(F.split(".")[0])
                bcc = [x for x, y in zip(bcs, bcfs) if y == F]
                if bcc:
                    from lmfdb.ecnf.main import split_full_label
                    F, NN, I, C = split_full_label(bcc[0])
                    tg1['bc'] = bcc[0]
                    tg1['bc_url'] = url_for('ecnf.show_ecnf',
                                            nf=F,
                                            conductor_label=NN,
                                            class_label=I,
                                            number=C)
            else:
                field_data = web_latex(coeff_to_poly(string2list(F)))
                deg = F.count(",")
            tg1['d'] = deg
            tg1['f'] = field_data
            tg1['t'] = '\(' + ' \\times '.join(
                ['\Z/{}\Z'.format(n) for n in T.split(",")]) + '\)'
            tg1['m'] = 0
            tgextra.append(tg1)

        tgextra.sort(key=lambda x: x['d'])
        tg['n'] = len(tgextra)
        lastd = 1
        for tg1 in tgextra:
            d = tg1['d']
            if d != lastd:
                tg1['m'] = len([x for x in tgextra if x['d'] == d])
                lastd = d

        ## Hard-code this for now.  While something like
        ## max(db.ec_curves.search({},projection='tor_degs')) might
        ## work, since 'tor_degs' is in the extra table it is very
        ## slow.  Note that the *only* place where this number is used
        ## is in the ec-curve template where it says "The number
        ## fields ... of degree up to {{data.tg.maxd}} such that...".

        tg['maxd'] = 7