当前位置: 首页>>代码示例>>Python>>正文


Python morphism.Morphism类代码示例

本文整理汇总了Python中sage.categories.morphism.Morphism的典型用法代码示例。如果您正苦于以下问题:Python Morphism类的具体用法?Python Morphism怎么用?Python Morphism使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Morphism类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, parent, im_gens, check=True):
        """
        EXAMPLES::

            sage: L = LieAlgebra(QQ, 'x,y,z')
            sage: Lyn = L.Lyndon()
            sage: H = L.Hall()
            sage: phi = Lyn.coerce_map_from(H)

        We skip the category test because the Homset's element class
        does not match this class::

            sage: TestSuite(phi).run(skip=['_test_category'])
        """
        Morphism.__init__(self, parent)
        if not isinstance(im_gens, Sequence_generic):
            if not isinstance(im_gens, (tuple, list)):
                im_gens = [im_gens]
            im_gens = Sequence(im_gens, parent.codomain(), immutable=True)
        if check:
            if len(im_gens) != len(parent.domain().lie_algebra_generators()):
                raise ValueError("number of images must equal number of generators")
            # TODO: Implement a (meaningful) _is_valid_homomorphism_()
            #if not parent.domain()._is_valid_homomorphism_(parent.codomain(), im_gens):
            #    raise ValueError("relations do not all (canonically) map to 0 under map determined by images of generators.")
        if not im_gens.is_immutable():
            import copy
            im_gens = copy.copy(im_gens)
            im_gens.set_immutable()
        self.__im_gens = im_gens
开发者ID:saraedum,项目名称:sage-renamed,代码行数:30,代码来源:morphism.py

示例2: __init__

    def __init__(self, relations, base_ring_images, images, codomain, reduce = True) :
        r"""
        INPUT:
            - ``relations``        -- An ideal in a polynomial ring.
            - ``base_ring_images`` -- A list or sequence of elements of a ring of (equivariant)
                                      monoid power series.
            - ``images``           -- A list or sequence of monoid power series.
            - ``codomain``         -- An ambient of (equivariant) monoid power series.
            - ``reduce``           -- A boolean (default: ``True``); If ``True`` polynomials will
                                      be reduced before the substitution is carried out.
        
        TESTS::
            sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *
            sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_ring import *
            sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_element import *
            sage: from psage.modform.fourier_expansion_framework.gradedexpansions.gradedexpansion_grading import DegreeGrading
            sage: from psage.modform.fourier_expansion_framework.gradedexpansions.gradedexpansion_ring import *
            sage: from psage.modform.fourier_expansion_framework.gradedexpansions.gradedexpansion_functor import *
            sage: mps = MonoidPowerSeriesRing(QQ, NNMonoid(False))
            sage: ev = GradedExpansionEvaluationHomomorphism(PolynomialRing(QQ, ['a', 'b']).ideal(0), Sequence([MonoidPowerSeries(mps, {1 : 1}, mps.monoid().filter(2))]), Sequence([MonoidPowerSeries(mps, {1 : 1, 2 : 3}, mps.monoid().filter(4))]), mps, False)
        """
        self.__relations = relations
        self.__base_ring_images = base_ring_images
        self.__images = images
        self.__reduce = reduce
        
        Morphism.__init__(self, relations.ring(), codomain)

        self._repr_type_str = "Evaluation homomorphism from %s to %s" % (relations.ring(), codomain)
开发者ID:RalphieBoy,项目名称:psage,代码行数:29,代码来源:gradedexpansion_functor.py

