Subfield subcode¶
Let \(C\) be a \([n, k]\) code over \(\GF{q^t}\). Let \(Cs = \{c \in C | \forall i, c_i \in \GF{q}\}\), \(c_i\) being the \(i\)-th coordinate of \(c\).
\(Cs\) is called the subfield subcode of \(C\) over \(\GF{q}\)
- class sage.coding.subfield_subcode.SubfieldSubcode(original_code, subfield, embedding=None)[source]¶
- Bases: - AbstractLinearCode- Representation of a subfield subcode. - INPUT: - original_code– the code- selfcomes from
- subfield– the base field of- self
- embedding– (default:- None) a homomorphism from- subfieldto- original_code’s base field. If- Noneis provided, it will default to the first homomorphism of the list of homomorphisms Sage can build.
 - EXAMPLES: - sage: C = codes.random_linear_code(GF(16, 'aa'), 7, 3) sage: codes.SubfieldSubcode(C, GF(4, 'a')) Subfield subcode of [7, 3] linear code over GF(16) down to GF(4) - >>> from sage.all import * >>> C = codes.random_linear_code(GF(Integer(16), 'aa'), Integer(7), Integer(3)) >>> codes.SubfieldSubcode(C, GF(Integer(4), 'a')) Subfield subcode of [7, 3] linear code over GF(16) down to GF(4) - dimension()[source]¶
- Return the dimension of - self.- EXAMPLES: - sage: C = codes.GeneralizedReedSolomonCode(GF(16, 'aa').list()[:13], 5) sage: Cs = codes.SubfieldSubcode(C, GF(4, 'a')) sage: Cs.dimension() 3 - >>> from sage.all import * >>> C = codes.GeneralizedReedSolomonCode(GF(Integer(16), 'aa').list()[:Integer(13)], Integer(5)) >>> Cs = codes.SubfieldSubcode(C, GF(Integer(4), 'a')) >>> Cs.dimension() 3 
 - dimension_lower_bound()[source]¶
- Return a lower bound for the dimension of - self.- EXAMPLES: - sage: C = codes.random_linear_code(GF(16, 'aa'), 7, 3) sage: Cs = codes.SubfieldSubcode(C, GF(4, 'a')) sage: Cs.dimension_lower_bound() -1 - >>> from sage.all import * >>> C = codes.random_linear_code(GF(Integer(16), 'aa'), Integer(7), Integer(3)) >>> Cs = codes.SubfieldSubcode(C, GF(Integer(4), 'a')) >>> Cs.dimension_lower_bound() -1 
 - dimension_upper_bound()[source]¶
- Return an upper bound for the dimension of - self.- EXAMPLES: - sage: C = codes.random_linear_code(GF(16, 'aa'), 7, 3) sage: Cs = codes.SubfieldSubcode(C, GF(4, 'a')) sage: Cs.dimension_upper_bound() 3 - >>> from sage.all import * >>> C = codes.random_linear_code(GF(Integer(16), 'aa'), Integer(7), Integer(3)) >>> Cs = codes.SubfieldSubcode(C, GF(Integer(4), 'a')) >>> Cs.dimension_upper_bound() 3 
 - embedding()[source]¶
- Return the field embedding between the base field of - selfand the base field of its original code.- EXAMPLES: - sage: C = codes.random_linear_code(GF(16, 'aa'), 7, 3) sage: Cs = codes.SubfieldSubcode(C, GF(4, 'a')) sage: Cs.embedding() Ring morphism: From: Finite Field in a of size 2^2 To: Finite Field in aa of size 2^4 Defn: a |--> aa^2 + aa - >>> from sage.all import * >>> C = codes.random_linear_code(GF(Integer(16), 'aa'), Integer(7), Integer(3)) >>> Cs = codes.SubfieldSubcode(C, GF(Integer(4), 'a')) >>> Cs.embedding() Ring morphism: From: Finite Field in a of size 2^2 To: Finite Field in aa of size 2^4 Defn: a |--> aa^2 + aa 
 - original_code()[source]¶
- Return the original code of - self.- EXAMPLES: - sage: C = codes.random_linear_code(GF(16, 'aa'), 7, 3) sage: Cs = codes.SubfieldSubcode(C, GF(4, 'a')) sage: Cs.original_code() [7, 3] linear code over GF(16) - >>> from sage.all import * >>> C = codes.random_linear_code(GF(Integer(16), 'aa'), Integer(7), Integer(3)) >>> Cs = codes.SubfieldSubcode(C, GF(Integer(4), 'a')) >>> Cs.original_code() [7, 3] linear code over GF(16) 
 - parity_check_matrix()[source]¶
- Return a parity check matrix of - self.- EXAMPLES: - sage: C = codes.GeneralizedReedSolomonCode(GF(16, 'aa').list()[:13], 5) sage: Cs = codes.SubfieldSubcode(C, GF(4, 'a')) sage: Cs.parity_check_matrix() [ 1 0 0 0 0 0 0 0 0 0 1 a + 1 a + 1] [ 0 1 0 0 0 0 0 0 0 0 a + 1 0 a] [ 0 0 1 0 0 0 0 0 0 0 a + 1 a 0] [ 0 0 0 1 0 0 0 0 0 0 0 a + 1 a] [ 0 0 0 0 1 0 0 0 0 0 a + 1 1 a + 1] [ 0 0 0 0 0 1 0 0 0 0 1 1 1] [ 0 0 0 0 0 0 1 0 0 0 a a 1] [ 0 0 0 0 0 0 0 1 0 0 a 1 a] [ 0 0 0 0 0 0 0 0 1 0 a + 1 a + 1 1] [ 0 0 0 0 0 0 0 0 0 1 a 0 a + 1] - >>> from sage.all import * >>> C = codes.GeneralizedReedSolomonCode(GF(Integer(16), 'aa').list()[:Integer(13)], Integer(5)) >>> Cs = codes.SubfieldSubcode(C, GF(Integer(4), 'a')) >>> Cs.parity_check_matrix() [ 1 0 0 0 0 0 0 0 0 0 1 a + 1 a + 1] [ 0 1 0 0 0 0 0 0 0 0 a + 1 0 a] [ 0 0 1 0 0 0 0 0 0 0 a + 1 a 0] [ 0 0 0 1 0 0 0 0 0 0 0 a + 1 a] [ 0 0 0 0 1 0 0 0 0 0 a + 1 1 a + 1] [ 0 0 0 0 0 1 0 0 0 0 1 1 1] [ 0 0 0 0 0 0 1 0 0 0 a a 1] [ 0 0 0 0 0 0 0 1 0 0 a 1 a] [ 0 0 0 0 0 0 0 0 1 0 a + 1 a + 1 1] [ 0 0 0 0 0 0 0 0 0 1 a 0 a + 1] 
 
