Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polynomial encoder for GRS codes fails if variable name is not x #20744

Closed
sagetrac-dlucas mannequin opened this issue Jun 1, 2016 · 31 comments
Closed

Polynomial encoder for GRS codes fails if variable name is not x #20744

sagetrac-dlucas mannequin opened this issue Jun 1, 2016 · 31 comments

Comments

@sagetrac-dlucas
Copy link
Mannequin

sagetrac-dlucas mannequin commented Jun 1, 2016

The following:

sage: F = GF(11)
sage: Fy.<y> = F[]
sage: n, k = 10 , 5
sage: C = codes.GeneralizedReedSolomonCode(F.list()[:n], k)
sage: E = C.encoder("EvaluationPolynomial")
sage: p = y^2 + 3*y + 10
sage: c = E.encode(p);

<BOOM>

fails because the polynomial to encode has to be in 'x' with the actual implementation.

This ticket fixes it, by allowing the user to specify a variable name when creating the encoder.

CC: @johanrosenkilde @jlavauzelle @sagetrac-panda314

Component: coding theory

Keywords: sd75

Author: Julien Lavauzelle, David Lucas

Branch/Commit: e5fef36

Reviewer: Johan Rosenkilde, Daniel Augot

Issue created by migration from https://trac.sagemath.org/ticket/20744

@sagetrac-dlucas sagetrac-dlucas mannequin added this to the sage-7.3 milestone Jun 1, 2016
@sagetrac-dlucas
Copy link
Mannequin Author

sagetrac-dlucas mannequin commented Jun 1, 2016

@sagetrac-dlucas
Copy link
Mannequin Author

sagetrac-dlucas mannequin commented Jun 1, 2016

comment:2

I fixed the bug, this is now open for review.

Best,

David


New commits:

9c3c1cdFixe d bug related to hardcoded variable for the polynomial ring

@sagetrac-dlucas
Copy link
Mannequin Author

sagetrac-dlucas mannequin commented Jun 1, 2016

Commit: 9c3c1cd

@johanrosenkilde
Copy link
Contributor

comment:3

I was wondering whether it would make more sense to have an option to give the polynomial ring? But I'm not sure it would. For ReedMullerCodes (which are in the making), one could argue that it does make sense (since we otherwise need many names), and in this case, it would be consistent that ReedSolomonCode follows the same pattern.

One could also, for usability, make a method polynomial_ring() on the encoder which is an alias of message_space().

@sagetrac-dlucas
Copy link
Mannequin Author

sagetrac-dlucas mannequin commented Jun 1, 2016

comment:4

Yes, I think it's important to be consistent between similar modules.
I'll change this so it now asks for a polynomial ring and not the variable.
I'll also add a method polynomial_ring().

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 1, 2016

Changed commit from 9c3c1cd to 7692498

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 1, 2016

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

99e9cd1Instead of the variable name, the encoder now takes the ring as optional input
7692498Added a getter method: polynomial_ring()

@sagetrac-dlucas
Copy link
Mannequin Author

sagetrac-dlucas mannequin commented Jun 1, 2016

comment:6

I did what we talked about, and added related input checks and TESTS block.
This method polynomial_ring feels like code duplication with message_space, but it makes sense to provide it, so even if it's not über-clean, I can live with that.

David

@johanrosenkilde
Copy link
Contributor

comment:7

Replying to @sagetrac-dlucas:

I did what we talked about, and added related input checks and TESTS block.

Cool. You also need a check that polynomial_ring.base_ring() is the field of the code.

This method polynomial_ring feels like code duplication with message_space, but it makes sense to provide it, so even if it's not über-clean, I can live with that.

Yes, that's why I suggested making it an "alias of message_space". But now you've made a full function anyway. However, can you add in the doc-string that this is the same as the message space?

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 1, 2016

Changed commit from 7692498 to 0860220

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 1, 2016

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

0860220Added another input check, polynomial_ring is now an alias of message_space

@sagetrac-dlucas
Copy link
Mannequin Author

sagetrac-dlucas mannequin commented Jun 1, 2016

comment:9

Done.

I also removed polynomial_ring as a full function and made it an alias of message_space as you suggested.
I think it's indeed better.

@johanrosenkilde
Copy link
Contributor

Reviewer: Johan S. R. Nielsen

@johanrosenkilde
Copy link
Contributor

comment:10

This looks good. I approve of the changes. However, I can't currently compile Sage on my machine, so I can't really test the patch :-S

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 29, 2016

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

bffcbefMerge branch 'develop' into grs_polynomial_encoder_msg_space_fix
6c5d8ffFixed bug (confusion between base_ring and base_field)

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 29, 2016

Changed commit from 0860220 to 6c5d8ff

@sagetrac-dlucas
Copy link
Mannequin Author

sagetrac-dlucas mannequin commented Jun 29, 2016

comment:12

I updated this ticket to latest beta, and fixed a bug (polynomial_ring.base_field() was used instead of polynomial_ring.base_ring()).

This is still open for review.

David

@sagetrac-danielaugot
Copy link
Mannequin

sagetrac-danielaugot mannequin commented Aug 25, 2016

comment:13

Hi David

This new feature is not examplified when typing codes.encoders.GRSEvaluationPolynomialEncoder?

I suggest there should be an example with 'y' or 'my_variable' in the EXAMPLE section of the docstring.

That could be quickly done by migrating part of the existing code in the TEST section to the EXAMPLE section.

Daniel

@jlavauzelle
Copy link
Contributor

@jlavauzelle
Copy link
Contributor

@jlavauzelle
Copy link
Contributor

comment:15

Hi,

I merged to the latest beta (7.4.beta3) and made the fix according to Daniel's comment. I also approve the changes.

Need someone for a definitive review (I guess).

Julien

@jlavauzelle jlavauzelle modified the milestones: sage-7.3, sage-7.4 Sep 5, 2016
@jlavauzelle
Copy link
Contributor

@johanrosenkilde
Copy link
Contributor

Changed commit from 6c5d8ff to 05bd5ec

@johanrosenkilde
Copy link
Contributor

comment:17

The polynomial ring has to go into __eq__.


New commits:

4e3cbbcMerge branch 'u/dlucas/grs_polynomial_encoder_msg_space_fix' of git://trac.sagemath.org/sage into 20744_grs_variable_name
05bd5ecImproved doc and tests related to polynomial_ring argument.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 5, 2016

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

e5fef36Fixed `__eq__` issue related to polynomial_ring.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 5, 2016

Changed commit from 05bd5ec to e5fef36

@jlavauzelle
Copy link
Contributor

comment:19

Hi Johan,

That's true, sorry. Fixed.

Julien

@johanrosenkilde
Copy link
Contributor

Changed keywords from none to sd75

@johanrosenkilde
Copy link
Contributor

Author: Julien Lavauzelle, David Lucas

@johanrosenkilde
Copy link
Contributor

Changed reviewer from Johan S. R. Nielsen to Johan Rosenkilde, Daniel Augot

@vbraun
Copy link
Member

vbraun commented Sep 8, 2016

Changed branch from u/jlavauzelle/grs_polynomial_encoder_msg_space_fix to e5fef36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants