File: galrep.py

package info (click to toggle)
sagemath-database-cremona-elliptic-curves 20221013-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 5,252,172 kB
  • sloc: python: 3,515; makefile: 83; sh: 28
file content (28 lines) | stat: -rw-r--r-- 766 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Sage interface to Sutherland's Magma script for Galois images

GALREP_SCRIPT_DIR = "/home/jec/galrep"

def init_galrep(mag, script_dir=GALREP_SCRIPT_DIR):
    """
    Load the 2adic magma script into this magma process
    """
    mag.eval('cwd:=GetCurrentDirectory();')
    mag.eval('ChangeDirectory("{}");'.format(script_dir))
    mag.eval('load "nfgalrep.m";')
    mag.eval('ChangeDirectory(cwd);')

def get_galrep_data(E, mag):
    """
    Use Magma script to compute mod-p Galois image data

    E is an elliptic curve over Q

    mag is a magma process.

    NB before calling this, the caller must have called init_galrep()

    Returns a (possibly empty) list of string representing image codes
    """
    return str(mag.ComputeQGaloisImage(E)).split()