Exemple #1
0
def by_label(label):
    try:
        nflabel = nf_string_to_label(clean_input(label))
        if label != nflabel:
            return redirect(url_for(".by_label", label=nflabel), 301)
        return render_field_webpage({'label': nf_string_to_label(label)})
    except ValueError as err:
        flash(Markup("Error: <span style='color:black'>%s</span> is not a valid number field. %s" % (label,err)), "error")
        bread = [('Global Number Fields', url_for(".number_field_render_webpage")), ('Search Results', ' ')]
        return search_input_error({'err':''}, bread)
Exemple #2
0
def by_label(label):
    try:
        nflabel = nf_string_to_label(clean_input(label))
        if label != nflabel:
            return redirect(url_for(".by_label", label=nflabel), 301)
        return render_field_webpage({'label': nf_string_to_label(label)})
    except ValueError as err:
        flash(Markup("Error: <span style='color:black'>%s</span> is not a valid number field. %s" % (label,err)), "error")
        bread = [('Global Number Fields', url_for(".number_field_render_webpage")), ('Search Results', ' ')]
        return search_input_error({'err':''}, bread)
Exemple #3
0
def show_ecnf(nf, conductor_label, class_label, number):
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        return search_input_error()
    label = "".join(["-".join([nf_label, conductor_label, class_label]), number])
    ec = ECNF.by_label(label)
    bread = [("Elliptic Curves", url_for(".index"))]
    if not ec:
        info = {"query": {}}
        info["err"] = "No elliptic curve in the database has label %s." % label
        return search_input_error(info, bread)

    title = "Elliptic Curve %s over Number Field %s" % (ec.short_label, ec.field.field_pretty())
    bread = [("Elliptic Curves", url_for(".index"))]
    bread.append((ec.field.field_pretty(), ec.urls["field"]))
    bread.append((ec.conductor_label, ec.urls["conductor"]))
    bread.append((ec.iso_label, ec.urls["class"]))
    bread.append((ec.number, ec.urls["curve"]))
    info = {}

    return render_template(
        "show-ecnf.html",
        credit=ecnf_credit,
        title=title,
        bread=bread,
        ec=ec,
        #        properties = ec.properties,
        properties2=ec.properties,
        friends=ec.friends,
        info=info,
        learnmore=learnmore_list(),
    )
Exemple #4
0
def show_ecnf_isoclass(nf, conductor_label, class_label):
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        return search_input_error()
    conductor_label = unquote(conductor_label)
    label = "-".join([nf_label, conductor_label, class_label])
    full_class_label = "-".join([conductor_label, class_label])
    cl = ECNF_isoclass.by_label(label)
    title = "Elliptic Curve isogeny class %s over Number Field %s" % (full_class_label, cl.field)
    bread = [("Elliptic Curves", url_for(".index"))]
    bread.append((cl.field, url_for(".show_ecnf1", nf=nf_label)))
    bread.append((conductor_label, url_for(".show_ecnf_conductor", nf=nf_label, conductor_label=conductor_label)))
    bread.append(
        (
            class_label,
            url_for(
                ".show_ecnf_isoclass", nf=nf_label, conductor_label=quote(conductor_label), class_label=class_label
            ),
        )
    )
    info = {}
    return render_template(
        "show-ecnf-isoclass.html",
        credit=ecnf_credit,
        title=title,
        bread=bread,
        cl=cl,
        properties2=cl.properties,
        friends=cl.friends,
        learnmore=learnmore_list(),
    )
Exemple #5
0
def show_ecnf(nf, conductor_label, class_label, number):
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        return search_input_error()
    label = "".join(["-".join([nf_label, conductor_label, class_label]), number])
    ec = ECNF.by_label(label)
    bread = [("Elliptic Curves", url_for(".index"))]
    if not ec:
        info = {'query':{}}
        info['err'] = 'No elliptic curve in the database has label %s.' % label
        return search_input_error(info, bread)

    title = "Elliptic Curve %s over Number Field %s" % (ec.short_label, ec.field.field_pretty())
    bread = [("Elliptic Curves", url_for(".index"))]
    bread.append((ec.field.field_pretty(), ec.urls['field']))
    bread.append((ec.conductor_label, ec.urls['conductor']))
    bread.append((ec.iso_label, ec.urls['class']))
    bread.append((ec.number, ec.urls['curve']))
    code = ec.code()
    code['show'] = {'magma':'','pari':'','sage':''} # use default show names
    info = {}
    return render_template("show-ecnf.html",
                           credit=ecnf_credit,
                           title=title,
                           bread=bread,
                           ec=ec,
                           code = code,
                           #        properties = ec.properties,
                           properties2=ec.properties,
                           friends=ec.friends,
                           info=info,
                           learnmore=learnmore_list())
