sagemath / sage

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

An Abstract Class for Rank Metric Codes #21226

Closed 5b3bd7e6-c3f3-4830-a555-991f5e6beec0 closed 4 years ago

5b3bd7e6-c3f3-4830-a555-991f5e6beec0 commented 8 years ago

We propose to implement AbstractRankMetricCode, an abstract class for rank metric codes which will initialize the basic parameters that every rank metric code possesses. This will inherit from AbstractCode class. Further, we propose to add rank-metric based methods to compute distance, weight and allow for matrix to vector (and reverse) conversions between representations. Finally, we create a generic representative class LinearRankMetricCode as well as encoding (generator matrix, systematic) and decoding (nearest neighbour) methods.

CC: @sagetrac-dlucas @johanrosenkilde @dimpase @xcaruso @Adurand8 @mbombar @vbraun

Component: coding theory

Author: Arpit Merchant, Marketa Slukova, Johan Rosenkilde

Branch: 899d390

Reviewer: Dima Pasechnik, Johan Rosenkilde, Xavier Caruso

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

5b3bd7e6-c3f3-4830-a555-991f5e6beec0 commented 8 years ago

Branch: u/arpitdm/abstract_linear_rank_metric_code_class

5b3bd7e6-c3f3-4830-a555-991f5e6beec0 commented 8 years ago
comment:2
  1. I've written a basic constructor for the class along with a couple of getter methods.
  2. I've added some modified rank-metric based methods.
  3. And deleted some methods from the ALC class according to the schema described in past discussions. There's about 10 more that need to be deleted similarly. I'm trying to see if this be written more compactly. Open to ideas.

More to follow.


New commits:

7e4b3a3added a very basic constructor, a couple of basic getter methods and deleted a couple of methods from ALC class. added some rank distance, rank weight, to_matrix_representation and from_matrix_representation.
5b3bd7e6-c3f3-4830-a555-991f5e6beec0 commented 8 years ago

Commit: 7e4b3a3

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

Hello,

I won't comment extensively for now, as there's still a lot to do. I just have one small comment/remark to keep in mind for later: when you will work on documentation, remember to carefully explain which representation you chose (matrix vs. vector) and how to get the other one to be sure users do understand how this class works and what they should expect from it.

David

johanrosenkilde commented 8 years ago
comment:4

Replying to @sagetrac-dlucas:

Hello,

I won't comment extensively for now, as there's still a lot to do. I just have one small comment/remark to keep in mind for later: when you will work on documentation, remember to carefully explain which representation you chose (matrix vs. vector) and how to get the other one to be sure users do understand how this class works and what they should expect from it.

Seconded. And remember to explain that this class only supports rank-metric codes which are linear over the big field!

Best, Johan

johanrosenkilde commented 8 years ago
comment:5

What's the state of this? What is missing? When do you plan to do it?

Best, Johan

johanrosenkilde commented 8 years ago
comment:6

I think the class should be call AbstractLinearRankMetricCode by the way. It's terribly long, but the Linear is important.

emes4 commented 5 years ago

Changed commit from 7e4b3a3 to none

emes4 commented 5 years ago

Dependencies: #28073

emes4 commented 5 years ago

Description changed:

--- 
+++ 
@@ -1,3 +1,3 @@
-We propose to implement `AbstractRankMetricCode`, an abstract class for rank metric codes which will initialize the basic parameters that every rank metric code possesses. This will inherit from `AbstractLinearCode` class so that all relevant methods can be accessed and the others will be deleted. Further, we propose to add rank-metric based methods to compute distance, weight and allow for matrix to vector (and reverse) conversions between representations.
+We propose to implement `AbstractRankMetricCode`, an abstract class for rank metric codes which will initialize the basic parameters that every rank metric code possesses. This will inherit from `AbstractCode` class. Further, we propose to add rank-metric based methods to compute distance, weight and allow for matrix to vector (and reverse) conversions between representations. Finally, we create a generic representative class `LinearRankMetricCode` as well as encoding (generator matrix, systematic) and decoding (nearest neighbour) methods.
emes4 commented 5 years ago

