Changeset 7752:79a9f901e372
- Timestamp:
- 12/15/07 15:22:53 (5 years ago)
- Branch:
- default
- Location:
- sage/coding
- Files:
-
- 2 edited
-
code_constructions.py (modified) (2 diffs)
-
linear_code.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/coding/code_constructions.py
r6439 r7752 133 133 sage: C 134 134 Linear code of length 24, dimension 12 over Finite Field of size 2 135 sage: C.minimum_distance() # long time135 sage: C.minimum_distance() 136 136 8 137 137 138 138 AUTHOR: David Joyner (2007-05) 139 139 """ 140 C = BinaryGolayCode() 141 return C.extended_code() 140 v = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1]] 141 V = span(GF(2), v) 142 return LinearCodeFromVectorSpace(V) 143 #C = BinaryGolayCode() 144 #return C.extended_code() 142 145 143 146 def TernaryGolayCode(): 144 147 """ 145 TernaryGolayCode returns a ternary Golay code. This is a perfect [11,6,5] code. 146 It is also equivalenet to a cyclic code, with generator polynomial $g(x)=2+x^2+2x^3+x^4+x^5$. 148 TernaryGolayCode returns a ternary Golay code. This is a perfect 149 [11,6,5] code. It is also equivalenet to a cyclic code, with 150 generator polynomial $g(x)=2+x^2+2x^3+x^4+x^5$. 147 151 148 152 EXAMPLES: … … 178 182 AUTHOR: David Joyner (11-2005) 179 183 """ 180 C = TernaryGolayCode() 181 return C.extended_code() 184 v = [[1, 0, 0, 0, 0, 0, 2, 0, 1, 2, 1, 2], [0, 1, 0, 0, 0, 0, 1, 2, 2, 2, 1, 0], [0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1], [0, 0, 0, 1, 0, 0, 1, 1, 0, 2, 2, 2], [0, 0, 0, 0, 1, 0, 2, 1, 2, 2, 0, 1], [0, 0, 0, 0, 0, 1, 0, 2, 1, 2, 2, 1]] 185 V = span(GF(3), v) 186 return LinearCodeFromVectorSpace(V) 187 #C = TernaryGolayCode() 188 #return C.extended_code() 182 189 183 190 def RandomLinearCode(n,k,F): -
sage/coding/linear_code.py
r7751 r7752 350 350 sage: best_known_linear_code(10,5,GF(2)) # long time 351 351 Linear code of length 10, dimension 5 over Finite Field of size 2 352 sage: gap.eval("C:=BestKnownLinearCode(10,5,GF(2))") 352 sage: gap.eval("C:=BestKnownLinearCode(10,5,GF(2))") # long time 353 353 'a linear [10,5,4]2..4 shortened code' 354 354 … … 767 767 sage: Cx 768 768 Linear code of length 22, dimension 18 over Finite Field in a of size 2^2 769 770 769 """ 771 770 G = self.gen_mat() … … 774 773 n = len(G.columns()) 775 774 k = len(G.rows()) 776 Gstr = str(gap(G))777 gap.eval( "G:="+ Gstr)775 g = gap(G) 776 gap.eval( "G:="+g.name()) 778 777 C = gap("GeneratorMatCode(G,GF("+str(q)+"))") 779 778 Cx = C.ExtendedCode() 780 779 Gx = Cx.GeneratorMat() 781 Gxs = Gx._matrix_(F) 780 Gxs = Gx._matrix_(F) # this is the killer 782 781 MS = MatrixSpace(F,k,n+1) 783 782 return LinearCode(MS(Gxs)) … … 1060 1059 sage: G = MS([[1,0,0,0,1,1,1,0],[0,1,1,1,0,0,0,0],[0,0,0,0,0,0,0,1],[0,0,0,0,0,1,0,0]]) 1061 1060 sage: C = LinearCode(G) 1062 sage: gp = C.permutation_automorphism_group() 1061 sage: gp = C.permutation_automorphism_group() # long time 1063 1062 1064 1063 Now type "C.module_composition_factors(gp)" to get the record printed. … … 1278 1277 sage: C.zeta_polynomial() 1279 1278 2/5*T^2 + 2/5*T + 1/5 1280 sage: C = best_known_linear_code(6,3,GF(2)) 1281 sage: C.minimum_distance() 1279 sage: C = best_known_linear_code(6,3,GF(2)) # long time 1280 sage: C.minimum_distance() # long time (because of above) 1282 1281 3 1283 sage: C.zeta_polynomial() 1282 sage: C.zeta_polynomial() # long time (because of above) 1284 1283 2/5*T^2 + 2/5*T + 1/5 1285 1284 sage: C = HammingCode(4,GF(2)) … … 1331 1330 EXAMPLES: 1332 1331 sage: C = HammingCode(3,GF(2)) 1333 sage: C.chinen_polynomial() 1332 sage: C.chinen_polynomial() # long time 1334 1333 (2*sqrt(2)*t^3/5 + 2*sqrt(2)*t^2/5 + 2*t^2/5 + sqrt(2)*t/5 + 2*t/5 + 1/5)/(sqrt(2) + 1) 1335 1334 sage: C = TernaryGolayCode() 1336 sage: C.chinen_polynomial() 1335 sage: C.chinen_polynomial() # long time 1337 1336 (6*sqrt(3)*t^3/7 + 6*sqrt(3)*t^2/7 + 6*t^2/7 + 2*sqrt(3)*t/7 + 6*t/7 + 2/7)/(2*sqrt(3) + 2) 1338 1337 … … 1393 1392 1394 1393 EXAMPLES: 1395 1394 sage: C = HammingCode(3,GF(2)) 1395 sage: C.zeta_function() 1396 (2/5*T^2 + 2/5*T + 1/5)/(2*T^2 - 3*T + 1) 1396 1397 """ 1397 1398 P = self.zeta_polynomial()
Note: See TracChangeset
for help on using the changeset viewer.
