rs_exs

1296 days ago by zoen

F.<a> = FiniteField(2^2) F.modulus() 
       
x^2 + x + 1
x^2 + x + 1
F.list() 
       
[0,
 a,
 a^2,
 a^3,
 a + 1,
 a^2 + a,
 a^3 + a^2,
 a^3 + a + 1,
 a^2 + 1,
 a^3 + a,
 a^2 + a + 1,
 a^3 + a^2 + a,
 a^3 + a^2 + a + 1,
 a^3 + a^2 + 1,
 a^3 + 1,
 1]
[0,
 a,
 a^2,
 a^3,
 a + 1,
 a^2 + a,
 a^3 + a^2,
 a^3 + a + 1,
 a^2 + 1,
 a^3 + a,
 a^2 + a + 1,
 a^3 + a^2 + a,
 a^3 + a^2 + a + 1,
 a^3 + a^2 + 1,
 a^3 + 1,
 1]
F = GF(11) F.list() 
       
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
M = GF(5) M.list() 
       
[0, 1, 2, 3, 4]
[0, 1, 2, 3, 4]
Mx.<x>=M[] n, k = 5 , 2 C = codes.GeneralizedReedSolomonCode(M.list()[:n], k) C.list() 
       
[(0, 0, 0, 0, 0),
 (1, 1, 1, 1, 1),
 (2, 2, 2, 2, 2),
 (3, 3, 3, 3, 3),
 (4, 4, 4, 4, 4),
 (0, 1, 2, 3, 4),
 (1, 2, 3, 4, 0),
 (2, 3, 4, 0, 1),
 (3, 4, 0, 1, 2),
 (4, 0, 1, 2, 3),
 (0, 2, 4, 1, 3),
 (1, 3, 0, 2, 4),
 (2, 4, 1, 3, 0),
 (3, 0, 2, 4, 1),
 (4, 1, 3, 0, 2),
 (0, 3, 1, 4, 2),
 (1, 4, 2, 0, 3),
 (2, 0, 3, 1, 4),
 (3, 1, 4, 2, 0),
 (4, 2, 0, 3, 1),
 (0, 4, 3, 2, 1),
 (1, 0, 4, 3, 2),
 (2, 1, 0, 4, 3),
 (3, 2, 1, 0, 4),
 (4, 3, 2, 1, 0)]
[(0, 0, 0, 0, 0),
 (1, 1, 1, 1, 1),
 (2, 2, 2, 2, 2),
 (3, 3, 3, 3, 3),
 (4, 4, 4, 4, 4),
 (0, 1, 2, 3, 4),
 (1, 2, 3, 4, 0),
 (2, 3, 4, 0, 1),
 (3, 4, 0, 1, 2),
 (4, 0, 1, 2, 3),
 (0, 2, 4, 1, 3),
 (1, 3, 0, 2, 4),
 (2, 4, 1, 3, 0),
 (3, 0, 2, 4, 1),
 (4, 1, 3, 0, 2),
 (0, 3, 1, 4, 2),
 (1, 4, 2, 0, 3),
 (2, 0, 3, 1, 4),
 (3, 1, 4, 2, 0),
 (4, 2, 0, 3, 1),
 (0, 4, 3, 2, 1),
 (1, 0, 4, 3, 2),
 (2, 1, 0, 4, 3),
 (3, 2, 1, 0, 4),
 (4, 3, 2, 1, 0)]
Fx.<x> = F[] n, k = 10 , 5 C = codes.GeneralizedReedSolomonCode(F.list()[:n], k) E = C.encoder("EvaluationPolynomial") p = x^2 + 3*x + 10 c = E.encode(p); c 
       
(10, 3, 9, 6, 5, 6, 9, 3, 10, 8)
(10, 3, 9, 6, 5, 6, 9, 3, 10, 8)
G = codes.encoders.GRSEvaluationVectorEncoder(C) G.generator_matrix() 
       
