Sage: Ticket #8909: Coercion from Gap to cyclotomic fields; usage of GAP to improve computation of invariant rings
https://trac.sagemath.org/ticket/8909
<p>
When coercing from GAP to a cyclotomic field, it was assumed that the generator of a cyclotomic field is <em>always</em> called <code></code>E(n)<code></code>. But this is not necessarily the case, in particular when the object in GAP was created from Sage.
</p>
<p>
Moreover, GAP prints an additional exclamation mark in front of numbers if they are part of a matrix defined over a cyclotomic field.
</p>
<p>
For these two reasons, the following example used to fail, but now works with the patch:
</p>
<pre class="wiki"> sage: F=CyclotomicField(8)
sage: z=F.gen()
sage: a=gap(z+1/z); a
-zeta8^3+zeta8
sage: F(a)
-zeta8^3 + zeta8
sage: b=gap(Matrix(F,[[z^2,1],[0,a+1]])); b
[ [ zeta8^2, !1 ], [ !0, -zeta8^3+zeta8+1 ] ]
sage: b[1,2]
!1
sage: F(b[1,2])
1
sage: Matrix(b,F)
[ zeta8^2 1]
[ 0 -zeta8^3 + zeta8 + 1]
</pre><p>
The idea was
</p>
<ul><li>to remove the exclamation mark when it is attempted to coerce into the rationals
</li><li>to test whether the generator name in GAP happens to coincide with the generator name in Sage (here: <code></code>zeta8<code></code>).
</li></ul><p>
The motivation for working on it is my attempt to improve the computation of non-modular invariant rings of finite groups: There is a doc test using a finite matrix group over a cyclotomic field.
</p>
<p>
One massive bottle neck for the computation of invariant rings with Singular is the computation of the Reynolds operator. It requires to enumerate the group elements, and Singular is not good at this task.
</p>
<p>
The patch uses GAP to enumerate the group elements and uses this to construct the Reynolds operator in Singular. For complicated groups, this should save a massive amount of resources.
</p>
<p>
With the patch, the enumeration of group elements in Singular has the status of a backup: If the transformation of the matrix group into GAP fails or if the transformation of the resulting GAP matrices back into Sage fails, then the old algorithm is used.
</p>
<p>
I think this ticket is about "interfaces". I hope this labelling is correct.
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/8909
Trac 1.1.6SimonKingFri, 07 May 2010 11:00:50 GMTattachment set
https://trac.sagemath.org/ticket/8909
https://trac.sagemath.org/ticket/8909
<ul>
<li><strong>attachment</strong>
set to <em>8909_gap2cyclotomic.patch</em>
</li>
</ul>
<p>
Improve coercion from GAP into cyclotomic fields; use GAP to compute Reynolds operators for Singular
</p>
TicketSimonKingSat, 08 May 2010 12:16:57 GMTstatus changed
https://trac.sagemath.org/ticket/8909#comment:1
https://trac.sagemath.org/ticket/8909#comment:1
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
</ul>
<p>
Sorry, I forgot to label it "needs review"
</p>
TicketdavidloefflerSat, 03 Jul 2010 08:15:45 GMT
https://trac.sagemath.org/ticket/8909#comment:2
https://trac.sagemath.org/ticket/8909#comment:2
<p>
When this is merged we can probably close <a class="closed ticket" href="https://trac.sagemath.org/ticket/5618" title="defect: Cyclotomic field elements are not converted to Gap correctly (closed: fixed)">#5618</a> too.
</p>
TicketdavidloefflerSat, 03 Jul 2010 10:28:16 GMTstatus changed
https://trac.sagemath.org/ticket/8909#comment:3
https://trac.sagemath.org/ticket/8909#comment:3
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
</ul>
<p>
Patch applies fine to 4.5.alpha1, code looks plausible, and all doctests pass. Contrary to my earlier hope, however, it does not fix <a class="closed ticket" href="https://trac.sagemath.org/ticket/5618" title="defect: Cyclotomic field elements are not converted to Gap correctly (closed: fixed)">#5618</a> which seems to be a separate problem.
</p>
TicketmhansenSun, 04 Jul 2010 18:39:43 GMTstatus changed; reviewer set
https://trac.sagemath.org/ticket/8909#comment:4
https://trac.sagemath.org/ticket/8909#comment:4
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>needs_work</em>
</li>
<li><strong>reviewer</strong>
set to <em>David Loeffler, Mike Hansen</em>
</li>
</ul>
<p>
There's a bare except clause at 6767 which should be fixed.
</p>
TicketSimonKingSun, 04 Jul 2010 19:00:06 GMT
https://trac.sagemath.org/ticket/8909#comment:5
https://trac.sagemath.org/ticket/8909#comment:5
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/8909#comment:4" title="Comment 4">mhansen</a>:
</p>
<blockquote class="citation">
<p>
There's a bare except clause at 6767 which should be fixed.
</p>
</blockquote>
<p>
By 'bare', you mean that it is not specified what error is raised? So, <code>except TypeError:</code> instead of <code>except:</code>? Well this would be easy enough to fix.
</p>
TicketSimonKingSun, 04 Jul 2010 19:10:44 GMTattachment set
https://trac.sagemath.org/ticket/8909
https://trac.sagemath.org/ticket/8909
<ul>
<li><strong>attachment</strong>
set to <em>trac_8909_catch_exception.patch</em>
</li>
</ul>
<p>
Specify an exception to be caught
</p>
TicketSimonKingSun, 04 Jul 2010 19:12:30 GMTstatus changed
https://trac.sagemath.org/ticket/8909#comment:6
https://trac.sagemath.org/ticket/8909#comment:6
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
</ul>
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/8909#comment:5" title="Comment 5">SimonKing</a>:
</p>
<blockquote class="citation">
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/8909#comment:4" title="Comment 4">mhansen</a>:
</p>
<blockquote class="citation">
<p>
There's a bare except clause at 6767 which should be fixed.
</p>
</blockquote>
<p>
By 'bare', you mean that it is not specified what error is raised? So, <code>except TypeError:</code> instead of <code>except:</code>? Well this would be easy enough to fix.
</p>
</blockquote>
<p>
Under the assumption that I understood you correctly, I provided a second patch that specifies that we only want to catch a <code>TypeError</code>, and return to needs_review.
</p>
TicketmhansenSun, 04 Jul 2010 19:20:35 GMTstatus changed
https://trac.sagemath.org/ticket/8909#comment:7
https://trac.sagemath.org/ticket/8909#comment:7
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
</ul>
<p>
Yep, looks good to me. If you didn't specify that, the except clause would also catch things like <a class="missing wiki">KeyboardInterrupt?</a> (Ctrl-C) which probably isn't intended.
</p>
<p>
Apply both patches.
</p>
TicketmpatelWed, 21 Jul 2010 03:31:55 GMTstatus changed; resolution, merged set
https://trac.sagemath.org/ticket/8909#comment:8
https://trac.sagemath.org/ticket/8909#comment:8
<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>merged</strong>
set to <em>sage-4.5.2.alpha0</em>
</li>
</ul>
Ticket