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

Commit 7c965dd

Browse files
author
David Lucas
committedNov 25, 2015
Integrated reviewer's comments
1 parent ddd1eb1 commit 7c965dd

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed
 

‎src/sage/coding/linear_code.py

+16-13
Original file line numberDiff line numberDiff line change
@@ -821,15 +821,15 @@ def __init__(self, base_field, length, default_encoder_name, default_decoder_nam
821821
TESTS:
822822
823823
If the length field is neither a Python int nor a Sage Integer, it will
824-
raise an exception::
824+
raise a exception::
825825
826826
sage: C = CodeExample(GF(17), 10.0, 5, generator_matrix)
827827
Traceback (most recent call last):
828828
...
829829
ValueError: length must be a Python int or a Sage Integer
830830
831831
If the name of the default decoder is not known by the class, it will raise
832-
an exception::
832+
a exception::
833833
834834
sage: class CodeExample(sage.coding.linear_code.AbstractLinearCode):
835835
....: def __init__(self, field, length, dimension, generator_matrix):
@@ -844,7 +844,7 @@ def __init__(self, base_field, length, default_encoder_name, default_decoder_nam
844844
sage: C = CodeExample(GF(17), 10, 5, generator_matrix)
845845
Traceback (most recent call last):
846846
...
847-
ValueError: You must set a valid decoder as default decoder for this code, by filling the dicitonary of registered decoders
847+
ValueError: You must set a valid decoder as default decoder for this code, by filling in the dicitonary of registered decoders
848848
849849
If the name of the default encoder is not known by the class, it will raise
850850
an exception::
@@ -862,7 +862,7 @@ def __init__(self, base_field, length, default_encoder_name, default_decoder_nam
862862
sage: C = CodeExample(GF(17), 10, 5, generator_matrix)
863863
Traceback (most recent call last):
864864
...
865-
ValueError: You must set a valid encoder as default encoder for this code, by filling the dictionary of registered encoders
865+
ValueError: You must set a valid encoder as default encoder for this code, by filling in the dictionary of registered encoders
866866
867867
A ring instead of a field::
868868
@@ -875,11 +875,10 @@ def __init__(self, base_field, length, default_encoder_name, default_decoder_nam
875875
raise ValueError("length must be a Python int or a Sage Integer")
876876
if not base_field.is_field():
877877
raise ValueError("'base_field' must be a field (and {} is not one)".format(base_field))
878-
self._length = Integer(length)
879878
if not default_encoder_name in self._registered_encoders:
880-
raise ValueError("You must set a valid encoder as default encoder for this code, by filling the dictionary of registered encoders")
879+
raise ValueError("You must set a valid encoder as default encoder for this code, by filling in the dictionary of registered encoders")
881880
if not default_decoder_name in self._registered_decoders:
882-
raise ValueError("You must set a valid decoder as default decoder for this code, by filling the dicitonary of registered decoders")
881+
raise ValueError("You must set a valid decoder as default decoder for this code, by filling in the dicitonary of registered decoders")
883882
self._length = Integer(length)
884883
self._default_decoder_name = default_decoder_name
885884
self._default_encoder_name = default_encoder_name
@@ -1610,7 +1609,7 @@ def decode(self, right, algorithm="syndrome"):
16101609
16111610
INPUT:
16121611
1613-
- ``right`` -- a vector of the same length as ``self`` over test
1612+
- ``right`` -- a vector of the same length as ``self`` over
16141613
the base field of ``self``
16151614
16161615
- ``algorithm`` -- (default: ``'syndrome'``) Name of the decoding algorithm which
@@ -1636,7 +1635,7 @@ def decode_to_code(self, word, decoder_name=None, **kwargs):
16361635
16371636
INPUT:
16381637
1639-
- ``word`` -- a vector of the same length as ``self`` over test
1638+
- ``word`` -- a vector of the same length as ``self`` over
16401639
the base field of ``self``
16411640
16421641
- ``decoder_name`` -- (default: ``None``) Name of the decoder which will be used
@@ -3901,7 +3900,7 @@ def __hash__(self):
39013900
sage: hash(C) #random
39023901
9015017528451745710
39033902
3904-
If ``C1`` and ``C2`` are two codes which only differs by the coefficients of their
3903+
If ``C1`` and ``C2`` are two codes which only differ by the coefficients of their
39053904
generator matrices, their hashes are different (we check that the bug found in trac #18813
39063905
is fixed)::
39073906
@@ -3914,7 +3913,7 @@ def __hash__(self):
39143913
"""
39153914
Str = str(self)
39163915
G = str(self.generator_matrix()) #str because mutable matrices are unhashable
3917-
return hash((Str, G)) ^ hash(Str) ^ hash(Str)
3916+
return hash((Str, G)) ^ hash(Str) ^ hash(G)
39183917

39193918
def generator_matrix(self, encoder_name=None, **kwargs):
39203919
r"""
@@ -4033,8 +4032,12 @@ def generator_matrix(self):
40334032
####################### decoders ###############################
40344033
class LinearCodeSyndromeDecoder(Decoder):
40354034
r"""
4036-
Construct a decoder for Linear Codes. This decoder will use a syndrome
4037-
based decoding algorithm.
4035+
Construct a decoder for Linear Codes.
4036+
4037+
.. WARNING::
4038+
4039+
As explained in trac #19623, despite its name this decoder actually uses a
4040+
nearest neighbor decoding algorithm.
40384041
40394042
INPUT:
40404043

0 commit comments

Comments
 (0)
This repository has been archived.