Skip to content

Commit a67136a

Browse files
author
Matthias Koeppe
committed
sage.coding: Wrap some long lines
1 parent d961aec commit a67136a

File tree

11 files changed

+123
-100
lines changed

11 files changed

+123
-100
lines changed

src/sage/coding/abstract_code.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ class AbstractCode(Parent):
197197
``MyDecoderClass``.
198198
199199
200-
As the class :class:`AbstractCode` is not designed to be instantiated, it does not have any
201-
representation methods. You should implement ``_repr_`` and ``_latex_``
202-
methods in the subclass.
200+
As the class :class:`AbstractCode` is not designed to be instantiated, it
201+
does not have any representation methods. You should implement ``_repr_``
202+
and ``_latex_`` methods in the subclass.
203203
"""
204204

205205
def __init__(self, length, default_encoder_name=None,

src/sage/coding/binary_code.pyx

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -162,29 +162,31 @@ def test_word_perms(t_limit=5.0):
162162
These are structures written in pure C for speed, and are tested from this
163163
function, which performs the following tests:
164164
165-
1. Tests :func:`create_word_perm`, which creates a :class:`WordPermutation` from a Python
166-
list `L` representing a permutation `i \mapsto L[i]`. Takes a random word and
167-
permutes it by a random list permutation, and tests that the result
168-
agrees with doing it the slow way.
169-
170-
1b. Tests :func:`create_array_word_perm`, which creates a :class:`WordPermutation` from a
171-
C array. Does the same as above.
172-
173-
2. Tests :func:`create_comp_word_perm`, which creates a :class:`WordPermutation` as a
174-
composition of two :class:`WordPermutation` objects. Takes a random word and
175-
two random permutations, and tests that the result of permuting by the
176-
composition is correct.
177-
178-
3. Tests :func:`create_inv_word_perm` and :func:`create_id_word_perm`, which create a
179-
:class:`WordPermutation` as the inverse and identity permutations, resp.
180-
Takes a random word and a random permutation, and tests that the result
181-
permuting by the permutation and its inverse in either order, and
182-
permuting by the identity both return the original word.
165+
1. Tests :func:`create_word_perm`, which creates a :class:`WordPermutation`
166+
from a Python list `L` representing a permutation `i \mapsto
167+
L[i]`. Takes a random word and permutes it by a random list permutation,
168+
and tests that the result agrees with doing it the slow way.
169+
170+
1b. Tests :func:`create_array_word_perm`, which creates a
171+
:class:`WordPermutation` from a C array. Does the same as above.
172+
173+
2. Tests :func:`create_comp_word_perm`, which creates a
174+
:class:`WordPermutation` as a composition of two
175+
:class:`WordPermutation` objects. Takes a random word and two random
176+
permutations, and tests that the result of permuting by the composition
177+
is correct.
178+
179+
3. Tests :func:`create_inv_word_perm` and :func:`create_id_word_perm`,
180+
which create a :class:`WordPermutation` as the inverse and identity
181+
permutations, resp. Takes a random word and a random permutation, and
182+
tests that the result permuting by the permutation and its inverse in
183+
either order, and permuting by the identity both return the original
184+
word.
183185
184186
.. NOTE::
185187
186-
The functions :func:`permute_word_by_wp` and :func:`dealloc_word_perm` are implicitly
187-
involved in each of the above tests.
188+
The functions :func:`permute_word_by_wp` and :func:`dealloc_word_perm`
189+
are implicitly involved in each of the above tests.
188190
189191
TESTS::
190192
@@ -866,8 +868,8 @@ cdef class BinaryCode:
866868

867869
def matrix(self):
868870
"""
869-
Returns the generator matrix of the :class:`BinaryCode`, i.e. the code is the
870-
rowspace of ``B.matrix()``.
871+
Return the generator matrix of the :class:`BinaryCode`, i.e. the code is
872+
the rowspace of ``B.matrix()``.
871873
872874
EXAMPLES::
873875
@@ -3910,9 +3912,9 @@ cdef class BinaryCodeClassifier:
39103912
39113913
- ``n`` -- limit on the degree of the code
39123914
3913-
- ``d`` -- test whether new vector has weight divisible by `d`. If `d=4`, this
3914-
ensures that all doubly-even canonically augmented children are
3915-
generated.
3915+
- ``d`` -- test whether new vector has weight divisible by `d`. If
3916+
`d=4`, this ensures that all doubly-even canonically augmented
3917+
children are generated.
39163918
39173919
EXAMPLES::
39183920

