-
-
Notifications
You must be signed in to change notification settings - Fork 648
Issue #40513, #40514: Allow zero code and add intersection method #40564
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
base: develop
Are you sure you want to change the base?
Conversation
Looks like the automated "build documentation (PDF)" check is failing. The error log shows:
It seems the build script is not converting my username to lowercase, which is causing the process to fail. This appears to be an issue with the CI workflow rather than the code in this PR. |
I think the file abstract_code would also reject zero linear code |
The changes for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
And can you test the dual code of zero linear code? @Hapsa21 |
And it is better for all tests. you can add the zero linear code in it |
…sa21/sage into fix-linear-code-intersection
f7c5b97
to
7e86f9e
Compare
I've added the test for the dual of the zero code and pushed the commit. |
Use (on this note, if you got the suggestion to use What's the reason behind the behavioral change? As far as I can see, neither of them use zero code or intersection method? |
@user202729 the changes in To fix the zero code bug, I had to make |
I think we can construct zero linear codes from dual codes. But we can not construct a zero linear code directly. I think we can allow direct construct a zero linear code if there are no conflict with the system. |
Documentation preview for this PR (built with commit 7e86f9e; changes) is ready! 🎉 |
…on, and fix CI
972ab65
to
0cb098b
Compare
some operations like decode and encode are compatible with zero linear code? |
I've added the tests for encode and decode with the zero code. Thanks for the suggestion! |
And just see this. @orlitzky Do you think we need to permit the construction of zero linear code? I think it is ok. Because we can use dual code to construct a zero linear code. But now the sage prevents our construct a zero linear code directly. If there are no conflicts. I think it can be |
src/sage/coding/linear_code.py
Outdated
EXAMPLES: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be EXAMPLES::
with two colons and a blank line after it
src/sage/coding/linear_code.py
Outdated
sage: c in C_int | ||
True | ||
# Test intersection with the zero code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be Test intersection with the zero code::
with a blank line after it. (The :: starts a code block in RST and without it, the doctest runner won't recognize this as a test.)
|
||
def intersection(self, other): | ||
""" | ||
Return the intersection of this linear code with another. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring should be a short summary on the first line, followed by a longer summary in subsequent paragraphs, like...
Return the intersection of this linear code with another.
The intersection of two linear codes C1 and C2 is the set of all...
I made some minor comments about the formatting, but you will need someone who knows what a linear code is to check the results :) |
This pull request resolves two issues by allowing the creation of the zero linear code and adding a method to compute the intersection of two codes.
__init__
method forLinearCode
is updated to correctly handle zero matrices and zero-dimensional vector space inputs, creating a valid[n, 0]
code instead of raising an error.intersection()
method is added toLinearCode
, implemented using the identityC1 ∩ C2 = (C1_dual + C2_dual)_dual
.All relevant doctests have been added or updated to reflect these changes.
Checklist
Dependencies
None.