Sage: Ticket #18048: Bug in GAP conversion of finite field elements
https://trac.sagemath.org/ticket/18048
<p>
As reported in <a class="ext-link" href="http://ask.sagemath.org/question/26283/computing-minimum_distance-of-a-code-on-non-prime-fields-fails-sometimes"><span class="icon"></span>this question on ask</a> we have a problem with our finite fields and GAP
</p>
<pre class="wiki">sage: K = GF(16,'a')
sage: a = K.gen()
sage: b = a**2 + a
sage: K(b._gap_())
Traceback (most recent call last):
...
TypeError: unable to coerce from a finite field other than the prime subfield
</pre><p>
Strangely, it works with <code>GF(8)</code>.
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/18048
Trac 1.1.6pbruinWed, 25 Mar 2015 18:36:49 GMT
https://trac.sagemath.org/ticket/18048#comment:1
https://trac.sagemath.org/ticket/18048#comment:1
<p>
This is because the function <code>sage.interfaces.gap.gfq_gap_to_sage</code>, which converts a GAP element into an element of a Sage finite field <code>F</code>, constructs an intermediate field which does not necessarily have a canonical embedding into <code>F</code>. I am now testing a patch which avoids the intermediate field.
</p>
TicketpbruinWed, 25 Mar 2015 19:29:35 GMTstatus changed; commit, branch, author set
https://trac.sagemath.org/ticket/18048#comment:2
https://trac.sagemath.org/ticket/18048#comment:2
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
<li><strong>commit</strong>
set to <em>61b6cb93796bc96ac72ce5eab6ecc46772335538</em>
</li>
<li><strong>branch</strong>
set to <em>u/pbruin/18048-gap_finite_field_conversion</em>
</li>
<li><strong>author</strong>
set to <em>Peter Bruin</em>
</li>
</ul>
<p>
Notes:
</p>
<ul><li>Before this patch, it was implicitly assumed that non-prime finite fields are defined by Conway polynomials, because this is how GAP represents finite fields. This is now an explicit requirement.
</li><li>Elements of a GAP prime field <code>Z(p)</code> are now converted into a Sage <code>FiniteField(p)</code>, as opposed to <code>IntegerModRing(p)</code>.
</li></ul>
TicketpbruinWed, 25 Mar 2015 19:30:34 GMT
https://trac.sagemath.org/ticket/18048#comment:3
https://trac.sagemath.org/ticket/18048#comment:3
<p>
In addition to the doctest, I tested the example given in the link in the ticket description 200 times and did not get any errors.
</p>
TicketvdelecroixWed, 25 Mar 2015 22:16:34 GMTpriority, status changed; reviewer set
https://trac.sagemath.org/ticket/18048#comment:4
https://trac.sagemath.org/ticket/18048#comment:4
<ul>
<li><strong>priority</strong>
changed from <em>major</em> to <em>critical</em>
</li>
<li><strong>reviewer</strong>
set to <em>Vincent Delecroix</em>
</li>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
</ul>
<p>
Hello,
</p>
<p>
That's wonderful that you did have a look! I put this to positive review as it fixes an important bug (and might hopefully be in sage-6.6).
</p>
<p>
On a related note, the code uses a lot of string parsing. This is ugly and not very safe. I think that we can get rid of most of it with
</p>
<ul><li><code>Characteristic(z)</code>: the characteristic of the field
</li><li><code>DegreeFFE(z)</code>: degree of the smallest base field containing the element <code>z</code>
</li><li><code>LogFFE(z,base)</code>: logarithm in finite field
</li></ul><p>
I do not like the fact that we need to call <code>LogFFE</code> to have access to the good power of the generator. If you think about a good solution for that I will open an other ticket.
</p>
<p>
Vincent
</p>
TicketvbraunFri, 27 Mar 2015 00:39:56 GMTstatus, branch changed; resolution set
https://trac.sagemath.org/ticket/18048#comment:5
https://trac.sagemath.org/ticket/18048#comment:5
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
<li><strong>branch</strong>
changed from <em>u/pbruin/18048-gap_finite_field_conversion</em> to <em>61b6cb93796bc96ac72ce5eab6ecc46772335538</em>
</li>
</ul>
Ticket