Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 5230b19

Browse files
committed
Merge #27634
2 parents 9608a23 + c650b8a commit 5230b19

30 files changed

+904
-737
lines changed

src/doc/en/reference/coding/index.rst

+65-38
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,52 @@
33
Coding Theory
44
=============
55

6-
Basic Coding Theory objects
7-
---------------------------
6+
Coding theory is the mathematical theory for algebraic and combinatorial codes
7+
used for forward error correction in communications theory. Sage provides an
8+
extensive library of objects and algorithms in coding theory.
89

10+
Basic objects in coding theory are channels, codes, linear codes, encoders, and
11+
decoders. The following modules provide the base classes defining them.
912

1013
.. toctree::
1114
:maxdepth: 1
1215

1316
sage/coding/abstract_code
1417
sage/coding/linear_code
15-
sage/coding/channel_constructions
16-
sage/coding/decoder
18+
sage/coding/channel
1719
sage/coding/encoder
20+
sage/coding/decoder
1821

19-
Catalogs
20-
--------
22+
Catalogs for available constructions of the basic objects and for bounds on
23+
the parameters of linear codes are provided.
2124

2225
.. toctree::
23-
:maxdepth: 2
26+
:maxdepth: 1
2427

2528
sage/coding/channels_catalog
2629
sage/coding/codes_catalog
2730
sage/coding/decoders_catalog
2831
sage/coding/encoders_catalog
2932
sage/coding/bounds_catalog
30-
sage/coding/databases
31-
sage/coding/two_weight_db
3233

33-
Code constructions
34-
------------------
34+
Families of Codes
35+
-----------------
3536

36-
.. toctree::
37-
:maxdepth: 1
38-
39-
sage/coding/linear_code
40-
41-
The named code families below are represented in Sage by their own classes,
42-
allowing specialised implementations of e.g. decoding or computation of properties:
37+
Famous families of codes, listed below, are represented in Sage by their own
38+
classes. For some of them, implementations of special decoding algorithms or
39+
computations for structural invariants are available.
4340

4441
.. toctree::
4542
:maxdepth: 2
4643

47-
sage/coding/grs
44+
sage/coding/parity_check_code
4845
sage/coding/hamming_code
46+
sage/coding/cyclic_code
47+
sage/coding/bch_code
4948
sage/coding/golay_code
50-
sage/coding/parity_check_code
5149
sage/coding/reed_muller_code
52-
sage/coding/cyclic_code
53-
sage/coding/bch
54-
sage/coding/goppa
50+
sage/coding/grs_code
51+
sage/coding/goppa_code
5552

5653
In contrast, for some code families Sage can only construct their generator
5754
matrix and has no other a priori knowledge on them:
@@ -68,8 +65,8 @@ Derived Code Constructions
6865
--------------------------
6966

7067
Sage supports the following derived code constructions. If the constituent code
71-
is from a special code family, the derived codes inherit e.g. decoding or
72-
minimum distance capabilities:
68+
is from a special code family, the derived codes inherit structural properties
69+
like decoding radius or minimum distance:
7370

7471
.. toctree::
7572
:maxdepth: 2
@@ -81,37 +78,67 @@ minimum distance capabilities:
8178
Other derived constructions that simply produce the modified generator matrix
8279
can be found among the methods of a constructed code.
8380

84-
Methods and Operations related to Linear Codes
85-
----------------------------------------------
81+
Decoding
82+
--------
83+
84+
Information-set decoding for linear codes:
85+
86+
.. toctree::
87+
:maxdepth: 1
88+
89+
sage/coding/information_set_decoder
8690

91+
Guruswami-Sudan interpolation-based list decoding for Reed-Solomon codes:
92+
93+
.. toctree::
94+
:maxdepth: 1
95+
96+
sage/coding/guruswami_sudan/gs_decoder
97+
sage/coding/guruswami_sudan/interpolation
98+
sage/coding/guruswami_sudan/utils
99+
100+
Automorphism Groups of Linear Codes
101+
-----------------------------------
87102

88103
.. toctree::
89104
:maxdepth: 2
90105

91106
sage/coding/codecan/codecan
92107
sage/coding/codecan/autgroup_can_label
93108

