本文整理匯總了Python中sage.groups.perm_gps.permgroup_named.SymmetricGroup.matrix方法的典型用法代碼示例。如果您正苦於以下問題:Python SymmetricGroup.matrix方法的具體用法?Python SymmetricGroup.matrix怎麽用?Python SymmetricGroup.matrix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sage.groups.perm_gps.permgroup_named.SymmetricGroup
的用法示例。
在下文中一共展示了SymmetricGroup.matrix方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: reorder
# 需要導入模塊: from sage.groups.perm_gps.permgroup_named import SymmetricGroup [as 別名]
# 或者: from sage.groups.perm_gps.permgroup_named.SymmetricGroup import matrix [as 別名]
def reorder(self, order):
"""
Return a new isogeny class with the curves reordered.
INPUT:
- ``order`` -- None, a string or an iterable over all curves
in this class. See
:meth:`sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.isogeny_class`
for more details.
OUTPUT:
- Another :class:`IsogenyClass_EC` with the curves reordered
(and matrices and maps changed as appropriate)
EXAMPLES::
sage: isocls = EllipticCurve('15a1').isogeny_class(use_tuple=False)
sage: print "\n".join([repr(C) for C in isocls.curves])
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 10*x - 10 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 5*x + 2 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 + 35*x - 28 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 135*x - 660 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 80*x + 242 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 110*x - 880 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 2160*x - 39540 over Rational Field
sage: isocls2 = isocls.reorder('lmfdb')
sage: print "\n".join([repr(C) for C in isocls2.curves])
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 2160*x - 39540 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 135*x - 660 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 110*x - 880 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 80*x + 242 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 10*x - 10 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 5*x + 2 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 + 35*x - 28 over Rational Field
"""
if order is None or isinstance(order, basestring) and order == self._algorithm:
return self
if isinstance(order, basestring):
if order == "lmfdb":
reordered_curves = sorted(self.curves, key = lambda E: E.a_invariants())
else:
reordered_curves = list(self.E.isogeny_class(algorithm=order, use_tuple=False))
elif isinstance(order, (list, tuple, IsogenyClass_EC)):
reordered_curves = list(order)
if len(reordered_curves) != len(self.curves):
raise ValueError("Incorrect length")
else:
raise TypeError("order parameter should be a string, list of curves or isogeny class")
need_perm = self._mat is not None
cpy = self.copy()
curves = []
perm = []
for E in reordered_curves:
try:
j = self.curves.index(E)
except ValueError:
try:
j = self.curves.index(E.minimal_model())
except ValueError:
raise ValueError("order does not yield a permutation of curves")
curves.append(self.curves[j])
if need_perm: perm.append(j+1)
cpy.curves = tuple(curves)
if need_perm:
from sage.groups.perm_gps.permgroup_named import SymmetricGroup
perm = SymmetricGroup(len(self.curves))(perm)
cpy._mat = perm.matrix() * self._mat * (~perm).matrix()
if self._maps is not None:
n = len(self._maps)
cpy._maps = [self._maps[perm(i+1)-1] for i in range(n)]
for i in range(n):
cpy._maps[i] = [cpy._maps[i][perm(j+1)-1] for j in range(n)]
else:
cpy._mat = None
cpy._maps = None
return cpy