src/sage/coding/channel.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,8 @@ class ErrorErasureChannel(Channel):
446446
r"""
447447
Channel which adds errors and erases several positions in any message it transmits.
448448
449-
The output space of this channel is a Cartesian product
450-
between its input space and a VectorSpace of the same dimension over `\GF{2}`.
449+
The output space of this channel is a Cartesian product between its input
450+
space and a VectorSpace of the same dimension over `\GF{2}`.
451451
452452
INPUT:
453453
@@ -561,8 +561,8 @@ def _latex_(self):
561561

562562
def transmit_unsafe(self, message):
563563
r"""
564-
Return ``message`` with as many errors as ``self._number_errors`` in it, and as many erasures
565-
as ``self._number_erasures`` in it.
564+
Return ``message`` with as many errors as ``self._number_errors`` in it,
565+
and as many erasures as ``self._number_erasures`` in it.
566566
567567
If ``self._number_errors`` was passed as an tuple for the number of errors, it will
568568
pick a random integer between the bounds of the tuple and use it as the number of errors.
@@ -583,9 +583,10 @@ def transmit_unsafe(self, message):
583583
584584
- a couple of vectors, namely:
585585
586-
- the transmitted message, which is ``message`` with erroneous and erased positions
587-
- the erasure vector, which contains ``1`` at the erased positions of the transmitted message
588-
and ``0`` elsewhere.
586+
- the transmitted message, which is ``message`` with erroneous and
587+
erased positions
588+
- the erasure vector, which contains ``1`` at the erased positions of
589+
the transmitted message and ``0`` elsewhere.
589590
590591
EXAMPLES::
591592
@@ -672,14 +673,15 @@ class QarySymmetricChannel(Channel):
672673
673674
EXAMPLES:
674675
675-
We construct a :class:`QarySymmetricChannel` which corrupts 30% of all transmitted
676-
symbols::
676+
We construct a :class:`QarySymmetricChannel` which corrupts 30% of all
677+
transmitted symbols::
677678
678679
sage: epsilon = 0.3
679680
sage: Chan = channels.QarySymmetricChannel(GF(59)^50, epsilon)
680681
sage: Chan
681682
q-ary symmetric channel with error probability 0.300000000000000,
682-
of input and output space Vector space of dimension 50 over Finite Field of size 59
683+
of input and output space
684+
Vector space of dimension 50 over Finite Field of size 59
683685
"""
684686

685687
def __init__(self, space, epsilon):

src/sage/coding/code_bounds.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@
152152
153153
- Delsarte (a.k.a. Linear Programming (LP)) upper bounds.
154154
155-
PROBLEM: In this module we shall typically either (a) seek bounds
156-
on `k`, given `n`, `d`, `q`, (b) seek bounds on `R`, `\delta`, `q` (assuming `n` is
155+
PROBLEM: In this module we shall typically either (a) seek bounds on `k`, given
156+
`n`, `d`, `q`, (b) seek bounds on `R`, `\delta`, `q` (assuming `n` is
157157
"infinity").
158158
159159
.. TODO::
@@ -300,10 +300,11 @@ def dimension_upper_bound(n, d, q, algorithm=None):
300300
Return an upper bound for the dimension of a linear code.
301301
302302
Return an upper bound `B(n,d) = B_q(n,d)` for the
303-
dimension of a linear code of length n, minimum distance d over a
304-
field of size q.
303+
dimension of a linear code of length `n`, minimum distance `d` over a
304+
field of size `q`.
305305
306-
Parameter ``algorithm`` has the same meaning as in :func:`codesize_upper_bound`
306+
Parameter ``algorithm`` has the same meaning as in
307+
:func:`codesize_upper_bound`
307308
308309
EXAMPLES::
309310

src/sage/coding/code_constructions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,8 @@ def QuadraticResidueCode(n,F):
502502
`n`'th root of unity; `i` ranges over the set of
503503
quadratic residues modulo `n`).
504504
505-
See :class:`QuadraticResidueCodeEvenPair` and :class:`QuadraticResidueCodeOddPair`
506-
for a more general construction.
505+
See :class:`QuadraticResidueCodeEvenPair` and
506+
:class:`QuadraticResidueCodeOddPair` for a more general construction.
507507
508508
INPUT:
509509

src/sage/coding/guruswami_sudan/gs_decoder.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737

3838
def n_k_params(C, n_k):
3939
r"""
40-
Internal helper function for the :class:`GRSGuruswamiSudanDecoder` class for allowing to
41-
specify either a GRS code `C` or the length and dimensions `n, k` directly,
42-
in all the static functions.
40+
Internal helper function for the :class:`GRSGuruswamiSudanDecoder` class for
41+
allowing to specify either a GRS code `C` or the length and dimensions `n,
42+
k` directly, in all the static functions.
4343
4444
If neither `C` or `n,k` were specified to those functions, an appropriate
4545
error should be raised. Otherwise, `n, k` of the code or the supplied tuple
@@ -49,7 +49,8 @@ def n_k_params(C, n_k):
4949
5050
- ``C`` -- A GRS code or ``None``
5151
52-
- ``n_k`` -- A tuple `(n,k)` being length and dimension of a GRS code, or ``None``.
52+
- ``n_k`` -- A tuple `(n,k)` being length and dimension of a GRS code, or
53+
``None``.
5354
5455
OUTPUT:
5556
@@ -164,7 +165,8 @@ class GRSGuruswamiSudanDecoder(Decoder):
164165
that will be used. The following possibilities are currently available:
165166
166167
* ``"LinearAlgebra"`` -- uses a linear system solver.
167-
* ``"LeeOSullivan"`` -- uses Lee O'Sullivan method based on row reduction of a matrix
168+
* ``"LeeOSullivan"`` -- uses Lee O'Sullivan method based on row reduction
169+
of a matrix
168170
* ``None`` -- one of the above will be chosen based on the size of the
169171
code and the parameters.
170172

