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

""" 

Overrides to unpickle old matrix groups 

""" 

 

from sage.structure.sage_object import SageObject, register_unpickle_override 

 

from sage.groups.matrix_gps.finitely_generated import FinitelyGeneratedMatrixGroup_gap 

from sage.groups.matrix_gps.group_element import MatrixGroupElement_gap 

from sage.groups.matrix_gps.linear import GL, LinearMatrixGroup_generic 

 

 

 

class LegacyMatrixGroup(FinitelyGeneratedMatrixGroup_gap): 

 

def __setstate__(self, state): 

""" 

Restore from old pickle. 

 

EXAMPLES:: 

 

sage: from sage.groups.matrix_gps.pickling_overrides import LegacyMatrixGroup 

sage: state = dict() 

sage: state['_MatrixGroup_gap__n'] = 2 

sage: state['_MatrixGroup_gap__R'] = GF(3) 

sage: state['_gensG'] = [ matrix(GF(3), [[1,2],[0,1]]) ] 

sage: M = LegacyMatrixGroup.__new__(LegacyMatrixGroup) 

sage: M.__setstate__(state) 

sage: M 

Matrix group over Finite Field of size 3 with 1 generators ( 

[1 2] 

[0 1] 

) 

""" 

matrix_gens = state['_gensG'] 

ring = state['_MatrixGroup_gap__R'] 

degree = state['_MatrixGroup_gap__n'] 

from sage.libs.all import libgap 

libgap_group = libgap.Group(libgap(matrix_gens)) 

self.__init__(degree, ring, libgap_group) 

 

 

register_unpickle_override( 

'sage.groups.matrix_gps.matrix_group', 'MatrixGroup_gens_finite_field', 

LegacyMatrixGroup) 

 

 

class LegacyMatrixGroupElement(MatrixGroupElement_gap): 

 

def __setstate__(self, state): 

""" 

Restore from old pickle. 

 

EXAMPLES:: 

 

sage: from sage.groups.matrix_gps.pickling_overrides import LegacyMatrixGroup, LegacyMatrixGroupElement 

sage: state = dict() 

sage: state['_MatrixGroup_gap__n'] = 2 

sage: state['_MatrixGroup_gap__R'] = GF(3) 

sage: state['_gensG'] = [ matrix(GF(3), [[1,2],[0,1]]) ] 

sage: M = LegacyMatrixGroup.__new__(LegacyMatrixGroup) 

sage: M.__setstate__(state) 

sage: M 

Matrix group over Finite Field of size 3 with 1 generators ( 

[1 2] 

[0 1] 

) 

sage: state = [ M, {'_MatrixGroupElement__mat':matrix(GF(3), [[1,2],[0,1]])} ] 

sage: m = LegacyMatrixGroupElement.__new__(LegacyMatrixGroupElement) 

sage: m.__setstate__(state) 

sage: m 

[1 2] 

[0 1] 

""" 

parent = state[0] 

m = state[1]['_MatrixGroupElement__mat'] 

m = parent.matrix_space()(m) 

self.__init__(parent, m, check=False) 

 

 

register_unpickle_override( 

'sage.groups.matrix_gps.matrix_group_element', 'MatrixGroupElement', 

LegacyMatrixGroupElement) 

 

 

class LegacyGeneralLinearGroup(LinearMatrixGroup_generic): 

 

def __setstate__(self, state): 

""" 

Restore from old pickle. 

 

EXAMPLES:: 

 

sage: from sage.groups.group import Group 

sage: from sage.groups.matrix_gps.pickling_overrides import LegacyGeneralLinearGroup 

sage: state = dict() 

sage: state['_MatrixGroup_gap__n'] = 2 

sage: state['_MatrixGroup_gap__R'] = ZZ 

sage: M = Group.__new__(LegacyGeneralLinearGroup) 

sage: M.__setstate__(state) 

sage: M 

General Linear Group of degree 2 over Integer Ring 

""" 

ring = state['_MatrixGroup_gap__R'] 

n = state['_MatrixGroup_gap__n'] 

G = GL(n, ring) 

self.__init__(G.degree(), G.base_ring(), G._special, G._name_string, G._latex_string) 

 

 

register_unpickle_override( 

'sage.groups.matrix_gps.general_linear', 'GeneralLinearGroup_finite_field', 

LegacyGeneralLinearGroup)