Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Use the zero of the code to initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitdm committed Apr 19, 2016
1 parent 9fcf54d commit febfd7f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/sage/coding/linear_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -4518,13 +4518,10 @@ def decode_to_code(self, r):
"""
c_min = self.code().zero()
h_min = r.hamming_weight()
try:
for c in self.code():
if (c-r).hamming_weight() < h_min:
h_min = (c-r).hamming_weight()
c_min = c
except StopIteration:
pass
for c in self.code():
if (c-r).hamming_weight() < h_min:
h_min = (c-r).hamming_weight()
c_min = c
c_min.set_immutable()
return c_min

Expand Down

0 comments on commit febfd7f

Please sign in to comment.