Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

""" 

Empty Species 

""" 

from __future__ import absolute_import 

#***************************************************************************** 

# Copyright (C) 2008 Florent Hivert <Florent.Hivert@univ-rouen,fr>, 

# 

# Distributed under the terms of the GNU General Public License (GPL) 

# 

# This code is distributed in the hope that it will be useful, 

# but WITHOUT ANY WARRANTY; without even the implied warranty of 

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 

# General Public License for more details. 

# 

# The full text of the GPL is available at: 

# 

# http://www.gnu.org/licenses/ 

#***************************************************************************** 

from .species import GenericCombinatorialSpecies 

from .series_order import inf 

from sage.structure.unique_representation import UniqueRepresentation 

 

class EmptySpecies(GenericCombinatorialSpecies, UniqueRepresentation): 

""" 

Returns the empty species. This species has no structure at all. 

It is the zero of the semi-ring of species. 

 

EXAMPLES:: 

 

sage: X = species.EmptySpecies(); X 

Empty species 

sage: X.structures([]).list() 

[] 

sage: X.structures([1]).list() 

[] 

sage: X.structures([1,2]).list() 

[] 

sage: X.generating_series().coefficients(4) 

[0, 0, 0, 0] 

sage: X.isotype_generating_series().coefficients(4) 

[0, 0, 0, 0] 

sage: X.cycle_index_series().coefficients(4) 

[0, 0, 0, 0] 

 

The empty species is the zero of the semi-ring of species. 

The following tests that it is neutral with respect to addition:: 

 

sage: Empt = species.EmptySpecies() 

sage: S = species.CharacteristicSpecies(2) 

sage: X = S + Empt 

sage: X == S # TODO: Not Implemented 

True 

sage: (X.generating_series().coefficients(4) == 

....: S.generating_series().coefficients(4)) 

True 

sage: (X.isotype_generating_series().coefficients(4) == 

....: S.isotype_generating_series().coefficients(4)) 

True 

sage: (X.cycle_index_series().coefficients(4) == 

....: S.cycle_index_series().coefficients(4)) 

True 

 

The following tests that it is the zero element with respect to 

multiplication:: 

 

sage: Y = Empt*S 

sage: Y == Empt # TODO: Not Implemented 

True 

sage: Y.generating_series().coefficients(4) 

[0, 0, 0, 0] 

sage: Y.isotype_generating_series().coefficients(4) 

[0, 0, 0, 0] 

sage: Y.cycle_index_series().coefficients(4) 

[0, 0, 0, 0] 

 

TESTS:: 

 

sage: Empt = species.EmptySpecies() 

sage: Empt2 = species.EmptySpecies() 

sage: Empt is Empt2 

True 

""" 

def __init__(self, min=None, max=None, weight=None): 

""" 

Initializer for the empty species. 

 

EXAMPLES:: 

 

sage: F = species.EmptySpecies() 

sage: F._check() 

True 

sage: F == loads(dumps(F)) 

True 

""" 

# There is no structure at all, so we set min and max accordingly. 

GenericCombinatorialSpecies.__init__(self, weight=weight) 

self._name = "Empty species" 

 

def _gs(self, series_ring, base_ring): 

""" 

Return the generating series for self. 

 

EXAMPLES:: 

 

sage: F = species.EmptySpecies() 

sage: F.generating_series().coefficients(5) # indirect doctest 

[0, 0, 0, 0, 0] 

sage: F.generating_series().count(3) 

0 

sage: F.generating_series().count(4) 

0 

""" 

return series_ring.zero() 

 

_itgs = _gs 

_cis = _gs 

 

def _order(self): 

""" 

Returns the order of the generating series. 

 

EXAMPLES:: 

 

sage: F = species.EmptySpecies() 

sage: F._order() 

Infinite series order 

""" 

return inf 

 

def _structures(self, structure_class, labels): 

""" 

Thanks to the couting optimisation, this is never called... Otherwise 

this should return an empty iterator. 

 

EXAMPLES:: 

 

sage: F = species.EmptySpecies() 

sage: F.structures([]).list() # indirect doctest 

[] 

sage: F.structures([1,2,3]).list() # indirect doctest 

[] 

""" 

assert False, "This should never be called" 

 

_default_structure_class = 0 

_isotypes = _structures 

 

def _equation(self, var_mapping): 

""" 

Returns the right hand side of an algebraic equation satisfied by 

this species. This is a utility function called by the 

algebraic_equation_system method. 

 

EXAMPLES:: 

 

sage: C = species.EmptySpecies() 

sage: Qz = QQ['z'] 

sage: R.<node0> = Qz[] 

sage: var_mapping = {'z':Qz.gen(), 'node0':R.gen()} 

sage: C._equation(var_mapping) 

0 

""" 

return 0 

 

EmptySpecies_class = EmptySpecies