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

Commit 784975a

Browse files
committed
Added sanity checks. Fixed decoding_radius method arguments.
1 parent d05bfc4 commit 784975a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/sage/coding/extended_code.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ def __init__(self, code):
208208
sage: E
209209
Extended matrix-based encoder for Extended code coming from Linear code of length 11, dimension 5 over Finite Field of size 7
210210
"""
211+
if not isinstance(code, ExtendedCode):
212+
raise TypeError("code has to be an instance of ExtendedCode class")
213+
211214
super(ExtendedCodeExtendedMatrixEncoder, self).__init__(code)
212215

213216
def _repr_(self):
@@ -329,6 +332,9 @@ def __init__(self, code, original_decoder = None, **kwargs):
329332
...
330333
ValueError: Original decoder must have the original code as associated code
331334
"""
335+
if not isinstance(code, ExtendedCode):
336+
raise TypeError("code has to be an instance of ExtendedCode class")
337+
332338
original_code = code.original_code()
333339
if original_decoder is not None and not original_decoder.code() == original_code:
334340
raise ValueError("Original decoder must have the original code as associated code")
@@ -441,10 +447,15 @@ def decode_to_code(self, y, **kwargs):
441447
decoded_list.append(last_pos)
442448
return vector(F, decoded_list)
443449

444-
def decoding_radius(self, **kwargs):
450+
def decoding_radius(self, *args, **kwargs):
445451
r"""
446452
Returns maximal number of errors that ``self`` can decode.
447453
454+
INPUT:
455+
456+
- ``*args``, ``**kwargs`` -- arguments and optional arguments are
457+
forwarded to original decoder's ``decoding_radius`` method.
458+
448459
EXAMPLES::
449460
450461
sage: C = codes.GeneralizedReedSolomonCode(GF(16, 'a').list()[:15], 7)
@@ -453,7 +464,7 @@ def decoding_radius(self, **kwargs):
453464
sage: D.decoding_radius()
454465
4
455466
"""
456-
return self.original_decoder().decoding_radius(**kwargs)
467+
return self.original_decoder().decoding_radius(*args, **kwargs)
457468

458469

459470
####################### registration ###############################

0 commit comments

Comments
 (0)