• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python cremona.class_to_int函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sage.databases.cremona.class_to_int函数的典型用法代码示例。如果您正苦于以下问题:Python class_to_int函数的具体用法?Python class_to_int怎么用?Python class_to_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了class_to_int函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: cmp_label

def cmp_label(lab1, lab2):
    from sage.databases.cremona import parse_cremona_label, class_to_int
    a, b, c = parse_cremona_label(lab1)
    id1 = int(a), class_to_int(b), int(c)
    a, b, c = parse_cremona_label(lab2)
    id2 = int(a), class_to_int(b), int(c)
    return cmp(id1, id2)
开发者ID:sibilant,项目名称:lmfdb,代码行数:7,代码来源:elliptic_curve.py


示例2: encode_hecke_orbit

def encode_hecke_orbit(label):
    level, weight, char_orbit_label, hecke_orbit_label = label.split('.')
    level = int(level)
    weight = int(weight)
    char_orbit = class_to_int(char_orbit_label)
    hecke_orbit = class_to_int(hecke_orbit_label)
    return level + (weight << 24) + (char_orbit << 36) + (hecke_orbit << 52)
开发者ID:davidfarmer,项目名称:lmfdb,代码行数:7,代码来源:web_newform.py


示例3: add_numeric_iso_labels

def add_numeric_iso_labels(min_conductor_norm=0, max_conductor_norm=None, fix=False):
    r""" One-off utility to add a numeric conversion of the letter-coded
    class labels 'a'->0', 'z'->25, 'ba'->26, etc. for sorting
    purposes.
    """
    from sage.databases.cremona import class_to_int
    count = 0
    query = {}
    query['conductor_norm'] = {'$gte' : int(min_conductor_norm)}
    if max_conductor_norm:
        query['conductor_norm']['$lte'] = int(max_conductor_norm)
    else:
        max_conductor_norm = oo
    curves_to_fix = nfcurves.find(query)
    print("%s curves to examine of conductor norm between %s and %s."
          % (curves_to_fix.count(),min_conductor_norm,max_conductor_norm))
    for c in curves_to_fix:
        count = count+1
        if count%100==0: print("%s: %s" % (count, c['label']))
        fix_data = {}
        lab = c['iso_label']
        if 'CM' in lab:
            nlab = -1 - class_to_int(lab[2:])
            print("converting label %s to %s" % (lab, nlab))
        else:
            nlab = class_to_int(lab.lower())
        fix_data['iso_nlabel'] = nlab
        #print("using fixed data %s for form %s" % (fix_data,c['label']))
        if fix:
            nfcurves.update_one({'_id': c['_id']}, {"$set": fix_data}, upsert=True)
开发者ID:sehlen,项目名称:lmfdb,代码行数:30,代码来源:hmf_check_find.py


示例4: extended_class_to_int

def extended_class_to_int(k):
    if k == 'a':
        return 0
    elif k[0] == 'a':
        return -class_to_int(k[1:])
    else:
        return class_to_int(k)
开发者ID:haraldschilly,项目名称:lmfdb,代码行数:7,代码来源:search_parsing.py


示例5: curve_cmp

def curve_cmp(E1, E2):
    r"""
    Comparison function for elliptic curves over `Q`.

    Order by label if in the database, else first by conductor, then
    by c_invariants.
    """
    t = cmp(E1.conductor(), E2.conductor())
    if t:
        return t

    # Now they have the same conductor
    try:
        from sage.databases.cremona import parse_cremona_label, class_to_int

        k1 = parse_cremona_label(E1.label())
        k2 = parse_cremona_label(E2.label())
        t = cmp(class_to_int(k1[1]), class_to_int(k2[1]))
        if t:
            return t
        return cmp(k1[2], k2[2])
    except RuntimeError:  # if not in database, label() will fail
        pass

    return cmp(E1.ainvs(), E2.ainvs())
开发者ID:sageb0t,项目名称:testsage,代码行数:25,代码来源:ell_egros.py


