Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
about Stein-Watlkins database
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Apr 13, 2022
1 parent 57fd20c commit 9d01ad7
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/sage/databases/stein_watkins.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
- The command ``SteinWatkinsPrimeData(n)`` returns an iterator over the curves
in the `n^{th}` Stein-Watkins prime table, which contains prime conductor
elliptic curves of conductor between `n10^6` and `(n+1)10^6`. Here `n`
elliptic curves of conductor between `n10^8` and `(n+1)10^8`. Here `n`
varies between 0 and 99, inclusive.
Expand Down Expand Up @@ -118,7 +118,7 @@
- [SW2002]_
"""

#*****************************************************************************
# ****************************************************************************
#
# Sage: Copyright (C) 2005 William Stein <wstein@gmail.com>
#
Expand All @@ -132,19 +132,20 @@
# The full text of the GPL is available at:
#
# http://www.gnu.org/licenses/
#*****************************************************************************
# ****************************************************************************

import bz2
import os

from sage.env import SAGE_SHARE


class SteinWatkinsIsogenyClass:
def __init__(self, conductor):
self.conductor = conductor

def __repr__(self):
return "Stein-Watkins isogeny class of conductor %s"%self.conductor
return "Stein-Watkins isogeny class of conductor %s" % self.conductor

def __len__(self):
try:
Expand All @@ -167,7 +168,7 @@ def _lines(s):
yield ""
return
line = s[:i]
s = s[i+1:]
s = s[i + 1:]
yield line


Expand All @@ -180,10 +181,10 @@ def __init__(self, num):
num = int(num)
self.num = num
if num < 0:
raise RuntimeError("num (=%s) must be a nonnegative integer"%num)
raise RuntimeError("num (=%s) must be a nonnegative integer" % num)
name = str(num)
name = '0'*(3-len(name)) + name
self._file = os.path.join(SAGE_SHARE, 'stein_watkins', 'a.%s.bz2'%name)
name = '0' * (3 - len(name)) + name
self._file = os.path.join(SAGE_SHARE, 'stein_watkins', 'a.%s.bz2' % name)
self._iter = iter(self)

def __repr__(self):
Expand All @@ -194,7 +195,7 @@ def __repr__(self):
sage: d
Stein-Watkins Database a.1 Iterator
"""
return "Stein-Watkins Database a.%s Iterator"%self.num
return "Stein-Watkins Database a.%s Iterator" % self.num

def __iter__(self):
"""
Expand All @@ -214,12 +215,12 @@ def __iter__(self):
try:
file = bz2.open(self._file, 'rt', encoding="utf-8")
except IOError:
raise IOError("The Stein-Watkins data file %s must be installed."%self._file)
raise IOError("The Stein-Watkins data file %s must be installed." % self._file)
C = None
for L in file:
if len(L) == 0:
continue
if L[0] != '[': # new curve
if L[0] != '[': # new curve
if C is not None:
yield C
x = L.split()
Expand Down Expand Up @@ -314,10 +315,10 @@ def __init__(self, num):
num = int(num)
self.num = num
if num < 0:
raise RuntimeError("num (=%s) must be a nonnegative integer"%num)
raise RuntimeError("num (=%s) must be a nonnegative integer" % num)
name = str(num)
name = '0'*(2-len(name)) + name
self._file = os.path.join(SAGE_SHARE,'stein_watkins', 'p.%s.bz2'%name)
name = '0' * (2 - len(name)) + name
self._file = os.path.join(SAGE_SHARE, 'stein_watkins', 'p.%s.bz2' % name)
self._iter = iter(self)

def __repr__(self):
Expand All @@ -328,7 +329,7 @@ def __repr__(self):
sage: d
Stein-Watkins Prime Conductor Database p.1 Iterator
"""
return "Stein-Watkins Prime Conductor Database p.%s Iterator"%self.num
return "Stein-Watkins Prime Conductor Database p.%s Iterator" % self.num


def ecdb_num_curves(max_level=200000):
Expand Down

0 comments on commit 9d01ad7

Please sign in to comment.