src/sage/coding/guruswami_sudan/interpolation.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ def gs_interpolation_linalg(points, tau, parameters, wy):
242242
243243
- ``parameters`` -- (default: ``None``) a pair of integers, where:
244244
245-
- the first integer is the multiplicity parameter of Guruswami-Sudan algorithm and
245+
- the first integer is the multiplicity parameter of Guruswami-Sudan
246+
algorithm and
246247
- the second integer is the list size parameter.
247248
248249
- ``wy`` -- an integer, the `y`-weight, where we seek `Q` of low
@@ -314,7 +315,8 @@ def lee_osullivan_module(points, parameters, wy):
314315
315316
- ``parameters`` -- (default: ``None``) a pair of integers, where:
316317
317-
- the first integer is the multiplicity parameter `s` of Guruswami-Sudan algorithm and
318+
- the first integer is the multiplicity parameter `s` of Guruswami-Sudan
319+
algorithm and
318320
- the second integer is the list size parameter.
319321
320322
- ``wy`` -- an integer, the `y`-weight, where we seek `Q` of low
@@ -368,7 +370,8 @@ def gs_interpolation_lee_osullivan(points, tau, parameters, wy):
368370
- ``tau`` -- an integer, the number of errors one wants to decode.
369371
370372
- ``parameters`` -- (default: ``None``) a pair of integers, where:
371-
- the first integer is the multiplicity parameter of Guruswami-Sudan algorithm and
373+
- the first integer is the multiplicity parameter of Guruswami-Sudan
374+
algorithm and
372375
- the second integer is the list size parameter.
373376
374377
- ``wy`` -- an integer, the `y`-weight, where we seek ``Q`` of low

src/sage/coding/linear_code_no_metric.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ class AbstractLinearCodeNoMetric(AbstractCode, Module):
7777
:class:`sage.coding.linear_code.LinearCode`.
7878
7979
80-
As the class :class:`AbstractLinearCodeNoMetric` is not designed to be instantiated, it does not
81-
have any representation methods. You should implement ``_repr_`` and ``_latex_``
82-
methods in the subclass.
80+
As the class :class:`AbstractLinearCodeNoMetric` is not designed to be
81+
instantiated, it does not have any representation methods. You should
82+
implement ``_repr_`` and ``_latex_`` methods in the subclass.
8383
8484
.. WARNING::
8585