示例6: add_numeric_label_suffixes

def add_numeric_label_suffixes(min_level_norm=0, max_level_norm=None, fix=False):
    r""" One-off utility to add a numeric conversion of the letter-coded
    label suffixes 'a'->0', 'z'->25, 'ba'->26, etc. for sorting
    purposes.
    """
    from sage.databases.cremona import class_to_int
    count = 0
    query = {}
    query['level_norm'] = {'$gte' : int(min_level_norm)}
    if max_level_norm:
        query['level_norm']['$lte'] = int(max_level_norm)
    else:
        max_level_norm = oo
    forms_to_fix = forms.find(query)
    print("%s forms to examine of level norm between %s and %s."
          % (forms_to_fix.count(),min_level_norm,max_level_norm))
    for f in forms_to_fix:
        count = count+1
        if count%100==0: print("%s: %s" % (count, f['label']))
        fix_data = {}
        lab = f['label_suffix']
        fix_data['label_nsuffix'] = class_to_int(lab)
        #print("using fixed data %s for form %s" % (fix_data,f['label']))
        if fix:
            forms.update({'label': f['label']}, {"$set": fix_data}, upsert=True)
开发者ID:paulhus,项目名称:lmfdb,代码行数:25,代码来源:check_conjugates.py


示例7: label_to_number

def label_to_number(modulus, number, all=False):
    """
    Takes the second part of a character label and converts it to the second
    part of a Conrey label.  This could be trivial (just casting to an int)
    or could require converting from an orbit label to a number.

    If the label is invalid, returns 0.
    """
    try:
        number = int(number)
    except ValueError:
        # encoding Galois orbit
        if modulus < 10000:
            try:
                orbit_label = '{0}.{1}'.format(modulus, 1 + class_to_int(number))
            except ValueError:
                return 0
            else:
                number = db.char_dir_orbits.lucky({'orbit_label':orbit_label}, 'galois_orbit')
                if number is None:
                    return 0
                if not all:
                    number = number[0]
        else:
            return 0
    else:
        if number <= 0 or gcd(modulus, number) != 1 or number > modulus:
            return 0
    return number
开发者ID:jvoight,项目名称:lmfdb,代码行数:29,代码来源:main.py


示例8: curve_key

def curve_key(E1):
    r"""
    Comparison key for elliptic curves over `\QQ`.

    The key is a tuple:

    - if the curve is in the database: (conductor, 0, label, number)

    - otherwise: (conductor, 1, a_invariants)

    EXAMPLES::

        sage: from sage.schemes.elliptic_curves.ell_egros import curve_key
        sage: E = EllipticCurve_from_j(1728)
        sage: curve_key(E)
        (32, 0, 0, 2)
        sage: E = EllipticCurve_from_j(1729)
        sage: curve_key(E)
        (2989441, 1, (1, 0, 0, -36, -1))
    """
    try:
        from sage.databases.cremona import parse_cremona_label, class_to_int
        N, l, k = parse_cremona_label(E1.label())
        return (N, 0, class_to_int(l), k)
    except RuntimeError:
        return (E1.conductor(), 1, E1.ainvs())
开发者ID:mcognetta,项目名称:sage,代码行数:26,代码来源:ell_egros.py


示例9: fix_labels

