def __invert__(self): """ Return the inverse of self. EXAMPLES:: sage: Gamma0(11)([1,-1,0,1]).__invert__() [1 1] [0 1] """ I = mi2x2(M2Z, [self.__x[1,1], -self.__x[0,1], -self.__x[1,0], self.__x[0,0]], copy=True, coerce=True) return self.parent()(I, check=False)
def __init__(self, parent, x, check=True): """ Create an element of an arithmetic subgroup. INPUT: - parent - an arithmetic subgroup - x - data defining a 2x2 matrix over ZZ which lives in parent - check - if True, check that parent is an arithmetic subgroup, and that x defines a matrix of determinant 1 We tend not to create elements of arithmetic subgroups that aren't SL2Z, in order to avoid coercion issues (that is, the other arithmetic subgroups are "facade parents"). EXAMPLES:: sage: G = Gamma0(27) sage: sage.modular.arithgroup.arithgroup_element.ArithmeticSubgroupElement(G, [4,1,27,7]) [ 4 1] [27 7] sage: sage.modular.arithgroup.arithgroup_element.ArithmeticSubgroupElement(Integers(3), [4,1,27,7]) Traceback (most recent call last): ... TypeError: parent (= Ring of integers modulo 3) must be an arithmetic subgroup sage: sage.modular.arithgroup.arithgroup_element.ArithmeticSubgroupElement(G, [2,0,0,2]) Traceback (most recent call last): ... TypeError: matrix must have determinant 1 sage: sage.modular.arithgroup.arithgroup_element.ArithmeticSubgroupElement(G, [2,0,0,2], check=False) [2, 0, 0, 2] sage: x = Gamma0(11)([2,1,11,6]) sage: x == loads(dumps(x)) True sage: x = Gamma0(5).0 sage: SL2Z(x) [1 1] [0 1] sage: x in SL2Z True """ if check: if not is_ArithmeticSubgroup(parent): raise TypeError, "parent (= %s) must be an arithmetic subgroup" % parent x = mi2x2(M2Z, x, copy=True, coerce=True) if x.determinant() != 1: raise TypeError, "matrix must have determinant 1" try: x.set_immutable() except AttributeError: pass MultiplicativeGroupElement.__init__(self, parent) self.__x = x
def __init__(self, parent, x, check=True): """ Create an element of an arithmetic subgroup. INPUT: - parent - an arithmetic subgroup - x - data defining a 2x2 matrix over ZZ which lives in parent - check - if True, check that parent is an arithmetic subgroup, and that x defines a matrix of determinant 1 We tend not to create elements of arithmetic subgroups that aren't SL2Z, in order to avoid coercion issues (that is, the other arithmetic subgroups are "facade parents"). EXAMPLES:: sage: G = Gamma0(27) sage: sage.modular.arithgroup.arithgroup_element.ArithmeticSubgroupElement(G, [4,1,27,7]) [ 4 1] [27 7] sage: sage.modular.arithgroup.arithgroup_element.ArithmeticSubgroupElement(Integers(3), [4,1,27,7]) Traceback (most recent call last): ... TypeError: parent (= Ring of integers modulo 3) must be an arithmetic subgroup sage: sage.modular.arithgroup.arithgroup_element.ArithmeticSubgroupElement(G, [2,0,0,2]) Traceback (most recent call last): ... TypeError: matrix must have determinant 1 sage: sage.modular.arithgroup.arithgroup_element.ArithmeticSubgroupElement(G, [2,0,0,2], check=False) [2, 0, 0, 2] sage: x = Gamma0(11)([2,1,11,6]) sage: x == loads(dumps(x)) True sage: x = Gamma0(5).0 sage: SL2Z(x) [1 1] [0 1] sage: x in SL2Z True """ if check: if not is_ArithmeticSubgroup(parent): raise TypeError, "parent (= %s) must be an arithmetic subgroup"%parent x = mi2x2(M2Z, x, copy=True, coerce=True) if x.determinant() != 1: raise TypeError, "matrix must have determinant 1" try: x.set_immutable() except AttributeError: pass MultiplicativeGroupElement.__init__(self, parent) self.__x = x