本文整理汇总了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
示例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