def fix_labels(field_label, min_level_norm=0, max_level_norm=None, fix_forms=False, fix_curves=False, reverse=False):
    r""" One-off utility to correct labels 'aa'->'ba'->'ca', ..., 'az'->'bz'->'cz'
    """
    from sage.databases.cremona import class_to_int
    count = 0
    query = {}
    query['field_label'] = field_label
    query['level_norm'] = {'$gte' : int(min_level_norm)}
    if max_level_norm:
        query['level_norm']['$lte'] = int(max_level_norm)
    else:
        max_level_norm = oo
    forms_to_fix = forms.find(query)
    print("%s forms to examine of level norm between %s and %s."
          % (forms_to_fix.count(),min_level_norm,max_level_norm))
    if forms_to_fix.count() == 0:
        return None
    for f in forms_to_fix:
        count = count+1
        if count%100==0: print("%s: %s" % (count, f['label']))
        fix_data = {}
        lab = f['label_suffix']
        if len(lab)==1:
            continue
        if f['label'][-2:] != lab:
            print("Incorrect label_suffix %s in form %s" % (lab,f['label']))
            return
        oldlab = lab
        lab = fix_one_label(lab, reverse=reverse)
        fix_data['label_suffix'] = lab
        fix_data['label'] = f['label'].replace(oldlab,lab)
        fix_data['short_label'] = f['short_label'].replace(oldlab,lab)
        fix_data['label_nsuffix'] = class_to_int(lab)
        print("using fixed data %s for form %s" % (fix_data,f['label']))
        if fix_forms:
            forms.update({'label': f['label']}, {"$set": fix_data}, upsert=True)

        # find associated elliptic curve and fix that too (where appropriate)
        if f['deg']==2 and f['dimension']==1:
            label = f['label']
            for e in nfcurves.find({'class_label':f['label']}):
                fix_data = {}
                fix_data['iso_label'] = lab
                fix_data['label'] = e['label'].replace(oldlab,lab)
                fix_data['short_label'] = e['short_label'].replace(oldlab,lab)
                fix_data['class_label'] = e['class_label'].replace(oldlab,lab)
                fix_data['short_class_label'] = e['short_class_label'].replace(oldlab,lab)
                print("using fixed data %s for curve %s" % (fix_data,e['label']))
                if fix_curves:
                    res = nfcurves.update_one({'_id': e['_id']}, {"$set": fix_data}, upsert=True)
                    assert res.matched_count==1
        else:
            print("No elliptic curve to fix")
开发者ID:paulhus,项目名称:lmfdb,代码行数:53,代码来源:check_conjugates.py


示例10: curve_cmp

def curve_cmp(E1, E2):
    r"""
    Comparison function for elliptic curves over `\QQ`.

    Order by label if in the database, else first by conductor, then
    by c_invariants.

    Deprecated, please use instead `curve_key`.

    EXAMPLES::

        sage: from sage.schemes.elliptic_curves.ell_egros import curve_cmp
        sage: E1 = EllipticCurve_from_j(1728)
        sage: E2 = EllipticCurve_from_j(1729)
        sage: curve_cmp(E1,E2)
        doctest:...: DeprecationWarning: Please use 'curve_key' instead.
        See http://trac.sagemath.org/21142 for details.
        -1
    """
    from sage.misc.superseded import deprecation
    deprecation(21142, "Please use 'curve_key' instead.")
    t = cmp(E1.conductor(), E2.conductor())
    if t:
        return t

    # Now they have the same conductor
    try:
        from sage.databases.cremona import parse_cremona_label, class_to_int
        k1 = parse_cremona_label(E1.label())
        k2 = parse_cremona_label(E2.label())
        t = cmp(class_to_int(k1[1]),class_to_int(k2[1]))
        if t:
            return t
        return cmp(k1[2], k2[2])
    except RuntimeError: # if not in database, label() will fail
        pass

    return cmp(E1.ainvs(),E2.ainvs())
开发者ID:mcognetta,项目名称:sage,代码行数:38,代码来源:ell_egros.py


示例11: numerify_iso_label

def numerify_iso_label(lab):
    from sage.databases.cremona import class_to_int
    if 'CM' in lab:
        return -1 - class_to_int(lab[2:])
    else:
        return class_to_int(lab.lower())
开发者ID:sehlen,项目名称:lmfdb,代码行数:6,代码来源:import_utils.py


示例12: import_data


