passagemath-eclib 10.6.40__cp314-cp314t-macosx_13_0_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of passagemath-eclib might be problematic. Click here for more details.

Binary file
@@ -0,0 +1,3 @@
1
+ # sage_setup: distribution = sagemath-eclib
2
+
3
+ from sage.all__sagemath_eclib import *
@@ -0,0 +1,161 @@
1
+ Metadata-Version: 2.4
2
+ Name: passagemath-eclib
3
+ Version: 10.6.40
4
+ Summary: passagemath: Elliptic curves over the rationals with eclib/mwrank
5
+ Author-email: The Sage Developers <sage-support@googlegroups.com>
6
+ Maintainer: Matthias Köppe, passagemath contributors
7
+ License-Expression: GPL-2.0-or-later
8
+ Project-URL: release notes, https://github.com/passagemath/passagemath/releases
9
+ Project-URL: repo (upstream), https://github.com/sagemath/sage
10
+ Project-URL: repo, https://github.com/passagemath/passagemath
11
+ Project-URL: documentation, https://passagemath.org/docs/latest
12
+ Project-URL: homepage (upstream), https://www.sagemath.org
13
+ Project-URL: discourse, https://passagemath.discourse.group
14
+ Project-URL: tracker (upstream), https://github.com/sagemath/sage/issues
15
+ Project-URL: tracker, https://github.com/passagemath/passagemath/issues
16
+ Classifier: Development Status :: 6 - Mature
17
+ Classifier: Intended Audience :: Education
18
+ Classifier: Intended Audience :: Science/Research
19
+ Classifier: Operating System :: POSIX
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Operating System :: MacOS :: MacOS X
22
+ Classifier: Programming Language :: Python :: 3 :: Only
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Programming Language :: Python :: 3.14
28
+ Classifier: Programming Language :: Python :: Implementation :: CPython
29
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
30
+ Requires-Python: <3.15,>=3.10
31
+ Description-Content-Type: text/x-rst
32
+ Requires-Dist: passagemath-linbox~=10.6.40.0
33
+ Requires-Dist: passagemath-modules~=10.6.40.0
34
+ Requires-Dist: passagemath-ntl~=10.6.40.0
35
+ Requires-Dist: memory_allocator
36
+ Requires-Dist: cysignals!=1.12.4; sys_platform == "win32"
37
+ Requires-Dist: cysignals!=1.12.0,>=1.11.2
38
+ Provides-Extra: test
39
+ Requires-Dist: passagemath-repl; extra == "test"
40
+ Requires-Dist: passagemath-schemes; extra == "test"
41
+
42
+ ==============================================================================================
43
+ passagemath: Elliptic curves over the rationals with eclib/mwrank
44
+ ==============================================================================================
45
+
46
+ `passagemath <https://github.com/passagemath/passagemath>`__ is open
47
+ source mathematical software in Python, released under the GNU General
48
+ Public Licence GPLv2+.
49
+
50
+ It is a fork of `SageMath <https://www.sagemath.org/>`__, which has been
51
+ developed 2005-2025 under the motto “Creating a Viable Open Source
52
+ Alternative to Magma, Maple, Mathematica, and MATLAB”.
53
+
54
+ The passagemath fork uses the motto "Creating a Free Passage Between the
55
+ Scientific Python Ecosystem and Mathematical Software Communities."
56
+ It was created in October 2024 with the following goals:
57
+
58
+ - providing modularized installation with pip,
59
+ - establishing first-class membership in the scientific Python
60
+ ecosystem,
61
+ - giving `clear attribution of upstream
62
+ projects <https://groups.google.com/g/sage-devel/c/6HO1HEtL1Fs/m/G002rPGpAAAJ>`__,
63
+ - providing independently usable Python interfaces to upstream
64
+ libraries,
65
+ - offering `platform portability and integration testing
66
+ services <https://github.com/passagemath/passagemath/issues/704>`__
67
+ to upstream projects,
68
+ - inviting collaborations with upstream projects,
69
+ - `building a professional, respectful, inclusive
70
+ community <https://groups.google.com/g/sage-devel/c/xBzaINHWwUQ>`__,
71
+ - `empowering Sage users to participate in the scientific Python ecosystem
72
+ <https://github.com/passagemath/passagemath/issues/248>`__ by publishing packages,
73
+ - developing a port to `Pyodide <https://pyodide.org/en/stable/>`__ for
74
+ serverless deployment with Javascript,
75
+ - developing a native Windows port.
76
+
77
+ `Full documentation <https://passagemath.org/docs/latest/html/en/index.html>`__ is
78
+ available online.
79
+
80
+ passagemath attempts to support and provides binary wheels suitable for
81
+ all major Linux distributions and recent versions of macOS.
82
+
83
+ Binary wheels for native Windows (x86_64) are are available for a subset of
84
+ the passagemath distributions. Use of the full functionality of passagemath
85
+ on Windows currently requires the use of Windows Subsystem for Linux (WSL)
86
+ or virtualization.
87
+
88
+ The supported Python versions in the passagemath 10.6.x series are 3.10.x-3.13.x.
89
+
90
+
91
+ About this pip-installable distribution package
92
+ -----------------------------------------------
93
+
94
+ This pip-installable distribution ``passagemath-eclib`` provides the
95
+ Cython interface to John Cremona's programs for enumerating and computing
96
+ with elliptic curves defined over the rational numbers.
97
+
98
+
99
+ What is included
100
+ ----------------
101
+
102
+ - `Sage interface to Cremona’s eclib library (also known as mwrank) <https://passagemath.org/docs/latest/html/en/reference/libs/sage/libs/eclib/interface.html>`_
103
+
104
+ - `Cython interface to Cremona’s eclib library (also known as mwrank) <https://passagemath.org/docs/latest/html/en/reference/libs/sage/libs/eclib/mwrank.html>`_
105
+
106
+ - `Cremona matrices <https://passagemath.org/docs/latest/html/en/reference/libs/sage/libs/eclib/mat.html>`_
107
+
108
+ - `Modular symbols using eclib newforms <https://passagemath.org/docs/latest/html/en/reference/libs/sage/libs/eclib/newforms.html>`_
109
+
110
+ - `Cremona modular symbols <https://passagemath.org/docs/latest/html/en/reference/libs/sage/libs/eclib/homspace.html>`_
111
+
112
+ - `Cremona modular symbols (constructor) <https://passagemath.org/docs/latest/html/en/reference/libs/sage/libs/eclib/constructor.html>`_
113
+
114
+ - `Interface to the mwrank program <https://passagemath.org/docs/latest/html/en/reference/interfaces/sage/interfaces/mwrank.html#module-sage.interfaces.mwrank>`_
115
+
116
+
117
+ Examples
118
+ --------
119
+
120
+ A quick way to try it out interactively::
121
+
122
+ $ pipx run --pip-args="--prefer-binary" --spec "passagemath-eclib[test]" ipython
123
+
124
+ In [1]: from passagemath_eclib import *
125
+
126
+ In [2]: M = CremonaModularSymbols(43, cuspidal=True); M
127
+ Out[2]: Cremona Cuspidal Modular Symbols space of dimension 6 for Gamma_0(43) of weight 2 with sign 0
128
+
129
+ Finding the installation location of the mwrank program::
130
+
131
+ $ pipx run --pip-args="--prefer-binary" --spec "passagemath-eclib" python
132
+ >>> from sage.features.eclib import Mwrank
133
+ >>> Mwrank().absolute_filename()
134
+ '.../bin/mwrank'
135
+
136
+ Use with `sage.schemes.elliptic_curves <https://passagemath.org/docs/latest/html/en/reference/arithmetic_curves/index.html#elliptic-curves>`_::
137
+
138
+ $ pipx run --pip-args="--prefer-binary" --spec "passagemath-eclib[test]" ipython
139
+
140
+ In [1]: from passagemath_eclib import *
141
+
142
+ In [2]: x = polygen(ZZ, 'x')
143
+
144
+ In [3]: K = NumberField(x**2 + 23, 'a'); a = K.gen()
145
+
146
+ In [4]: E = EllipticCurve(K, [0,0,0,101,0])
147
+
148
+ In [5]: E.gens()
149
+
150
+
151
+ Development
152
+ -----------
153
+
154
+ ::
155
+
156
+ $ git clone --origin passagemath https://github.com/passagemath/passagemath.git
157
+ $ cd passagemath
158
+ passagemath $ ./bootstrap
159
+ passagemath $ python3 -m venv eclib-venv
160
+ passagemath $ source eclib-venv/bin/activate
161
+ (eclib-venv) passagemath $ pip install -v -e pkgs/sagemath-eclib
@@ -0,0 +1,33 @@
1
+ passagemath_eclib-10.6.40.dist-info/RECORD,,
2
+ passagemath_eclib-10.6.40.dist-info/WHEEL,sha256=RVsjh5yijuLhpAeoj1rcJ6CnX6JK7wyaBksB-qUN_2E,155
3
+ passagemath_eclib-10.6.40.dist-info/top_level.txt,sha256=0XP-a724JYuL7lNTHSaQ05dyR3Jxz-IUzAWaASLTSHE,24
4
+ passagemath_eclib-10.6.40.dist-info/METADATA,sha256=OSO77mog7huY4mQRNli_gSsOPjtKVONRLdkx5g7iCes,7056
5
+ passagemath_eclib/__init__.py,sha256=zMD8y2IByHS2O6bJW-aznIYrFHjoZtYxoYoqUos3YZ0,84
6
+ passagemath_eclib/.dylibs/libntl.45.dylib,sha256=IIzBQ4o1SOL91ntdeLaFjmUWpc30AUdsUx0e1oPNNOY,2295376
7
+ passagemath_eclib/.dylibs/libec.14.dylib,sha256=0DVG3lhHtfYejqlLL2Skzo5HRvAUM5zi5mu882fm7eU,3581040
8
+ passagemath_eclib/.dylibs/libgf2x.3.dylib,sha256=Mum3EH7fP9F88Kg1vNVlev7kvPgeGq2rag2CxK0UN0Y,97424
9
+ passagemath_eclib/.dylibs/libflint.22.0.dylib,sha256=RnifOX28gUA6YBA8poP_VWR-r38uiG6bTxsVKsAOSyM,10494912
10
+ passagemath_eclib/.dylibs/libpari-gmp-tls.dylib,sha256=BRTkP35SDPGpceN64xTkPgguF-LHXakdoT4FXRT4I7U,10108944
11
+ passagemath_eclib/.dylibs/libgmp.10.dylib,sha256=2xC1Z40d_Ifjv-41VxTFo65oGBuEuwCIkSDZMiyCjEA,488712
12
+ passagemath_eclib/.dylibs/libmpfr.6.dylib,sha256=qNKLox_p8m4x4tpTtHSLTVnOlpMN9MH-gxcibf5W6Uk,465224
13
+ sage_wheels/bin/mwrank,sha256=nJYk3Z9eiXW5f9nZ0U8EbHQVnOD83rIA4XrIskV0hjk,35544
14
+ sage/all__sagemath_eclib.py,sha256=PnPfHmKUTc7cMx6GOd0BupMBdOugvB3CDOKnfLdfzFY,348
15
+ sage/libs/all__sagemath_eclib.py,sha256=H84MU_RUF7AFi4kYwqjD7qf-5Ubp8p1JM0CQ3zQPEbM,497
16
+ sage/libs/eclib/homspace.pyx,sha256=uzmWG8kKgH9NNAEx-Ym1JaW7UVUwoJ-jwsWdwh7jfw4,9653
17
+ sage/libs/eclib/constructor.py,sha256=k4ug-84zOdPsVkcc0fQECuaXcxdWuK34j76U4n0k80Y,2962
18
+ sage/libs/eclib/__init__.pxd,sha256=J-IK32oq6HIKmFTHYGbr4Q6EJ33Vcsv5YVeaD-9vyIo,4784
19
+ sage/libs/eclib/newforms.pxd,sha256=7OmyBO8Tj8hncCdPAPHNLIS4axhZRM-rRYoyLjZ7-Mc,186
20
+ sage/libs/eclib/mat.pyx,sha256=m1iEfSMrBFqBOZScc0LLbim3GgNJz5OTiEpDSmiyeG4,7316
21
+ sage/libs/eclib/interface.py,sha256=bNn_mVlAJU9OxOQ_SvUfIlscFepNDIAf4qLi0YqTfac,50561
22
+ sage/libs/eclib/__init__.py,sha256=VjiZlK64wgH3SQYvGUcepeTUQngHlgGRH90Uyv5LnSE,44
23
+ sage/libs/eclib/newforms.cpython-314t-darwin.so,sha256=nas_5RzUS9pIGWi3HyK3b2w9E22s77SL9Lw94SQr2_U,104760
24
+ sage/libs/eclib/all.py,sha256=Nwq0p-bytJLGjPQi9SA0ej_gnjDmhUYHsqr6owIimss,316
25
+ sage/libs/eclib/homspace.cpython-314t-darwin.so,sha256=zgvUKXAJnYoGchYw5Cq7pj9VdGeDpaYkRusgD9X-6QI,94112
26
+ sage/libs/eclib/newforms.pyx,sha256=sqx0yta_mul8McABIBlzK0Xj9COo-HFDM_zFCWtbKMc,15483
27
+ sage/libs/eclib/mat.pxd,sha256=JXuI8yzgKxxGkVWfM5hNvr3I8bIu-HKzmNuddrV0Hf8,173
28
+ sage/libs/eclib/mwrank.pyx,sha256=39FNEm22seSBoepMAUdf-aUT5DGVkErzqzFfun8BkqQ,43700
29
+ sage/libs/eclib/homspace.pxd,sha256=snYcG_sEmIHuV1zAlVjXgYfCyJ_BIBRKplJ8dOVisMw,131
30
+ sage/libs/eclib/mwrank.cpython-314t-darwin.so,sha256=Dm2pDTmTPQARN6joIUT--9bpxPGQCFJgHXfdkiqzp40,231960
31
+ sage/libs/eclib/mat.cpython-314t-darwin.so,sha256=whZi0lLXVSHOloPB_Wwmzz-Vux7On5ijXDgtS2WU280,99264
32
+ sage/interfaces/mwrank.py,sha256=y6lal269BI5a2Uvf35qN8ovvYikn3MRJ7_L_a2KU0a8,12478
33
+ sage/interfaces/all__sagemath_eclib.py,sha256=VjiZlK64wgH3SQYvGUcepeTUQngHlgGRH90Uyv5LnSE,44
@@ -0,0 +1,6 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp314-cp314t-macosx_13_0_x86_64
5
+ Generator: delocate 0.13.1.dev42+ga0af70b54
6
+
@@ -0,0 +1,3 @@
1
+
2
+ passagemath_eclib
3
+ sage
@@ -0,0 +1,17 @@
1
+ # sage_setup: distribution = sagemath-eclib
2
+ # delvewheel: patch
3
+
4
+ try:
5
+ from sage.all__sagemath_repl import *
6
+ except ImportError:
7
+ pass
8
+
9
+ from sage.all__sagemath_modules import *
10
+ from sage.all__sagemath_linbox import *
11
+
12
+ try:
13
+ from sage.all__sagemath_schemes import *
14
+ except ImportError:
15
+ pass
16
+
17
+ from sage.libs.all__sagemath_eclib import *
@@ -0,0 +1 @@
1
+ # sage_setup: distribution = sagemath-eclib
@@ -0,0 +1,370 @@
1
+ # sage_setup: distribution = sagemath-eclib
2
+ r"""
3
+ Interface to mwrank
4
+ """
5
+
6
+ # ****************************************************************************
7
+ # Copyright (C) 2005 William Stein <wstein@gmail.com>
8
+ #
9
+ # Distributed under the terms of the GNU General Public License (GPL)
10
+ #
11
+ # This code is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # General Public License for more details.
15
+ #
16
+ # The full text of the GPL is available at:
17
+ #
18
+ # https://www.gnu.org/licenses/
19
+ # ****************************************************************************
20
+
21
+ import os
22
+ import shlex
23
+ import weakref
24
+
25
+ from sage.features.eclib import Mwrank as mwrank_executable
26
+
27
+ from .expect import Expect
28
+
29
+ instances = {}
30
+
31
+
32
+ def Mwrank(options='', server=None, server_tmpdir=None):
33
+ """
34
+ Create and return an mwrank interpreter, with given options.
35
+
36
+ INPUT:
37
+
38
+ - ``options`` -- string; passed when starting mwrank.
39
+ The format is::
40
+
41
+ -h help prints this info and quits
42
+ -q quiet turns OFF banner display and prompt
43
+ -v n verbosity sets verbosity to n (default=1)
44
+ -o PARI/GP output turns ON extra PARI/GP short output (default: OFF)
45
+ -p n precision sets precision to n decimals (default=15)
46
+ -b n quartic bound bound on quartic point search (default=10)
47
+ -x n n aux number of aux primes used for sieving (default=6)
48
+ -l list turns ON listing of points (default: ON, unless v=0)
49
+ -s selmer_only if set, computes Selmer rank only (default: not set)
50
+ -d skip_2nd_descent if set, skips the second descent for curves with 2-torsion (default: not set)
51
+ -S n sat_bd upper bound on saturation primes (default=100, -1 for automatic)
52
+
53
+ .. WARNING::
54
+
55
+ Do not use the option "-q" which turns off the prompt.
56
+
57
+ EXAMPLES::
58
+
59
+ sage: M = Mwrank('-v 0 -l')
60
+ sage: print(M('0 0 1 -1 0'))
61
+ Curve [0,0,1,-1,0] : Rank = 1
62
+ Generator 1 is [0:-1:1]; height 0.051...
63
+ Regulator = 0.051...
64
+ """
65
+ global instances
66
+ try:
67
+ X = instances[options]()
68
+ if X:
69
+ return X
70
+ except KeyError:
71
+ pass
72
+ X = Mwrank_class(options, server=server, server_tmpdir=server_tmpdir)
73
+ instances[options] = weakref.ref(X)
74
+ return X
75
+
76
+
77
+ import re
78
+ # regex matching '[a1,a2,a3,a4,a6]', no spaces, each ai a possibly signed integer
79
+ AINVS_LIST_RE = re.compile(r'\[[+-]?(\d+)(,[+-]?\d+){4}]')
80
+ # regex matching ' a1 a2 a3 a4 a6 ', any whitespace, each ai a possibly signed integer
81
+ AINVS_PLAIN_RE = re.compile(r'^(\s*)([+-]?(\d+)(\s+)){4}([+-]?(\d+))(\s*)$')
82
+
83
+
84
+ def validate_mwrank_input(s):
85
+ r"""
86
+ Return a string suitable for mwrank input, or raises an error.
87
+
88
+ INPUT:
89
+
90
+ - ``s`` -- one of the following:
91
+
92
+ - a list or tuple of 5 integers [a1,a2,a3,a4,a6] or (a1,a2,a3,a4,a6)
93
+ - a string of the form '[a1,a2,a3,a4,a6]' or 'a1 a2 a3 a4 a6' where a1, a2, a3, a4, a6 are integers
94
+
95
+ OUTPUT:
96
+
97
+ For valid input, a string of the form '[a1,a2,a3,a4,a6]'.
98
+ For invalid input a :exc:`ValueError` is raised.
99
+
100
+ EXAMPLES:
101
+
102
+ A list or tuple of 5 integers::
103
+
104
+ sage: from sage.interfaces.mwrank import validate_mwrank_input
105
+ sage: validate_mwrank_input([1,2,3,4,5])
106
+ '[1, 2, 3, 4, 5]'
107
+ sage: validate_mwrank_input((-1,2,-3,4,-55))
108
+ '[-1, 2, -3, 4, -55]'
109
+ sage: validate_mwrank_input([1,2,3,4])
110
+ Traceback (most recent call last):
111
+ ...
112
+ ValueError: [1, 2, 3, 4] is not valid input to mwrank (should have 5 entries)
113
+ sage: validate_mwrank_input([1,2,3,4,i])
114
+ Traceback (most recent call last):
115
+ ...
116
+ ValueError: [1, 2, 3, 4, I] is not valid input to mwrank (entries should be integers)
117
+
118
+
119
+ A string of the form '[a1,a2,a3,a4,a6]' with any whitespace and integers ai::
120
+
121
+ sage: validate_mwrank_input('0 -1 1 -7 6')
122
+ '[0,-1,1,-7,6]'
123
+ sage: validate_mwrank_input("[0,-1,1,0,0]\n")
124
+ '[0,-1,1,0,0]'
125
+ sage: validate_mwrank_input('0\t -1\t 1\t 0\t 0\n')
126
+ '[0,-1,1,0,0]'
127
+ sage: validate_mwrank_input('0 -1 1 -7 ')
128
+ Traceback (most recent call last):
129
+ ...
130
+ ValueError: 0 -1 1 -7 is not valid input to mwrank
131
+ """
132
+ if isinstance(s, (list, tuple)):
133
+ from sage.rings.integer_ring import ZZ
134
+ if len(s) != 5:
135
+ raise ValueError("%s is not valid input to mwrank (should have 5 entries)" % s)
136
+ try:
137
+ ai = [ZZ(a) for a in s]
138
+ return str(ai)
139
+ except (TypeError, ValueError):
140
+ raise ValueError("%s is not valid input to mwrank (entries should be integers)" % s)
141
+
142
+ if isinstance(s, str):
143
+ if AINVS_PLAIN_RE.match(s):
144
+ ai = s.split()
145
+ return "[" + ",".join(ai) + "]"
146
+ ss = s.replace(' ', '').replace('\n', '').replace('\t', '')
147
+ if AINVS_LIST_RE.match(ss):
148
+ return ss
149
+ raise ValueError("%s is not valid input to mwrank" % s)
150
+
151
+
152
+ class Mwrank_class(Expect):
153
+ """
154
+ Interface to the Mwrank interpreter.
155
+ """
156
+ def __init__(self, options='', server=None, server_tmpdir=None):
157
+ """
158
+ INPUT:
159
+
160
+ - ``options`` -- string; passed when starting mwrank.
161
+ The format is::
162
+
163
+ -h help prints this info and quits
164
+ -q quiet turns OFF banner display and prompt
165
+ -v n verbosity sets verbosity to n (default=1)
166
+ -o PARI/GP output turns ON extra PARI/GP short output (default: OFF)
167
+ -p n precision sets precision to n decimals (default=15)
168
+ -b n quartic bound bound on quartic point search (default=10)
169
+ -x n n aux number of aux primes used for sieving (default=6)
170
+ -l list turns ON listing of points (default: ON, unless v=0)
171
+ -s selmer_only if set, computes Selmer rank only (default: not set)
172
+ -d skip_2nd_descent if set, skips the second descent for curves with 2-torsion (default: not set)
173
+ -S n sat_bd upper bound on saturation primes (default=100, -1 for automatic)
174
+
175
+ .. WARNING::
176
+
177
+ Do not use the option "-q" which turns off the prompt.
178
+
179
+ .. NOTE::
180
+
181
+ Normally instances of this class would be created by
182
+ calling the global function :meth:`Mwrank`.
183
+
184
+ EXAMPLES::
185
+
186
+ sage: from sage.interfaces.mwrank import Mwrank_class
187
+ sage: M = Mwrank_class('-v 0 -l')
188
+ sage: M('0 -1 1 0 0')
189
+ 'Curve [0,-1,1,0,0] :...Rank = 0...Regulator = 1...'
190
+
191
+ sage: from sage.interfaces.mwrank import Mwrank_class
192
+ sage: TestSuite(Mwrank_class).run()
193
+ """
194
+ Expect.__init__(self,
195
+ name='mwrank',
196
+ prompt='Enter curve: ',
197
+ command=f"{shlex.quote(mwrank_executable().absolute_filename())} {options}",
198
+ server=server,
199
+ server_tmpdir=server_tmpdir,
200
+ restart_on_ctrlc=True,
201
+ verbose_start=False)
202
+
203
+ def __getattr__(self, attrname):
204
+ """
205
+ Standard function to return an attribute.
206
+
207
+ EXAMPLES::
208
+
209
+ sage: mwrank.zzz
210
+ Traceback (most recent call last):
211
+ ...
212
+ AttributeError
213
+ """
214
+ raise AttributeError
215
+
216
+ def __reduce__(self):
217
+ """
218
+ EXAMPLES::
219
+
220
+ sage: Mwrank().__reduce__()
221
+ (<function _reduce_load_mwrank at 0x...>, ())
222
+ """
223
+
224
+ return _reduce_load_mwrank, tuple([])
225
+
226
+ def __call__(self, cmd):
227
+ """
228
+ Interface to eval method.
229
+
230
+ INPUT:
231
+
232
+ - ``cmd`` A string, or Sage object which when converted to a
233
+ string gives valid input to ``mwrank``. The conversion is
234
+ done by :meth:`validate_mwrank_input`.
235
+
236
+ EXAMPLES:
237
+
238
+ The input can be five integers separated by whitespace::
239
+
240
+ sage: mwrank('0 -1 1 0 0')
241
+ 'Curve [0,-1,1,0,0] :...Basic pair: I=16, J=-304...'
242
+
243
+ Or a list or tuple of exactly five integers::
244
+
245
+ sage: s = mwrank([0,-1,1,0,0])
246
+ sage: "Rank = 0" in s and "been determined unconditionally" in s
247
+ True
248
+
249
+ TESTS:
250
+
251
+ Invalid input raises an :exc:`ValueError` (see :issue:`10108`); this
252
+ includes syntactically valid input which defines a singular curve::
253
+
254
+ sage: mwrank(10)
255
+ Traceback (most recent call last):
256
+ ...
257
+ ValueError: Invalid input: 10 is not valid input to mwrank
258
+
259
+ sage: mwrank('0 0 0 0 0')
260
+ Traceback (most recent call last):
261
+ ...
262
+ ValueError: Invalid input ([0,0,0,0,0]) to mwrank (singular curve)
263
+
264
+ sage: mwrank('0 0 0 -3 2')
265
+ Traceback (most recent call last):
266
+ ...
267
+ ValueError: Invalid input ([0,0,0,-3,2]) to mwrank (singular curve)
268
+ """
269
+ try:
270
+ s = validate_mwrank_input(cmd)
271
+ except ValueError as err:
272
+ raise ValueError("Invalid input: %s" % err)
273
+ try:
274
+ return self.eval(s)
275
+ except ValueError as err:
276
+ raise ValueError(err)
277
+ except RuntimeError:
278
+ raise ValueError(cmd)
279
+
280
+ def eval(self, s, **kwds):
281
+ """
282
+ Return mwrank's output for the given input.
283
+
284
+ INPUT:
285
+
286
+ - ``s`` -- string; a Sage object which when converted to a string
287
+ gives valid input to ``mwrank``. The conversion is done by
288
+ :meth:`validate_mwrank_input`. Possible formats are:
289
+
290
+ - a string representing exactly five integers separated by
291
+ whitespace, for example '1 2 3 4 5'
292
+
293
+ - a string representing exactly five integers separated by
294
+ commas, preceded by '[' and followed by ']' (with
295
+ arbitrary whitespace), for example '[1 2 3 4 5]'
296
+
297
+ - a list or tuple of exactly 5 integers.
298
+
299
+ .. NOTE::
300
+
301
+ If a :exc:`RuntimeError` exception is raised, then the mwrank
302
+ interface is restarted and the command is retried once.
303
+
304
+ EXAMPLES::
305
+
306
+ sage: mwrank.eval('12 3 4 5 6')
307
+ 'Curve [12,3,4,5,6] :...'
308
+ sage: mwrank.eval('[12, 3, 4, 5, 6]')
309
+ 'Curve [12,3,4,5,6] :...'
310
+ sage: mwrank.eval([12, 3, 4, 5, 6])
311
+ 'Curve [12,3,4,5,6] :...'
312
+ sage: mwrank.eval((12, 3, 4, 5, 6))
313
+ 'Curve [12,3,4,5,6] :...'
314
+ """
315
+ if self._expect is not None and not self._expect.isalive():
316
+ # if mwrank is interrupted twice in rapid succession,
317
+ # then it doesn't restart correctly, and we're left with:
318
+ # "RuntimeError: [Errno 9] Bad file descriptor"
319
+ # Doing _start again fixes that always. See trac #5157.
320
+ self._start()
321
+ try:
322
+ ss = validate_mwrank_input(s)
323
+ return Expect.eval(self, ss, **kwds)
324
+ except ValueError as err:
325
+ raise ValueError('Invalid input: %s' % err)
326
+ except RuntimeError:
327
+ raise ValueError('Invalid input (%s) to mwrank (singular curve)' % s)
328
+
329
+ def console(self):
330
+ """
331
+ Start the mwrank console.
332
+
333
+ EXAMPLES::
334
+
335
+ sage: mwrank.console() # not tested: expects console input
336
+ Program mwrank: ...
337
+ """
338
+ mwrank_console()
339
+
340
+
341
+ # An instance
342
+ mwrank = Mwrank()
343
+
344
+
345
+ def _reduce_load_mwrank():
346
+ """
347
+ Return the standard mwrank instance.
348
+
349
+ EXAMPLES::
350
+
351
+ sage: from sage.interfaces.mwrank import _reduce_load_mwrank
352
+ sage: _reduce_load_mwrank()
353
+ Mwrank
354
+ """
355
+ return mwrank
356
+
357
+
358
+ def mwrank_console():
359
+ """
360
+ Start the mwrank console.
361
+
362
+ EXAMPLES::
363
+
364
+ sage: mwrank_console() # not tested: expects console input
365
+ Program mwrank: ...
366
+ """
367
+ from sage.repl.rich_output.display_manager import get_display_manager
368
+ if not get_display_manager().is_in_terminal():
369
+ raise RuntimeError('Can use the console only in the terminal. Try %%mwrank magics instead.')
370
+ os.system(f'{shlex.quote(mwrank_executable().absolute_filename())}')
@@ -0,0 +1,11 @@
1
+ # sage_setup: distribution = sagemath-eclib
2
+
3
+ from sage.misc.lazy_import import lazy_import
4
+
5
+ lazy_import('sage.libs.eclib.constructor', 'CremonaModularSymbols')
6
+ lazy_import('sage.libs.eclib.interface', ['mwrank_EllipticCurve', 'mwrank_MordellWeil'])
7
+ lazy_import('sage.libs.eclib.mwrank', 'get_precision', 'mwrank_get_precision')
8
+ lazy_import('sage.libs.eclib.mwrank', 'set_precision', 'mwrank_set_precision')
9
+ lazy_import('sage.libs.eclib.mwrank', 'initprimes', 'mwrank_initprimes')
10
+
11
+ del lazy_import