Exemple #6
0
def show_ecnf_isoclass(nf, conductor_label, class_label):
    conductor_label = unquote(conductor_label)
    if re.match(OLD_COND_RE, conductor_label):
        conductor_label = '.'.join(conductor_label[1:-1].split(','))
        return redirect(url_for('.show_ecnf_isoclass',nf=nf,conductor_label=conductor_label,class_label=class_label),301)
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        return search_input_error()
    label = "-".join([nf_label, conductor_label, class_label])
    full_class_label = "-".join([conductor_label, class_label])
    cl = ECNF_isoclass.by_label(label)
    bread = [("Elliptic Curves", url_for(".index"))]
    if not isinstance(cl, ECNF_isoclass):
        info = {'query':{}, 'err':'No elliptic curve isogeny class in the database has label %s.' % label}
        return search_input_error(info, bread)
    title = "Elliptic Curve isogeny class %s over Number Field %s" % (full_class_label, cl.field)
    bread.append((cl.field, url_for(".show_ecnf1", nf=nf_label)))
    bread.append((conductor_label, url_for(".show_ecnf_conductor", nf=nf_label, conductor_label=conductor_label)))
    bread.append((class_label, url_for(".show_ecnf_isoclass", nf=nf_label, conductor_label=quote(conductor_label), class_label=class_label)))
    return render_template("ecnf-isoclass.html",
                           credit=ecnf_credit,
                           title=title,
                           bread=bread,
                           cl=cl,
                           properties2=cl.properties,
                           friends=cl.friends,
                           learnmore=learnmore_list())
Exemple #7
0
def show_ecnf(nf, conductor_label, class_label, number):
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        return search_input_error()
    label = "".join(
        ["-".join([nf_label, conductor_label, class_label]), number])
    ec = ECNF.by_label(label)
    bread = [("Elliptic Curves", url_for(".index"))]
    if not ec:
        info = {'query': {}}
        info['err'] = 'No elliptic curve in the database has label %s.' % label
        return search_input_error(info, bread)

    title = "Elliptic Curve %s over Number Field %s" % (
        ec.short_label, ec.field.field_pretty())
    bread = [("Elliptic Curves", url_for(".index"))]
    bread.append((ec.field.field_pretty(), ec.urls['field']))
    bread.append((ec.conductor_label, ec.urls['conductor']))
    bread.append((ec.iso_label, ec.urls['class']))
    bread.append((ec.number, ec.urls['curve']))
    info = {}

    return render_template(
        "show-ecnf.html",
        credit=ecnf_credit,
        title=title,
        bread=bread,
        ec=ec,
        #        properties = ec.properties,
        properties2=ec.properties,
        friends=ec.friends,
        info=info,
        learnmore=learnmore_list())
Exemple #8
0
def show_ecnf_isoclass(nf, conductor_label, class_label):
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        return search_input_error()
    conductor_label = unquote(conductor_label)
    label = "-".join([nf_label, conductor_label, class_label])
    full_class_label = "-".join([conductor_label, class_label])
    cl = ECNF_isoclass.by_label(label)
    title = "Elliptic Curve isogeny class %s over Number Field %s" % (
        full_class_label, cl.field)
    bread = [("Elliptic Curves", url_for(".index"))]
    bread.append((cl.field, url_for(".show_ecnf1", nf=nf_label)))
    bread.append((conductor_label,
                  url_for(".show_ecnf_conductor",
                          nf=nf_label,
                          conductor_label=conductor_label)))
    bread.append((class_label,
                  url_for(".show_ecnf_isoclass",
                          nf=nf_label,
                          conductor_label=quote(conductor_label),
                          class_label=class_label)))
    info = {}
    return render_template("show-ecnf-isoclass.html",
                           credit=ecnf_credit,
                           title=title,
                           bread=bread,
                           cl=cl,
                           properties2=cl.properties,
                           friends=cl.friends,
                           learnmore=learnmore_list())
