|
12 | 12 | from sage.calculus.var import var
|
13 | 13 | from sage.functions.generalized import sgn
|
14 | 14 | from sage.functions.transcendental import Function_zeta
|
15 |
| -from sage.groups.finitely_presented import wrap_FpGroup |
16 | 15 | from sage.interfaces.gp import gp
|
17 | 16 | from sage.libs.pari.all import PariError, pari
|
18 | 17 | from sage.matrix.all import Matrix, matrix
|
@@ -2170,11 +2169,18 @@ def simplification_isomorphism(G, return_inverse=False):
|
2170 | 2169 |
|
2171 | 2170 | Uses GAP.
|
2172 | 2171 | """
|
| 2172 | + |
2173 | 2173 | I = G.gap().IsomorphismSimplifiedFpGroup()
|
2174 | 2174 | domain = G
|
2175 |
| - codomain = wrap_FpGroup(I.Range()) |
2176 |
| - phi = lambda x: codomain(I.ImageElm(x.gap())) |
2177 |
| - ans = G.hom(phi, codomain) |
| 2175 | + try: # Sagemath >= 10.5 |
| 2176 | + codomain = I.Range().sage() |
| 2177 | + phi = lambda x: codomain(I.ImageElm(x)) |
| 2178 | + ans = G.hom(im_gens=[phi(x) for x in G.gap().GeneratorsOfGroup], codomain=codomain, check=False) |
| 2179 | + except NotImplementedError: # Sagemath < 10.5 |
| 2180 | + from sage.groups.finitely_presented import wrap_FpGroup |
| 2181 | + codomain = wrap_FpGroup(I.Range()) |
| 2182 | + phi = lambda x: codomain(I.ImageElm(x.gap())) |
| 2183 | + ans = G.hom(phi, codomain) |
2178 | 2184 | if return_inverse:
|
2179 | 2185 | Iinv = I.InverseGeneralMapping()
|
2180 | 2186 | phi_inv = lambda x: domain(Iinv.ImageElm(x.gap()))
|
|
0 commit comments