switch to libgap in sage/coding
Closed this issue · 33 comments
after #34737 there are still uses of pexpect GAP left there.
We remove them on this ticket.
Part of #26902
Depends on #34770
CC: @kwankyu @fchapoton @wdjoyner @mkoeppe
Component: coding theory
Author: Dima Pasechnik
Branch/Commit: b1257bf
Reviewer: Vincent Delecroix, Matthias Koeppe
Issue created by migration from https://trac.sagemath.org/ticket/34771
Trying to use #34770 to avoid explict calls to gfq_gap_to_sage from sage.interfaces.gap.
Branch: u/dimpase/coding/use_libgap
Author: Dima Pasechnik
Branch pushed to git repo; I updated commit sha1. New commits:
b082066 | use libgap in coding/binary_code |
Branch pushed to git repo; I updated commit sha1. New commits:
ec1c72e | fixed off by 1 error: switching to Python's indexing from GAP's |
2 doctest errors in coding/ with these changes:
File "src/sage/coding/code_constructions.py", line 732, in sage.coding.code_constructions.ToricCode
Failed example:
C.minimum_distance()
Expected:
24
Got:
30
**********************************************************************
File "src/sage/coding/code_constructions.py", line 740, in sage.coding.code_constructions.ToricCode
Failed example:
C.minimum_distance()
Expected:
6
Got:
10
note that doctests using Guava for these codes added in ec1c72e output correct minimal distances.
Description changed:
---
+++
@@ -1,4 +1,5 @@
after #34737 there are still uses of pexpect GAP left there.
+We remove them on this ticket.
Part of #26902Branch pushed to git repo; I updated commit sha1. New commits:
249acaa | do not overwrite all-0 vector v0 |
Branch pushed to git repo; I updated commit sha1. New commits:
d60bf32 | use libgap in doctest |
With #34391, few doctests related to Guava will need to be adjusted, as Guava is less chatty in GAP 4.12.1.
Branch pushed to git repo; I updated commit sha1. New commits:
274dc61 | easier way to get Guava's bindir |
This is doing way too much conversions
H = libgap(aut_m).Intersection2(aut_B_aug)
rt_transversal = aut_B_aug.RightTransversal(H).List().sage()
rt_transversal = [PermutationGroupElement(g) for g in rt_transversal if str(g) != '()']
rt_transversal = [[a-1 for a in g.domain()] for g in rt_transversal]
rt_transversal = [g + list(xrange(len(g), n))
It would be nicer as
H = libgap(aut_m).Intersection2(aut_B_aug)
rt_transversal = aut_B_aug.RightTransversal(H)
rt_transversal = [[int(a) - 1 for a in g.ListPerm(n)] for g in rt_transversal if not g.IsOne()]
At the time guava is loaded, one should check for its availability. The standard way is
sage: from sage.features.gap import GapPackage
sage: pkg = GapPackage("guava")
sage: pkg.require()
Traceback (most recent call last):
...
FeatureNotPresentError: gap_package_guava is not available.
`TestPackageAvailability("guava")` evaluated to `fail` in GAP.
Reviewer: Vincent Delecroix
Replying to Vincent Delecroix:
This is doing way too much conversions
H = libgap(aut_m).Intersection2(aut_B_aug) rt_transversal = aut_B_aug.RightTransversal(H).List().sage() rt_transversal = [PermutationGroupElement(g) for g in rt_transversal if str(g) != '()'] rt_transversal = [[a-1 for a in g.domain()] for g in rt_transversal] rt_transversal = [g + list(xrange(len(g), n))It would be nicer as
H = libgap(aut_m).Intersection2(aut_B_aug) rt_transversal = aut_B_aug.RightTransversal(H) rt_transversal = [[int(a) - 1 for a in g.ListPerm(n)] for g in rt_transversal if not g.IsOne()]
Sure, thanks, I agree. My goal was to get it to work with libgap rather than pexpect gap, I mostly went with tweaking pre-existing code line by line.
Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:
1c4a69f | use GapElement from an abstract superclass |
6e5ea79 | move import of libgap into a function |
ee9a3d4 | use only libgap in coding/linear_code |
1f67fa2 | use libgap in coding/binary_code |
7528cfb | fixed off by 1 error: switching to Python's indexing from GAP's |
2bdf591 | do not overwrite all-0 vector v0 |
4167b6d | use libgap in doctest |
5e463c8 | easier way to get Guava's bindir |
781677f | add missing string conversion |
8b0526e | code simplification, checking for Guava availability |
ping?
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
730cd62 | use only libgap in coding/linear_code |
5232c56 | use libgap in coding/binary_code |
930eea6 | fixed off by 1 error: switching to Python's indexing from GAP's |
6576c4c | do not overwrite all-0 vector v0 |
df9628c | use libgap in doctest |
318b431 | easier way to get Guava's bindir |
6513816 | add missing string conversion |
b1257bf | code simplification, checking for Guava availability |
please review
Changed reviewer from Vincent Delecroix to Vincent Delecroix, Matthias Koeppe
LGTM
Changed branch from u/dimpase/coding/use_libgap to b1257bf