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


Python ZZ.str方法代码示例

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


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

示例1: niceideals

# 需要导入模块: from sage.all import ZZ [as 别名]
# 或者: from sage.all.ZZ import str [as 别名]
def niceideals(F, ideals): #HNF + sage ideal + label
    """Convert a list of ideas from strongs to actual NumberField ideals

    F is a Sage NumberField

    ideals is a list of strings representing ideals I in the field, of
    the form [N,a,alpha] where N is the norm of I, a the least
    positive integer in I, and alpha a field element such that I is
    generated by a and alpha.

    The output is a list

    """
    nideals = []
    ilabel = 1
    norm = ZZ(0)
    for i in range(len(ideals)):
        N,n,idl,_ = str2ideal(F,ideals[i])
        assert idl.norm() == N and idl.smallest_integer() == n
        if N != norm:
            ilabel = ZZ(1)
            norm = N
        label = N.str() + '.' + ilabel.str()
        hnf = idl.pari_hnf().python()
        nideals.append([hnf, idl, label])
        ilabel += 1
    return nideals
开发者ID:edgarcosta,项目名称:lmfdb,代码行数:29,代码来源:hilbert_field.py

示例2: _iter_ideals

# 需要导入模块: from sage.all import ZZ [as 别名]
# 或者: from sage.all.ZZ import str [as 别名]
 def _iter_ideals(self, primes=False, number=None):
     """
     Iterator through all ideals of self.  Delivers dicts with keys
     'label' and 'ideal'.
     """
     count = 0
     ilabel = 1
     norm = ZZ(0)
     ideals = self.ideals
     if primes:
         ideals = self.primes
     for idlstr in ideals:
         N,n,idl,_ = str2ideal(self.K(),idlstr)
         assert idl.norm() == N and idl.smallest_integer() == n
         if N != norm:
             ilabel = ZZ(1)
             norm = N
         label = N.str() + '.' + ilabel.str()
         yield {'label':label, 'ideal':idl}
         ilabel += 1
         count += 1
         if count==number:
             raise StopIteration
开发者ID:edgarcosta,项目名称:lmfdb,代码行数:25,代码来源:hilbert_field.py


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