示例3: __init__

    def __init__(self, domain, codomain):
        """
        The Python constructor

        EXAMPLES::

            sage: R = QQ['x']['y']['s','t']['X']
            sage: p = R.random_element()
            sage: from sage.rings.polynomial.flatten import FlatteningMorphism
            sage: f = FlatteningMorphism(R)
            sage: g = f.section()
            sage: g(f(p)) == p
            True

        ::

            sage: R = QQ['a','b','x','y']
            sage: S = ZZ['a','b']['x','z']
            sage: from sage.rings.polynomial.flatten import UnflatteningMorphism
            sage: UnflatteningMorphism(R, S)
            Traceback (most recent call last):
            ...
            ValueError: rings must have same base ring

        ::

            sage: R = QQ['a','b','x','y']
            sage: S = QQ['a','b']['x','z','w']
            sage: from sage.rings.polynomial.flatten import UnflatteningMorphism
            sage: UnflatteningMorphism(R, S)
            Traceback (most recent call last):
            ...
            ValueError: rings must have the same number of variables
        """
        if not is_MPolynomialRing(domain):
            raise ValueError("domain should be a multivariate polynomial ring")
        if not is_PolynomialRing(codomain) and not is_MPolynomialRing(codomain):
            raise ValueError("codomain should be a polynomial ring")

        ring = codomain
        intermediate_rings = []

        while is_PolynomialRing(ring) or is_MPolynomialRing(ring):
            intermediate_rings.append(ring)
            ring = ring.base_ring()

        if domain.base_ring() != intermediate_rings[-1].base_ring():
            raise ValueError("rings must have same base ring")
        if domain.ngens() != sum([R.ngens() for R in intermediate_rings]):
            raise ValueError("rings must have the same number of variables")

        self._intermediate_rings = intermediate_rings
        self._intermediate_rings.reverse()

        Morphism.__init__(self, domain, codomain)
        self._repr_type_str = 'Unflattening'
开发者ID:saraedum,项目名称:sage-renamed,代码行数:56,代码来源:flatten.py

示例4: __init__

    def __init__(self, map, base_ring=None, cohomology=False):
        """
        INPUT:

        - ``map`` -- the map of simplicial complexes
        - ``base_ring`` -- a field (optional, default ``QQ``)
        - ``cohomology`` -- boolean (optional, default ``False``). If
          ``True``, return the induced map in cohomology rather than
          homology.

        EXAMPLES::

            sage: from sage.homology.homology_morphism import InducedHomologyMorphism
            sage: K = simplicial_complexes.RandomComplex(8, 3)
            sage: H = Hom(K,K)
            sage: id = H.identity()
            sage: f = InducedHomologyMorphism(id, QQ)
            sage: f.to_matrix(0) == 1  and  f.to_matrix(1) == 1  and  f.to_matrix(2) == 1
            True
            sage: f = InducedHomologyMorphism(id, ZZ)
            Traceback (most recent call last):
            ...
            ValueError: the coefficient ring must be a field
            sage: S1 = simplicial_complexes.Sphere(1).barycentric_subdivision()
            sage: S1.is_mutable()
            True
            sage: g = Hom(S1, S1).identity()
            sage: h = g.induced_homology_morphism(QQ)
            Traceback (most recent call last):
            ...
            ValueError: the domain and codomain complexes must be immutable
            sage: S1.set_immutable()
            sage: g = Hom(S1, S1).identity()
            sage: h = g.induced_homology_morphism(QQ)
        """
        if (isinstance(map.domain(), SimplicialComplex)
            and (map.domain().is_mutable() or map.codomain().is_mutable())):
                raise ValueError('the domain and codomain complexes must be immutable')
        if base_ring is None:
            base_ring = QQ
        if not base_ring.is_field():
            raise ValueError('the coefficient ring must be a field')

        self._cohomology = cohomology
        self._map = map
        self._base_ring = base_ring
        if cohomology:
            domain = map.domain().cohomology_ring(base_ring=base_ring)
            codomain = map.codomain().cohomology_ring(base_ring=base_ring)
            Morphism.__init__(self, Hom(domain, codomain,
                                        category=GradedAlgebrasWithBasis(base_ring)))
        else:
            domain = map.domain().homology_with_basis(base_ring=base_ring, cohomology=cohomology)
            codomain = map.codomain().homology_with_basis(base_ring=base_ring, cohomology=cohomology)
            Morphism.__init__(self, Hom(domain, codomain,
                                        category=GradedModulesWithBasis(base_ring)))
开发者ID:mcognetta,项目名称:sage,代码行数:56,代码来源:homology_morphism.py

示例5: __init__

    def __init__(self, parent):
        r"""
        TESTS::

            sage: from sage.rings.valuation.valuation import DiscretePseudoValuation
            sage: isinstance(ZZ.valuation(2), DiscretePseudoValuation)
            True

        """
        Morphism.__init__(self, parent=parent)
开发者ID:saraedum,项目名称:sage-renamed,代码行数:10,代码来源:valuation.py

示例6: __init__

    def __init__(self, parent):
        """
        Set-theoretic map between matrix groups.

        EXAMPLES::

            sage: from sage.groups.matrix_gps.morphism import MatrixGroupMap
            sage: MatrixGroupMap(ZZ.Hom(ZZ))   # mathematical nonsense
            MatrixGroup endomorphism of Integer Ring
        """
        Morphism.__init__(self, parent)
