本文整理汇总了Python中congroup_generic.CongruenceSubgroup.__cmp__方法的典型用法代码示例。如果您正苦于以下问题:Python CongruenceSubgroup.__cmp__方法的具体用法?Python CongruenceSubgroup.__cmp__怎么用?Python CongruenceSubgroup.__cmp__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类congroup_generic.CongruenceSubgroup
的用法示例。
在下文中一共展示了CongruenceSubgroup.__cmp__方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __cmp__
# 需要导入模块: from congroup_generic import CongruenceSubgroup [as 别名]
# 或者: from congroup_generic.CongruenceSubgroup import __cmp__ [as 别名]
def __cmp__(self, other):
"""
Compare self to other.
The ordering on congruence subgroups of the form GammaH(N) for
some H is first by level and then by the subgroup H. In
particular, this means that we have Gamma1(N) < GammaH(N) <
Gamma0(N) for every nontrivial subgroup H.
EXAMPLES::
sage: G = GammaH(86, [9])
sage: G.__cmp__(G)
0
sage: G.__cmp__(GammaH(86, [11])) is not 0
True
sage: Gamma1(11) < Gamma0(11)
True
sage: Gamma1(11) == GammaH(11, [])
True
sage: Gamma0(11) == GammaH(11, [2])
True
"""
if is_GammaH(other):
t = cmp(self.level(), other.level())
if t:
return t
else:
return cmp(self._list_of_elements_in_H(), other._list_of_elements_in_H())
else:
return CongruenceSubgroup.__cmp__(self, other)
示例2: __cmp__
# 需要导入模块: from congroup_generic import CongruenceSubgroup [as 别名]
# 或者: from congroup_generic.CongruenceSubgroup import __cmp__ [as 别名]
def __cmp__(self, other):
"""
Compare self to other.
The ordering on congruence subgroups of the form GammaH(N) for some H
is first by level, then by the order of H, then lexicographically by H.
In particular, this means that we have Gamma1(N) < GammaH(N) <
Gamma0(N) for every nontrivial proper subgroup H.
EXAMPLES::
sage: G = GammaH(86, [9])
sage: G.__cmp__(G)
0
sage: G.__cmp__(GammaH(86, [11])) is not 0
True
sage: Gamma1(11) < Gamma0(11)
True
sage: Gamma1(11) == GammaH(11, [])
True
sage: Gamma0(11) == GammaH(11, [2])
True
sage: G = Gamma0(86)
sage: G.__cmp__(G)
0
sage: G.__cmp__(GammaH(86, [11])) is not 0
True
sage: Gamma1(17) < Gamma0(17)
True
sage: Gamma0(1) == SL2Z
True
sage: Gamma0(2) == Gamma1(2)
True
sage: [x._list_of_elements_in_H() for x in sorted(Gamma0(24).gamma_h_subgroups())]
[[1],
[1, 5],
[1, 7],
[1, 11],
[1, 13],
[1, 17],
[1, 19],
[1, 23],
[1, 5, 7, 11],
[1, 5, 13, 17],
[1, 5, 19, 23],
[1, 7, 13, 19],
[1, 7, 17, 23],
[1, 11, 13, 23],
[1, 11, 17, 19],
[1, 5, 7, 11, 13, 17, 19, 23]]
"""
if is_GammaH(other):
return (cmp(self.level(), other.level())
or -cmp(self.index(), other.index())
or cmp(self._list_of_elements_in_H(), other._list_of_elements_in_H()))
else:
return CongruenceSubgroup.__cmp__(self, other)
示例3: __cmp__
# 需要导入模块: from congroup_generic import CongruenceSubgroup [as 别名]
# 或者: from congroup_generic.CongruenceSubgroup import __cmp__ [as 别名]
def __cmp__(self, other):
r"""
Compare self to other.
EXAMPLES::
sage: Gamma(3) == SymmetricGroup(8)
False
sage: Gamma(3) == Gamma1(3)
False
sage: Gamma(5) < Gamma(6)
True
sage: Gamma(5) == Gamma(5)
True
sage: Gamma(3) == Gamma(3).as_permutation_group()
True
"""
if is_Gamma(other):
return cmp(self.level(), other.level())
else:
return CongruenceSubgroup.__cmp__(self, other)