sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.47k stars 486 forks source link

A new structure for Punctured Codes #19422

Closed 1861b8a9-77f0-4f35-8431-8514a75b40d1 closed 8 years ago

1861b8a9-77f0-4f35-8431-8514a75b40d1 commented 9 years ago

This ticket proposes a new implementation for punctured codes.

It contains:

This new structure presents the following advantages:

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

1861b8a9-77f0-4f35-8431-8514a75b40d1 commented 8 years ago
comment:36

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

jlavauzelle commented 8 years ago
comment:38

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

1861b8a9-77f0-4f35-8431-8514a75b40d1 commented 8 years ago
comment:39

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...

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 8a3a084 to 45d4ee1

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

45d4ee1Fixed structured_representation
1861b8a9-77f0-4f35-8431-8514a75b40d1 commented 8 years ago
comment:41

I took your solution and tested it on several instances. I'm fine with it, even if it's not perfect.

David

jlavauzelle commented 8 years ago

Reviewer: Julien Lavauzelle

jlavauzelle commented 8 years ago
comment:42

Now that's ok for me. Great job again !

Julien

1861b8a9-77f0-4f35-8431-8514a75b40d1 commented 8 years ago
comment:43

Amazing, thanks!

vbraun commented 8 years ago

Changed branch from u/dlucas/punctured_code to 45d4ee1