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

from cpython.object cimport * 

from cysignals.signals cimport sig_on, sig_off 

  

cdef extern from 'symmetrica/def.h': 

INT kostka_number(OP shape, OP content, OP result) 

INT kostka_tab(OP shape, OP content, OP result) 

INT kostka_tafel(OP n, OP result) 

  

def kostka_number_symmetrica(shape, content): 

""" 

computes the kostkanumber, i.e. the number of 

tableaux of given shape, which is a PARTITION object, and 

of given content, which also is a PARTITION object, or a VECTOR 

object with INTEGER entries. The 

result is an INTEGER object, which is freed to an empty 

object at the beginning. The shape could also be a 

SKEWPARTITION object, then we compute the number of 

skewtableaux of the given shape. 

  

EXAMPLES:: 

  

sage: symmetrica.kostka_number([2,1],[1,1,1]) 

2 

sage: symmetrica.kostka_number([1,1,1],[1,1,1]) 

1 

sage: symmetrica.kostka_number([3],[1,1,1]) 

1 

""" 

cdef OP cshape = callocobject(), ccontent = callocobject(), result = callocobject() 

  

if isinstance(shape, <type>builtinlist): 

if isinstance(shape[0], <type>builtinlist): 

shape = SkewPartition(shape) 

else: 

shape = Partition(shape) 

  

  

if isinstance(shape, <type>SkewPartition): 

_op_skew_partition(shape, cshape) 

else: 

_op_partition(shape, cshape) 

  

_op_partition(content, ccontent) 

  

kostka_number(ccontent, cshape, result) 

  

res = _py(result) 

  

freeall(cshape) 

freeall(ccontent) 

freeall(result) 

  

  

return res 

  

def kostka_tab_symmetrica(shape, content): 

""" 

computes the list of tableaux of given shape 

and content. shape is a PARTITION object or a 

SKEWPARTITION object and 

content is a PARTITION object or a VECTOR object with 

INTEGER entries, the result becomes a 

LIST object whose entries are the computed TABLEAUX 

object. 

  

EXAMPLES:: 

  

sage: symmetrica.kostka_tab([3],[1,1,1]) 

[[[1, 2, 3]]] 

sage: symmetrica.kostka_tab([2,1],[1,1,1]) 

[[[1, 2], [3]], [[1, 3], [2]]] 

sage: symmetrica.kostka_tab([1,1,1],[1,1,1]) 

[[[1], [2], [3]]] 

sage: symmetrica.kostka_tab([[2,2,1],[1,1]],[1,1,1]) 

[[[None, 1], [None, 2], [3]], 

[[None, 1], [None, 3], [2]], 

[[None, 2], [None, 3], [1]]] 

sage: symmetrica.kostka_tab([[2,2],[1]],[1,1,1]) 

[[[None, 1], [2, 3]], [[None, 2], [1, 3]]] 

  

  

""" 

late_import() 

  

cdef OP cshape = callocobject(), ccontent = callocobject(), result = callocobject() 

cdef INT err 

  

if isinstance(shape, <type>builtinlist): 

if isinstance(shape[0], <type>builtinlist): 

shape = SkewPartition(shape) 

else: 

shape = Partition(shape) 

  

  

if isinstance(shape, <type>SkewPartition): 

_op_skew_partition(shape, cshape) 

else: 

_op_partition(shape, cshape) 

  

  

  

#Check to make sure the content is compatible with the shape. 

  

_op_il_vector(content, ccontent) 

  

err = kostka_tab(cshape, ccontent, result) 

  

res = _py(result) 

  

freeall(cshape) 

freeall(ccontent) 

freeall(result) 

  

  

return res 

  

def kostka_tafel_symmetrica(n): 

""" 

Returns the table of Kostka numbers of weight n. 

  

EXAMPLES:: 

  

sage: symmetrica.kostka_tafel(1) 

[1] 

  

sage: symmetrica.kostka_tafel(2) 

[1 0] 

[1 1] 

  

sage: symmetrica.kostka_tafel(3) 

[1 0 0] 

[1 1 0] 

[1 2 1] 

  

sage: symmetrica.kostka_tafel(4) 

[1 0 0 0 0] 

[1 1 0 0 0] 

[1 1 1 0 0] 

[1 2 1 1 0] 

[1 3 2 3 1] 

  

sage: symmetrica.kostka_tafel(5) 

[1 0 0 0 0 0 0] 

[1 1 0 0 0 0 0] 

[1 1 1 0 0 0 0] 

[1 2 1 1 0 0 0] 

[1 2 2 1 1 0 0] 

[1 3 3 3 2 1 0] 

[1 4 5 6 5 4 1] 

""" 

  

cdef OP cn = callocobject(), cresult = callocobject() 

  

_op_integer(n, cn) 

  

sig_on() 

kostka_tafel(cn, cresult) 

sig_off() 

  

res = _py(cresult) 

  

freeall(cn) 

freeall(cresult) 

  

return res