94-
Source coding
95-
-------------
109+
Bounds for Parameters of Linear Codes
110+
-------------------------------------
111+
112+
.. toctree::
113+
:maxdepth: 2
114+
115+
sage/coding/code_bounds
116+
sage/coding/delsarte_bounds
117+
118+
Databases for Coding Theory
119+
---------------------------
120+
121+
.. toctree::
122+
:maxdepth: 2
123+
124+
sage/coding/databases
125+
sage/coding/two_weight_db
126+
127+
Miscellaneous Modules
128+
---------------------
129+
130+
There is at least one module in Sage for source coding in communications theory:
96131

97132
.. toctree::
98133
:maxdepth: 1
99134

100135
sage/coding/source_coding/huffman
101136

102-
Other modules
103-
-------------
137+
Finally an experimental module used for code constructions:
104138

105139
.. toctree::
106140
:maxdepth: 1
107141

108142
sage/coding/relative_finite_field_extension
109-
sage/coding/guruswami_sudan/gs_decoder
110-
sage/coding/guruswami_sudan/interpolation
111-
sage/coding/guruswami_sudan/utils
112-
sage/coding/information_set_decoder
113-
sage/coding/code_bounds
114-
sage/coding/delsarte_bounds
115-
116143

117144
.. include:: ../footer.txt

src/doc/en/thematic_tutorials/coding_theory.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ we can now ask for specific encoder and decoder::
316316
sage: Evect
317317
Evaluation vector-style encoder for [40, 12, 29] Generalized Reed-Solomon Code over GF(59)
318318
sage: type(Evect)
319-
<class 'sage.coding.grs.GRSEvaluationVectorEncoder'>
319+
<class 'sage.coding.grs_code.GRSEvaluationVectorEncoder'>
320320
sage: msg = random_vector(GF(59), C.dimension()) #random
321321
sage: c = Evect.encode(msg)
322322
sage: NN = C.decoder("NearestNeighbor")

src/sage/coding/bch.py src/sage/coding/bch_code.py

+19-17
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
r"""
2-
BCH Code
2+
BCH code
33
4-
Let `F = GF(q)` and `\Phi` be the splitting field of `x^{n} - 1` over `F`,
5-
with `n` a positive integer. Let also `\alpha` be an element of multiplicative
6-
order `n` in `\Phi`. Finally, let `b, \delta, \ell` be integers such that
7-
`0 \le b \le n`, `1 \le \delta \le n` and `\alpha^\ell` generates the
8-
multiplicative group `\Phi^{\times}`.
4+
Let `F = GF(q)` and `\Phi` be the splitting field of `x^{n} - 1` over `F`, with
5+
`n` a positive integer. Let also `\alpha` be an element of multiplicative order
6+
`n` in `\Phi`. Finally, let `b, \delta, \ell` be integers such that `0 \le b
7+
\le n`, `1 \le \delta \le n` and `\alpha^\ell` generates the multiplicative
8+
group `\Phi^{\times}`.
99
1010
A BCH code over `F` with designed distance `\delta` is a cyclic code whose
1111
codewords `c(x) \in F[x]` satisfy `c(\alpha^{a}) = 0`, for all integers `a` in
12-
the arithmetic sequence
13-
`b, b + \ell, b + 2 \times \ell, \dots, b + (\delta - 2) \times \ell`.
12+
the arithmetic sequence `b, b + \ell, b + 2 \times \ell, \dots, b + (\delta -
13+
2) \times \ell`.
1414
1515
TESTS:
1616
@@ -23,11 +23,13 @@
2323
sage: Fqm.<aa> = GF(16)
2424
sage: Fq.<a> = GF(4)
2525
sage: RelativeFiniteFieldExtension(Fqm, Fq)
26-
doctest:...: FutureWarning: This class/method/function is marked as experimental. It, its functionality or its interface might change without a formal deprecation.
26+
doctest:...: FutureWarning: This class/method/function is marked as
27+
experimental. It, its functionality or its interface might change without a
28+
formal deprecation.
2729
See http://trac.sagemath.org/20284 for details.
28-
Relative field extension between Finite Field in aa of size 2^4 and Finite Field in a of size 2^2
30+
Relative field extension between Finite Field in aa of size 2^4 and Finite
31+
Field in a of size 2^2
2932
"""
30-
3133
# *****************************************************************************
3234
# Copyright (C) 2016 David Lucas <[email protected]>
3335
# 2017 Julien Lavauzelle <[email protected]>
@@ -38,17 +40,17 @@
3840
# (at your option) any later version.
3941
# https://www.gnu.org/licenses/
4042
# *****************************************************************************
43+
from copy import copy
4144

