• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python category.Category类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __classcall_private__

    def __classcall_private__(cls, crystals, facade=True, keepkey=False, category=None):
        """
        Normalization of arguments; see :class:`UniqueRepresentation`.

        TESTS:

        We check that direct sum of crystals have unique representation::

            sage: B = crystals.Tableaux(['A',2], shape=[2,1])
            sage: C = crystals.Letters(['A',2])
            sage: D1 = crystals.DirectSum([B, C])
            sage: D2 = crystals.DirectSum((B, C))
            sage: D1 is D2
            True
            sage: D3 = crystals.DirectSum([B, C, C])
            sage: D4 = crystals.DirectSum([D1, C])
            sage: D3 is D4
            True
        """
        if not isinstance(facade, bool) or not isinstance(keepkey, bool):
            raise TypeError
        # Normalize the facade-keepkey by giving keepkey dominance
        facade = not keepkey

        # We expand out direct sums of crystals
        ret = []
        for x in Family(crystals):
            if isinstance(x, DirectSumOfCrystals):
                ret += list(x.crystals)
            else:
                ret.append(x)
        category = Category.meet([Category.join(c.categories()) for c in ret])
        return super(DirectSumOfCrystals, cls).__classcall__(cls,
            Family(ret), facade=facade, keepkey=keepkey, category=category)
开发者ID:mcognetta,项目名称:sage,代码行数:34,代码来源:direct_sum.py


示例2: __init__

    def __init__(self, G):
        """
        TESTS::

            sage: S8 = SymmetricGroup(8)
            sage: TestSuite(GSets(S8)).run()
        """
        Category.__init__(self)
        self.__G = G
开发者ID:drupel,项目名称:sage,代码行数:9,代码来源:g_sets.py


示例3: __init__

    def __init__(self):
        """
        TESTS::

            sage: C = Schemes()
            sage: C
            Category of Schemes
            sage: TestSuite(C).run()
        """
        Category.__init__(self, "Schemes")
开发者ID:sageb0t,项目名称:testsage,代码行数:10,代码来源:schemes.py


示例4: __init__

    def __init__(self, left_base, right_base, name=None):
        """
        EXAMPLES::

            sage: C = Bimodules(QQ, ZZ)
            sage: TestSuite(C).run()
        """
        Category.__init__(self, name)
        assert left_base  in _Rings, "The left base must be a ring"
        assert right_base in _Rings, "The right base must be a ring"
        self._left_base_ring = left_base
        self._right_base_ring = right_base
开发者ID:ohanar,项目名称:sage,代码行数:12,代码来源:bimodules.py


示例5: __init__

    def __init__(self, G = None):
        """
        TESTS::

            sage: S8 = SymmetricGroup(8)
            sage: C = Groupoid(S8)
            sage: TestSuite(C).run()
        """
        Category.__init__(self) #, "Groupoid")
        if G is None:
            from sage.groups.perm_gps.permgroup_named import SymmetricGroup
            G = SymmetricGroup(8)
        self.__G = G
开发者ID:bgxcpku,项目名称:sagelib,代码行数:13,代码来源:groupoid.py


示例6: __init__

    def __init__(self, left_base, right_base, name=None):
        """
        EXAMPLES::

            sage: C = Bimodules(QQ, ZZ)
            sage: TestSuite(C).run()
        """
        if not (left_base in Rings or (isinstance(left_base, Category) and left_base.is_subcategory(Rings()))):
            raise ValueError("the left base must be a ring or a subcategory of Rings()")
        if not (right_base in Rings or (isinstance(right_base, Category) and right_base.is_subcategory(Rings()))):
            raise ValueError("the right base must be a ring or a subcategory of Rings()")
        self._left_base_ring = left_base
        self._right_base_ring = right_base
        Category.__init__(self, name)
开发者ID:sensen1,项目名称:sage,代码行数:14,代码来源:bimodules.py


示例7: __init__

    def __init__(self, sets, category, order=None, **kwargs):
        r"""
        See :class:`CartesianProductPoset` for details.

        TESTS::

            sage: P = Poset((srange(3), lambda left, right: left <= right))
            sage: C = cartesian_product((P, P), order='notexisting')
            Traceback (most recent call last):
            ...
            ValueError: No order 'notexisting' known.
            sage: C = cartesian_product((P, P), category=(Groups(),))
            sage: C.category()
            Join of Category of groups and Category of posets
        """
        if order is None:
            self._le_ = self.le_product
        elif isinstance(order, str):
            try:
                self._le_ = getattr(self, 'le_' + order)
            except AttributeError:
                raise ValueError("No order '%s' known." % (order,))
        else:
            self._le_ = order

        from sage.categories.category import Category
        from sage.categories.posets import Posets
        if not isinstance(category, tuple):
            category = (category,)
        category = Category.join(category + (Posets(),))
        super(CartesianProductPoset, self).__init__(
            sets, category, **kwargs)
