Beispiel #1
0
 def __init__(self, parent, labels, subset, left, right):
     """
     TESTS::
     
         sage: S = species.SetSpecies()
         sage: F = S * S
         sage: a = F.structures(['a','b','c']).random_element()
         sage: a == loads(dumps(a))
         True
     """
     self._subset = subset
     GenericSpeciesStructure.__init__(self, parent, labels, [left, right])
Beispiel #2
0
    def __init__(self, parent, labels, pi, f, gs):
        """
        TESTS::

            sage: E = species.SetSpecies(); C = species.CycleSpecies()
            sage: L = E(C)
            sage: a = L.structures(['a','b','c']).random_element()
            sage: a == loads(dumps(a))
            True
        """
        self._partition = pi
        GenericSpeciesStructure.__init__(self, parent, labels, [f, gs])
Beispiel #3
0
 def __init__(self, parent, labels, subset, left, right):
     """
     TESTS::
     
         sage: S = species.SetSpecies()
         sage: F = S * S
         sage: a = F.structures(['a','b','c']).random_element()
         sage: a == loads(dumps(a))
         True
     """
     self._subset = subset
     GenericSpeciesStructure.__init__(self, parent, labels, [left, right])
Beispiel #4
0
    def __init__(self, parent, labels, pi, f, gs):
        """
        TESTS::

            sage: E = species.SetSpecies(); C = species.CycleSpecies()
            sage: L = E(C)
            sage: a = L.structures(['a','b','c']).random_element()
            sage: a == loads(dumps(a))
            True
        """
        self._partition = pi
        GenericSpeciesStructure.__init__(self, parent, labels, [f, gs])
Beispiel #5
0
 def __init__(self, parent, labels, list):
     """
     EXAMPLES::
     
         sage: from sage.combinat.species.partition_species import PartitionSpeciesStructure
         sage: P = species.PartitionSpecies()
         sage: s = PartitionSpeciesStructure(P, ['a','b','c'], [[1,2],[3]]); s
         {{'a', 'b'}, {'c'}}
         sage: s == loads(dumps(s))
         True
     """
     list = [SubsetSpeciesStructure(parent, labels, block) if not isinstance(block, SubsetSpeciesStructure) else block for block in list]
     list.sort(key=lambda block:(-len(block), block))
     GenericSpeciesStructure.__init__(self, parent, labels, list)
Beispiel #6
0
    def __init__(self, parent, labels, list):
        """
        EXAMPLES::

            sage: from sage.combinat.species.partition_species import PartitionSpeciesStructure
            sage: P = species.PartitionSpecies()
            sage: s = PartitionSpeciesStructure(P, ['a','b','c'], [[1,2],[3]]); s
            {{'a', 'b'}, {'c'}}
            sage: s == loads(dumps(s))
            True
        """
        list = [SubsetSpeciesStructure(parent, labels, block) if not isinstance(block, SubsetSpeciesStructure) else block for block in list]
        list.sort(key=lambda block:(-len(block), block))
        GenericSpeciesStructure.__init__(self, parent, labels, list)
Beispiel #7
0
    def __repr__(self):
        """
        EXAMPLES::

            sage: S = species.SubsetSpecies()
            sage: a = S.structures(["a","b","c"]).random_element(); a
            {}
        """
        s = GenericSpeciesStructure.__repr__(self)
        return "{" + s[1:-1] + "}"
Beispiel #8
0
    def __repr__(self):
        """
        EXAMPLES::

            sage: S = species.CycleSpecies()
            sage: a = S.structures(["a","b","c"]).random_element(); a
            ('a', 'b', 'c')
        """
        s = GenericSpeciesStructure.__repr__(self)
        return "(" + s[1:-1] + ")"
Beispiel #9
0
 def __repr__(self):
     """
     EXAMPLES::
     
         sage: S = species.PartitionSpecies()
         sage: a = S.structures(["a","b","c"]).random_element(); a
         {{'a', 'b', 'c'}}
     """
     s = GenericSpeciesStructure.__repr__(self)
     return "{"+s[1:-1]+"}"
Beispiel #10
0
 def __repr__(self):
     """
     EXAMPLES::
     
         sage: S = species.CycleSpecies()
         sage: a = S.structures(["a","b","c"]).random_element(); a
         ('a', 'b', 'c')
     """
     s = GenericSpeciesStructure.__repr__(self)
     return "(" + s[1:-1] + ")"
Beispiel #11
0
 def __repr__(self):
     """
     EXAMPLES::
     
         sage: S = species.SubsetSpecies()
         sage: a = S.structures(["a","b","c"]).random_element(); a
         {}
     """
     s = GenericSpeciesStructure.__repr__(self)
     return "{" + s[1:-1] + "}"
    def __repr__(self):
        """
        EXAMPLES::

            sage: S = species.PartitionSpecies()
            sage: a = S.structures(["a","b","c"]).random_element(); a
            {{'a', 'b', 'c'}}
        """
        s = GenericSpeciesStructure.__repr__(self)
        return "{" + s[1:-1] + "}"
    def __repr__(self):
        """
        EXAMPLES::

            sage: F = species.CharacteristicSpecies(3)
            sage: a = F.structures([1, 2, 3]).random_element(); a
            {1, 2, 3}
            sage: F = species.SingletonSpecies()
            sage: F.structures([1]).list()
            [1]
            sage: F = species.EmptySetSpecies()
            sage: F.structures([]).list()
            [{}]
        """
        s = GenericSpeciesStructure.__repr__(self)
        if self.parent()._n == 1:
            return s[1:-1]
        else:
            return "{" + s[1:-1] + "}"