Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question
1

Computing minimum_distance of a code on non-prime fields fails ... sometimes.

asked 10 years ago

Koji gravatar image

updated 8 years ago

FrédéricC gravatar image

Consider the following piece of code:

C=codes.RandomLinearCode(4,2,GF(16,'b'))
C.minimum_distance()

About half of the time, it fails with error

TypeError: unable to coerce from a finite field other than the prime subfield

I'd understand if SAGE could only compute the minimum distance for codes over primes fields, what has me confused is the fact that sometimes it can, sometimes it can't. Any clues as to what is going on here?

Preview: (hide)

Comments

Hello,

Which version are you using? On both sage-6.5 and sage-6.6.rc0 I got

sage: C=codes.RandomLinearCode(4,2,GF(16,'b'))
sage: C.minimum_distance()
3
vdelecroix gravatar imagevdelecroix ( 10 years ago )

Yes, it may work for a few times; but if you keep evaluating, after a couple of successful evaluations you'll come up with a TypeError. You can try it this way, which certainly fails:

for i in range(100):
    C=codes.RandomLinearCode(4,2,GF(16,'b'))
    C.minimum_distance()

Thanks though for the interest, @vdelecroix

Koji gravatar imageKoji ( 10 years ago )

@Koji, all right. Got the error as well!

vdelecroix gravatar imagevdelecroix ( 10 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 10 years ago

vdelecroix gravatar image

updated 10 years ago

Hello,

Indeed there is a bug in Sage/GAP code conversion. It works for GF(23) but not GF(24)

sage: K = GF(8,'a')
sage: for x in K:
....:     print x == K(x._gap_()),
True True True True True True True True

sage: K = GF(16,'a')
sage: for x in K:
....:     print x == K(x._gap_()), 
True True True True True
Traceback (most recent call last):
...
TypeError: unable to coerce from a finite field other than the prime subfield

I opened the trac ticket #18048 for that issue.

Vincent

Preview: (hide)
link

Comments

Thanks a lot for both the quick answer and the ticket. Do I get bragging rights (for my students) for uncovering this, @vdelecroix ? ;)

Koji gravatar imageKoji ( 10 years ago )

Hopefully, Peter Bruin came with a solution to fix the bug (you can have a look on the ticket #18048. So it should be fixed in sage-6.6. In the mean time, the only solution I see is to use git to get his modifications on your computer (you do have explanations in the Developer Guide. If you are not familiar with that it might be simpler to just wait for sage-6.6 (should be a matter of weeks).

vdelecroix gravatar imagevdelecroix ( 10 years ago )

You guys rock! I can git my way, if my life depends on it, but since it's not "mission critical", I'll wait for 6.6.

Koji gravatar imageKoji ( 10 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 10 years ago

Seen: 501 times

Last updated: Mar 24 '15