-
-
Notifications
You must be signed in to change notification settings - Fork 554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
more libgap in permutation groups ; get rid of _libgap_init_ #36889
Conversation
src/sage/groups/class_function.py
Outdated
@@ -123,20 +125,20 @@ def __init__(self, G, values): | |||
if isinstance(values, GapElement) and gap.IsClassFunction(values): | |||
self._gap_classfunction = values | |||
else: | |||
self._gap_classfunction = gap.ClassFunction(G, list(values)) | |||
self._gap_classfunction = gap.ClassFunction(G, gap(values)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the point of calling gap()
here? This is a call to pexpect GAP, what were getting rid of, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, this is inside Classfunction_gap
. I have made so that Classfunction
now calls ClassFunction_libgap
by default, unless the second argument is a GapPexpect element.
Of course, it would be better to get rid completely of Classfunction_gap
but maybe in another ticket ?
Do you have any idea about the failing doctests in class_function.py ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have any idea about the failing doctests in class_function.py ?
it comes from the fact that GAP operates on characters associated to a character table,
not to a group, and is unable to identify these tables for
Not clear how to fix this easily.
sage: chi1 = ClassFunction(G, [3, 1, -1, 0, -1])
sage: isinstance(chi1, ClassFunction_libgap)
True
sage: chi2 = ClassFunction(G, [1, -1, 1, 1, -1])
sage: isinstance(chi2, ClassFunction_libgap)
True
sage: chi1._gap_classfunction
ClassFunction( CharacterTable( Sym( [ 1 .. 4 ] ) ), [ 3, 1, -1, 0, -1 ] )
sage: chi2._gap_classfunction
ClassFunction( CharacterTable( Sym( [ 1 .. 4 ] ) ), [ 1, -1, 1, 1, -1 ] )
sage: chi1._gap_classfunction*chi2._gap_classfunction
---------------------------------------------------------------------------
GAPError Traceback (most recent call last)
Cell In[11], line 1
----> 1 chi1._gap_classfunction*chi2._gap_classfunction
File /mnt/opt/Sage/sage-clang/src/sage/structure/element.pyx:1513, in sage.structure.element.Element.__mul__()
1511 cdef int cl = classify_elements(left, right)
1512 if HAVE_SAME_PARENT(cl):
-> 1513 return (<Element>left)._mul_(right)
1514 if BOTH_ARE_ELEMENT(cl):
1515 return coercion_model.bin_op(left, right, mul)
File /mnt/opt/Sage/sage-clang/src/sage/libs/gap/element.pyx:1056, in sage.libs.gap.element.GapElement._mul_()
1054 try:
1055 sig_GAP_Enter()
-> 1056 sig_on()
1057 result = GAP_PROD(self.value, (<GapElement>right).value)
1058 sig_off()
GAPError: Error, no product of class functions of different tables
there also seems to be a disconnect between Sage's conjugacy classes of |
1170be0
to
fa84162
Compare
the failure can be traced to the fact that the underlying character tables are not identical:
although they share the same group but not quite :
see https://github.com/gap-system/gap/blob/master/lib/ctblfuns.gi |
and one can find that
|
this is very strange. I would expect the 1st call to |
the good old expect interface behaves better :
|
I don't know --- a/src/sage/groups/perm_gps/permgroup.py
+++ b/src/sage/groups/perm_gps/permgroup.py
@@ -684,7 +684,8 @@ class PermutationGroup_generic(FiniteGroup):
"""
if self._libgap is not None:
return self._libgap
- return super()._libgap_()
+ self._libgap = super()._libgap_()
+ return self._libgap
# Override the default _libgap_ to use the caching as self._libgap
_libgap_ = gap This fixes this weird |
now all tests in class_function.py pass. Some noise in doctests of permutation_group.py (same groups, different sets of generators, will fix them now) |
OK, I'm not 100% sure about the fix
originally one had the sequence of subgroups It seems it's a bug, which now manifests itself differently. Something funny is going on, but I don't think it's due to my change. EDIT |
still one broken doctest in |
The issue in fusion rings may be caused by the fact that the trivial character no longer comes first in the list :
but I am not sure. |
there is indeed a difference of behaviour :
|
I can try to look at it tonight. |
I tried modifying |
However, doing such a change in SageMath is bound to cause a discrepancy, as we really don't want |
The method |
I don’t think there is anything else besides the |
OK, thanks. |
here is a tentative |
as a side job, can we unify |
This fixes weird sage: S = SymmetricGroup(4) sage: g1 = S._libgap_() sage: g2 = S._libgap_() sage: g1.IsIdenticalObj(g2) false (one gets true now)
f1797e5
to
fc2d24d
Compare
Let us do the following change: --- a/src/sage/structure/sage_object.pyx
+++ b/src/sage/structure/sage_object.pyx
@@ -755,7 +755,7 @@ cdef class SageObject:
def _libgap_(self):
from sage.libs.gap.libgap import libgap
- return libgap.eval(self._gap_init_())
+ return libgap.eval(self)
def _gp_(self, G=None):
if G is None: Your |
Documentation preview for this PR (built with commit b20ef4f; changes) is ready! 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
sagemathgh-36889: more libgap in permutation groups ; get rid of _libgap_init_ Moving forward from gap pexpect interface to libgap interface : - using more libgap in the permutation groups code - get rid of the barely used `_libgap_init_` method in favor of the unique `_gap_init_` method. ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have created tests covering the changes. URL: sagemath#36889 Reported by: Frédéric Chapoton Reviewer(s): Dima Pasechnik, Frédéric Chapoton
sagemathgh-36889: more libgap in permutation groups ; get rid of _libgap_init_ Moving forward from gap pexpect interface to libgap interface : - using more libgap in the permutation groups code - get rid of the barely used `_libgap_init_` method in favor of the unique `_gap_init_` method. ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have created tests covering the changes. URL: sagemath#36889 Reported by: Frédéric Chapoton Reviewer(s): Dima Pasechnik, Frédéric Chapoton
Moving forward from gap pexpect interface to libgap interface :
using more libgap in the permutation groups code
get rid of the barely used
_libgap_init_
method in favor of the unique_gap_init_
method.📝 Checklist