def __init__(self, X, Y, category=None): r""" Create the space of homomorphisms between X and Y, which must have the same base ring. EXAMPLES:: sage: M = ModularForms(Gamma0(7), 4) sage: M.Hom(M) Set of Morphisms from ... to ... in Category of Hecke modules over Rational Field sage: sage.modular.hecke.homspace.HeckeModuleHomspace(M, M.base_extend(Qp(13))) Traceback (most recent call last): ... TypeError: X and Y must have the same base ring sage: M.Hom(M) == loads(dumps(M.Hom(M))) True TESTS:: sage: M = ModularForms(Gamma0(7), 4) sage: H = M.Hom(M) sage: TestSuite(H).run(skip='_test_elements') """ if not is_HeckeModule(X) or not is_HeckeModule(Y): raise TypeError("X and Y must be Hecke modules") if X.base_ring() != Y.base_ring(): raise TypeError("X and Y must have the same base ring") if category is None: category = X.category() HomsetWithBase.__init__(self, X, Y, category=category)
def __init__(self, G, H): r""" Return the homset of two matrix groups. INPUT: - ``G`` -- a matrix group. - ``H`` -- a matrix group. OUTPUT: The homset of two matrix groups. EXAMPLES:: sage: F = GF(5) sage: gens = [matrix(F,2,[1,2, -1, 1]), matrix(F,2, [1,1, 0,1])] sage: G = MatrixGroup(gens) sage: from sage.groups.matrix_gps.homset import MatrixGroupHomset sage: MatrixGroupHomset(G, G) Set of Homomorphisms from Matrix group over Finite Field of size 5 with 2 generators ( [1 2] [1 1] [4 1], [0 1] ) to Matrix group over Finite Field of size 5 with 2 generators ( [1 2] [1 1] [4 1], [0 1] ) """ from sage.categories.groups import Groups from sage.categories.homset import HomsetWithBase HomsetWithBase.__init__(self, G, H, Groups(), G.base_ring())
def __init__(self, domain, codomain, cat): """ Create a homspace. INPUT: - ``domain, codomain`` - modular abelian varieties - ``cat`` - category EXAMPLES:: sage: H = Hom(J0(11), J0(22)); H Space of homomorphisms from Abelian variety J0(11) of dimension 1 to Abelian variety J0(22) of dimension 2 sage: Hom(J0(11), J0(11)) Endomorphism ring of Abelian variety J0(11) of dimension 1 sage: type(H) <class 'sage.modular.abvar.homspace.Homspace_with_category'> sage: H.homset_category() Category of modular abelian varieties over Rational Field """ from .abvar import is_ModularAbelianVariety if not is_ModularAbelianVariety(domain): raise TypeError("domain must be a modular abelian variety") if not is_ModularAbelianVariety(codomain): raise TypeError("codomain must be a modular abelian variety") self._gens = None HomsetWithBase.__init__(self, domain, codomain, category=cat)
def __init__(self, X, Y, category=None, check=True, base=ZZ): HomsetWithBase.__init__(self, X, Y, category=category, check=check, base=base)
def __init__(self, X, S, category=None, check=True): r""" EXAMPLES: The bug reported at trac #1785 is fixed:: sage: K.<a> = NumberField(x^2 + x - (3^3-3)) sage: E = EllipticCurve('37a') sage: X = E(K) sage: X Abelian group of points on Elliptic Curve defined by y^2 + y = x^3 + (-1)*x over Number Field in a with defining polynomial x^2 + x - 24 sage: P = X([3,a]) sage: P (3 : a : 1) sage: P in E False sage: P in E.base_extend(K) True """ R = X.base_ring() if R != S: X = X.base_extend(S) Y = spec.Spec(S, R) HomsetWithBase.__init__(self, Y, X, category=category, check=check, base=ZZ)
def __init__(self, R, S, category=None): """ Initialize ``self``. EXAMPLES:: sage: Hom(ZZ, QQ) Set of Homomorphisms from Integer Ring to Rational Field """ if category is None: category = _Rings HomsetWithBase.__init__(self, R, S, category)
def __init__(self, R, S, category = None): """ Initialize ``self``. EXAMPLES:: sage: Hom(ZZ, QQ) Set of Homomorphisms from Integer Ring to Rational Field """ if category is None: category = _Rings HomsetWithBase.__init__(self, R, S, category)
def __init__(self, G, H): r""" See ``MatrixGroupHomset`` for full documentation. EXAMPLES:: sage: F = GF(5) sage: gens = [matrix(F,2,[1,2, -1, 1]), matrix(F,2, [1,1, 0,1])] sage: G = MatrixGroup(gens) sage: from sage.groups.matrix_gps.homset import MatrixGroupHomset sage: MatrixGroupHomset(G, G) Set of Homomorphisms from Matrix group over Finite Field of size 5 with 2 generators: [[[1, 2], [4, 1]], [[1, 1], [0, 1]]] to Matrix group over Finite Field of size 5 with 2 generators: [[[1, 2], [4, 1]], [[1, 1], [0, 1]]] """ HomsetWithBase.__init__(self, G, H, GROUPS, G.base_ring())
def __init__(self, G, H, category=None, check=True): r""" Return the homset of two libgap groups. TESTS:: sage: from sage.groups.abelian_gps.abelian_group_gap import AbelianGroupGap sage: A = AbelianGroupGap([2,4]) sage: H = A.Hom(A) sage: TestSuite(H).run() """ if check: from sage.groups.perm_gps.permgroup import PermutationGroup_generic if not isinstance(G, (ParentLibGAP, PermutationGroup_generic)): raise TypeError("G (={}) must be a ParentLibGAP or a permutation group".format(G)) if not isinstance(H, (ParentLibGAP, PermutationGroup_generic)): raise TypeError("H (={}) must be a ParentLibGAP or a permutation group".format(H)) HomsetWithBase.__init__(self, G, H, category, check=check, base=ZZ)
def _coerce_impl(self, x): """ Coerce x into self, if possible. EXAMPLES:: sage: J = J0(37) ; J.Hom(J)._coerce_impl(matrix(ZZ,4,[5..20])) Abelian variety endomorphism of Abelian variety J0(37) of dimension 2 sage: K = J0(11) * J0(11) ; J.Hom(K)._coerce_impl(matrix(ZZ,4,[5..20])) Abelian variety morphism: From: Abelian variety J0(37) of dimension 2 To: Abelian variety J0(11) x J0(11) of dimension 2 """ if self.matrix_space().has_coerce_map_from(parent(x)): return self(x) else: return HomsetWithBase._coerce_impl(self, x)
def __init__(self, R, S, category = None): if category is None: category = _Rings HomsetWithBase.__init__(self, R, S, category)
def __init__(self, R, S, category=None): if category is None: category = _Rings HomsetWithBase.__init__(self, R, S, category)