[1 1 1 1 1 1 1 1 1 1]
[0 1 2 3 4 5 6 7 8 9]
[0 1 4 9 5 3 3 5 9 4]
[0 1 8 5 9 4 7 2 6 3]
[0 1 5 4 3 9 9 3 4 5]
[1 1 1 1 1 1 1 1 1 1]
[0 1 2 3 4 5 6 7 8 9]
[0 1 4 9 5 3 3 5 9 4]
[0 1 8 5 9 4 7 2 6 3]
[0 1 5 4 3 9 9 3 4 5]
m = matrix(F,[[10,3,1,0,0]]); m; m.parent() 
       
[10  3  1  0  0]
Full MatrixSpace of 1 by 5 dense matrices over Finite Field of size 11
[10  3  1  0  0]
Full MatrixSpace of 1 by 5 dense matrices over Finite Field of size 11
A = matrix(F,[[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 4, 9, 5, 3, 3, 5, 9, 4], [0, 1, 8, 5, 9, 4, 7, 2, 6, 3], [0, 1, 5, 4, 3, 9, 9, 3, 4, 5] ]) 
       
m*A 
       
[10  3  9  6  5  6  9  3 10  8]
[10  3  9  6  5  6  9  3 10  8]
C.minimum_distance() 
       
6
6
C.weight_distribution() 
       
[1, 0, 0, 0, 0, 0, 2100, 6000, 29250, 61500, 62200]
[1, 0, 0, 0, 0, 0, 2100, 6000, 29250, 61500, 62200]
Fx.<x> = F[] n, k = 10 , 5 C = codes.GeneralizedReedSolomonCode(F.list()[:n], k) E = C.encoder("EvaluationPolynomial") p = x^2 + 3*x + 10 c = E.encode(p); c 
       
(10, 3, 9, 6, 5, 6, 9, 3, 10, 8)
(10, 3, 9, 6, 5, 6, 9, 3, 10, 8)
C.decode_to_message(c) 
       
(10, 3, 1, 0, 0)
(10, 3, 1, 0, 0)
C.parity_check_matrix() 
       
[10  9  8  7  6  5  4  3  2  1]
[ 0  9  5 10  2  3  2 10  5  9]
[ 0  9 10  8  8  4  1  4  7  4]
[ 0  9  9  2 10  9  6  6  1  3]
[ 0  9  7  6  7  1  3  9  8  5]
[10  9  8  7  6  5  4  3  2  1]
[ 0  9  5 10  2  3  2 10  5  9]
[ 0  9 10  8  8  4  1  4  7  4]
[ 0  9  9  2 10  9  6  6  1  3]
[ 0  9  7  6  7  1  3  9  8  5]
H=C.parity_check_matrix() 
       
 
       
[10  9  8  7  6  5  4  3  2  1]
[ 0  9  5 10  2  3  2 10  5  9]
[ 0  9 10  8  8  4  1  4  7  4]
[ 0  9  9  2 10  9  6  6  1  3]
[ 0  9  7  6  7  1  3  9  8  5]
[10  9  8  7  6  5  4  3  2  1]
[ 0  9  5 10  2  3  2 10  5  9]
[ 0  9 10  8  8  4  1  4  7  4]
[ 0  9  9  2 10  9  6  6  1  3]
[ 0  9  7  6  7  1  3  9  8  5]
[H,H] 
       