42-
from .cyclic_code import CyclicCode
43-
from .grs import GeneralizedReedSolomonCode
44-
from .decoder import Decoder
4545
from sage.modules.free_module_element import vector
4646
from sage.misc.misc_c import prod
4747
from sage.categories.fields import Fields
4848
from sage.arith.all import gcd
4949
from sage.rings.all import Zmod
50-
from copy import copy
5150

51+
from .cyclic_code import CyclicCode
52+
from .grs_code import GeneralizedReedSolomonCode
53+
from .decoder import Decoder
5254

5355
class BCHCode(CyclicCode):
5456
r"""
@@ -272,7 +274,7 @@ def bch_to_grs(self):
272274
class BCHUnderlyingGRSDecoder(Decoder):
273275
r"""
274276
A decoder which decodes through the underlying
275-
:class:`sage.coding.grs.GeneralizedReedSolomonCode` code of the provided
277+
:class:`sage.coding.grs_code.GeneralizedReedSolomonCode` code of the provided
276278
BCH code.
277279
278280
INPUT:
@@ -448,7 +450,7 @@ def decode_to_code(self, y):
448450
(a, a + 1, 1, a + 1, 1, a, a + 1, a + 1, 0, 1, a + 1, 1, 1, 1, a)
449451
sage: D.decode_to_code(y) in C
450452
True
451-
453+
452454
We check that it still works when, while list-decoding, the GRS decoder
453455
output some words which do not lie in the BCH code::
454456

src/sage/coding/binary_code.pyx

+41
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,17 @@ cdef class BinaryCode:
736736
737737
"""
738738
def __cinit__(self, arg1, arg2=None):
739+
"""
740+
Initialize.
741+
742+
TESTS::
743+
744+
sage: import sage.coding.binary_code
745+
sage: from sage.coding.binary_code import *
746+
sage: M = Matrix(GF(2), [[1,1,1,1]])
747+
sage: B = BinaryCode(M)
748+
sage: TestSuite(B).run()
749+
"""
739750
cdef int nrows, i, j, size
740751
cdef int nwords, other_nwords, parity, combination
741752
cdef codeword word, glue_word
@@ -1259,6 +1270,16 @@ cdef class OrbitPartition:
12591270
12601271
"""
12611272
def __cinit__(self, int nrows, int ncols):
1273+
"""
1274+
Initialize.
1275+
1276+
TESTS::
1277+
1278+
sage: import sage.coding.binary_code
1279+
sage: from sage.coding.binary_code import *
1280+
sage: O = OrbitPartition(4, 8)
1281+
sage: TestSuite(O).run(skip='_test_pickling')
1282+
"""
12621283
cdef int col
12631284
cdef int nwords, word
12641285
nwords = (1 << nrows)
@@ -1558,6 +1579,16 @@ cdef class PartitionStack:
15581579
group computation.
15591580
"""
15601581
def __cinit__(self, arg1, arg2=None):
1582+
"""
1583+
Initialize.
1584+
1585+
TESTS::
1586+
1587+
sage: import sage.coding.binary_code
1588+
sage: from sage.coding.binary_code import *
1589+
sage: P = PartitionStack(2, 6)
1590+
sage: TestSuite(P).run(skip='_test_pickling')
1591+
"""
15611592
cdef int k, nwords, ncols, sizeof_int
15621593
cdef PartitionStack other = None
15631594
cdef int *wd_ents
@@ -3047,6 +3078,16 @@ cdef class PartitionStack:
30473078
cdef class BinaryCodeClassifier:
30483079

30493080
def __cinit__(self):
3081+
"""
3082+
Initialize.
3083+
3084+
TESTS::
3085+
3086+
sage: import sage.coding.binary_code
3087+
sage: from sage.coding.binary_code import *
3088+
sage: BC = BinaryCodeClassifier()
3089+
sage: TestSuite(BC).run(skip='_test_pickling')
3090+
"""
30503091
self.radix = sizeof(codeword) << 3
30513092
self.ham_wts = hamming_weights()
30523093
self.L = 100 # memory limit for Phi and Omega- multiply by 8KB

0 commit comments

Comments
 (0)