Exemple #9
0
def show_ecnf_isoclass(nf, conductor_label, class_label):
    conductor_label = unquote(conductor_label)
    conductor_label = convert_IQF_label(nf,conductor_label)
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        return search_input_error()
    label = "-".join([nf_label, conductor_label, class_label])
    full_class_label = "-".join([conductor_label, class_label])
    cl = ECNF_isoclass.by_label(label)
    bread = [("Elliptic Curves", url_for(".index"))]
    if not isinstance(cl, ECNF_isoclass):
        info = {'query':{}, 'err':'No elliptic curve isogeny class in the database has label %s.' % label}
        return search_input_error(info, bread)
    title = "Elliptic Curve isogeny class %s over Number Field %s" % (full_class_label, cl.field)
    bread.append((cl.field, url_for(".show_ecnf1", nf=nf_label)))
    bread.append((conductor_label, url_for(".show_ecnf_conductor", nf=nf_label, conductor_label=conductor_label)))
    bread.append((class_label, url_for(".show_ecnf_isoclass", nf=nf_label, conductor_label=quote(conductor_label), class_label=class_label)))
    return render_template("ecnf-isoclass.html",
                           credit=ecnf_credit,
                           title=title,
                           bread=bread,
                           cl=cl,
                           properties2=cl.properties,
                           friends=cl.friends,
                           learnmore=learnmore_list())
Exemple #10
0
def show_ecnf1(nf):
    if nf == "1.1.1.1":
        return redirect(url_for("ec.rational_elliptic_curves", **request.args))
    if request.args:
        return elliptic_curve_search(data=request.args)
    start = 0
    count = 50
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        return search_input_error()
    query = {'field_label': nf_label}
    cursor = db_ecnf().find(query)
    nres = cursor.count()
    if (start >= nres):
        start -= (1 + (start - nres) / count) * count
    if (start < 0):
        start = 0

    res = cursor.sort([('field_label', ASC), ('conductor_norm', ASC),
                       ('conductor_label', ASC), ('iso_nlabel', ASC),
                       ('number', ASC)]).skip(start).limit(count)

    bread = [('Elliptic Curves', url_for(".index")),
             (nf_label, url_for('.show_ecnf1', nf=nf_label))]

    res = list(res)
    for e in res:
        e['field_knowl'] = nf_display_knowl(e['field_label'],
                                            getDBConnection(),
                                            field_pretty(e['field_label']))
    info = {}
    info['field'] = nf_label
    info['query'] = query
    info['curves'] = res  # [ECNF(e) for e in res]
    info['number'] = nres
    info['start'] = start
    info['count'] = count
    info['more'] = int(start + count < nres)
    info['field_pretty'] = field_pretty
    info['web_ainvs'] = web_ainvs
    #don't risk recomputing all the ecnf stats just to show curves for a single number field
    #if nf_label:
    #info['stats'] = ecnf_field_summary(nf_label)
    if nres == 1:
        info['report'] = 'unique match'
    else:
        if nres > count or start != 0:
            info['report'] = 'displaying matches %s-%s of %s' % (
                start + 1, min(nres, start + count), nres)
        else:
            info['report'] = 'displaying all %s matches' % nres
    t = 'Elliptic Curves over %s' % field_pretty(nf_label)
    return render_template("ecnf-search-results.html",
                           info=info,
                           credit=ecnf_credit,
                           bread=bread,
                           title=t,
                           learnmore=learnmore_list())
Exemple #11
0
def by_label(label):
    try:
        return render_field_webpage({'label': nf_string_to_label(label)})
    except ValueError:
        bread = [('Global Number Fields',
                  url_for(".number_field_render_webpage")),
                 ('Search results', ' ')]
        return search_input_error({'err': ''}, bread)
Exemple #12
0
def get_nf_info(lab):
    r""" extract number field label from string and pretty"""
    try:
        label = nf_string_to_label(lab)
        pretty = field_pretty (label)
    except ValueError as err:
        flash(Markup("Error: <span style='color:black'>%s</span> is not a valid number field. %s" % (lab,err)), "error")
        raise ValueError
    return label, pretty
Exemple #13
0
def get_nf_info(lab):
    r""" extract number field label from string and pretty"""
    try:
        label = nf_string_to_label(lab)
        pretty = field_pretty (label)
    except ValueError as err:
        flash(Markup("Error: <span style='color:black'>%s</span> is not a valid number field. %s" % (lab,err)), "error")
        raise ValueError
    return label, pretty
Exemple #14
0
def show_ecnf_conductor(nf, conductor_label):
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        return search_input_error()
    return elliptic_curve_search(data={
        'nf_label': nf_label,
        'conductor_label': quote(conductor_label)
    },
                                 **request.args)
