def gen(self, i=0): """ Return i-th generator of self. INPUT: - ``i`` - an integer OUTPUT: a morphism EXAMPLES:: sage: E = End(J0(22)) sage: E.gen(0).matrix() [1 0 0 0] [0 1 0 0] [0 0 1 0] [0 0 0 1] """ self.calculate_generators() if i > self.ngens(): raise ValueError, "self only has %s generators" % self.ngens() return morphism.Morphism(self, self._gens[i])
def _calculate_endomorphism_generators(self): """ Calculate generators for the endomorphism ring of self. EXAMPLES:: sage: J0(11)._calculate_endomorphism_generators() [Abelian variety endomorphism of Abelian variety J0(11) of dimension 1] sage: ls = J0(46)._calculate_endomorphism_generators() ; ls [Abelian variety endomorphism of Abelian variety J0(46) of dimension 5, Abelian variety endomorphism of Abelian variety J0(46) of dimension 5, Abelian variety endomorphism of Abelian variety J0(46) of dimension 5, Abelian variety endomorphism of Abelian variety J0(46) of dimension 5, Abelian variety endomorphism of Abelian variety J0(46) of dimension 5] sage: len(ls) == J0(46).dimension() True """ D = self.decomposition() phi = self._isogeny_to_product_of_simples() psi = phi.complementary_isogeny() m1 = phi.matrix() m2 = psi.matrix() H = self.Hom(self) M = H.matrix_space() ls = [] ind = 0 for d in D: to_newform = d._isogeny_to_newform_abelian_variety() n1 = to_newform.matrix() n2 = to_newform.complementary_isogeny().matrix() f_gens = to_newform.codomain()._calculate_endomorphism_generators() small_space = to_newform.parent().matrix_space() f_gens = [small_space(x.list()) for x in f_gens] for m in f_gens: mat = H.matrix_space()(0) mat.set_block(ind, ind, n1 * m * n2) ls.append((m1 * mat * m2).list()) ind += 2 * d.dimension() return [H(morphism.Morphism(H, M(x))) for x in ls]
def __call__(self, M): r""" Create a homomorphism in this space from M. M can be any of the following: - a Morphism of abelian varieties - a matrix of the appropriate size (i.e. 2\*self.domain().dimension() x 2\*self.codomain().dimension()) whose entries are coercible into self.base_ring() - anything that can be coerced into self.matrix_space() EXAMPLES:: sage: H = Hom(J0(11), J0(22)) sage: phi = H(matrix(ZZ,2,4,[5..12])) ; phi Abelian variety morphism: From: Abelian variety J0(11) of dimension 1 To: Abelian variety J0(22) of dimension 2 sage: phi.matrix() [ 5 6 7 8] [ 9 10 11 12] sage: phi.matrix().parent() Full MatrixSpace of 2 by 4 dense matrices over Integer Ring :: sage: H = J0(22).Hom(J0(11)*J0(11)) sage: m1 = J0(22).degeneracy_map(11,1).matrix() ; m1 [ 0 1] [-1 1] [-1 0] [ 0 -1] sage: m2 = J0(22).degeneracy_map(11,2).matrix() ; m2 [ 1 -2] [ 0 -2] [ 1 -1] [ 0 -1] sage: m = m1.transpose().stack(m2.transpose()).transpose() ; m [ 0 1 1 -2] [-1 1 0 -2] [-1 0 1 -1] [ 0 -1 0 -1] sage: phi = H(m) ; phi Abelian variety morphism: From: Abelian variety J0(22) of dimension 2 To: Abelian variety J0(11) x J0(11) of dimension 2 sage: phi.matrix() [ 0 1 1 -2] [-1 1 0 -2] [-1 0 1 -1] [ 0 -1 0 -1] """ if isinstance(M, morphism.Morphism): if M.parent() is self: return M elif M.domain() == self.domain() and M.codomain() == self.codomain( ): M = M.matrix() else: raise ValueError, "cannot convert %s into %s" % (M, self) elif is_Matrix(M): if M.base_ring() != ZZ: M = M.change_ring(ZZ) if M.nrows() != 2 * self.domain().dimension() or M.ncols( ) != 2 * self.codomain().dimension(): raise TypeError, "matrix has wrong dimension" elif self.matrix_space().has_coerce_map_from(parent(M)): M = self.matrix_space()(M) else: raise TypeError, "can only coerce in matrices or morphisms" return morphism.Morphism(self, M)