本文整理汇总了Python中sage.matrix.constructor.Matrix.denominator方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.denominator方法的具体用法?Python Matrix.denominator怎么用?Python Matrix.denominator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.matrix.constructor.Matrix
的用法示例。
在下文中一共展示了Matrix.denominator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_cocycle_from_elliptic_curve
# 需要导入模块: from sage.matrix.constructor import Matrix [as 别名]
# 或者: from sage.matrix.constructor.Matrix import denominator [as 别名]
def get_cocycle_from_elliptic_curve(self,E,sign = 1,use_magma = True):
if sign == 0:
return self.get_cocycle_from_elliptic_curve(E,1,use_magma) + self.get_cocycle_from_elliptic_curve(E,-1,use_magma)
if not sign in [1, -1]:
raise NotImplementedError
F = self.group().base_ring()
if F.signature()[1] == 0 or (F.signature() == (0,1) and 'G' not in self.group()._grouptype):
K = (self.hecke_matrix(oo).transpose()-sign).kernel().change_ring(QQ)
else:
K = Matrix(QQ,self.dimension(),self.dimension(),0).kernel()
disc = self.S_arithgroup().Gpn._O_discriminant
discnorm = disc.norm()
try:
N = ZZ(discnorm.gen())
except AttributeError:
N = ZZ(discnorm)
if F == QQ:
x = QQ['x'].gen()
F = NumberField(x,names='a')
E = E.change_ring(F)
def getap(q):
if F == QQ:
return E.ap(q)
else:
Q = F.ideal(q).factor()[0][0]
return ZZ(Q.norm() + 1 - E.reduction(Q).count_points())
q = ZZ(1)
g0 = None
while K.dimension() > 1:
q = q.next_prime()
for qq,e in F.ideal(q).factor():
if ZZ(qq.norm()).is_prime() and not qq.divides(F.ideal(disc.gens_reduced()[0])):
try:
ap = getap(qq)
except (ValueError,ArithmeticError):
continue
try:
K1 = (self.hecke_matrix(qq.gens_reduced()[0],g0 = g0,use_magma = use_magma).transpose()-ap).kernel()
except RuntimeError:
continue
K = K.intersection(K1)
if K.dimension() != 1:
raise ValueError,'Did not obtain a one-dimensional space corresponding to E'
col = [ZZ(o) for o in (K.denominator()*K.matrix()).list()]
return sum([a * self.gen(i) for i,a in enumerate(col) if a != 0],self(0))
示例2: get_rational_cocycle_from_ap
# 需要导入模块: from sage.matrix.constructor import Matrix [as 别名]
# 或者: from sage.matrix.constructor.Matrix import denominator [as 别名]
def get_rational_cocycle_from_ap(self,getap,sign = 1,use_magma = True):
F = self.group().base_ring()
if F.signature()[1] == 0 or (F.signature() == (0,1) and 'G' not in self.group()._grouptype):
K = (self.hecke_matrix(oo).transpose()-sign).kernel().change_ring(QQ)
else:
K = Matrix(QQ,self.dimension(),self.dimension(),0).kernel()
disc = self.S_arithgroup().Gpn._O_discriminant
discnorm = disc.norm()
try:
N = ZZ(discnorm.gen())
except AttributeError:
N = ZZ(discnorm)
if F == QQ:
x = QQ['x'].gen()
F = NumberField(x,names='a')
q = ZZ(1)
g0 = None
while K.dimension() > 1:
q = q.next_prime()
for qq,e in F.ideal(q).factor():
if ZZ(qq.norm()).is_prime() and not qq.divides(F.ideal(disc.gens_reduced()[0])):
try:
ap = getap(qq)
except (ValueError,ArithmeticError):
continue
try:
K1 = (self.hecke_matrix(qq.gens_reduced()[0],g0 = g0,use_magma = use_magma).transpose()-ap).kernel()
except RuntimeError:
continue
K = K.intersection(K1)
if K.dimension() != 1:
raise ValueError,'Group does not have the required system of eigenvalues'
col = [ZZ(o) for o in (K.denominator()*K.matrix()).list()]
return sum([ a * self.gen(i) for i,a in enumerate(col) if a != 0], self(0))
示例3: get_rational_cocycle
# 需要导入模块: from sage.matrix.constructor import Matrix [as 别名]
# 或者: from sage.matrix.constructor.Matrix import denominator [as 别名]
def get_rational_cocycle(self,sign = 1,use_magma = True,bound = 3, return_all = False):
F = self.group().base_ring()
if F.signature()[1] == 0 or (F.signature()[1] == 1 and 'G' not in self.group()._grouptype):
K = (self.hecke_matrix(oo).transpose()-sign).kernel().change_ring(QQ)
else:
K = Matrix(QQ,self.dimension(),self.dimension(),0).kernel()
component_list = []
good_components = []
if K.dimension() == 1:
good_components.append(K)
else:
component_list.append(K)
disc = self.S_arithgroup().Gpn._O_discriminant
discnorm = disc.norm()
try:
N = ZZ(discnorm.gen())
except AttributeError:
N = ZZ(discnorm)
if F == QQ:
x = QQ['x'].gen()
F = NumberField(x,names='a')
q = ZZ(1)
g0 = None
num_hecke_operators = 0
while len(component_list) > 0 and num_hecke_operators < bound:
verbose('num_hecke_ops = %s'%num_hecke_operators)
verbose('len(components_list) = %s'%len(component_list))
q = q.next_prime()
for qq,e in F.ideal(q).factor():
if ZZ(qq.norm()).is_prime() and not qq.divides(F.ideal(disc.gens_reduced()[0])):
try:
Aq = self.hecke_matrix(qq.gens_reduced()[0],g0 = g0,use_magma = use_magma).transpose().change_ring(QQ)
except (RuntimeError,TypeError) as e:
continue
verbose('Computed hecke matrix at qq = %s'%qq)
old_component_list = component_list
component_list = []
num_hecke_operators += 1
for U in old_component_list:
V = Aq.decomposition_of_subspace(U)
for U0,is_irred in V:
if Aq.restrict(U0).eigenvalues()[0] == ZZ(qq.norm()) + 1:
continue # Do not take Eisenstein classes.
if U0.dimension() == 1:
good_components.append(U0)
elif is_irred:
# Bad
continue
else: # U0.dimension() > 1 and not is_irred
component_list.append(U0)
if len(good_components) > 0 and not return_all:
K = good_components[0]
col = [ZZ(o) for o in (K.denominator()*K.matrix()).list()]
return sum([a*self.gen(i) for i,a in enumerate(col) if a != 0],self(0))
if len(component_list) == 0 or num_hecke_operators >= bound:
break
if len(good_components) == 0:
raise ValueError('Group does not seem to be attached to an elliptic curve')
else:
if return_all:
ans = []
for K in good_components:
col = [ZZ(o) for o in (K.denominator()*K.matrix()).list()]
ans.append( sum([a*self.gen(i) for i,a in enumerate(col) if a != 0],self(0)))
return ans
else:
K = good_components[0]
col = [ZZ(o) for o in (K.denominator()*K.matrix()).list()]
return sum([ a * self.gen(i) for i,a in enumerate(col) if a != 0], self(0))