Exemple #15
0
def show_ecnf(nf, conductor_label, class_label, number):
    conductor_label = unquote(conductor_label)
    if re.match(OLD_COND_RE, conductor_label):
        conductor_label = '.'.join(conductor_label[1:-1].split(','))
        return redirect(
            url_for('.show_ecnf',
                    nf=nf,
                    conductor_label=conductor_label,
                    class_label=class_label,
                    number=number), 301)
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        return search_input_error()
    label = "".join(
        ["-".join([nf_label, conductor_label, class_label]), number])
    ec = ECNF.by_label(label)
    bread = [("Elliptic Curves", url_for(".index"))]
    if not ec:
        info = {'query': {}}
        info['err'] = 'No elliptic curve in the database has label %s.' % label
        return search_input_error(info, bread)

    title = "Elliptic Curve %s over Number Field %s" % (
        ec.short_label, ec.field.field_pretty())
    bread = [("Elliptic Curves", url_for(".index"))]
    bread.append((ec.field.field_pretty(), ec.urls['field']))
    bread.append((ec.conductor_label, ec.urls['conductor']))
    bread.append((ec.iso_label, ec.urls['class']))
    bread.append((ec.number, ec.urls['curve']))
    code = ec.code()
    code['show'] = {
        'magma': '',
        'pari': '',
        'sage': ''
    }  # use default show names
    info = {}
    return render_template(
        "ecnf-curve.html",
        credit=ecnf_credit,
        title=title,
        bread=bread,
        ec=ec,
        code=code,
        #        properties = ec.properties,
        properties2=ec.properties,
        friends=ec.friends,
        info=info,
        learnmore=learnmore_list())
Exemple #16
0
def show_ecnf1(nf):
    if nf == "1.1.1.1":
        return redirect(url_for("ec.rational_elliptic_curves", **request.args))
    if request.args:
        return elliptic_curve_search(data=request.args)
    start = 0
    count = 50
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        return search_input_error()
    query = {'field_label': nf_label}
    cursor = db_ecnf().find(query)
    nres = cursor.count()
    if(start >= nres):
        start -= (1 + (start - nres) / count) * count
    if(start < 0):
        start = 0

    res = cursor.sort([('field_label', ASC), ('conductor_norm', ASC), ('conductor_label', ASC), ('iso_nlabel', ASC), ('number', ASC)]).skip(start).limit(count)

    bread = [('Elliptic Curves', url_for(".index")),
             (nf_label, url_for('.show_ecnf1', nf=nf_label))]

    res = list(res)
    for e in res:
        e['field_knowl'] = nf_display_knowl(e['field_label'], getDBConnection(), field_pretty(e['field_label']))
    info = {}
    info['field'] = nf_label
    info['query'] = query
    info['curves'] = res  # [ECNF(e) for e in res]
    info['number'] = nres
    info['start'] = start
    info['count'] = count
    info['more'] = int(start + count < nres)
    info['field_pretty'] = field_pretty
    info['web_ainvs'] = web_ainvs
    #don't risk recomputing all the ecnf stats just to show curves for a single number field
    #if nf_label:
        #info['stats'] = ecnf_field_summary(nf_label)
    if nres == 1:
        info['report'] = 'unique match'
    else:
        if nres > count or start != 0:
            info['report'] = 'displaying matches %s-%s of %s' % (start + 1, min(nres, start + count), nres)
        else:
            info['report'] = 'displaying all %s matches' % nres
    t = 'Elliptic Curves over %s' % field_pretty(nf_label)
    return render_template("ecnf-search-results.html", info=info, credit=ecnf_credit, bread=bread, title=t, learnmore=learnmore_list())
Exemple #17
0
def download_ECNF_all(nf,conductor_label,class_label,number):
    conductor_label = unquote(conductor_label)
    conductor_label = convert_IQF_label(nf,conductor_label)
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        return search_input_error()
    label = "".join(["-".join([nf_label, conductor_label, class_label]), number])
    data = db.ec_nfcurves.lookup(label)
    if data is None:
        return search_input_error()

    response = make_response(Json.dumps(data))
    response.headers['Content-type'] = 'text/plain'
    return response
Exemple #18
0
def download_ECNF_all(nf,conductor_label,class_label,number):
    conductor_label = unquote(conductor_label)
    conductor_label = convert_IQF_label(nf,conductor_label)
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        return search_input_error()
    label = "".join(["-".join([nf_label, conductor_label, class_label]), number])
    data = db.ec_nfcurves.lookup(label)
    if data is None:
        return search_input_error()

    response = make_response(Json.dumps(data))
    response.headers['Content-type'] = 'text/plain'
    return response
Exemple #19
0
def download_ECNF_all(nf,conductor_label,class_label,number):
    conductor_label = unquote(conductor_label)
    conductor_label = convert_IQF_label(nf,conductor_label)
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        return search_input_error()
    label = "".join(["-".join([nf_label, conductor_label, class_label]), number])
    data = db_ecnf().find_one({'label':label}, {'_id':False})
    if data is None:
        return search_input_error()

    import json
    response = make_response(json.dumps(data))
    response.headers['Content-type'] = 'text/plain'
    return response