开发者ID:BlairArchibald,项目名称:sage,代码行数:11,代码来源:morphism.py

示例7: __init__

    def __init__(self, domain):
        r"""
        EXAMPLES::

            sage: G = AdditiveAbelianGroupWrapper(QQbar, [sqrt(QQbar(2)), sqrt(QQbar(3))], [0, 0])
            sage: F = QQbar.coerce_map_from(G); F
            Generic morphism:
              From: Additive abelian group isomorphic to Z + Z embedded in Algebraic Field
              To:   Algebraic Field
            sage: type(F)
            <class 'sage.groups.additive_abelian.additive_abelian_wrapper.UnwrappingMorphism'>
        """
        Morphism.__init__(self, domain.Hom(domain.universe()))
开发者ID:mcognetta,项目名称:sage,代码行数:13,代码来源:additive_abelian_wrapper.py

示例8: __init__

    def __init__(self, domain):
        r"""
        TESTS::

            sage: from sage.modular.pollack_stevens.sigma0 import Sigma0, _Sigma0Embedding
            sage: x = _Sigma0Embedding(Sigma0(3))
            sage: TestSuite(x).run(skip=['_test_category'])

        # TODO: The category test breaks because _Sigma0Embedding is not an instance of
        # the element class of its parent (a homset in the category of
        # monoids). I have no idea how to fix this.
        """
        Morphism.__init__(self, domain.Hom(domain._matrix_space, category=Monoids()))
开发者ID:saraedum,项目名称:sage-renamed,代码行数:13,代码来源:sigma0.py

示例9: __init__

    def __init__(self, model, A, check=True):
        r"""
        See :class:`HyperbolicIsometry` for full documentation.

        EXAMPLES::

            sage: A = HyperbolicPlane().UHP().get_isometry(matrix(2, [0,1,-1,0]))
            sage: TestSuite(A).run(skip="_test_category")
        """
        if check:
            model.isometry_test(A)
        self._matrix = copy(A) # Make a copy of the potentially mutable matrix
        self._matrix.set_immutable() # Make it immutable
        Morphism.__init__(self, Hom(model, model))
开发者ID:aaditya-thakkar,项目名称:sage,代码行数:14,代码来源:hyperbolic_isometry.py

示例10: __init__

    def __init__(self, domain, codomain):
        """
        Initialize ``self``.

        EXAMPLES::

            sage: L = LieAlgebras(QQ).FiniteDimensional().WithBasis().example()
            sage: f = L.lift

        We skip the category test since this is currently not an element of
        a homspace::

            sage: TestSuite(f).run(skip="_test_category")
        """
        Morphism.__init__(self, Hom(domain, codomain))
开发者ID:saraedum,项目名称:sage-renamed,代码行数:15,代码来源:lie_algebras.py

示例11: __init__

 def __init__(self, domain, codomain) :
     """
     INPUT:
         - ``domain``   -- A ring; The base ring.
         - ``codomain`` -- A ring; The ring of monoid power series.
     
     TESTS::
         sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_functor import MonoidPowerSeriesFunctor, MonoidPowerSeriesBaseRingInjection
         sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import NNMonoid
         sage: mps = MonoidPowerSeriesFunctor(NNMonoid(False))(ZZ)
         sage: binj = MonoidPowerSeriesBaseRingInjection(ZZ, mps)
     """
     Morphism.__init__(self, domain, codomain)
     
     self._repr_type_str = "MonoidPowerSeries base injection"
开发者ID:Alwnikrotikz,项目名称:purplesage,代码行数:15,代码来源:monoidpowerseries_functor.py

示例12: __init__

    def __init__(self, parent, phi, check=True):
        """
        A morphism between finitely generated modules over a PID.

        EXAMPLES::

            sage: V = span([[1/2,1,1],[3/2,2,1],[0,0,1]],ZZ); W = V.span([2*V.0+4*V.1, 9*V.0+12*V.1, 4*V.2])
            sage: Q = V/W; Q
            Finitely generated module V/W over Integer Ring with invariants (4, 12)
            sage: phi = Q.hom([Q.0+3*Q.1, -Q.1]); phi
            Morphism from module over Integer Ring with invariants (4, 12) to module with invariants (4, 12) that sends the generators to [(1, 3), (0, 11)]
            sage: phi(Q.0) == Q.0 + 3*Q.1
            True
            sage: phi(Q.1) == -Q.1
            True

        For full documentation, see :class:`FGP_Morphism`.
        """
        Morphism.__init__(self, parent)
        M = parent.domain()
        N = parent.codomain()
        if isinstance(phi, FGP_Morphism):
            if check:
                if phi.parent() != parent:
                    raise TypeError
            phi = phi._phi
            check = False # no need

        # input: phi is a morphism from MO = M.optimized().V() to N.V()
        # that sends MO.W() to N.W()
        if check:
            if not is_Morphism(phi) and M == N:
                A = M.optimized()[0].V()
                B = N.V()
                s = M.base_ring()(phi) * B.coordinate_module(A).basis_matrix()
                phi = A.Hom(B)(s)

            MO, _ = M.optimized()
            if phi.domain() != MO.V():
                raise ValueError("domain of phi must be the covering module for the optimized covering module of the domain")
            if phi.codomain() != N.V():
                raise ValueError("codomain of phi must be the covering module the codomain.")
            # check that MO.W() gets sent into N.W()
            # todo (optimize): this is slow:
            for x in MO.W().basis():
                if phi(x) not in N.W():
                    raise ValueError("phi must send optimized submodule of M.W() into N.W()")
        self._phi = phi
开发者ID:saraedum,项目名称:sage-renamed,代码行数:48,代码来源:fgp_morphism.py

示例13: __init__

    def __init__(self, UCF):
        r"""
        INPUT:

        - ``UCF`` -- a universal cyclotomic field

        TESTS::

            sage: UCF = UniversalCyclotomicField()
            sage: UCF.coerce_embedding()
            Generic morphism:
              From: Universal Cyclotomic Field
              To:   Algebraic Field
        """
        from sage.rings.qqbar import QQbar
        Morphism.__init__(self, UCF, QQbar)
开发者ID:aaditya-thakkar,项目名称:sage,代码行数:16,代码来源:universal_cyclotomic_field.py

示例14: __init__

    def __init__(self, domain, codomain):
        """
        Construct the morphism

        TESTS::

            sage: Z4 = AbelianGroupWithValues([I], [4])
            sage: from sage.groups.abelian_gps.values import AbelianGroupWithValuesEmbedding
            sage: AbelianGroupWithValuesEmbedding(Z4, Z4.values_group())
            Generic morphism:
              From: Multiplicative Abelian group isomorphic to C4
              To:   Symbolic Ring
        """
        assert domain.values_group() is codomain
        from sage.categories.homset import Hom
        Morphism.__init__(self, Hom(domain, codomain))
开发者ID:biasse,项目名称:sage,代码行数:16,代码来源:values.py

示例15: __init__

    def __init__(self, E, kernel):
        if not is_EdwardsCurve(E):
            raise TypeError("E parameter must be an EdwardsCurve.")

        if not isinstance(kernel, type([1,1])) and kernel in E :
            # a single point was given, we put it in a list
            # the first condition assures that [1,1] is treated as x+1
            kernel = [E(kernel)]
        
        if isinstance(kernel, list):
            for P in kernel:
                if P not in E:
                    raise ValueError("The generators of the kernel of the isogeny must first lie on the EdwardsCurve")    
        
        self.__E1 = E #domain curve
        self.__E2 = None #codomain curve; not yet found
        
        self.__degree = None
        self.__base_field = E.base_ring()
        
        self.__kernel_gens = kernel
        self.__kernel_list = None
        self.__degree = None
        
        self.__poly_ring = PolynomialRing(self.__base_field, ['x','y'])

        self.__x_var = self.__poly_ring('x')
        self.__y_var = self.__poly_ring('y')
        
        # to determine the codomain, and the x and y rational maps
        self.__initialize_kernel_list()
        self.__compute_B()
        self.__compute_E2()
        self.__initialize_rational_maps()
        self._domain = self.__E1
        self._codomain = self.__E2

        # sets up the parent
        parent = homset.Hom(self.__E1(0).parent(), self.__E2(0).parent())
        Morphism.__init__(self, parent)
开发者ID:adarshsaraf123,项目名称:Dissertation,代码行数:40,代码来源:edwards_curve.py


注:本文中的sage.categories.morphism.Morphism类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。