开发者ID:sensen1,项目名称:sage,代码行数:32,代码来源:cartesian_product.py


示例8: default_super_categories

    def default_super_categories(cls, category, *args):
        """
        Return the default super categories of `F_{Cat}(A,B,...)` for
        `A,B,...` parents in `Cat`.

        INPUT:

        - ``cls`` -- the category class for the functor `F`
        - ``category`` -- a category `Cat`
        - ``*args`` -- further arguments for the functor

        OUTPUT:

        A join category.

        This implements the property that an induced subcategory is a
        subcategory.

        EXAMPLES:

        A subquotient of a monoid is a monoid, and a subquotient of
        semigroup::

            sage: Monoids().Subquotients().super_categories()
            [Category of monoids, Category of subquotients of semigroups]

        TESTS::

            sage: C = Monoids().Subquotients()
            sage: C.__class__.default_super_categories(C.base_category(), *C._args)
            Category of unital subquotients of semigroups
        """
        return Category.join([category, super(RegressiveCovariantConstructionCategory, cls).default_super_categories(category, *args)])
开发者ID:sagemath,项目名称:sage,代码行数:33,代码来源:covariant_functorial_construction.py


示例9: category_from_categories

    def category_from_categories(self, categories):
        """
        Return the category of `F(A,B,...)` for `A,B,...` parents in
        the given categories.

        INPUT:

         - ``self``: a functor `F`
         - ``categories``: a non empty tuple of categories

        EXAMPLES::

            sage: Cat1 = Rings()
            sage: Cat2 = Groups()
            sage: cartesian_product.category_from_categories((Cat1, Cat1, Cat1))
            Join of Category of rings and ...
                and Category of Cartesian products of semigroups and ...
                and Category of Cartesian products of commutative additive groups

            sage: cartesian_product.category_from_categories((Cat1, Cat2))
            Join of Category of monoids
                and Category of Cartesian products of semigroups
                and Category of Cartesian products of unital magmas
        """
        assert(len(categories) > 0)
        return self.category_from_category(Category.meet(categories))
开发者ID:ingolfured,项目名称:sageproject,代码行数:26,代码来源:covariant_functorial_construction.py


示例10: __init__

    def __init__(self, crystals, **options):
        """
        TESTS::

            sage: from sage.combinat.crystals.tensor_product import FullTensorProductOfCrystals
            sage: C = crystals.Letters(['A',2])
            sage: T = crystals.TensorProduct(C,C)
            sage: isinstance(T, FullTensorProductOfCrystals)
            True
            sage: TestSuite(T).run()
        """
        category = Category.meet([crystal.category() for crystal in crystals])
        category = category.TensorProducts()
        if any(c in Sets().Infinite() for c in crystals):
            category = category.Infinite()
        Parent.__init__(self, category=category)
        self.crystals = crystals
        if 'cartan_type' in options:
            self._cartan_type = CartanType(options['cartan_type'])
        else:
            if not crystals:
                raise ValueError("you need to specify the Cartan type if the tensor product list is empty")
            else:
                self._cartan_type = crystals[0].cartan_type()
        self.cartesian_product = cartesian_product(self.crystals)
        self.module_generators = self
开发者ID:vbraun,项目名称:sage,代码行数:26,代码来源:tensor_product.py


示例11: default_super_categories

    def default_super_categories(cls, category, *args):
        """
        Returns the default super categories of ``...``

        INPUT:

         - ``category`` -- a category

        OUTPUT: a join category

        This implements the property that an induced subcategory is a
        subcategory.

        EXAMPLES:

        A subquotient of a monoid is a monoid, and a subquotient of
        semigroup::

            sage: Monoids().Subquotients().super_categories()
            [Category of monoids, Category of subquotients of semigroups]

        TESTS::

            sage: C = Monoids().Subquotients()
            sage: C.__class__.default_super_categories(C.base_category(), *C._args)
            Join of Category of monoids and Category of subquotients of semigroups
        """
        return Category.join([category, super(RegressiveCovariantConstructionCategory, cls).default_super_categories(category, *args)])
开发者ID:CETHop,项目名称:sage,代码行数:28,代码来源:covariant_functorial_construction.py