Exemple #20
0
def download_ECNF_all(nf,conductor_label,class_label,number):
    conductor_label = unquote(conductor_label)
    conductor_label = convert_IQF_label(nf,conductor_label)
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        return search_input_error()
    label = "".join(["-".join([nf_label, conductor_label, class_label]), number])
    data = db_ecnf().find_one({'label':label}, {'_id':False})
    if data is None:
        return search_input_error()

    import json
    response = make_response(json.dumps(data))
    response.headers['Content-type'] = 'text/plain'
    return response
Exemple #21
0
def ecnf_simple_label_search(search, baseurl, label):

    label_bits = label.split('/')
    try:
        nf = label_bits[0]
        conductor_label = label_bits[1]
        class_label = label_bits[2]
        number = label_bits[3]
    except IndexError:
        search['query'] = {'label': 'dummy'}
        return

    conductor_label = unquote(conductor_label)
    conductor_label = convert_IQF_label(nf, conductor_label)
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        search['query'] = {'label': 'dummy'}
        return

    label = "".join(
        ["-".join([nf_label, conductor_label, class_label]), number])

    search['query'] = {'label': label}
Exemple #22
0
def bmf_field_dim_table(**args):
    argsdict = to_dict(args)
    argsdict.update(to_dict(request.args))
    gl_or_sl = argsdict['gl_or_sl']

    field_label = argsdict['field_label']
    field_label = nf_string_to_label(field_label)

    start = 0
    if 'start' in argsdict:
        start = int(argsdict['start'])

    info = {}
    info['gl_or_sl'] = gl_or_sl
    # level_flag controls whether to list all levels ('all'), only
    # those with positive cuspidal dimension ('cusp'), or only those
    # with positive new dimension ('new').  Default is 'cusp'.
    level_flag = argsdict.get('level_flag', 'cusp')
    info['level_flag'] = level_flag
    count = 50
    if 'count' in argsdict:
        count = int(argsdict['count'])

    pretty_field_label = field_pretty(field_label)
    bread = [('Bianchi Modular Forms', url_for(".index")),
             (pretty_field_label, ' ')]
    properties = []
    if gl_or_sl == 'gl2_dims':
        info['group'] = 'GL(2)'
        info['bgroup'] = '\GL(2,\mathcal{O}_K)'
    else:
        info['group'] = 'SL(2)'
        info['bgroup'] = '\SL(2,\mathcal{O}_K)'
    t = ' '.join([
        'Dimensions of spaces of {} Bianchi modular forms over'.format(
            info['group']), pretty_field_label
    ])
    query = {}
    query['field_label'] = field_label
    query[gl_or_sl] = {'$exists': True}
    if level_flag != 'all':
        # find which weights are present (TODO: get this from a stats collection)
        wts = list(
            sum((Set(d.keys()) for d in db_dims().distinct(gl_or_sl)), Set()))
    if level_flag == 'cusp':
        # restrict the query to only return levels where at least one
        # cuspidal dimension is positive:
        query.update({
            '$or': [{
                gl_or_sl + '.{}.cuspidal_dim'.format(w): {
                    '$gt': 0
                }
            } for w in wts]
        })
    if level_flag == 'new':
        # restrict the query to only return levels where at least one
        # new dimension is positive:
        query.update({
            '$or': [{
                gl_or_sl + '.{}.new_dim'.format(w): {
                    '$gt': 0
                }
            } for w in wts]
        })
    data = db_dims().find(query)
    data = data.sort([('level_norm', ASCENDING)])
    info['number'] = nres = data.count()
    if nres > count or start != 0:
        info['report'] = 'Displaying items %s-%s of %s levels,' % (
            start + 1, min(nres, start + count), nres)
    else:
        info['report'] = 'Displaying all %s levels,' % nres

    data = list(data.skip(start).limit(count))
    info['field'] = field_label
    info['field_pretty'] = pretty_field_label
    nf = WebNumberField(field_label)
    info['base_galois_group'] = nf.galois_string()
    info['field_degree'] = nf.degree()
    info['field_disc'] = str(nf.disc())
    info['field_poly'] = teXify_pol(str(nf.poly()))
    weights = set()
    for dat in data:
        weights = weights.union(set(dat[gl_or_sl].keys()))
    weights = list([int(w) for w in weights])
    weights.sort()
    info['weights'] = weights
    info['nweights'] = len(weights)
    info['count'] = count
    info['start'] = start
    info['more'] = int(start + count < nres)

    dims = {}
    for dat in data:
        dims[dat['level_label']] = d = {}
        for w in weights:
            sw = str(w)
            if sw in dat[gl_or_sl]:
                d[w] = {
                    'd': dat[gl_or_sl][sw]['cuspidal_dim'],
                    'n': dat[gl_or_sl][sw]['new_dim']
                }
            else:
                d[w] = {'d': '?', 'n': '?'}
    info['nlevels'] = len(data)
    dimtable = [{
        'level_label':
        dat['level_label'],
        'level_norm':
        dat['level_norm'],
        'level_space':
        url_for(".render_bmf_space_webpage",
                field_label=field_label,
                level_label=dat['level_label'])
        if gl_or_sl == 'gl2_dims' else "",
        'dims':
        dims[dat['level_label']]
    } for dat in data]
    print("Length of dimtable = {}".format(len(dimtable)))
    info['dimtable'] = dimtable
    return render_template("bmf-field_dim_table.html",
                           info=info,
                           title=t,
                           properties=properties,
                           bread=bread)
