當前位置: 首頁>>代碼示例>>Python>>正文


Python disjoint_union_enumerated_sets.DisjointUnionEnumeratedSets類代碼示例

本文整理匯總了Python中sage.sets.disjoint_union_enumerated_sets.DisjointUnionEnumeratedSets的典型用法代碼示例。如果您正苦於以下問題:Python DisjointUnionEnumeratedSets類的具體用法?Python DisjointUnionEnumeratedSets怎麽用?Python DisjointUnionEnumeratedSets使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DisjointUnionEnumeratedSets類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

    def __init__(self, crystals, facade, keepkey, category, **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 facade:
            Parent.__init__(self, facade=tuple(crystals), category=category)
        else:
            Parent.__init__(self, category=category)
        DisjointUnionEnumeratedSets.__init__(self, crystals, keepkey=keepkey, facade=facade)
        self.rename("Direct sum of the crystals {}".format(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:Babyll,項目名稱:sage,代碼行數:33,代碼來源:direct_sum.py

示例2: __init__

    def __init__(self, max_entry=None):
        r"""
        Initialize ``self``.

        TESTS::

            sage: CT = CompositionTableaux()
            sage: TestSuite(CT).run()
        """
        self.max_entry = max_entry
        CT_n = lambda n: CompositionTableaux_size(n, max_entry)
        DisjointUnionEnumeratedSets.__init__(self,
                    Family(NonNegativeIntegers(), CT_n),
                    facade=True, keepkey = False)
開發者ID:mcognetta,項目名稱:sage,代碼行數:14,代碼來源:composition_tableau.py

示例3: __init__

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

            sage: sum(x**len(t) for t in
            ....:     set(RootedTree(t) for t in OrderedTrees(6)))
            x^5 + x^4 + 3*x^3 + 6*x^2 + 9*x
            sage: sum(x**len(t) for t in RootedTrees(6))
            x^5 + x^4 + 3*x^3 + 6*x^2 + 9*x

            sage: TestSuite(RootedTrees()).run() # long time
        """
        DisjointUnionEnumeratedSets.__init__(
            self, Family(NonNegativeIntegers(), RootedTrees_size),
            facade=True, keepkey=False)
開發者ID:mcognetta,項目名稱:sage,代碼行數:15,代碼來源:rooted_tree.py

示例4: __init__

    def __init__(self, n=None):
        r"""
        EXAMPLES::

            sage: from sage.combinat.baxter_permutations import BaxterPermutations_all
            sage: BaxterPermutations_all()
            Baxter permutations
        """
        self.element_class = Permutations().element_class
        from sage.categories.examples.infinite_enumerated_sets import NonNegativeIntegers
        from sage.sets.family import Family
        DisjointUnionEnumeratedSets.__init__(self,
                                             Family(NonNegativeIntegers(),
                                                    BaxterPermutations_size),
                                             facade=False, keepkey=False)
開發者ID:Findstat,項目名稱:sage,代碼行數:15,代碼來源:baxter_permutations.py

示例5: __init__

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

            sage: C = WeightedIntegerVectors([2,1,3])
            sage: C.category()
            Category of facade infinite enumerated sets with grading
            sage: TestSuite(C).run()
        """
        self._weights = weight
        from sage.sets.all import Family, NonNegativeIntegers
        # Use "partial" to make the basis function (with the weights
        # argument specified) pickleable.  Otherwise, it seems to
        # cause problems...
        from functools import partial
        F = Family(NonNegativeIntegers(), partial(WeightedIntegerVectors, weight=weight))
        cat = (SetsWithGrading(), InfiniteEnumeratedSets())
        DisjointUnionEnumeratedSets.__init__(self, F, facade=True, keepkey=False,
                                             category=cat)
開發者ID:mcognetta,項目名稱:sage,代碼行數:19,代碼來源:integer_vector_weighted.py

示例6: __init__

    def __init__(self, crystals, **options):
        """
        TESTS::
        
            sage: C = CrystalOfLetters(['A',2])
            sage: B = DirectSumOfCrystals([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: isinstance(B, DirectSumOfCrystals)
            True
        """
        if options.has_key('keepkey'):
            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:pombredanne,項目名稱:sage-1,代碼行數:39,代碼來源:direct_sum.py

示例7: __init__

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

            sage: from sage.combinat.ordered_tree import OrderedTrees_all
            sage: B = OrderedTrees_all()
            sage: B.cardinality()
            +Infinity

            sage: it = iter(B)
            sage: (next(it), next(it), next(it), next(it), next(it))
            ([], [[]], [[], []], [[[]]], [[], [], []])
            sage: next(it).parent()
            Ordered trees
            sage: B([])
            []

            sage: B is OrderedTrees_all()
            True
            sage: TestSuite(B).run() # long time
            """
        DisjointUnionEnumeratedSets.__init__(
            self, Family(NonNegativeIntegers(), OrderedTrees_size),
            facade=True, keepkey=False)
開發者ID:Findstat,項目名稱:sage,代碼行數:24,代碼來源:ordered_tree.py

示例8: __init__

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

            sage: from sage.combinat.binary_tree import BinaryTrees_all
            sage: B = BinaryTrees_all()
            sage: B.cardinality()
            +Infinity

            sage: it = iter(B)
            sage: (it.next(), it.next(), it.next(), it.next(), it.next())
            (., [., .], [., [., .]], [[., .], .], [., [., [., .]]])
            sage: it.next().parent()
            Binary trees
            sage: B([])
            [., .]

            sage: B is BinaryTrees_all()
            True
            sage: TestSuite(B).run()
            """
        DisjointUnionEnumeratedSets.__init__(
            self, Family(NonNegativeIntegers(), BinaryTrees_size),
            facade=True, keepkey = False)
開發者ID:biasse,項目名稱:sage,代碼行數:24,代碼來源:binary_tree.py


注:本文中的sage.sets.disjoint_union_enumerated_sets.DisjointUnionEnumeratedSets類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。