Skip to content

Commit

Permalink
gh-38652: get rid of sage_eval in Mestre call of magma
Browse files Browse the repository at this point in the history
    
avoid one use of `sage_eval` by better communication with `magma`

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.
    
URL: #38652
Reported by: Frédéric Chapoton
Reviewer(s): Kwankyu Lee
  • Loading branch information
Release Manager committed Sep 27, 2024
2 parents 5ebb994 + c90efec commit 3d98d9e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/sage/schemes/hyperelliptic_curves/mestre.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,16 @@ def HyperellipticCurve_from_invariants(i, reduced=True, precision=None,

if algorithm == 'magma':
from sage.interfaces.magma import magma
from sage.misc.sage_eval import sage_eval
if MConic.has_rational_point(algorithm='magma'):
parametrization = [l.replace('$.1', 't').replace('$.2', 'u')
for l in str(magma(MConic).Parametrization()).splitlines()[4:7]]
[F1, F2, F3] = [sage_eval(p, locals={'t': t, 'u': 1, 'a': k.gen()})
for p in parametrization]
parametrization = magma(MConic).Parametrization().DefiningPolynomials().sage()
F1, F2, F3 = (p(t, 1) for p in parametrization)
else:
raise ValueError(f"No such curve exists over {k} as there are no "
f"rational points on {MConic}")
else:
if MConic.has_rational_point():
parametrization = MConic.parametrization(morphism=False)[0]
[F1, F2, F3] = [p(t, 1) for p in parametrization]
F1, F2, F3 = (p(t, 1) for p in parametrization)
else:
raise ValueError(f"No such curve exists over {k} as there are no "
f"rational points on {MConic}")
Expand Down

0 comments on commit 3d98d9e

Please sign in to comment.