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

A coding/two_weight_db module #19463

Closed
nathanncohen mannequin opened this issue Oct 23, 2015 · 60 comments
Closed

A coding/two_weight_db module #19463

nathanncohen mannequin opened this issue Oct 23, 2015 · 60 comments

Comments

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Oct 23, 2015

This ticket creates a new coding/two_weight_db module.

In it are stored all codes that were stored in graphs/strongly_regular_db.pyx. I expect that this file will change heavily, if we end up enriching our list of two weight codes for their own sake.

A first commit moves out of the strongly_regular_graph function the code that builds the database of small strongly regular graphs. Which turned out to be a good idea later, as building this list actually takes some time in order to guess the parameters of the SRG from the 2-weight code.

Nathann

Depends on #19624

CC: @johanrosenkilde @sagetrac-dlucas @dimpase

Component: coding theory

Author: Nathann Cohen

Branch: a865eb3

Reviewer: Dima Pasechnik

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

@nathanncohen nathanncohen mannequin added this to the sage-6.10 milestone Oct 23, 2015
@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Oct 23, 2015

Commit: 9d9894a

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Oct 23, 2015

comment:1

What the hell. I made a mistake and was dead sure I had deleted that branch that took me hours. Praise the Lord for 'git reflog' [1] O_o

Nathann

[1] http://stackoverflow.com/questions/3640764/can-i-recover-branch-after-its-deletion-in-git


New commits:

6e37891trac #19463: A function to build the db of small srgs
9d9894atrac #19463: A coding/two_weight_db module

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Oct 23, 2015

Branch: u/ncohen/19463

@nathanncohen nathanncohen mannequin added the s: needs review label Oct 23, 2015
@dimpase
Copy link
Member

dimpase commented Oct 24, 2015

comment:2

in [BJ03], you get name wrong; it is
Iliya Bouyukliev, Juriaan Simonis, i.e. the 1st names are Iliya and Juriaan.
(Juriaan is not so uncommon given Dutch name, Simonis is a relatively rare !Dutch/Flemish surname).

@dimpase
Copy link
Member

dimpase commented Oct 24, 2015

comment:3

The code should be capable of telling whether an SRG with such and such parameters can be constructed merely from knowledge of parameters of two-weight codes available in the DB. Currently this is not implemented, partly due to an error in the formulas on http://moodle.tec.hkr.se/~chen/research/2-weight-codes/index.htm

@videlec
Copy link
Contributor

videlec commented Oct 25, 2015

comment:4

Isn't there a simpler way of getting the set of weights than

_,w1,w2 = sorted(set([x.hamming_weight() for x in LinearCode(M)]))

You are going through the whole set of vectors! But I admit that the module is not imported on sage startup.

One possibility: hard code the values + add a (long) doctest that checks that these values are indeed correct?

@videlec
Copy link
Contributor

videlec commented Oct 25, 2015

comment:5

... and note that there is WeightDistribution in the guava GAP package (very efficiently written in C).

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 25, 2015

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

6c8ea20trac #19463: Review

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 25, 2015

Changed commit from 9d9894a to 6c8ea20

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Oct 25, 2015

comment:7

in [BJ03], you get name wrong

Fixed.

Isn't there a simpler way of getting the set of weights than

I now call LinearCode.weight_distribution.

One possibility: hard code the values + add a (long) doctest that checks that these values are indeed correct?

That was done in an early version of this patch. I removed it to not see data repeated. I guess that it cannot hurt... All this code may eventually be wiped out however, if we start adding generic code constructions instead of fixed-size examples. That will probably change all the design, but well. We'll see.

Nathann

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 25, 2015

Changed commit from 6c8ea20 to 73930f2

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 25, 2015

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

73930f2trac #19463: Hardcode more data

@johanrosenkilde
Copy link
Contributor

comment:9

Replying to @videlec:

Isn't there a simpler way of getting the set of weights than

_,w1,w2 = sorted(set([x.hamming_weight() for x in LinearCode(M)]))

You are going through the whole set of vectors! But I admit that the module is not imported on sage startup.

One possibility: hard code the values + add a (long) doctest that checks that these values are indeed correct?

I was thinking that it would be nice to refactor the DB by creating a class TwoWeightCode; a two-weight code has, after all, rather special properties and certain properties could be computed much faster for it.