#.........这里部分代码省略.........
        assert 'primes' in F_hmf  # DY:  want to make sure the fields are not touched!
    if 'primes' in F_hmf:  # Nothing smart: make sure it is the same
        assert F_hmf['primes'] == primes_str
    else:
        F_hmf['primes'] = primes_str
        if test:
            print("Would now save primes string %s... into hmf_fields" % primes_str[:100])
        else:
            hmf_fields.replace_one(F_hmf)
            print "...saved!"

    # Collect levels
    v = hmff.readline()
    if v[:9] == 'LEVELS :=':
        # Skip this line since we do not use the list of levels
        v = hmff.readline()
    for i in range(3):
        if v[:11] != 'NEWFORMS :=':
            v = hmff.readline()
        else:
            break

    # Finally, newforms!
    print "Starting newforms!"
    while v != '':
        v = hmff.readline()[1:-3]
        if len(v) == 0:
            break
        data = eval(preparse(v))
        level_ideal = data[0]
        level_norm = data[0][0]
        label_suffix = fix_one_label(data[1])
        weight = [2 for i in range(n)]
        label_nsuffix = class_to_int(label_suffix)

        level_ind = int(magma('Index(ideals, ideal<ZF | {F!x : x in ' + str(level_ideal) + '}>)')
                        ) - 1  # Magma counts starting at 1
        level_ideal = ideals_str[level_ind]
        assert magma('ideal<ZF | {F!x : x in ' + str(level_ideal) + '}> eq '
                     + 'ideal<ZF | {F!x : x in ' + str(data[0]) + '}>;')
        level_dotlabel = level_ind - ideals_norms.index(level_norm) + 1   # Start counting at 1
        assert level_dotlabel > 0
        level_label = str(level_norm) + '.' + str(level_dotlabel)

        label = construct_full_label(field_label, weight, level_label, label_suffix)
        short_label = level_label + '-' + label_suffix

        if len(data) == 3:
            hecke_polynomial = x
            hecke_eigenvalues = data[2]
        else:
            hecke_polynomial = data[2]
            hecke_eigenvalues = data[3]

        if resort:
            hecke_eigenvalues = [hecke_eigenvalues[i] for i in primes_resort]

        # Constrain eigenvalues to size 2MB
        hecke_eigenvalues = [str(c) for c in hecke_eigenvalues]
        leftout = 0
        while sum([len(s) for s in hecke_eigenvalues]) > 2000000:
            hecke_eigenvalues = hecke_eigenvalues[:-1]
            leftout += 1
            # commented code below throws an error.  use above.
            # just be safe and remove one eigenvalue at a time.
            # Aurel's code will adjust and remove extra when needed.
开发者ID:LMFDB,项目名称:lmfdb,代码行数:67,代码来源:import_hmf_data_gnu_phase_0.py


示例13: cmp_label

def cmp_label(lab1, lab2):
    a, b, c = parse_cremona_label(lab1)
    id1 = int(a), class_to_int(b), int(c)
    a, b, c = parse_cremona_label(lab2)
    id2 = int(a), class_to_int(b), int(c)
    return cmp(id1, id2)
开发者ID:LMFDB,项目名称:lmfdb,代码行数:6,代码来源:elliptic_curve.py


示例14: minimal_conrey_in_character_orbit

def minimal_conrey_in_character_orbit(level, weight, char_orbit):
    if isinstance(char_orbit, basestring):
        char_orbit = class_to_int(char_orbit) + 1
    res = db.mf_newspaces.lucky({'level': level, 'weight': weight, 'char_orbit_index':char_orbit}, projection='char_labels')
    return None if res is None else res[0]
开发者ID:koffie,项目名称:lmfdb,代码行数:5,代码来源:web_space.py


示例15: numerify_iso_label

def numerify_iso_label(lab):
    from sage.databases.cremona import class_to_int
    return class_to_int(lab.lower())
开发者ID:edgarcosta,项目名称:lmfdb,代码行数:3,代码来源:import_bianchi_forms.py



注:本文中的sage.databases.cremona.class_to_int函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cremona.parse_cremona_label函数代码示例发布时间:2022-05-27
下一篇:
Python sf.SymmetricFunctions类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap