sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.44k stars 481 forks source link

minimum distance of all 0 code raised mysterious error message #6486

Closed wdjoyner closed 14 years ago

wdjoyner commented 15 years ago

This should return a more useful error message:

sage: G = matrix(GF(2),[[0,0,0]])
sage: C = LinearCode(G)
sage: C.list()
[(0, 0, 0)]
sage: C.minimum_distance()
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)

/home/wdj/.sage/temp/tinah/7902/_home_wdj__sage_init_sage_0.py in <module>()

/home/wdj/sagefiles/sage-4.1.rc1/local/lib/python2.6/site-packages/sage/coding/linear_code.pyc in minimum_distance(self, method)
   1681             return ZZ(d)
   1682         Gstr = "%s*Z(%s)^0"%(gapG, q)
-> 1683         return hamming_weight(min_wt_vec_gap(Gstr,n,k,F))
   1684
   1685     def module_composition_factors(self,gp):

/home/wdj/sagefiles/sage-4.1.rc1/local/lib/python2.6/site-packages/sage/coding/linear_code.pyc in min_wt_vec_gap(Gmat, n, k, F, method)
    379         #print [gap.eval("v["+str(i+1)+"]") for i in range(n)]
    380         all.append([v._matrix_(F),m._matrix_(F),int(dist)])
--> 381     ans = all[0]
    382     for x in all:
    383         if x[2]<ans[2] and x[2]>0:

IndexError: list index out of range

Component: coding theory

Author: Sebastian Pancratz

Reviewer: Craig Citro

Merged: sage-4.3.2.alpha0

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

5689d088-9d81-41e2-b555-2341cea5bc21 commented 14 years ago

Attachment: trac6486.patch.gz

Adds some documentation and handles the min distance problem

craigcitro commented 14 years ago

Reviewer: Craig Citro

craigcitro commented 14 years ago

Author: Sebastian Pancratz

craigcitro commented 14 years ago
comment:2

This looks good. Tons of nice cleanup, and it's clearly the right fix for the bug on the ticket.

7c09a680-e216-4024-bb8e-9bfd4aa7f313 commented 14 years ago

Merged: sage-4.3.2.alpha0