I would give this class a flag at construction time verify = True. When this is true, it computes the weight distribution and verifies the code is two-weight. When it is false, the code is assumed two-weight: the two weights could either be given to the constructor, or they could be inferred very easily by running through the code until two distinct weights had been encountered. This can be expected to happen very quickly. A long test could then run a verify_is_two_weight in the codes or something.

Johan

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Oct 25, 2015

comment:10

I was thinking that it would be nice to refactor the DB by creating a class TwoWeightCode; a two-weight code has, after all, rather special properties and certain properties could be computed much faster for it.

I have no objection to that if you plan to do it yourself.

Nathann

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Oct 25, 2015

comment:11

To be more precise: this is a trac ticket. What is going here is a review, and I read anything that is written here as a comment about my code. When somebody says here that "it would be cool if your code did this/that" I read it as a comment from a reviewer. Could you make it clear whether you were asking me to implement it, or is it a random idea you were throwing here?

Nathann

@johanrosenkilde
Copy link
Contributor

comment:12

I wrote it as a "random idea". I am somewhat motivated to do it myself, but realistically, I might well not find time to do it. I have no objections to your code if no one else wants to implement my suggestion.

It was also a comment to Vincent's suggestion. Something like: what he suggests opens up a few questions IMHO, and to properly cater all that, one needs a more invasive restructuring of your code. In that sense it was a defence of your code as it's currently written.

Johan

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Oct 25, 2015

comment:13

It was also a comment to Vincent's suggestion. Something like: what he suggests opens up a few questions IMHO, and to properly cater all that, one needs a more invasive restructuring of your code. In that sense it was a defence of your code as it's currently written.

I expect all this code to be totally wiped out and rewritten in the future.

As you saw in the emails I sent about 2-weight codes the plan is to make it the 'new database' for those objects, and from what Eric Chen was saying it seems that all these codes belong to known families that we will be able to generate easily later.

I do not know what this code will look like, if it will totally replace what we have or only replace it partially, and how soon this will be implemented.

What I did here is extract the codes from the strongly regular graph module, in what will eventually become an independent database. Which, for the moment, is nothing but a dictionary with a bit of doc.

Nathann

@johanrosenkilde
Copy link
Contributor

comment:14

As you saw in the emails I sent about 2-weight codes the plan is to make it the 'new database' for those objects, and from what Eric Chen was saying it seems that all these codes belong to known families that we will be able to generate easily later.

My suggestion would make even more sense in this case, almost no matter how the future code will be written. Encapsulating the two-weight code properties and algorithms in a class is much more tidy and more easily supports computing things on demand.

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Oct 25, 2015

comment:15

My suggestion would make even more sense in this case, almost no matter how the future code will be written. Encapsulating the two-weight code properties and algorithms in a class is much more tidy and more easily supports computing things on demand.

Which properties and algorithms are you talking about?

Nathann

@dimpase
Copy link
Member

dimpase commented Oct 25, 2015

comment:16

Replying to @nathanncohen:

My suggestion would make even more sense in this case, almost no matter how the future code will be written. Encapsulating the two-weight code properties and algorithms in a class is much more tidy and more easily supports computing things on demand.

Which properties and algorithms are you talking about?

see the examples in http://pages.uoregon.edu/kantor/PAPERS/2-WeightCodes.pdf
Most of them are infinite series. It's 30 years old paper, one should check if there is a newer survey...

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Oct 25, 2015

comment:17

I just love conversing with you guys. I ask one person what properties/algorithms he would expect to see in a TwoWeightCode class and I am answered with a survey on those codes.

If you have any question about the code under review here, I will be glad to help.

Nathann

@dimpase
Copy link
Member

dimpase commented Oct 25, 2015

comment:18

Replying to @nathanncohen:

I just love conversing with you guys. I ask one person what properties/algorithms he would expect to see in a TwoWeightCode class and I am answered with a survey on those codes.

well, I meant algorithms to build all these...
One further bunch of algorithms would be constructing these complementary and projective duals...

Disclaimer: I am not a coding theorist and I know almost nothing about all these marvellous practical things about decoding/encoding, etc...

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Oct 25, 2015

comment:19

well, I meant algorithms to build all these...

Oh. Well, that was not the topic. As you can read, we were discussing the usefulness of a specific class for two weight codes. While I hold nothing against it, I wondered why Johan thought that it would be useful: I personally just need the codes to build strongly regular graphs. I don't know which properties/methods we would attach to them if we had such a class.

