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

Abstract Linear Code No Metric Class #28350

Closed
emes4 opened this issue Aug 13, 2019 · 36 comments
Closed

Abstract Linear Code No Metric Class #28350

emes4 opened this issue Aug 13, 2019 · 36 comments

Comments

@emes4
Copy link
Contributor

emes4 commented Aug 13, 2019

With the changes in the coding component, the classes AbstractLinearCode and AbstractLinearRankMetricCode share a lot of the same code. To avoid this and also make creating new linear codes with different metrics easier, we propose to create a new class, AbstractLinearCodeNoMetric, which will stand between AbstractCode and AbstractLinearCode/AbstractLinearRankMetricCode. This class will contain all the methods relevant for linear codes, which do not depend on a metric. In practice this is mostly methods related to generator matrix.

CC: @dimpase @johanrosenkilde @xcaruso @Adurand8

Component: coding theory

Keywords: gsoc19

Author: Marketa Slukova, Amaury Durand

Branch/Commit: 158d73f

Reviewer: Dima Pasechnik

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

@emes4 emes4 added this to the sage-8.9 milestone Aug 13, 2019
@emes4
Copy link
Contributor Author

emes4 commented Aug 15, 2019

Branch: u/emes4/28073

@emes4
Copy link
Contributor Author

emes4 commented Aug 15, 2019

Changed branch from u/emes4/28073 to u/emes4/28350

@emes4
Copy link
Contributor Author

emes4 commented Aug 15, 2019

Changed branch from u/emes4/28350 to none

@emes4
Copy link
Contributor Author

emes4 commented Aug 15, 2019

Commit: 45cf76e

@emes4
Copy link
Contributor Author

emes4 commented Aug 15, 2019

Branch: u/gh-emes4/coding/no_metric

@emes4
Copy link
Contributor Author

emes4 commented Aug 15, 2019

Last 10 new commits:

40df01eFinished up documentation.
01135cbMerge branch 'develop' of git://trac.sagemath.org/sage into t/28073/abstract_code
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.

@emes4
Copy link
Contributor Author

emes4 commented Aug 15, 2019

comment:5

I created the class AbstractLinearCodeNoMetric and moved stuff from AbstractLinearCode there, including the category theory set up. I don't understand what the facade does, but when I remove it, the test suite test in LinearCode is unhappy.

The only thing I couldn't get to work was the requirement that the dimension of the code is at most the length. The problem is that the dimension requires a generator matrix (unless it's given) and that causes some issues. I kept the check line commented out in __init__ of AbstractLinearCodeNoMetric.

Unlike AbstractCode, in AbstractLinearCodeNoMetric, it is required that subclasses have default encoders/decoders. This should make sense since we require a generic constructor class.

@emes4 emes4 self-assigned this Aug 15, 2019
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 19, 2019

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

01d9a3dMerge branch 'develop' of git://trac.sagemath.org/sage into t/28350/abstract_linear_code_no_metric_class

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 19, 2019

Changed commit from 45cf76e to 01d9a3d

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 19, 2019

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

226ffbfAdded no metric to coding documentation index. Moved zero method from AbstractLinearCode. Changed base_field check.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 19, 2019

Changed commit from 01d9a3d to 226ffbf

@emes4
Copy link
Contributor Author

emes4 commented Aug 19, 2019

comment:10

Updated Sage.

Added linear_code_no_metric.py to the index of coding module documentation.

Moved zero method from AbstractLinearCode.

Changed base_field check message.

@dimpase
Copy link
Member

dimpase commented Sep 8, 2019

comment:11

with python3:
(i.e. doing ./configure --with-python=3 && make)

sage -t src/sage/coding/decoder.py
**********************************************************************
File "src/sage/coding/decoder.py", line 197, in sage.coding.decoder.Decoder.__hash__
Failed example:
    hash(D) #random
Exception raised:
    Traceback (most recent call last):
      File "/mnt/opt/Sage/sage-dev/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 681, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/mnt/opt/Sage/sage-dev/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1123, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.coding.decoder.Decoder.__hash__[3]>", line 1, in <module>
        hash(D) #random
      File "/mnt/opt/Sage/sage-dev/local/lib/python3.7/site-packages/sage/coding/linear_code.py", line 2632, in __hash__
        return hash((self.code(), self.maximum_error_weight()))
    TypeError: unhashable type: 'LinearCode_with_category'
**********************************************************************

this causes more errors

sage -t src/sage/coding/decoder.py  # 1 doctest failed
sage -t src/sage/coding/linear_code_no_metric.py  # 2 doctests failed
sage -t src/sage/coding/linear_code.py  # 1 doctest failed

@dimpase
Copy link
Member

dimpase commented Oct 31, 2019

comment:14

Any chance this could be brought forward - it holds up few more tickets...