Changed author from Arpit Merchant to Arpit Merchant, Marketa Slukova

emes4 commented 5 years ago

Changed branch from u/arpitdm/abstract_linear_rank_metric_code_class to u/gh-emes4/coding/linear_rank_metric

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

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

64f446aMerge branch 'develop' of git://trac.sagemath.org/sage into abstract_code
53e445badded base_ring and length parameter to AbstractCode
5e6dffeFixed some dependencies. Category still set up wrong.
ba4fc53Merge branch 'abstract_code' into t/28073/abstract_code
e8edfebFixed unclean merge.
880aebbFixed default decoder/encoder dependencies. Set to None by default.
d115600No category set up and base_field in AbstractCode. No encoder/decoder error msgs. Documentation and tests.
82fdc3cMerge branch 'develop' of git://trac.sagemath.org/sage into rank_metric
5c0fd69Merge branch 'develop' of git://trac.sagemath.org/sage into rank_metric
a251c61Inheriting from Abstract Code. Encoding, decoding methods. Generic LinearRankMetricCode class.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Commit: a251c61

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

Changed commit from a251c61 to 05476b3

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

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

05476b3Generator matrix methods in AbstractLinearRankMetricCode
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 05476b3 to 08b6e4f

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

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

524efc8Inheriting from Abstract Code. Encoding, decoding methods. Generic LinearRankMetricCode class.
77fc1e2Generator matrix methods in AbstractLinearRankMetricCode
08b6e4fMerge branch 'u/gh-emes4/coding/linear_rank_metric' of git://trac.sagemath.org/sage into rank_metric
emes4 commented 5 years ago

Changed dependencies from #28073 to #28073, #28209

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

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

8442aa6documentation
086fa74AbstractLinearRankMetricCode done
c39e3caClasses and methods done.
12bb30fGeneric documentation.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 08b6e4f to 12bb30f

emes4 commented 5 years ago
comment:15

Finished up everything and added documentation and doc tests. Few notes:

I kept the parameter requirement that the length of the code has to be at most the degree of the extension.

I didn't manage to turn off the experimental warning, except for handling it in doc tests.

I will add a doctest for the method decode_to_code when Gabidulin codes are in place.

There is no test for linearity over the big field and also no test for the finite field extension in the initialising parameters of AbstractLinearRankMetricCode.

I also added a very slow algorithm for computing the minimum distance.

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

Changed commit from 12bb30f to 72df923

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

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

2bf73f8Merge branch 'develop' of git://trac.sagemath.org/sage into t/28073/abstract_code
487e9e2Category related methods added. Encoder/decoder documentation specified for linear codes.
40df01eFinished up documentation.
b7cab95Merge branch 'u/gh-emes4/coding/abstract_code' of git://trac.sagemath.org/sage into rank_metric
25ca9b7Merge branch 'develop' of git://trac.sagemath.org/sage into rank_metric
72df923Documentation tree link and fixes. Updated Sage.
emes4 commented 5 years ago

Changed dependencies from #28073, #28209 to #28073

johanrosenkilde commented 5 years ago
comment:19

This looks very good! Though my list of comments below is long, I think that this first stab at the class is very good work :-)

In the module doc of linear_rank_metric:

About the to/from matrix repr:

In AbstractLinearRankMetricCode:

In LinearRankMetricCode:

johanrosenkilde commented 5 years ago
comment:20

Concerning my text added to the module doc, one can actually convert to a linear code simply by doing C_hamm = LinearCode(C).

emes4 commented 5 years ago

Changed dependencies from #28073 to #28350

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

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

ef7b797Merge branch 'develop' of git://trac.sagemath.org/sage into t/28073/abstract_code
9608a23Documentation and example fixes.
5230b19Merge #27634
318b444Module inheritance. Ambient_space and `__call__` changes.
3996761Merge commit '8b01cc5df9e1508250976b08b4d2212aecb02927' of git://trac.sagemath.org/sage into t/28073/abstract_code
a4582a3Merge branch 'develop' of git://trac.sagemath.org/sage into t/28073/abstract_code
4dbc878documentation fix
45cf76eClass linear_code_no_metric. Moved stuff from linear_code.
f7d9438Merge in 28350, Linear Code No Metric
d4d3e89No Metric changes. Removed Relative Finite Field Extension, added vector_space method and basis option. Doctests and documentation. Deleted rank metric specific encoders.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 72df923 to d4d3e89