Nathann

@dimpase
Copy link
Member

dimpase commented Oct 25, 2015

comment:20

Probably it makes sense to make a sub-class for projective codes, for a q-ary [n,k]-projective code naturally corresponds to a set in PG(k-1, q), to which one can do things not possible with general codes. But 2-distance? Well, I don't know.

@johanrosenkilde
Copy link
Contributor

comment:21

Replying to @nathanncohen:

well, I meant algorithms to build all these...

While I hold nothing against it, I wondered why Johan thought that it would be useful: I personally just need the codes to build strongly regular graphs. I don't know which properties/methods we would attach to them if we had such a class.

A class is just a dictionary with code attached to it :-) Two-weight codes are special codes that allow certain properties to be calculated much faster than the general exponential bounds. Such as, obviously, minimum distance and which hamming weights are in the code, but there's surely more. Since such codes are apparently interesting in graph theory and combinatorics, it seems likely that someone might want to play around with them as codes, before you build graphs. "playing around" would then be computing stuff on them. Making them a class would give a natural place to put this code. By just making them LinearCodes, we miss out on the opportunity of putting these fast algorithms in a natural place. I'm not really talking about encoding/decoding, since I don't know that anyone should be interested in that.

One concrete example in your use where a class might be useful is in lazy computation of the two weights, using the faster, probabilistic algorithm.

The constructions of families that Dima talks about could be either functions that instantiate TwoWeightCode or subclasses, depending on whether the first would be overkill or not.

I concede that it might look like over-engineering from your point of view, however. From my point of view, this is a very special class of codes that is seemingly useful and (now) used in Sage. Therefore its natural that it should have a class :-)

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 26, 2015

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

6c39665trac #19463: pay ye import duty

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 26, 2015

Changed commit from a3220e2 to 6c39665

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Nov 26, 2015

comment:34

Fixed. Thanks,

Nathann

@dimpase
Copy link
Member

dimpase commented Nov 26, 2015

comment:35

Replying to @nathanncohen:

......................................

NEVER use one of Dima's branches.

I told you - take the last commit :-)

@dimpase
Copy link
Member

dimpase commented Nov 26, 2015

comment:36

I don't quite understand the new design, but it seems to work.

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Nov 26, 2015

Reviewer: Dima Pasechnik

@vbraun
Copy link
Member

vbraun commented Nov 27, 2015

comment:38

Merge conflict

@dimpase
Copy link
Member

dimpase commented Nov 27, 2015

Changed branch from u/ncohen/19463 to public/19463

@dimpase
Copy link
Member

dimpase commented Nov 27, 2015

Changed commit from 6c39665 to d161122

@dimpase
Copy link
Member

dimpase commented Nov 27, 2015

comment:40

the merge conflict was in the .rst file, trivial to resolve. I hope I didn't screw up the branch I propose...

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Nov 28, 2015

Changed branch from public/19463 to u/ncohen/19463

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Nov 28, 2015

Changed commit from d161122 to 6c39665

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 28, 2015

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

a865eb3trac #19463: Merged with 6.10.beta6

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 28, 2015

Changed commit from 6c39665 to a865eb3

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Nov 28, 2015

comment:43

This new commit only merges it with beta6, and not with anything else.

@vbraun
Copy link
Member

vbraun commented Nov 29, 2015

Changed branch from u/ncohen/19463 to a865eb3

@dimpase
Copy link
Member

dimpase commented Nov 29, 2015

Changed commit from a865eb3 to none

@dimpase
Copy link
Member

dimpase commented Nov 29, 2015

comment:45

There is still a two-weight code left in graphs/strongly_regular_graphs_db, namely, in
SRG_729_336_153_156 there is matrix L, which gives

sage: [w for w,f in enumerate(LinearCode(L.T).weight_distribution()) if w and f]
[108, 117]
sage: LinearCode(L.T)
Linear code of length 168, dimension 6 over Finite Field of size 3

@dimpase
Copy link
Member

dimpase commented Nov 29, 2015

comment:46

I didn't know that commenting on closed tickets looks like it nukes commits. I think it's actually just a wrong message, as I can still see this commit just fine.

@dimpase dimpase mentioned this issue Dec 6, 2015
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

4 participants