@johanrosenkilde
Copy link
Contributor

comment:15

I unfortunately don't have any time to move on this currently :-(

@emes4
Copy link
Contributor Author

emes4 commented Nov 3, 2019

comment:16

I will have a look at it this week!

@embray
Copy link
Contributor

embray commented Dec 30, 2019

comment:17

Ticket retargeted after milestone closed

@embray embray modified the milestones: sage-8.9, sage-9.1 Dec 30, 2019
@Adurand8
Copy link
Mannequin

Adurand8 mannequin commented Jan 30, 2020

Changed branch from u/gh-emes4/coding/no_metric to u/gh-Adurand8/coding/no_metric

@xcaruso
Copy link
Contributor

xcaruso commented Jan 30, 2020

Changed commit from 226ffbf to dbaaaa1

@xcaruso
Copy link
Contributor

xcaruso commented Jan 30, 2020

comment:19

Hello,

I'm not really satisfied with the names of the classes.
Instead, I would propose the following hierarchy:

AbstractCode
  AbstractLinearCode
    AbstractLinearMetricCode
      AbstractLinearHammingMetricCode  # if relevant
      AbstractLinearRankMetricCode

Also, through it is not directly related to this ticket, I don't understand the purpose of the class LinearCode...


New commits:

d49390emerged version 9.1.beta1
80ff011Add function hash
dbaaaa1Merge branch 'develop' into t/28350/coding/no_metric

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 30, 2020

Changed commit from dbaaaa1 to db3b18a

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 30, 2020

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

db3b18aError commit on linear_code_no_metric in precedent commit

@dimpase
Copy link
Member

dimpase commented Jan 30, 2020

comment:21

Replying to @xcaruso:

I'm not really satisfied with the names of the classes.

I'd propose that we complete this ticket and #28209 (which depends on this ticket) with as few chnages as posssible,
and then go on with renaming/redesigning.

@dimpase
Copy link
Member

dimpase commented Jan 30, 2020

comment:22

tests pass now. Is it ready for review?

@dimpase
Copy link
Member

dimpase commented Jan 30, 2020

Changed author from Marketa Slukova to Marketa Slukova, Durand Amaury

@dimpase
Copy link
Member

dimpase commented Jan 30, 2020

Changed author from Marketa Slukova, Durand Amaury to Marketa Slukova, Amaury Durand

@dimpase
Copy link
Member

dimpase commented Feb 13, 2020

comment:24

Ping?

@johanrosenkilde
Copy link
Contributor

comment:25

Dima, is there a specific reason you refrain from reviewing yourself? I'm completely swamped right now, so there's no chance I'll do it any time soon, but I remember being fairly happy about the design during GSoC.

@xcaruso: Concerning your proposed naming, I guess your names are better from a completely general point of view. The current naming is for "historic reasons" centering on classical "linear codes over Hamming metric" being what everyone would expect. So in some sense the names follow the principal of least surprise by specifically pointing out in the name when it differs from the "expected". But I think I could easily be talked into going with your hierarchy.

The purpose of LinearCode btw is to act as a thin wrapper around AbstractLinearCode for constructing "unstructured" codes directly from a generator matrix. That's an essential class for users. The distinction from AbstractLinearCode was created as part of the encoder-framework (long story), but is a typical way to construct a class hierarchy in more strongly typed languages: if I could do so in Python, I would specify on a type level that AbstractLinearCode is not supposed to be instantiated directly.

@dimpase
Copy link
Member

dimpase commented Feb 27, 2020

comment:26

I was not reviewing as the ticket is set to needs work. So I've set it to needs review and to positive review now.

@dimpase
Copy link
Member

dimpase commented Feb 27, 2020

Reviewer: Dima Pasechnik

@vbraun
Copy link
Member

vbraun commented Feb 27, 2020

comment:27

Merge conflit

@dimpase
Copy link
Member

dimpase commented Mar 3, 2020

comment:28

rebased


New commits:

244f4afClass linear_code_no_metric. Moved stuff from linear_code.
c716526Added no metric to coding documentation index. Moved zero method from AbstractLinearCode. Changed base_field check.
0b5baa0Add function hash
158d73fError commit on linear_code_no_metric in precedent commit

@dimpase
Copy link
Member

dimpase commented Mar 3, 2020

Changed commit from db3b18a to 158d73f

@dimpase
Copy link
Member

dimpase commented Mar 3, 2020

Changed dependencies from #28073 to none

@dimpase
Copy link
Member

dimpase commented Mar 3, 2020

Changed branch from u/gh-Adurand8/coding/no_metric to u/dimpase/coding/no_metric

@vbraun
Copy link
Member

vbraun commented Mar 5, 2020

Changed branch from u/dimpase/coding/no_metric to 158d73f

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

6 participants