当前位置: 首页>>代码示例>>Python>>正文


Python HilbertNumberField.ideal_from_str方法代码示例

本文整理汇总了Python中lmfdb.hilbert_modular_forms.hilbert_field.HilbertNumberField.ideal_from_str方法的典型用法代码示例。如果您正苦于以下问题:Python HilbertNumberField.ideal_from_str方法的具体用法?Python HilbertNumberField.ideal_from_str怎么用?Python HilbertNumberField.ideal_from_str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lmfdb.hilbert_modular_forms.hilbert_field.HilbertNumberField的用法示例。


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

示例1: compare_with_db

# 需要导入模块: from lmfdb.hilbert_modular_forms.hilbert_field import HilbertNumberField [as 别名]
# 或者: from lmfdb.hilbert_modular_forms.hilbert_field.HilbertNumberField import ideal_from_str [as 别名]
    def compare_with_db(self, field=None):
        lab = self.dbdata['label']
        f = WebHMF.by_label(lab)
        if f==None:
            print("No Hilbert newform in the database has label %s" % lab)
            return False
        if field==None:
            field = HilbertNumberField(self.dbdata['field_label'])
        agree = True
        for key in self.dbdata.keys():
            if key in ['is_base_change', 'is_CM']:
                continue
            if key=='hecke_eigenvalues':
                if self.dbdata[key]!=f.dbdata[key]:
                    agree = False
                    print("Inconsistent data for HMF %s in field %s" % (lab,key))
                    print("self has %s entries, \ndb   has %s entries" % (len(self.dbdata[key]),len(f.dbdata[key])))
                    print("Entries differ at indices %s" % [i for i in range(len(self.dbdata[key])) if self.dbdata[key][i]!=f.dbdata[key][i]])
            elif key=='level_ideal':
                if self.dbdata[key]!=f.dbdata[key]:
                    I = field.ideal_from_str(f.dbdata['level_ideal'])[2]
                    J = field.ideal_from_str(self.dbdata['level_ideal'])[2]
                    if I==J:
                        print("OK, these are the same ideal")
                    else:
                        agree = False
                        print("These are different ideals!")

            else:
                if self.dbdata[key]!=f.dbdata[key]:
                    agree = False
                    print("Inconsistent data for HMF %s in field %s" % (lab,key))
        return agree
开发者ID:koffie,项目名称:lmfdb,代码行数:35,代码来源:web_HMF.py

示例2: create_from_data_string

# 需要导入模块: from lmfdb.hilbert_modular_forms.hilbert_field import HilbertNumberField [as 别名]
# 或者: from lmfdb.hilbert_modular_forms.hilbert_field.HilbertNumberField import ideal_from_str [as 别名]
    def create_from_data_string(self, label_or_field, L):
        """Takes an input line L from a raw data file and constructs the
        associated HMF object with given base field.

        String sample:
        <[31, 31, w + 12], "a", [-3, -2, 2, 4, -4, ...]>,
        """
        data = self.dbdata = {}
        if isinstance(label_or_field, str):
            label = label_or_field
            data['field_label'] = label
            F = HilbertNumberField(label)
            if not F:
                raise ValueError("No Hilbert number field with label %s is in the database" % label)
        elif label_or_field == None:
            raise ValueError("Must specify a valid field label")
        else: # we were passed a HilbertNumberField already
            F = label_or_field
            data['field_label'] = F.label
        #print("data['field_label'] = %s" % data['field_label'])

        # The level

        i = L.find('[')
        j = L.find(']')
        data['level_ideal'] = L[i:j+1]
        #print("data['level_ideal'] = %s" % data['level_ideal'])
        N, n, alpha = data['level_ideal'][1:-1].split(',')
        data['level_norm'] = int(N)
        #print("data['level_norm'] = %s" % data['level_norm'])
        level = F.ideal_from_str(data['level_ideal'])[2]
        #print("level = %s" % level)
        data['level_label'] = F.ideal_label(level)
        #print("data['level_label'] = %s" % data['level_label'])

        # The weight

        data['parallel_weight'] = int(2)
        data['weight'] = str([data['parallel_weight']] * F.degree())
        weight = [2] * F.degree()

        # The label

        i = L.find('"')
        j = L.find('"', i+1)
        data['label_suffix'] = L[i+1:j].replace(" ","")

        data['label'] = construct_full_label(data['field_label'],
                                             weight,
                                             data['level_label'],
                                             data['label_suffix'])
        data['short_label'] = '-'.join([data['level_label'], data['label_suffix']])
        #print("data['label'] = %s" % data['label'] )
        #print("data['short_label'] = %s" % data['short_label'] )

        # The hecke polynomial and degree

        if 'x' in L:
            # non-rational
            i = L.find("x")
            j = L.find(i+1,",")
            data['hecke_polynomial'] = pol = L[i:j]
            data['dimension'] = int(1)
            x = polygen(QQ)
            hpol = x.parent()(str(pol))
            data['dimension'] = int(hpol.degree())
        else:
            # rational
            data['hecke_polynomial'] = 'x'
            data['dimension'] = int(1)

        i = L.rfind("[")
        j = L.rfind("]")
        data['hecke_eigenvalues'] = L[i+1:j].replace(" ","").split(",")
        data['hecke_eigenvalues'] = [unicode(s) for s in data['hecke_eigenvalues']]
        #print("hecke_eigenvalues = %s..." % data['hecke_eigenvalues'][:20])

        # Find (some of the) AL-eigenvalues

        BP = level.prime_factors()
        BP_indices = [F.prime_index(P) for P in BP]
        print("BP_indices = %s" % BP_indices)
        BP_exponents = [level.valuation(P) for P in BP]
        #print("BP_exponents = %s" % BP_exponents)
        AL_eigs = [int(data['hecke_eigenvalues'][k]) for k in BP_indices]
        #print("AL_eigs      = %s" % AL_eigs)
        if not all([(e==1 and eig in [-1,1]) or (eig==0)
                    for e,eig in zip(BP_exponents,AL_eigs)]):
            print("Some bad AL-eigenvalues found")
        # NB the following will put 0 for the eigenvalue for primes
        # whose quare divides the level; this will need fixing later.
        data['AL_eigenvalues'] = [[F.primes[k],data['hecke_eigenvalues'][k]] for k in BP_indices]

        data['is_CM'] = '?'
        data['is_base_change'] = '?'
开发者ID:koffie,项目名称:lmfdb,代码行数:97,代码来源:web_HMF.py


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