src/sage/coding/punctured_code.py

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ def _insert_punctured_positions(l, punctured_points, value = None):
6969
7070
- ``punctured_points`` -- a set of integers
7171
72-
- ``value`` -- (default: ``None``) an element to insert in every position given in``punctured_points``.
73-
If it is let to ``None``, a random value will be chosen for each insertion.
72+
- ``value`` -- (default: ``None``) an element to insert in every position
73+
given in``punctured_points``. If it is let to ``None``, a random value
74+
will be chosen for each insertion.
7475
7576
EXAMPLES::
7677
@@ -121,13 +122,15 @@ def __init__(self, C, positions):
121122
r"""
122123
TESTS:
123124
124-
If one of the positions to puncture is bigger than the length of ``C``, an exception will be raised::
125+
If one of the positions to puncture is bigger than the length of ``C``,
126+
an exception will be raised::
125127
126128
sage: C = codes.random_linear_code(GF(7), 11, 5)
127129
sage: Cp = codes.PuncturedCode(C, {4,8,15})
128130
Traceback (most recent call last):
129131
...
130-
ValueError: Positions to puncture must be positive integers smaller than the length of the provided code
132+
ValueError: Positions to puncture must be positive integers smaller
133+
than the length of the provided code
131134
"""
132135
if not isinstance(positions, (Integer, int, set, list)):
133136
raise TypeError("positions must be either a Sage Integer, a Python int, a set or a list")
@@ -439,18 +442,19 @@ class PuncturedCodeOriginalCodeDecoder(Decoder):
439442
- ``strategy`` -- (default: ``None``) the strategy used to decode.
440443
The available strategies are:
441444
442-
* ``'error-erasure'`` -- uses an error-erasure decoder over the original code if available,
443-
fails otherwise.
445+
* ``'error-erasure'`` -- uses an error-erasure decoder over the original
446+
code if available, fails otherwise.
444447
445448
* ``'random-values'`` -- fills the punctured positions with random elements
446449
in ``code``'s base field and tries to decode using
447450
the default decoder of the original code
448451
449-
* ``'try-all'`` -- fills the punctured positions with every possible combination of
450-
symbols until decoding succeeds, or until every combination have been tried
452+
* ``'try-all'`` -- fills the punctured positions with every possible
453+
combination of symbols until decoding succeeds, or until every
454+
combination have been tried
451455
452-
* ``None`` -- uses ``error-erasure`` if an error-erasure decoder is available,
453-
switch to ``random-values`` behaviour otherwise
456+
* ``None`` -- uses ``error-erasure`` if an error-erasure decoder is
457+
available, switch to ``random-values`` behaviour otherwise
454458
455459
- ``original_decoder`` -- (default: ``None``) the decoder that will be used over the original code.
456460
It has to be a decoder object over the original code.
@@ -468,19 +472,20 @@ class PuncturedCodeOriginalCodeDecoder(Decoder):
468472
Decoder of Puncturing of [15, 7, 9] Reed-Solomon Code over GF(16) on position(s) [3]
469473
through Error-Erasure decoder for [15, 7, 9] Reed-Solomon Code over GF(16)
470474
471-
As seen above, if all optional are left blank, and if an error-erasure decoder is
472-
available, it will be chosen as the original decoder.
473-
Now, if one forces ``strategy`` to ``'try-all'`` or ``'random-values'``, the
474-
default decoder of the original code will be chosen, even if an error-erasure is available::
475+
As seen above, if all optional are left blank, and if an error-erasure
476+
decoder is available, it will be chosen as the original decoder. Now, if
477+
one forces ``strategy`` to ``'try-all'`` or ``'random-values'``, the default
478+
decoder of the original code will be chosen, even if an error-erasure is
479+
available::
475480
476481
sage: C = codes.GeneralizedReedSolomonCode(GF(16, 'a').list()[:15], 7)
477482
sage: Cp = codes.PuncturedCode(C, 3)
478483
sage: D = codes.decoders.PuncturedCodeOriginalCodeDecoder(Cp, strategy="try-all")
479484
sage: "error-erasure" in D.decoder_type()
480485
False
481486
482-
And if one fills ``original_decoder`` and ``strategy`` fields with contradictory
483-
elements, the ``original_decoder`` takes precedence::
487+
And if one fills ``original_decoder`` and ``strategy`` fields with
488+
contradictory elements, the ``original_decoder`` takes precedence::
484489
485490
sage: C = codes.GeneralizedReedSolomonCode(GF(16, 'a').list()[:15], 7)
486491
sage: Cp = codes.PuncturedCode(C, 3)

0 commit comments

Comments
 (0)