Skip to content
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

get rid of one sage_eval in modular #38394

Merged
merged 1 commit into from
Aug 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 11 additions & 25 deletions src/sage/modular/buzzard.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,12 @@
#
# https://www.gnu.org/licenses/
#############################################################################
from pathlib import Path

from sage.interfaces.gp import Gp
from sage.misc.sage_eval import sage_eval
from sage.env import SAGE_EXTCODE
from sage.libs.pari import pari

_gp = None


def gp():
r"""
Return a copy of the GP interpreter with the appropriate files loaded.

EXAMPLES::

sage: import sage.modular.buzzard
sage: sage.modular.buzzard.gp()
PARI/GP interpreter
"""
global _gp
if _gp is None:
_gp = Gp(script_subdirectory='buzzard')
_gp.read("DimensionSk.g")
_gp.read("genusn.g")
_gp.read("Tpprog.g")
return _gp
buzzard_dir = Path(SAGE_EXTCODE) / "pari" / "buzzard"

# def buzzard_dimension_cusp_forms(eps, k):
# r"""
Expand Down Expand Up @@ -86,6 +68,7 @@ def buzzard_tpslopes(p, N, kmax):

sage: from sage.modular.buzzard import buzzard_tpslopes
sage: c = buzzard_tpslopes(2,1,50)
...
sage: c[50]
[4, 8, 13]

Expand All @@ -107,7 +90,10 @@ def buzzard_tpslopes(p, N, kmax):

- William Stein (2006-03-17): small Sage wrapper of Buzzard's scripts
"""
v = gp().eval('tpslopes(%s, %s, %s)' % (p, N, kmax))
v = sage_eval(v)
v.insert(0, []) # so v[k] = info about weight k (since python is 0-based)
pari.read(buzzard_dir / "DimensionSk.g")
pari.read(buzzard_dir / "genusn.g")
pari.read(buzzard_dir / "Tpprog.g")
# v = pari.tpslopes(p, N, kmax).sage()
v = pari('tpslopes(%s, %s, %s)' % (p, N, kmax)).sage()
v.insert(0, []) # so that v[k] = info about weight k
return v
Loading