Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
AndrewVSutherland
GitHub Repository: AndrewVSutherland/lmfdb
Path: blob/main/scripts/lfunctions/populate_trace_hash_ECQG2Q.py
1128 views
1
2
import sys, os
3
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)),"../.."))
4
from lmfdb.db_backend import db
5
6
def upsert_hash(id_number, skip = False):
7
row = db.lfunc_lfunctions.lucky({'id':id_number}, projection = ['id', 'Lhash','trace_hash','origin'])
8
if skip and 'trace_hash' in row:
9
return
10
trace_hash = int(row['Lhash'])
11
assert trace_hash < 2**61
12
if 'origin' not in row:
13
print(row)
14
sys.exit(1)
15
assert "Genus2Curve/Q/" in row['origin'] or "EllipticCurve/Q/" in row['origin'], "%s" % row
16
print(row['origin'], trace_hash)
17
db.lfunc_lfunctions.upsert({'id': row['id']}, {'trace_hash':trace_hash})
18
19
import sys
20
if len(sys.argv) == 3:
21
mod = int(sys.argv[1])
22
c = int(sys.argv[2])
23
for key in ['G2Q','Cremona']:
24
for i in db.lfunc_lfunctions.search({'load_key':key}, projection='id'):
25
if (i % mod) == c:
26
upsert_hash(i)
27
else:
28
print(r"""Usage:
29
You should run this on legendre as: (this will use 40 cores):
30
# parallel -u -j 40 --halt 2 --progress sage -python %s 40 ::: {0..39}""" % sys.argv[0])
31
32
33
34