def bmf_field_dim_table(**args):
    argsdict = to_dict(args)
    argsdict.update(to_dict(request.args))
    gl_or_sl = argsdict['gl_or_sl']

    field_label=argsdict['field_label']
    field_label = nf_string_to_label(field_label)

    start = 0
    if 'start' in argsdict:
        start = int(argsdict['start'])

    info={}
    info['gl_or_sl'] = gl_or_sl
    # level_flag controls whether to list all levels ('all'), only
    # those with positive cuspidal dimension ('cusp'), or only those
    # with positive new dimension ('new').  Default is 'cusp'.
    level_flag = argsdict.get('level_flag', 'cusp')
    info['level_flag'] = level_flag
    count = 50
    if 'count' in argsdict:
        count = int(argsdict['count'])

    pretty_field_label = field_pretty(field_label)
    bread = [('Bianchi Modular Forms', url_for(".index")), (
        pretty_field_label, ' ')]
    properties = []
    if gl_or_sl=='gl2_dims':
        info['group'] = 'GL(2)'
        info['bgroup'] = '\GL(2,\mathcal{O}_K)'
    else:
        info['group'] = 'SL(2)'
        info['bgroup'] = '\SL(2,\mathcal{O}_K)'
    t = ' '.join(['Dimensions of Spaces of {} Bianchi Modular Forms over'.format(info['group']), pretty_field_label])
    query = {}
    query['field_label'] = field_label
    query[gl_or_sl] = {'$exists': True}
    data = db_dims().find(query)
    data = data.sort([('level_norm', ASCENDING)])
    info['number'] = nres = data.count()
    if nres > count or start != 0:
        info['report'] = 'Displaying items %s-%s of %s levels,' % (start + 1, min(nres, start + count), nres)
    else:
        info['report'] = 'Displaying all %s levels,' % nres

    # convert data to a list and eliminate levels where all
    # new/cuspidal dimensions are 0.  (This could be done at the
    # search stage, but that requires adding new fields to each
    # record.)
    def filter(dat, flag):
        dat1 = dat[gl_or_sl]
        return any([int(dat1[w][flag])>0 for w in dat1])
    flag = 'cuspidal_dim' if level_flag=='cusp' else 'new_dim'
    data = [dat for dat in data if level_flag == 'all' or filter(dat, flag)]

    data = data[start:start+count]
    info['field'] = field_label
    info['field_pretty'] = pretty_field_label
    nf = WebNumberField(field_label)
    info['base_galois_group'] = nf.galois_string()
    info['field_degree'] = nf.degree()
    info['field_disc'] = str(nf.disc())
    info['field_poly'] = teXify_pol(str(nf.poly()))
    weights = set()
    for dat in data:
        weights = weights.union(set(dat[gl_or_sl].keys()))
    weights = list([int(w) for w in weights])
    weights.sort()
    info['weights'] = weights
    info['nweights'] = len(weights)
    info['count'] = count
    info['start'] = start
    info['more'] = int(start + count < nres)

    data.sort(key = lambda x: [int(y) for y in x['level_label'].split(".")])
    dims = {}
    for dat in data:
        dims[dat['level_label']] = d = {}
        for w in weights:
            sw = str(w)
            if sw in dat[gl_or_sl]:
                d[w] = {'d': dat[gl_or_sl][sw]['cuspidal_dim'],
                        'n': dat[gl_or_sl][sw]['new_dim']}
            else:
                d[w] = {'d': '?', 'n': '?'}
    info['nlevels'] = len(data)
    dimtable = [{'level_label': dat['level_label'],
                 'level_norm': dat['level_norm'],
                 'level_space': url_for(".render_bmf_space_webpage", field_label=field_label, level_label=dat['level_label']) if gl_or_sl=='gl2_dims' else "",
                  'dims': dims[dat['level_label']]} for dat in data]
    info['dimtable'] = dimtable
    return render_template("bmf-field_dim_table.html", info=info, title=t, properties=properties, bread=bread)
