Beispiel #1
0
    def __cmp__(self, other):
        """
        Compare self to other.

        The ordering on congruence subgroups of the form `\Gamma_H(N)` for
        some H is first by level and then by the subgroup H. In
        particular, this means that we have `\Gamma_1(N) < \Gamma_H(N) <
        \Gamma_0(N)` for every nontrivial subgroup H.

        EXAMPLES::

            sage: G = Gamma1(86)
            sage: G.__cmp__(G)
            0
            sage: G.__cmp__(GammaH(86, [11])) is not 0
            True
            sage: Gamma1(12) < Gamma0(12)
            True
            sage: Gamma1(10) < Gamma1(12)
            True
            sage: Gamma1(11) == GammaH(11, [])
            True
            sage: Gamma1(1) == SL2Z
            True
            sage: Gamma1(2) == Gamma0(2)
            True
        """
        from all import is_GammaH
        if not is_CongruenceSubgroup(other):
            return cmp(type(self), type(other))

        c = cmp(self.level(), other.level())
        if c: return c

        # Since Gamma1(N) is GammaH(N) for H all of (Z/N)^\times,
        # we know how to compare it to any other GammaH without having
        # to look at self._list_of_elements_in_H().
        if is_GammaH(other):
            if is_Gamma1(other):
                return 0
            else:
                H = other._generators_for_H()
                return cmp(0,len(H))
        return cmp(type(self), type(other))
Beispiel #2
0
    def __cmp__(self, other):
        """
        Compare self to other.

        The ordering on congruence subgroups of the form `\Gamma_H(N)` for
        some H is first by level and then by the subgroup H. In
        particular, this means that we have `\Gamma_1(N) < \Gamma_H(N) <
        \Gamma_0(N)` for every nontrivial subgroup H.

        EXAMPLES::

            sage: G = Gamma1(86)
            sage: G.__cmp__(G)
            0
            sage: G.__cmp__(GammaH(86, [11])) is not 0
            True
            sage: Gamma1(12) < Gamma0(12)
            True
            sage: Gamma1(10) < Gamma1(12)
            True
            sage: Gamma1(11) == GammaH(11, [])
            True
            sage: Gamma1(1) == SL2Z
            True
            sage: Gamma1(2) == Gamma0(2)
            True
        """
        from all import is_GammaH
        if not is_CongruenceSubgroup(other):
            return cmp(type(self), type(other))

        c = cmp(self.level(), other.level())
        if c: return c

        # Since Gamma1(N) is GammaH(N) for H all of (Z/N)^\times,
        # we know how to compare it to any other GammaH without having
        # to look at self._list_of_elements_in_H().
        if is_GammaH(other):
            if is_Gamma1(other):
                return 0
            else:
                H = other._generators_for_H()
                return cmp(0, len(H))
        return cmp(type(self), type(other))