Closed 1861b8a9-77f0-4f35-8431-8514a75b40d1 closed 8 years ago
Hello Julien,
Thanks for your comments!
I fixed the bug in structured_representation
. I also fixed a bug I found while compiling the documentation, added input sanitization in the encoder and the decoder (speaking of which, these checks are missing almost everywhere... I'll open a new ticket to fix that in other classes).
I also removed non-Pythonic syntax (fun fact: four lines below the ones you noticed, error_erasure
was set to True
or False
... Consistency, I haz it).
Should be ok now.
FYI, I tested locally error-erasure
, list-decoder
and "classical" decoders, standard decoding tests passed.
David
Hi David,
Your fix of structured_representation
doesn't work. Try this:
C = codes.GeneralizedReedSolomonCode(GF(7).list(), 4)
Cp = codes.PuncturedCode(C, [5,6])
Cp2 = codes.PuncturedCode(Cp, [1,2])
If you print list_pts
at the end of the method, you'll see it is not [1,2,5,6]
as expected.
Here is a piece of code which should work:
while(isinstance(C, PuncturedCode)):
cur_pts = list(C.punctured_positions())
list_len = len(list_pts)
for p in cur_pts:
for i in range(list_len):
if (p <= list_pts[i]):
list_pts[i] += 1
list_pts += cur_pts
C = C.original_code()
return C._punctured_form(set(list_pts))
I'm not satisfied about its algorithmic complexity, so you're free to improve it, even though I cannot believe that this piece of code will ever become a bottleneck of any algorithm.
I agree with the other fixes :)
Julien
If you print
list_pts
at the end of the method, you'll see it is not[1,2,5,6]
as expected.
Oh yes you're right, my solution only works if one erases the same coordinates repeatedly...
Branch pushed to git repo; I updated commit sha1. New commits:
45d4ee1 | Fixed structured_representation |
I took your solution and tested it on several instances. I'm fine with it, even if it's not perfect.
David
Reviewer: Julien Lavauzelle
Now that's ok for me. Great job again !
Julien
Amazing, thanks!
Changed branch from u/dlucas/punctured_code to 45d4ee1
This ticket proposes a new implementation for punctured codes.
It contains:
a new code class,
PuncturedCode
a dedicated encoder to compute the generator matrix of a Punctured Code.
a dedicate decoder which uses the original code to correct errors
This new structure presents the following advantages:
it keeps track of the code it comes from. If one punctures a code A, the punctured code one gets will remember it comes from A.
This allows to perform several operations, like encoding or picking a random element without constructing the generator matrix for the punctured code, thus saving time and memory.
because it keeps track of the original code, it's possible to get a structured representation of the punctured code, e.g. if one punctures a GRS code and asks for the structured representation of the punctured code one got, a GRS code will be returned.
Depends on #19653
CC: @wdjoyner @ppurka
Component: coding theory
Author: David Lucas
Branch/Commit:
45d4ee1
Reviewer: Julien Lavauzelle
Issue created by migration from https://trac.sagemath.org/ticket/19422