@@ -73,6 +73,9 @@ def __mul__(self, x):
73
73
raise ValueError , "Two sets of elements cannot be multiplied"
74
74
75
75
def power_to_tuple (self ):
76
+ """
77
+ Convert Galois field elements from power form to tuple form representation.
78
+ """
76
79
y = zeros (len (self .elements ))
77
80
for idx , i in enumerate (self .elements ):
78
81
if 2 ** i < 2 ** self .m :
@@ -82,6 +85,9 @@ def power_to_tuple(self):
82
85
return GF (y , self .m )
83
86
84
87
def tuple_to_power (self ):
88
+ """
89
+ Convert Galois field elements from tuple form to power form representation.
90
+ """
85
91
y = zeros (len (self .elements ))
86
92
for idx , i in enumerate (self .elements ):
87
93
if i != 0 :
@@ -98,13 +104,19 @@ def tuple_to_power(self):
98
104
return GF (y , self .m )
99
105
100
106
def order (self ):
107
+ """
108
+ Compute the orders of the Galois field elements.
109
+ """
101
110
orders = zeros (len (self .elements ))
102
111
power_gf = self .tuple_to_power ()
103
112
for idx , i in enumerate (power_gf .elements ):
104
113
orders [idx ] = (2 ** self .m - 1 )/ (gcd (i , 2 ** self .m - 1 ))
105
114
return orders
106
115
107
116
def cosets (self ):
117
+ """
118
+ Compute the cyclotomic cosets of the Galois field.
119
+ """
108
120
coset_list = []
109
121
x = self .tuple_to_power ().elements
110
122
mark_list = zeros (len (x ))
@@ -127,6 +139,9 @@ def cosets(self):
127
139
return coset_list
128
140
129
141
def minpolys (self ):
142
+ """
143
+ Compute the minimal polynomials for all elements of the Galois field.
144
+ """
130
145
minpol_list = array ([])
131
146
full_gf = GF (arange (2 ** self .m ), self .m )
132
147
full_cosets = full_gf .cosets ()
0 commit comments