#20201: Improving Efficiency of LinearCode.NearestNeighborDecoder method
-------------------------------------+-------------------------------------
Reporter: arpitdm | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-7.1
Component: coding theory | Resolution:
Keywords: beginner | Merged in:
Authors: Arpit Merchant | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/arpitdm/improving_efficiency_of_linearcode_nearestneighbordecoder_method|
b13f73f6072b5bb52e27e5a0a69cc65e7b265e29
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by dlucas):
Hello,
I finally looked at the code, my remarks follow:
- You're absolutely right, it should be `w_err` and not `word` as input to
`decode_to_code` in the doctest.
- I'm not a huge fan of the check depending on `flag` which will always
fail except on the first time it is performed.
I suggest you use an iterator over the codewords instead: you perform this
initialization step outside the loop and then the loop only contains the
comparison test on hamming weights.
By the way, a linear code always contains the zero word, and, according to
the way Sage sorts the elements of a code, `C[0]` will always be the zero
vector of the ambient space of `C`.
So you can directly set `h_min` to the hamming weight of `r`.
Something like:
{{{
It = iter(C.list())
c_min = It.next()
h_min = r.hamming_weight()
try:
#loop
except StopIteration:
pass
c_min.set_immutable()
return c_min
}}}
Oh, and when you finish your work on a ticket, don't forget to set it to
`needs_review` (under "modify ticket button".
Apart from that, I'm fine with your code!
David
--
Ticket URL: <http://trac.sagemath.org/ticket/20201#comment:6>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.