def by_label(label):
    try:
        return render_field_webpage({'label': nf_string_to_label(label)})
    except ValueError:
        bread = [('Global Number Fields', url_for(".number_field_render_webpage")), ('Search results', ' ')]
        return search_input_error({'err':''}, bread)
def bmf_field_dim_table(**args):
    argsdict = to_dict(args)
    argsdict.update(to_dict(request.args))
    gl_or_sl = argsdict['gl_or_sl']

    field_label=argsdict['field_label']
    field_label = nf_string_to_label(field_label)

    start = 0
    if 'start' in argsdict:
        start = int(argsdict['start'])

    info={}
    info['gl_or_sl'] = gl_or_sl
    # level_flag controls whether to list all levels ('all'), only
    # those with positive cuspidal dimension ('cusp'), or only those
    # with positive new dimension ('new').  Default is 'cusp'.
    level_flag = argsdict.get('level_flag', 'cusp')
    info['level_flag'] = level_flag
    count = 50
    if 'count' in argsdict:
        count = int(argsdict['count'])

    pretty_field_label = field_pretty(field_label)
    bread = [('Bianchi Modular Forms', url_for(".index")), (
        pretty_field_label, ' ')]
    properties = []
    if gl_or_sl=='gl2_dims':
        info['group'] = 'GL(2)'
        info['bgroup'] = '\GL(2,\mathcal{O}_K)'
    else:
        info['group'] = 'SL(2)'
        info['bgroup'] = '\SL(2,\mathcal{O}_K)'
    t = ' '.join(['Dimensions of spaces of {} Bianchi modular forms over'.format(info['group']), pretty_field_label])
    query = {}
    query['field_label'] = field_label
    query[gl_or_sl] = {'$exists': True}
    if level_flag != 'all':
        # find which weights are present (TODO: get this from a stats collection)
        wts = list(sum((Set(d.keys()) for d in db_dims().distinct(gl_or_sl)),Set()))
    if level_flag == 'cusp':
        # restrict the query to only return levels where at least one
        # cuspidal dimension is positive:
        query.update(
            {'$or':[{gl_or_sl+'.{}.cuspidal_dim'.format(w):{'$gt':0}} for w in wts]}
        )
    if level_flag == 'new':
        # restrict the query to only return levels where at least one
        # new dimension is positive:
        query.update(
            {'$or':[{gl_or_sl+'.{}.new_dim'.format(w):{'$gt':0}} for w in wts]}
        )
    data = db_dims().find(query)
    data = data.sort([('level_norm', ASCENDING)])
    info['number'] = nres = data.count()
    if nres > count or start != 0:
        info['report'] = 'Displaying items %s-%s of %s levels,' % (start + 1, min(nres, start + count), nres)
    else:
        info['report'] = 'Displaying all %s levels,' % nres

    data = list(data.skip(start).limit(count))
    info['field'] = field_label
    info['field_pretty'] = pretty_field_label
    nf = WebNumberField(field_label)
    info['base_galois_group'] = nf.galois_string()
    info['field_degree'] = nf.degree()
    info['field_disc'] = str(nf.disc())
    info['field_poly'] = teXify_pol(str(nf.poly()))
    weights = set()
    for dat in data:
        weights = weights.union(set(dat[gl_or_sl].keys()))
    weights = list([int(w) for w in weights])
    weights.sort()
    info['weights'] = weights
    info['nweights'] = len(weights)
    info['count'] = count
    info['start'] = start
    info['more'] = int(start + count < nres)

    dims = {}
    for dat in data:
        dims[dat['level_label']] = d = {}
        for w in weights:
            sw = str(w)
            if sw in dat[gl_or_sl]:
                d[w] = {'d': dat[gl_or_sl][sw]['cuspidal_dim'],
                        'n': dat[gl_or_sl][sw]['new_dim']}
            else:
                d[w] = {'d': '?', 'n': '?'}
    info['nlevels'] = len(data)
    dimtable = [{'level_label': dat['level_label'],
                 'level_norm': dat['level_norm'],
                 'level_space': url_for(".render_bmf_space_webpage", field_label=field_label, level_label=dat['level_label']) if gl_or_sl=='gl2_dims' else "",
                  'dims': dims[dat['level_label']]} for dat in data]
    print("Length of dimtable = {}".format(len(dimtable)))
    info['dimtable'] = dimtable
    return render_template("bmf-field_dim_table.html", info=info, title=t, properties=properties, bread=bread)