示例12: __init__

    def __init__(self, crystals, **options):
        """
        TESTS::

            sage: from sage.combinat.crystals.tensor_product import FullTensorProductOfCrystals
            sage: C = CrystalOfLetters(['A',2])
            sage: T = TensorProductOfCrystals(C,C)
            sage: isinstance(T, FullTensorProductOfCrystals)
            True
            sage: TestSuite(T).run()
        """
        crystals = list(crystals)
        category = Category.meet([crystal.category() for crystal in crystals])
        Parent.__init__(self, category = category)
        self.rename("Full tensor product of the crystals %s"%(crystals,))
        self.crystals = crystals
        if options.has_key('cartan_type'):
            self._cartan_type = CartanType(options['cartan_type'])
        else:
            if len(crystals) == 0:
                raise ValueError, "you need to specify the Cartan type if the tensor product list is empty"
            else:
                self._cartan_type = crystals[0].cartan_type()
        self.cartesian_product = CartesianProduct(*self.crystals)
        self.module_generators = self
开发者ID:odellus,项目名称:sage,代码行数:25,代码来源:tensor_product.py


示例13: __init__

    def __init__(self, cartan_type):
        """
        Construct this Coxeter group as a Sage permutation group, by
        fetching the permutation representation of the generators from
        Chevie's database.

        TESTS::

            sage: from sage.combinat.root_system.coxeter_group import CoxeterGroupAsPermutationGroup
            sage: W = CoxeterGroupAsPermutationGroup(CartanType(["H",3])) # optional - chevie
            sage: TestSuite(W).run()             # optional - chevie
        """
        assert cartan_type.is_finite()
        assert cartan_type.is_irreducible()
        self._semi_simple_rank = cartan_type.n
        from sage.interfaces.gap3 import gap3
        gap3._start()
        gap3.load_package("chevie")
        self._gap_group = gap3('CoxeterGroup("%s",%s)'%(cartan_type.letter,cartan_type.n))
        # Following #9032, x.N is an alias for x.numerical_approx in every Sage object ...
        N = self._gap_group.__getattr__("N").sage()
        generators = [str(x) for x in self._gap_group.generators]
        self._is_positive_root = [None] + [ True ] * N + [False]*N
        PermutationGroup_generic.__init__(self, gens = generators,
                                          category = Category.join([FinitePermutationGroups(), FiniteCoxeterGroups()]))
开发者ID:CETHop,项目名称:sage,代码行数:25,代码来源:coxeter_group.py


示例14: _repr_object_names

    def _repr_object_names(self):
        """
        EXAMPLES::

            sage: Semigroups().Subquotients()  # indirect doctest
            Category of subquotients of semigroups
        """
        return "%s of %s"%(Category._repr_object_names(self), self.base_category()._repr_object_names())
开发者ID:CETHop,项目名称:sage,代码行数:8,代码来源:covariant_functorial_construction.py


示例15: _latex_

    def _latex_(self):
        """
        EXAMPLES::

            sage: print Bimodules(QQ, ZZ)._latex_()
            {\mathbf{Bimodules}}_{\Bold{Q}}_{\Bold{Z}}
        """
        from sage.misc.latex import latex
        return "{%s}_{%s}_{%s}"%(Category._latex_(self), latex(self._left_base_ring), latex(self._right_base_ring))
开发者ID:ohanar,项目名称:sage,代码行数:9,代码来源:bimodules.py


示例16: __init__

    def __init__(self, A, gens=None):
        """
        A subring of the endomorphism ring.

        INPUT:


        -  ``A`` - an abelian variety

        -  ``gens`` - (default: None); optional; if given
           should be a tuple of the generators as matrices


        EXAMPLES::

            sage: J0(23).endomorphism_ring()
            Endomorphism ring of Abelian variety J0(23) of dimension 2
            sage: sage.modular.abvar.homspace.EndomorphismSubring(J0(25))
            Endomorphism ring of Abelian variety J0(25) of dimension 0
            sage: E = J0(11).endomorphism_ring()
            sage: type(E)
            <class 'sage.modular.abvar.homspace.EndomorphismSubring_with_category'>
            sage: E.category()
            Join of Category of hom sets in Category of sets and Category of rings
            sage: E.homset_category()
            Category of modular abelian varieties over Rational Field
            sage: TestSuite(E).run(skip=["_test_elements"])

        TESTS:

        The following tests against a problem on 32 bit machines that
        occured while working on trac ticket #9944::

            sage: sage.modular.abvar.homspace.EndomorphismSubring(J1(12345))
            Endomorphism ring of Abelian variety J1(12345) of dimension 5405473

        """
        self._J = A.ambient_variety()
        self._A = A

        # Initialise self with the correct category.
        # TODO: a category should be able to specify the appropriate
        # category for its endomorphism sets
        # We need to initialise it as a ring first
        homset_cat = A.category()
        cat = Category.join([homset_cat.hom_category(),Rings()])
        Ring.__init__(self, A.base_ring())
        Homspace.__init__(self, A, A, cat=homset_cat)
        self._refine_category_(Rings())
        if gens is None:
            self._gens = None
        else:
            self._gens = tuple([ self._get_matrix(g) for g in gens ])
        self._is_full_ring = gens is None