[
[10  9  8  7  6  5  4  3  2  1]  [10  9  8  7  6  5  4  3  2  1]
[ 0  9  5 10  2  3  2 10  5  9]  [ 0  9  5 10  2  3  2 10  5  9]
[ 0  9 10  8  8  4  1  4  7  4]  [ 0  9 10  8  8  4  1  4  7  4]
[ 0  9  9  2 10  9  6  6  1  3]  [ 0  9  9  2 10  9  6  6  1  3]
[ 0  9  7  6  7  1  3  9  8  5], [ 0  9  7  6  7  1  3  9  8  5]
]
[
[10  9  8  7  6  5  4  3  2  1]  [10  9  8  7  6  5  4  3  2  1]
[ 0  9  5 10  2  3  2 10  5  9]  [ 0  9  5 10  2  3  2 10  5  9]
[ 0  9 10  8  8  4  1  4  7  4]  [ 0  9 10  8  8  4  1  4  7  4]
[ 0  9  9  2 10  9  6  6  1  3]  [ 0  9  9  2 10  9  6  6  1  3]
[ 0  9  7  6  7  1  3  9  8  5], [ 0  9  7  6  7  1  3  9  8  5]
]
G=H.augment(H) 
       
       
[10  9  8  7  6  5  4  3  2  1 10  9  8  7  6  5  4  3  2  1]
[ 0  9  5 10  2  3  2 10  5  9  0  9  5 10  2  3  2 10  5  9]
[ 0  9 10  8  8  4  1  4  7  4  0  9 10  8  8  4  1  4  7  4]
[ 0  9  9  2 10  9  6  6  1  3  0  9  9  2 10  9  6  6  1  3]
[ 0  9  7  6  7  1  3  9  8  5  0  9  7  6  7  1  3  9  8  5]
[10  9  8  7  6  5  4  3  2  1 10  9  8  7  6  5  4  3  2  1]
[ 0  9  5 10  2  3  2 10  5  9  0  9  5 10  2  3  2 10  5  9]
[ 0  9 10  8  8  4  1  4  7  4  0  9 10  8  8  4  1  4  7  4]
[ 0  9  9  2 10  9  6  6  1  3  0  9  9  2 10  9  6  6  1  3]
[ 0  9  7  6  7  1  3  9  8  5  0  9  7  6  7  1  3  9  8  5]
G*vector([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]) 
       
(0, 0, 0, 0, 0)
(0, 0, 0, 0, 0)
F = GF(59) n, k = 40, 12 C = codes.GeneralizedReedSolomonCode(F.list()[:n], k) D = codes.decoders.GRSErrorErasureDecoder(C) c = C.random_element() n_era = randint(0, C.minimum_distance() - 2) Chan = channels.ErrorErasureChannel(C.ambient_space(), D.decoding_radius(n_era), n_era) y = Chan(c) D.connected_encoder().unencode(c) == D.decode_to_message(y) 
       
Traceback (click to the left of this block for traceback)
...
AttributeError: 'module' object has no attribute
'GRSErrorErasureDecoder'
Traceback (most recent call last):    Chan = channels.ErrorErasureChannel(C.ambient_space(), D.decoding_radius(n_era), n_era)
  File "", line 1, in <module>
    
  File "/tmp/tmpeo1cen/___code___.py", line 6, in <module>
    D = codes.decoders.GRSErrorErasureDecoder(C)
AttributeError: 'module' object has no attribute 'GRSErrorErasureDecoder'
F = GF(59) n, k = 40, 12 C = codes.GeneralizedReedSolomonCode(F.list()[:n], k) D = codes.decoders.GRSErrorErasureDecoder(C) 
       
Traceback (click to the left of this block for traceback)
...
AttributeError: 'module' object has no attribute
'GRSErrorErasureDecoder'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_12.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("RiA9IEdGKDU5KQpuLCBrID0gNDAsIDEyCkMgPSBjb2Rlcy5HZW5lcmFsaXplZFJlZWRTb2xvbW9uQ29kZShGLmxpc3QoKVs6bl0sIGspCkQgPSBjb2Rlcy5kZWNvZGVycy5HUlNFcnJvckVyYXN1cmVEZWNvZGVyKEMp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpXH6ymo/___code___.py", line 6, in <module>
    exec compile(u'D = codes.decoders.GRSErrorErasureDecoder(C)
  File "", line 1, in <module>
    
AttributeError: 'module' object has no attribute 'GRSErrorErasureDecoder'