Exemple #26
0
def show_ecnf_conductor(nf, conductor_label):
    try:
        nf_label = nf_string_to_label(nf)
    except ValueError:
        return search_input_error()
    return elliptic_curve_search(data={'nf_label': nf_label, 'conductor_label': quote(conductor_label)}, **request.args)
Exemple #27
0
def by_label(label):
    try:
        return render_field_webpage({"label": nf_string_to_label(label)})
    except ValueError:
        bread = [("Global Number Fields", url_for(".number_field_render_webpage")), ("Search results", " ")]
        return search_input_error({"err": ""}, bread)
def bmf_field_dim_table(**args):
    argsdict = to_dict(args)
    argsdict.update(to_dict(request.args))
    gl_or_sl = argsdict['gl_or_sl']

    field_label=argsdict['field_label']
    field_label = nf_string_to_label(field_label)

    start = 0
    if 'start' in argsdict:
        start = int(argsdict['start'])

    info={}
    info['gl_or_sl'] = gl_or_sl
    # level_flag controls whether to list all levels ('all'), only
    # those with positive cuspidal dimension ('cusp'), or only those
    # with positive new dimension ('new').  Default is 'cusp'.
    level_flag = argsdict.get('level_flag', 'cusp')
    info['level_flag'] = level_flag
    count = 50
    if 'count' in argsdict:
        count = int(argsdict['count'])

    pretty_field_label = field_pretty(field_label)
    bread = [('Bianchi Modular Forms', url_for(".index")), (
        pretty_field_label, ' ')]
    properties = []
    if gl_or_sl=='gl2_dims':
        info['group'] = 'GL(2)'
        info['bgroup'] = '\GL(2,\mathcal{O}_K)'
    else:
        info['group'] = 'SL(2)'
        info['bgroup'] = '\SL(2,\mathcal{O}_K)'
    t = ' '.join(['Dimensions of spaces of {} Bianchi modular forms over'.format(info['group']), pretty_field_label])
    query = {}
    query['field_label'] = field_label
    query[gl_or_sl] = {'$exists': True}
    data = db_dims().find(query)
    data = data.sort([('level_norm', ASCENDING)])
    info['number'] = nres = data.count()
    if nres > count or start != 0:
        info['report'] = 'Displaying items %s-%s of %s levels,' % (start + 1, min(nres, start + count), nres)
    else:
        info['report'] = 'Displaying all %s levels,' % nres

    # convert data to a list and eliminate levels where all
    # new/cuspidal dimensions are 0.  (This could be done at the
    # search stage, but that requires adding new fields to each
    # record.)
    def filter(dat, flag):
        dat1 = dat[gl_or_sl]
        return any([int(dat1[w][flag])>0 for w in dat1])
    flag = 'cuspidal_dim' if level_flag=='cusp' else 'new_dim'
    data = [dat for dat in data if level_flag == 'all' or filter(dat, flag)]

    data = data[start:start+count]
    info['field'] = field_label
    info['field_pretty'] = pretty_field_label
    nf = WebNumberField(field_label)
    info['base_galois_group'] = nf.galois_string()
    info['field_degree'] = nf.degree()
    info['field_disc'] = str(nf.disc())
    info['field_poly'] = teXify_pol(str(nf.poly()))
    weights = set()
    for dat in data:
        weights = weights.union(set(dat[gl_or_sl].keys()))
    weights = list([int(w) for w in weights])
    weights.sort()
    info['weights'] = weights
    info['nweights'] = len(weights)
    info['count'] = count
    info['start'] = start
    info['more'] = int(start + count < nres)

    data.sort(key = lambda x: [int(y) for y in x['level_label'].split(".")])
    dims = {}
    for dat in data:
        dims[dat['level_label']] = d = {}
        for w in weights:
            sw = str(w)
            if sw in dat[gl_or_sl]:
                d[w] = {'d': dat[gl_or_sl][sw]['cuspidal_dim'],
                        'n': dat[gl_or_sl][sw]['new_dim']}
            else:
                d[w] = {'d': '?', 'n': '?'}
    info['nlevels'] = len(data)
    dimtable = [{'level_label': dat['level_label'],
                 'level_norm': dat['level_norm'],
                 'level_space': url_for(".render_bmf_space_webpage", field_label=field_label, level_label=dat['level_label']) if gl_or_sl=='gl2_dims' else "",
                  'dims': dims[dat['level_label']]} for dat in data]
    info['dimtable'] = dimtable
    return render_template("bmf-field_dim_table.html", info=info, title=t, properties=properties, bread=bread)