emes4 commented 5 years ago
comment:23

I made all the changes in Johan's comment.

Also merged in Linear Code No Metric and deleted the duplicate stuff.

I removed Relative Finite Field Extension and replaced it with vector_space method, which also allows the user to choose a basis, which is now an initialising parameter for AbstractLinearRankMetricCode and LinearRankMetricCode. I just noticed that I forgot to add the basis parameter in the Super method of LinearRankMetricCode, will fix that now.

I ran make ptestlong and there were no errors.

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

Changed commit from d4d3e89 to 1e32a0c

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

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

1e32a0cSuper method of LinearRankMetricCode includes basis.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 1e32a0c to 0a115d0

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

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

3917048Merge branch 'develop' of git://trac.sagemath.org/sage into rank_metric
01d9a3dMerge branch 'develop' of git://trac.sagemath.org/sage into t/28350/abstract_linear_code_no_metric_class
226ffbfAdded no metric to coding documentation index. Moved zero method from AbstractLinearCode. Changed base_field check.
bd31704Merge branch 'u/gh-emes4/coding/no_metric' of git://trac.sagemath.org/sage into rank_metric
0a115d0Removed zero method. Added field extension method.
xcaruso commented 4 years ago

Changed branch from u/gh-emes4/coding/linear_rank_metric to u/caruso/coding/linear_rank_metric

xcaruso commented 4 years ago

Changed commit from 0a115d0 to 5ea97ac

xcaruso commented 4 years ago
comment:29

I merged with sage 9.1.beta2.

Let me also point out that #21413 (about general field extensions) is now merged. I think it would be nice to rely on it in order to allow for more general fields than finite fields. Any thoughts?


New commits:

d49390emerged version 9.1.beta1
80ff011Add function hash
dbaaaa1Merge branch 'develop' into t/28350/coding/no_metric
5ea97acMerge branch 'u/gh-emes4/coding/linear_rank_metric' of git://trac.sagemath.org/sage into rank_metric_codes
dimpase commented 4 years ago
comment:30

As I already said on #28350, I'd like to see the work of gh-emes4 merged, and then more hacking can start.

Aside from this, I'm all for more general fields to be possible.

dimpase commented 4 years ago

Changed branch from u/caruso/coding/linear_rank_metric to u/dimpase/coding/linear_rank_metric

dimpase commented 4 years ago

Reviewer: Dima Pasechnik

dimpase commented 4 years ago
comment:32

did a straightforward merge on trac/develop (9.2.beta3). Tests pass!


New commits:

3f0d00cMerge remote-tracking branch 'trac/develop' into HEAD
ffb8297take into account map change in trac:#28481
dimpase commented 4 years ago

Changed commit from 5ea97ac to ffb8297

dimpase commented 4 years ago

Changed author from Arpit Merchant, Marketa Slukova to Arpit Merchant, Marketa Slukova, Xavier Caruso

johanrosenkilde commented 4 years ago

Changed reviewer from Dima Pasechnik to Dima Pasechnik, Johan Rosenkilde

johanrosenkilde commented 4 years ago
comment:34

Awesome!

xcaruso commented 4 years ago
comment:36

The method sage.coding.linear_code_no_metric.__eq__ misses doctests.

xcaruso commented 4 years ago

Changed reviewer from Dima Pasechnik, Johan Rosenkilde to Dima Pasechnik, Johan Rosenkilde, Xavier Caruso

xcaruso commented 4 years ago

Changed author from Arpit Merchant, Marketa Slukova, Xavier Caruso to Arpit Merchant, Marketa Slukova

johanrosenkilde commented 4 years ago
comment:38

The __eq__ method is also incorrect: two codes (= vector spaces) may be equal though their generator matrices are not. I'm fixing this.