- class sage.coding.subfield_subcode.SubfieldSubcodeOriginalCodeDecoder(code, original_decoder=None, **kwargs)[source]¶
- Bases: - Decoder- Decoder decoding through a decoder over the original code of - code.- INPUT: - code– the associated code of this decoder
- original_decoder– (default:- None) the decoder that will be used over the original code. It has to be a decoder object over the original code. If it is set to- None, the default decoder over the original code will be used.
- **kwargs– all extra arguments are forwarded to original code’s decoder
 - EXAMPLES: - sage: C = codes.GeneralizedReedSolomonCode(GF(16, 'aa').list()[:13], 5) sage: Cs = codes.SubfieldSubcode(C, GF(4, 'a')) sage: codes.decoders.SubfieldSubcodeOriginalCodeDecoder(Cs) Decoder of Subfield subcode of [13, 5, 9] Reed-Solomon Code over GF(16) down to GF(4) through Gao decoder for [13, 5, 9] Reed-Solomon Code over GF(16) - >>> from sage.all import * >>> C = codes.GeneralizedReedSolomonCode(GF(Integer(16), 'aa').list()[:Integer(13)], Integer(5)) >>> Cs = codes.SubfieldSubcode(C, GF(Integer(4), 'a')) >>> codes.decoders.SubfieldSubcodeOriginalCodeDecoder(Cs) Decoder of Subfield subcode of [13, 5, 9] Reed-Solomon Code over GF(16) down to GF(4) through Gao decoder for [13, 5, 9] Reed-Solomon Code over GF(16) - decode_to_code(y)[source]¶
- Return an error-corrected codeword from - y.- EXAMPLES: - sage: C = codes.GeneralizedReedSolomonCode(GF(16, 'aa').list()[:13], 5) sage: Cs = codes.SubfieldSubcode(C, GF(4, 'a')) sage: D = codes.decoders.SubfieldSubcodeOriginalCodeDecoder(Cs) sage: Chan = channels.StaticErrorRateChannel(Cs.ambient_space(), ....: D.decoding_radius()) sage: c = Cs.random_element() sage: y = Chan(c) sage: c == D.decode_to_code(y) True - >>> from sage.all import * >>> C = codes.GeneralizedReedSolomonCode(GF(Integer(16), 'aa').list()[:Integer(13)], Integer(5)) >>> Cs = codes.SubfieldSubcode(C, GF(Integer(4), 'a')) >>> D = codes.decoders.SubfieldSubcodeOriginalCodeDecoder(Cs) >>> Chan = channels.StaticErrorRateChannel(Cs.ambient_space(), ... D.decoding_radius()) >>> c = Cs.random_element() >>> y = Chan(c) >>> c == D.decode_to_code(y) True 
 - decoding_radius(**kwargs)[source]¶
- Return the maximal number of errors - selfcan decode.- INPUT: - kwargs– optional arguments are forwarded to original decoder’s- sage.coding.decoder.Decoder.decoding_radius()method
 - EXAMPLES: - sage: C = codes.GeneralizedReedSolomonCode(GF(16, 'aa').list()[:13], 5) sage: Cs = codes.SubfieldSubcode(C, GF(4, 'a')) sage: D = codes.decoders.SubfieldSubcodeOriginalCodeDecoder(Cs) sage: D.decoding_radius() 4 - >>> from sage.all import * >>> C = codes.GeneralizedReedSolomonCode(GF(Integer(16), 'aa').list()[:Integer(13)], Integer(5)) >>> Cs = codes.SubfieldSubcode(C, GF(Integer(4), 'a')) >>> D = codes.decoders.SubfieldSubcodeOriginalCodeDecoder(Cs) >>> D.decoding_radius() 4 
 - original_decoder()[source]¶
- Return the decoder over the original code that will be used to decode words of - sage.coding.decoder.Decoder.code().- EXAMPLES: - sage: C = codes.GeneralizedReedSolomonCode(GF(16, 'aa').list()[:13], 5) sage: Cs = codes.SubfieldSubcode(C, GF(4, 'a')) sage: D = codes.decoders.SubfieldSubcodeOriginalCodeDecoder(Cs) sage: D.original_decoder() Gao decoder for [13, 5, 9] Reed-Solomon Code over GF(16) - >>> from sage.all import * >>> C = codes.GeneralizedReedSolomonCode(GF(Integer(16), 'aa').list()[:Integer(13)], Integer(5)) >>> Cs = codes.SubfieldSubcode(C, GF(Integer(4), 'a')) >>> D = codes.decoders.SubfieldSubcodeOriginalCodeDecoder(Cs) >>> D.original_decoder() Gao decoder for [13, 5, 9] Reed-Solomon Code over GF(16)