开发者ID:chos9,项目名称:sage,代码行数:54,代码来源:homspace.py


示例17: __init__

    def __init__(self, crystals, **options):
        """
        TESTS::

            sage: C = crystals.Letters(['A',2])
            sage: B = crystals.DirectSum([C,C], keepkey=True)
            sage: B
            Direct sum of the crystals Family (The crystal of letters for type ['A', 2], The crystal of letters for type ['A', 2])
            sage: B.cartan_type()
            ['A', 2]

            sage: from sage.combinat.crystals.direct_sum import DirectSumOfCrystals
            sage: isinstance(B, DirectSumOfCrystals)
            True
        """
        if "keepkey" in options:
            keepkey = options["keepkey"]
        else:
            keepkey = False
        #        facade = options['facade']
        if keepkey:
            facade = False
        else:
            facade = True
        category = Category.meet([Category.join(crystal.categories()) for crystal in crystals])
        Parent.__init__(self, category=category)
        DisjointUnionEnumeratedSets.__init__(self, crystals, keepkey=keepkey, facade=facade)
        self.rename("Direct sum of the crystals %s" % (crystals,))
        self._keepkey = keepkey
        self.crystals = crystals
        if len(crystals) == 0:
            raise ValueError("The direct sum is empty")
        else:
            assert (crystal.cartan_type() == crystals[0].cartan_type() for crystal in crystals)
            self._cartan_type = crystals[0].cartan_type()
        if keepkey:
            self.module_generators = [
                self(tuple([i, b])) for i in range(len(crystals)) for b in crystals[i].module_generators
            ]
        else:
            self.module_generators = sum((list(B.module_generators) for B in crystals), [])
开发者ID:JoseGuzman,项目名称:sage,代码行数:41,代码来源:direct_sum.py


示例18: __init__

    def __init__(self, category, *args):
        """
        TESTS::

            sage: from sage.categories.covariant_functorial_construction import CovariantConstructionCategory
            sage: class FooBars(CovariantConstructionCategory):
            ...       pass
            sage: C = FooBars(ModulesWithBasis(QQ))
            sage: C
            Category of foo bars of modules with basis over Rational Field
            sage: C.base_category()
            Category of modules with basis over Rational Field
            sage: latex(C)
            \mathbf{FooBars}(\mathbf{ModulesWithBasis}_{\Bold{Q}})
            sage: import __main__; __main__.FooBars = FooBars # Fake FooBars being defined in a python module
            sage: TestSuite(C).run()
        """
        assert isinstance(category, Category)
        Category.__init__(self)
        self._base_category = category
        self._args = args
开发者ID:jwbober,项目名称:sagelib,代码行数:21,代码来源:covariant_functorial_construction.py


示例19: _latex_

    def _latex_(self):
        """
        Return a latex representation of ``self``.

        EXAMPLES::

            sage: print(Bimodules(QQ, ZZ)._latex_())
            {\mathbf{Bimodules}}_{\Bold{Q}, \Bold{Z}}
        """
        from sage.misc.latex import latex
        return "{{{0}}}_{{{1}, {2}}}".format(Category._latex_(self),
                                             latex(self._left_base_ring),
                                             latex(self._right_base_ring))
开发者ID:saraedum,项目名称:sage-renamed,代码行数:13,代码来源:bimodules.py


示例20: super_categories

    def super_categories(self):
        """
        Returns the super categories of a construction category

        EXAMPLES::

            sage: Sets().Subquotients().super_categories()
            [Category of sets]
            sage: Semigroups().Quotients().super_categories()
            [Category of subquotients of semigroups, Category of quotients of sets]
        """
        return Category.join(self.extra_super_categories() +
                             [self.__class__.default_super_categories(self.base_category(), *self._args)],
                             as_list = True)
开发者ID:CETHop,项目名称:sage,代码行数:14,代码来源:covariant_functorial_construction.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python morphism.Morphism类代码示例发布时间:2022-05-27
下一篇:
Python cartesian_product.cartesian_product函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap