passagemath-repl 10.5.1__py3-none-any.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.
- passagemath_repl-10.5.1.data/scripts/sage-cachegrind +25 -0
- passagemath_repl-10.5.1.data/scripts/sage-callgrind +16 -0
- passagemath_repl-10.5.1.data/scripts/sage-cleaner +230 -0
- passagemath_repl-10.5.1.data/scripts/sage-coverage +327 -0
- passagemath_repl-10.5.1.data/scripts/sage-eval +14 -0
- passagemath_repl-10.5.1.data/scripts/sage-fixdoctests +710 -0
- passagemath_repl-10.5.1.data/scripts/sage-inline-fortran +12 -0
- passagemath_repl-10.5.1.data/scripts/sage-ipynb2rst +50 -0
- passagemath_repl-10.5.1.data/scripts/sage-ipython +16 -0
- passagemath_repl-10.5.1.data/scripts/sage-massif +25 -0
- passagemath_repl-10.5.1.data/scripts/sage-notebook +267 -0
- passagemath_repl-10.5.1.data/scripts/sage-omega +25 -0
- passagemath_repl-10.5.1.data/scripts/sage-preparse +302 -0
- passagemath_repl-10.5.1.data/scripts/sage-run +27 -0
- passagemath_repl-10.5.1.data/scripts/sage-run-cython +10 -0
- passagemath_repl-10.5.1.data/scripts/sage-runtests +9 -0
- passagemath_repl-10.5.1.data/scripts/sage-startuptime.py +163 -0
- passagemath_repl-10.5.1.data/scripts/sage-valgrind +34 -0
- passagemath_repl-10.5.1.dist-info/METADATA +77 -0
- passagemath_repl-10.5.1.dist-info/RECORD +162 -0
- passagemath_repl-10.5.1.dist-info/WHEEL +5 -0
- passagemath_repl-10.5.1.dist-info/top_level.txt +1 -0
- sage/all__sagemath_repl.py +119 -0
- sage/doctest/__init__.py +4 -0
- sage/doctest/__main__.py +236 -0
- sage/doctest/all.py +4 -0
- sage/doctest/check_tolerance.py +261 -0
- sage/doctest/control.py +1727 -0
- sage/doctest/external.py +534 -0
- sage/doctest/fixtures.py +383 -0
- sage/doctest/forker.py +2665 -0
- sage/doctest/marked_output.py +102 -0
- sage/doctest/parsing.py +1708 -0
- sage/doctest/parsing_test.py +79 -0
- sage/doctest/reporting.py +733 -0
- sage/doctest/rif_tol.py +124 -0
- sage/doctest/sources.py +1657 -0
- sage/doctest/test.py +584 -0
- sage/doctest/tests/1second.rst +4 -0
- sage/doctest/tests/99seconds.rst +4 -0
- sage/doctest/tests/abort.rst +5 -0
- sage/doctest/tests/atexit.rst +7 -0
- sage/doctest/tests/fail_and_die.rst +6 -0
- sage/doctest/tests/initial.rst +15 -0
- sage/doctest/tests/interrupt.rst +7 -0
- sage/doctest/tests/interrupt_diehard.rst +14 -0
- sage/doctest/tests/keyboardinterrupt.rst +11 -0
- sage/doctest/tests/longtime.rst +5 -0
- sage/doctest/tests/nodoctest +5 -0
- sage/doctest/tests/random_seed.rst +4 -0
- sage/doctest/tests/show_skipped.rst +18 -0
- sage/doctest/tests/sig_on.rst +9 -0
- sage/doctest/tests/simple_failure.rst +8 -0
- sage/doctest/tests/sleep_and_raise.rst +106 -0
- sage/doctest/tests/tolerance.rst +31 -0
- sage/doctest/util.py +750 -0
- sage/interfaces/cleaner.py +48 -0
- sage/interfaces/quit.py +163 -0
- sage/misc/all__sagemath_repl.py +51 -0
- sage/misc/banner.py +235 -0
- sage/misc/benchmark.py +221 -0
- sage/misc/classgraph.py +134 -0
- sage/misc/copying.py +22 -0
- sage/misc/cython.py +694 -0
- sage/misc/dev_tools.py +745 -0
- sage/misc/edit_module.py +304 -0
- sage/misc/explain_pickle.py +3079 -0
- sage/misc/gperftools.py +361 -0
- sage/misc/inline_fortran.py +212 -0
- sage/misc/messaging.py +86 -0
- sage/misc/pager.py +21 -0
- sage/misc/profiler.py +179 -0
- sage/misc/python.py +70 -0
- sage/misc/remote_file.py +53 -0
- sage/misc/sage_eval.py +249 -0
- sage/misc/sage_input.py +3621 -0
- sage/misc/sagedoc.py +1742 -0
- sage/misc/sh.py +38 -0
- sage/misc/trace.py +90 -0
- sage/repl/__init__.py +16 -0
- sage/repl/all.py +15 -0
- sage/repl/attach.py +625 -0
- sage/repl/configuration.py +186 -0
- sage/repl/display/__init__.py +1 -0
- sage/repl/display/fancy_repr.py +354 -0
- sage/repl/display/formatter.py +318 -0
- sage/repl/display/jsmol_iframe.py +290 -0
- sage/repl/display/pretty_print.py +153 -0
- sage/repl/display/util.py +163 -0
- sage/repl/image.py +302 -0
- sage/repl/inputhook.py +91 -0
- sage/repl/interface_magic.py +298 -0
- sage/repl/interpreter.py +854 -0
- sage/repl/ipython_extension.py +593 -0
- sage/repl/ipython_kernel/__init__.py +1 -0
- sage/repl/ipython_kernel/__main__.py +4 -0
- sage/repl/ipython_kernel/all_jupyter.py +10 -0
- sage/repl/ipython_kernel/install.py +301 -0
- sage/repl/ipython_kernel/interact.py +278 -0
- sage/repl/ipython_kernel/kernel.py +217 -0
- sage/repl/ipython_kernel/widgets.py +466 -0
- sage/repl/ipython_kernel/widgets_sagenb.py +587 -0
- sage/repl/ipython_tests.py +163 -0
- sage/repl/load.py +326 -0
- sage/repl/preparse.py +2218 -0
- sage/repl/prompts.py +90 -0
- sage/repl/rich_output/__init__.py +4 -0
- sage/repl/rich_output/backend_base.py +648 -0
- sage/repl/rich_output/backend_doctest.py +316 -0
- sage/repl/rich_output/backend_emacs.py +151 -0
- sage/repl/rich_output/backend_ipython.py +596 -0
- sage/repl/rich_output/buffer.py +311 -0
- sage/repl/rich_output/display_manager.py +829 -0
- sage/repl/rich_output/example.avi +0 -0
- sage/repl/rich_output/example.canvas3d +1 -0
- sage/repl/rich_output/example.dvi +0 -0
- sage/repl/rich_output/example.flv +0 -0
- sage/repl/rich_output/example.gif +0 -0
- sage/repl/rich_output/example.jpg +0 -0
- sage/repl/rich_output/example.mkv +0 -0
- sage/repl/rich_output/example.mov +0 -0
- sage/repl/rich_output/example.mp4 +0 -0
- sage/repl/rich_output/example.ogv +0 -0
- sage/repl/rich_output/example.pdf +0 -0
- sage/repl/rich_output/example.png +0 -0
- sage/repl/rich_output/example.svg +54 -0
- sage/repl/rich_output/example.webm +0 -0
- sage/repl/rich_output/example.wmv +0 -0
- sage/repl/rich_output/example_jmol.spt.zip +0 -0
- sage/repl/rich_output/example_wavefront_scene.mtl +7 -0
- sage/repl/rich_output/example_wavefront_scene.obj +17 -0
- sage/repl/rich_output/output_basic.py +391 -0
- sage/repl/rich_output/output_browser.py +103 -0
- sage/repl/rich_output/output_catalog.py +54 -0
- sage/repl/rich_output/output_graphics.py +320 -0
- sage/repl/rich_output/output_graphics3d.py +345 -0
- sage/repl/rich_output/output_video.py +231 -0
- sage/repl/rich_output/preferences.py +432 -0
- sage/repl/rich_output/pretty_print.py +339 -0
- sage/repl/rich_output/test_backend.py +201 -0
- sage/repl/user_globals.py +214 -0
- sage/tests/all.py +0 -0
- sage/tests/all__sagemath_repl.py +3 -0
- sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py +630 -0
- sage/tests/arxiv_0812_2725.py +351 -0
- sage/tests/benchmark.py +1925 -0
- sage/tests/book_schilling_zabrocki_kschur_primer.py +795 -0
- sage/tests/book_stein_ent.py +651 -0
- sage/tests/book_stein_modform.py +558 -0
- sage/tests/cmdline.py +796 -0
- sage/tests/combinatorial_hopf_algebras.py +52 -0
- sage/tests/finite_poset.py +623 -0
- sage/tests/functools_partial_src.py +27 -0
- sage/tests/gosper-sum.py +218 -0
- sage/tests/lazy_imports.py +28 -0
- sage/tests/modular_group_cohomology.py +80 -0
- sage/tests/numpy.py +21 -0
- sage/tests/parigp.py +76 -0
- sage/tests/startup.py +27 -0
- sage/tests/symbolic-series.py +76 -0
- sage/tests/sympy.py +16 -0
- sage/tests/test_deprecation.py +31 -0
sage/tests/benchmark.py
ADDED
@@ -0,0 +1,1925 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
2
|
+
# sage.doctest: needs sage.symbolic
|
3
|
+
"""
|
4
|
+
Benchmarks
|
5
|
+
|
6
|
+
COMMENTS:
|
7
|
+
|
8
|
+
Taken as a whole these benchmarks suggest that by far the fastest math
|
9
|
+
software is MAGMA, Mathematica, and Sage (with appropriate tuning and
|
10
|
+
choices -- it can also be very slow !). Maxima is very slow, at least
|
11
|
+
in the form that comes with Sage (perhaps this is because of using
|
12
|
+
clisp, at least partly). GP is slow at some thing and very fast at
|
13
|
+
others.
|
14
|
+
|
15
|
+
TESTS::
|
16
|
+
|
17
|
+
sage: import sage.tests.benchmark
|
18
|
+
"""
|
19
|
+
from cysignals.alarm import alarm, cancel_alarm, AlarmInterrupt
|
20
|
+
from sage.combinat.combinat import fibonacci
|
21
|
+
from sage.functions.other import factorial
|
22
|
+
from sage.interfaces.gp import gp
|
23
|
+
from sage.interfaces.magma import magma, Magma
|
24
|
+
from sage.interfaces.maple import maple
|
25
|
+
from sage.interfaces.mathematica import mathematica
|
26
|
+
from sage.interfaces.maxima import maxima
|
27
|
+
from sage.interfaces.singular import singular
|
28
|
+
from sage.libs.pari import pari
|
29
|
+
from sage.matrix.matrix_space import MatrixSpace
|
30
|
+
from sage.misc.functional import log
|
31
|
+
from sage.misc.lazy_import import lazy_import
|
32
|
+
from sage.misc.timing import cputime, walltime
|
33
|
+
from sage.modular.modsym.modsym import ModularSymbols
|
34
|
+
from sage.rings.complex_mpfr import ComplexField
|
35
|
+
from sage.rings.finite_rings.finite_field_constructor import GF
|
36
|
+
from sage.rings.finite_rings.integer_mod_ring import Integers
|
37
|
+
from sage.rings.rational_field import QQ
|
38
|
+
from sage.rings.integer import Integer
|
39
|
+
from sage.rings.integer_ring import ZZ
|
40
|
+
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
|
41
|
+
from sage.schemes.elliptic_curves.constructor import EllipticCurve
|
42
|
+
|
43
|
+
lazy_import('sage.interfaces.macaulay2', 'macaulay2')
|
44
|
+
lazy_import('sage.libs.gap.libgap', 'libgap')
|
45
|
+
|
46
|
+
|
47
|
+
def avg(X):
|
48
|
+
"""
|
49
|
+
Return the average of the list X.
|
50
|
+
|
51
|
+
EXAMPLES::
|
52
|
+
|
53
|
+
sage: from sage.tests.benchmark import avg
|
54
|
+
sage: avg([1,2,3])
|
55
|
+
2.0
|
56
|
+
"""
|
57
|
+
s = sum(X, 0)
|
58
|
+
return s / float(len(X))
|
59
|
+
|
60
|
+
|
61
|
+
STD_SYSTEMS = ['sage', 'maxima', 'libgap', 'gp', 'pari', 'python']
|
62
|
+
OPT_SYSTEMS = ['magma', 'macaulay2', 'maple', 'mathematica']
|
63
|
+
|
64
|
+
|
65
|
+
class Benchmark:
|
66
|
+
"""
|
67
|
+
A class for running specific benchmarks against different systems.
|
68
|
+
|
69
|
+
In order to implement an extension of this class, one must write
|
70
|
+
functions named after the different systems one wants to test. These
|
71
|
+
functions must perform the same task for each function. Calling
|
72
|
+
the run command with a list of systems will then show the timings.
|
73
|
+
|
74
|
+
EXAMPLES::
|
75
|
+
|
76
|
+
sage: from sage.tests.benchmark import Benchmark
|
77
|
+
sage: B = Benchmark()
|
78
|
+
sage: def python():
|
79
|
+
....: t = cputime()
|
80
|
+
....: 2+2
|
81
|
+
....: return cputime(t)
|
82
|
+
sage: B.python = python
|
83
|
+
sage: B.run(systems=['python'])
|
84
|
+
sage.tests.benchmark.Benchmark instance
|
85
|
+
System min avg max trials cpu or wall
|
86
|
+
* python ...
|
87
|
+
"""
|
88
|
+
def run(self, systems=None, timeout=60, trials=1, sort=False, optional=False):
|
89
|
+
"""
|
90
|
+
Run the benchmarking functions for the current benchmark on the systems
|
91
|
+
given.
|
92
|
+
|
93
|
+
INPUT:
|
94
|
+
|
95
|
+
- ``systems`` -- (optional) list of strings of which systems to run tests on;
|
96
|
+
if ``None``, runs the standard systems
|
97
|
+
- ``timeout`` -- integer (default: 60); how long (in seconds)
|
98
|
+
to run each test for
|
99
|
+
- ``trials`` -- integer (default: 1); number of trials
|
100
|
+
- ``sort`` -- boolean (default: ``False``); whether to sort system names
|
101
|
+
- ``optional`` -- boolean (default: ``False``); if systems is ``None``,
|
102
|
+
whether to test optional systems
|
103
|
+
|
104
|
+
EXAMPLES::
|
105
|
+
|
106
|
+
sage: from sage.tests.benchmark import PolyFactor
|
107
|
+
sage: PolyFactor(10, QQ).run()
|
108
|
+
Factor a product of 2 polynomials of degree 10 over Rational Field.
|
109
|
+
System min avg max trials cpu or wall
|
110
|
+
* sage ...
|
111
|
+
* gp ...
|
112
|
+
"""
|
113
|
+
if sort:
|
114
|
+
systems.sort()
|
115
|
+
print('\n\n\n' + str(self))
|
116
|
+
print(' %-12s%-12s%-12s%-12s%-12s%15s' % ('System', 'min',
|
117
|
+
'avg', 'max',
|
118
|
+
'trials', 'cpu or wall'))
|
119
|
+
if systems is None:
|
120
|
+
systems = STD_SYSTEMS
|
121
|
+
if optional:
|
122
|
+
systems += OPT_SYSTEMS
|
123
|
+
for S in systems:
|
124
|
+
try:
|
125
|
+
X = []
|
126
|
+
wall = False
|
127
|
+
for i in range(trials):
|
128
|
+
alarm(timeout)
|
129
|
+
t = getattr(self, S)()
|
130
|
+
cancel_alarm()
|
131
|
+
if isinstance(t, tuple):
|
132
|
+
wall = True
|
133
|
+
t = t[1]
|
134
|
+
X.append(t)
|
135
|
+
mn = min(X)
|
136
|
+
mx = max(X)
|
137
|
+
av = avg(X)
|
138
|
+
s = '* %-12s%-12f%-12f%-12f%-12s' % (S, mn, av,
|
139
|
+
mx, trials)
|
140
|
+
if wall:
|
141
|
+
s += '%15fw' % t
|
142
|
+
else:
|
143
|
+
s += '%15fc' % t
|
144
|
+
print(s)
|
145
|
+
except AlarmInterrupt:
|
146
|
+
print('%-12sinterrupted (timeout: %s seconds wall time)' %
|
147
|
+
(S, timeout))
|
148
|
+
except AttributeError:
|
149
|
+
pass
|
150
|
+
except Exception as msg:
|
151
|
+
print(msg)
|
152
|
+
|
153
|
+
bench = run
|
154
|
+
|
155
|
+
def __repr__(self):
|
156
|
+
"""
|
157
|
+
Print representation of self, simply coming from self.repr_str.
|
158
|
+
|
159
|
+
EXAMPLES::
|
160
|
+
|
161
|
+
sage: from sage.tests.benchmark import Benchmark
|
162
|
+
sage: B = Benchmark()
|
163
|
+
sage: B.repr_str = 'spam'
|
164
|
+
sage: B
|
165
|
+
spam
|
166
|
+
"""
|
167
|
+
try:
|
168
|
+
return self.repr_str
|
169
|
+
except AttributeError:
|
170
|
+
return 'sage.tests.benchmark.Benchmark instance'
|
171
|
+
|
172
|
+
|
173
|
+
class Divpoly(Benchmark):
|
174
|
+
def __init__(self, n):
|
175
|
+
"""
|
176
|
+
Class for benchmarking computation of the division polynomial
|
177
|
+
of the following elliptic curve.
|
178
|
+
|
179
|
+
EXAMPLES::
|
180
|
+
|
181
|
+
sage: E = EllipticCurve([1,2,3,4,5])
|
182
|
+
sage: E.division_polynomial(3)
|
183
|
+
3*x^4 + 9*x^3 + 33*x^2 + 87*x + 35
|
184
|
+
sage: E.division_polynomial(5)
|
185
|
+
5*x^12 + 45*x^11 + 422*x^10 + ... - 426371
|
186
|
+
|
187
|
+
sage: from sage.tests.benchmark import Divpoly
|
188
|
+
sage: B = Divpoly(99)
|
189
|
+
sage: B
|
190
|
+
99-Division polynomial
|
191
|
+
"""
|
192
|
+
self.__n = n
|
193
|
+
self.repr_str = "%s-Division polynomial" % self.__n
|
194
|
+
|
195
|
+
def sage(self):
|
196
|
+
"""
|
197
|
+
Time the computation in Sage.
|
198
|
+
|
199
|
+
EXAMPLES::
|
200
|
+
|
201
|
+
sage: from sage.tests.benchmark import Divpoly
|
202
|
+
sage: B = Divpoly(3)
|
203
|
+
sage: isinstance(B.sage(), float)
|
204
|
+
True
|
205
|
+
"""
|
206
|
+
n = self.__n
|
207
|
+
t = cputime()
|
208
|
+
E = EllipticCurve([1, 2, 3, 4, 5])
|
209
|
+
E.division_polynomial(n)
|
210
|
+
return cputime(t)
|
211
|
+
|
212
|
+
def magma(self):
|
213
|
+
"""
|
214
|
+
Time the computation in Magma.
|
215
|
+
|
216
|
+
EXAMPLES::
|
217
|
+
|
218
|
+
sage: from sage.tests.benchmark import Divpoly
|
219
|
+
sage: B = Divpoly(3)
|
220
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
221
|
+
True
|
222
|
+
"""
|
223
|
+
n = self.__n
|
224
|
+
t = magma.cputime()
|
225
|
+
magma('DivisionPolynomial(EllipticCurve([1,2,3,4,5]), %s)' % n)
|
226
|
+
return magma.cputime(t)
|
227
|
+
|
228
|
+
|
229
|
+
class PolySquare(Benchmark):
|
230
|
+
def __init__(self, n, R):
|
231
|
+
self.__n = n
|
232
|
+
self.__R = R
|
233
|
+
self.repr_str = 'Square a polynomial of degree %s over %s' % (self.__n, self.__R)
|
234
|
+
|
235
|
+
def sage(self):
|
236
|
+
"""
|
237
|
+
Time the computation in Sage.
|
238
|
+
|
239
|
+
EXAMPLES::
|
240
|
+
|
241
|
+
sage: from sage.tests.benchmark import PolySquare
|
242
|
+
sage: B = PolySquare(3, QQ)
|
243
|
+
sage: isinstance(B.sage(), float)
|
244
|
+
True
|
245
|
+
"""
|
246
|
+
R = self.__R
|
247
|
+
n = self.__n
|
248
|
+
f = R['x'](range(1, n + 1))
|
249
|
+
t = cputime()
|
250
|
+
f**2
|
251
|
+
return cputime(t)
|
252
|
+
|
253
|
+
def magma(self):
|
254
|
+
"""
|
255
|
+
Time the computation in Magma.
|
256
|
+
|
257
|
+
EXAMPLES::
|
258
|
+
|
259
|
+
sage: from sage.tests.benchmark import PolySquare
|
260
|
+
sage: B = PolySquare(3, QQ)
|
261
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
262
|
+
True
|
263
|
+
"""
|
264
|
+
R = magma(self.__R)
|
265
|
+
f = magma('PolynomialRing(%s)![1..%s]' % (R.name(), self.__n))
|
266
|
+
t = magma.cputime()
|
267
|
+
f * f
|
268
|
+
return magma.cputime(t)
|
269
|
+
|
270
|
+
def maple(self):
|
271
|
+
"""
|
272
|
+
Time the computation in Maple.
|
273
|
+
|
274
|
+
EXAMPLES::
|
275
|
+
|
276
|
+
sage: from sage.tests.benchmark import PolySquare
|
277
|
+
sage: B = PolySquare(3, QQ)
|
278
|
+
sage: isinstance(B.maple()[1], float) # optional - maple
|
279
|
+
True
|
280
|
+
"""
|
281
|
+
R = self.__R
|
282
|
+
if not (R == ZZ or R == QQ):
|
283
|
+
raise NotImplementedError
|
284
|
+
n = self.__n
|
285
|
+
f = maple(str(R['x'](range(1, n + 1))))
|
286
|
+
t = walltime()
|
287
|
+
f * f
|
288
|
+
return False, walltime(t)
|
289
|
+
|
290
|
+
|
291
|
+
class MPolynomialPower(Benchmark):
|
292
|
+
def __init__(self, nvars=2, exp=10, base=QQ, allow_singular=True):
|
293
|
+
self.nvars = nvars
|
294
|
+
self.exp = exp
|
295
|
+
self.base = base
|
296
|
+
self.allow_singular = allow_singular
|
297
|
+
s = 'Compute (x_0 + ... + x_%s)^%s over %s' % (
|
298
|
+
self.nvars - 1, self.exp, self.base)
|
299
|
+
if self.allow_singular:
|
300
|
+
s += ' (use singular for Sage mult.)'
|
301
|
+
self.repr_str = s
|
302
|
+
|
303
|
+
def sage(self):
|
304
|
+
"""
|
305
|
+
Time the computation in Sage.
|
306
|
+
|
307
|
+
EXAMPLES::
|
308
|
+
|
309
|
+
sage: from sage.tests.benchmark import MPolynomialPower
|
310
|
+
sage: B = MPolynomialPower()
|
311
|
+
sage: isinstance(B.sage()[1], float)
|
312
|
+
True
|
313
|
+
"""
|
314
|
+
R = PolynomialRing(self.base, self.nvars, 'x')
|
315
|
+
z = sum(R.gens())
|
316
|
+
if self.allow_singular:
|
317
|
+
z = singular(sum(R.gens()))
|
318
|
+
t = walltime()
|
319
|
+
z**self.exp
|
320
|
+
return False, walltime(t)
|
321
|
+
t = cputime()
|
322
|
+
z**self.exp
|
323
|
+
return cputime(t)
|
324
|
+
|
325
|
+
def macaulay2(self):
|
326
|
+
"""
|
327
|
+
Time the computation in Macaulay2.
|
328
|
+
|
329
|
+
EXAMPLES::
|
330
|
+
|
331
|
+
sage: from sage.tests.benchmark import MPolynomialPower
|
332
|
+
sage: B = MPolynomialPower()
|
333
|
+
sage: isinstance(B.macaulay2()[1], float) # optional - macaulay2
|
334
|
+
True
|
335
|
+
"""
|
336
|
+
R = PolynomialRing(self.base, self.nvars, 'x')
|
337
|
+
z = macaulay2(sum(R.gens()))
|
338
|
+
t = walltime()
|
339
|
+
z**self.exp
|
340
|
+
return False, walltime(t)
|
341
|
+
|
342
|
+
def maxima(self):
|
343
|
+
"""
|
344
|
+
Time the computation in Maxima.
|
345
|
+
|
346
|
+
EXAMPLES::
|
347
|
+
|
348
|
+
sage: from sage.tests.benchmark import MPolynomialPower
|
349
|
+
sage: B = MPolynomialPower()
|
350
|
+
sage: isinstance(B.maxima()[1], float)
|
351
|
+
True
|
352
|
+
"""
|
353
|
+
R = PolynomialRing(self.base, self.nvars, 'x')
|
354
|
+
z = maxima(str(sum(R.gens())))
|
355
|
+
w = walltime()
|
356
|
+
(z**self.exp).expand()
|
357
|
+
return False, walltime(w)
|
358
|
+
|
359
|
+
def maple(self):
|
360
|
+
"""
|
361
|
+
Time the computation in Maple.
|
362
|
+
|
363
|
+
EXAMPLES::
|
364
|
+
|
365
|
+
sage: from sage.tests.benchmark import MPolynomialPower
|
366
|
+
sage: B = MPolynomialPower()
|
367
|
+
sage: isinstance(B.maple()[1], float) # optional - maple
|
368
|
+
True
|
369
|
+
"""
|
370
|
+
R = PolynomialRing(self.base, self.nvars, 'x')
|
371
|
+
z = maple(str(sum(R.gens())))
|
372
|
+
w = walltime()
|
373
|
+
(z**self.exp).expand()
|
374
|
+
return False, walltime(w)
|
375
|
+
|
376
|
+
def mathematica(self):
|
377
|
+
"""
|
378
|
+
Time the computation in Mathematica.
|
379
|
+
|
380
|
+
EXAMPLES::
|
381
|
+
|
382
|
+
sage: from sage.tests.benchmark import MPolynomialPower
|
383
|
+
sage: B = MPolynomialPower()
|
384
|
+
sage: isinstance(B.mathematica()[1], float) # optional - mathematica
|
385
|
+
True
|
386
|
+
"""
|
387
|
+
R = PolynomialRing(self.base, self.nvars, 'x')
|
388
|
+
z = mathematica(str(sum(R.gens())))
|
389
|
+
w = walltime()
|
390
|
+
(z**self.exp).Expand()
|
391
|
+
return False, walltime(w)
|
392
|
+
|
393
|
+
# this doesn't really expand out -- pari has no function to do so,
|
394
|
+
# as far as I know.
|
395
|
+
# def gp(self):
|
396
|
+
# R = PolynomialRing(self.base, self.nvars)
|
397
|
+
# z = gp(str(sum(R.gens())))
|
398
|
+
# gp.eval('gettime')
|
399
|
+
# z**self.exp
|
400
|
+
# return float(gp.eval('gettime/1000.0'))
|
401
|
+
|
402
|
+
def magma(self):
|
403
|
+
"""
|
404
|
+
Time the computation in Magma.
|
405
|
+
|
406
|
+
EXAMPLES::
|
407
|
+
|
408
|
+
sage: from sage.tests.benchmark import MPolynomialPower
|
409
|
+
sage: B = MPolynomialPower()
|
410
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
411
|
+
True
|
412
|
+
"""
|
413
|
+
R = magma.PolynomialRing(self.base, self.nvars)
|
414
|
+
z = R.gen(1)
|
415
|
+
for i in range(2, self.nvars + 1):
|
416
|
+
z += R.gen(i)
|
417
|
+
t = magma.cputime()
|
418
|
+
z**magma(self.exp)
|
419
|
+
return magma.cputime(t)
|
420
|
+
|
421
|
+
|
422
|
+
class MPolynomialMult(Benchmark):
|
423
|
+
def __init__(self, nvars=2, base=QQ, allow_singular=True):
|
424
|
+
if nvars % 2:
|
425
|
+
nvars += 1
|
426
|
+
self.nvars = nvars
|
427
|
+
self.base = base
|
428
|
+
self.allow_singular = allow_singular
|
429
|
+
s = 'Compute (x_0 + ... + x_%s) * (x_%s + ... + x_%s) over %s' % (
|
430
|
+
self.nvars // 2 - 1, self.nvars // 2, self.nvars, self.base)
|
431
|
+
if self.allow_singular:
|
432
|
+
s += ' (use singular for Sage mult.)'
|
433
|
+
self.repr_str = s
|
434
|
+
|
435
|
+
def maxima(self):
|
436
|
+
"""
|
437
|
+
Time the computation in Maxima.
|
438
|
+
|
439
|
+
EXAMPLES::
|
440
|
+
|
441
|
+
sage: from sage.tests.benchmark import MPolynomialMult
|
442
|
+
sage: B = MPolynomialMult()
|
443
|
+
sage: isinstance(B.maxima()[1], float)
|
444
|
+
True
|
445
|
+
"""
|
446
|
+
R = PolynomialRing(self.base, self.nvars, 'x')
|
447
|
+
k = self.nvars // 2
|
448
|
+
z0 = maxima(str(sum(R.gens()[:k])))
|
449
|
+
z1 = maxima(str(sum(R.gens()[k:])))
|
450
|
+
w = walltime()
|
451
|
+
(z0 * z1).expand()
|
452
|
+
return False, walltime(w)
|
453
|
+
|
454
|
+
def maple(self):
|
455
|
+
"""
|
456
|
+
Time the computation in Maple.
|
457
|
+
|
458
|
+
EXAMPLES::
|
459
|
+
|
460
|
+
sage: from sage.tests.benchmark import MPolynomialMult
|
461
|
+
sage: B = MPolynomialMult()
|
462
|
+
sage: isinstance(B.maple()[1], float) # optional - maple
|
463
|
+
True
|
464
|
+
"""
|
465
|
+
R = PolynomialRing(self.base, self.nvars, 'x')
|
466
|
+
k = self.nvars // 2
|
467
|
+
z0 = maple(str(sum(R.gens()[:k])))
|
468
|
+
z1 = maple(str(sum(R.gens()[k:])))
|
469
|
+
w = walltime()
|
470
|
+
(z0 * z1).expand()
|
471
|
+
return False, walltime(w)
|
472
|
+
|
473
|
+
def mathematica(self):
|
474
|
+
"""
|
475
|
+
Time the computation in Mathematica.
|
476
|
+
|
477
|
+
EXAMPLES::
|
478
|
+
|
479
|
+
sage: from sage.tests.benchmark import MPolynomialMult
|
480
|
+
sage: B = MPolynomialMult()
|
481
|
+
sage: isinstance(B.mathematica()[1], float) # optional - mathematica
|
482
|
+
True
|
483
|
+
"""
|
484
|
+
R = PolynomialRing(self.base, self.nvars, 'x')
|
485
|
+
k = self.nvars // 2
|
486
|
+
z0 = mathematica(str(sum(R.gens()[:k])))
|
487
|
+
z1 = mathematica(str(sum(R.gens()[k:])))
|
488
|
+
w = walltime()
|
489
|
+
(z0 * z1).Expand()
|
490
|
+
return False, walltime(w)
|
491
|
+
|
492
|
+
# def gp(self):
|
493
|
+
# R = PolynomialRing(self.base, self.nvars)
|
494
|
+
# k = self.nvars // 2
|
495
|
+
# z0 = gp(str(sum(R.gens()[:k])))
|
496
|
+
# z1 = gp(str(sum(R.gens()[k:])))
|
497
|
+
# gp.eval('gettime')
|
498
|
+
# z0*z1
|
499
|
+
# return float(gp.eval('gettime/1000.0'))
|
500
|
+
|
501
|
+
def sage(self):
|
502
|
+
"""
|
503
|
+
Time the computation in Sage.
|
504
|
+
|
505
|
+
EXAMPLES::
|
506
|
+
|
507
|
+
sage: from sage.tests.benchmark import MPolynomialMult
|
508
|
+
sage: B = MPolynomialMult()
|
509
|
+
sage: isinstance(B.sage()[1], float)
|
510
|
+
True
|
511
|
+
"""
|
512
|
+
R = PolynomialRing(self.base, self.nvars, 'x')
|
513
|
+
k = self.nvars // 2
|
514
|
+
z0 = sum(R.gens()[:k])
|
515
|
+
z1 = sum(R.gens()[k:])
|
516
|
+
if self.allow_singular:
|
517
|
+
z0 = singular(z0)
|
518
|
+
z1 = singular(z1)
|
519
|
+
t = walltime()
|
520
|
+
z0 * z1
|
521
|
+
return False, walltime(t)
|
522
|
+
else:
|
523
|
+
t = cputime()
|
524
|
+
z0 * z1
|
525
|
+
return cputime(t)
|
526
|
+
|
527
|
+
def macaulay2(self):
|
528
|
+
"""
|
529
|
+
Time the computation in Macaulay2.
|
530
|
+
|
531
|
+
EXAMPLES::
|
532
|
+
|
533
|
+
sage: from sage.tests.benchmark import MPolynomialMult
|
534
|
+
sage: B = MPolynomialMult()
|
535
|
+
sage: isinstance(B.macaulay2()[1], float) # optional - macaulay2
|
536
|
+
True
|
537
|
+
"""
|
538
|
+
R = PolynomialRing(self.base, self.nvars, 'x')
|
539
|
+
k = self.nvars // 2
|
540
|
+
z0 = macaulay2(sum(R.gens()[:k]))
|
541
|
+
z1 = macaulay2(sum(R.gens()[k:]))
|
542
|
+
t = walltime()
|
543
|
+
z0 * z1
|
544
|
+
return False, walltime(t)
|
545
|
+
|
546
|
+
def magma(self):
|
547
|
+
"""
|
548
|
+
Time the computation in Magma.
|
549
|
+
|
550
|
+
EXAMPLES::
|
551
|
+
|
552
|
+
sage: from sage.tests.benchmark import MPolynomialMult
|
553
|
+
sage: B = MPolynomialMult()
|
554
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
555
|
+
True
|
556
|
+
"""
|
557
|
+
R = magma.PolynomialRing(self.base, self.nvars)
|
558
|
+
z0 = R.gen(1)
|
559
|
+
k = self.nvars // 2
|
560
|
+
for i in range(2, k + 1):
|
561
|
+
z0 += R.gen(i)
|
562
|
+
z1 = R.gen(k + 1)
|
563
|
+
for i in range(k + 1, self.nvars + 1):
|
564
|
+
z1 += R.gen(i)
|
565
|
+
t = magma.cputime()
|
566
|
+
z0 * z1
|
567
|
+
return magma.cputime(t)
|
568
|
+
|
569
|
+
|
570
|
+
class MPolynomialMult2(Benchmark):
|
571
|
+
def __init__(self, nvars=2, base=QQ, allow_singular=True):
|
572
|
+
if nvars % 2:
|
573
|
+
nvars += 1
|
574
|
+
self.nvars = nvars
|
575
|
+
self.base = base
|
576
|
+
self.allow_singular = allow_singular
|
577
|
+
s = 'Compute (x_1 + 2*x_2 + 3*x_3 + ... + %s*x_%s) * (%s * x_%s + ... + %s*x_%s) over %s' % (
|
578
|
+
self.nvars // 2, self.nvars // 2, self.nvars // 2 + 1, self.nvars // 2 + 1,
|
579
|
+
self.nvars + 1, self.nvars + 1, self.base)
|
580
|
+
if self.allow_singular:
|
581
|
+
s += ' (use singular for Sage mult.)'
|
582
|
+
self.repr_str = s
|
583
|
+
|
584
|
+
# def gp(self):
|
585
|
+
# R = PolynomialRing(self.base, self.nvars)
|
586
|
+
# k = self.nvars // 2
|
587
|
+
# z0 = R(0)
|
588
|
+
# z1 = R(0)
|
589
|
+
# for i in range(k):
|
590
|
+
# z0 += (i+1)*R.gen(i)
|
591
|
+
# for i in range(k,self.nvars):
|
592
|
+
# z1 += (i+1)*R.gen(i)
|
593
|
+
# z0 = gp(str(z0))
|
594
|
+
# z1 = gp(str(z1))
|
595
|
+
# gp.eval('gettime')
|
596
|
+
# z0*z1
|
597
|
+
# return float(gp.eval('gettime/1000.0'))
|
598
|
+
|
599
|
+
def maxima(self):
|
600
|
+
"""
|
601
|
+
Time the computation in Maxima.
|
602
|
+
|
603
|
+
EXAMPLES::
|
604
|
+
|
605
|
+
sage: from sage.tests.benchmark import MPolynomialMult2
|
606
|
+
sage: B = MPolynomialMult2()
|
607
|
+
sage: isinstance(B.maxima()[1], float)
|
608
|
+
True
|
609
|
+
"""
|
610
|
+
R = PolynomialRing(self.base, self.nvars, 'x')
|
611
|
+
k = self.nvars // 2
|
612
|
+
z0 = R(0)
|
613
|
+
z1 = R(0)
|
614
|
+
for i in range(k):
|
615
|
+
z0 += (i + 1) * R.gen(i)
|
616
|
+
for i in range(k, self.nvars):
|
617
|
+
z1 += (i + 1) * R.gen(i)
|
618
|
+
z0 = maxima(str(z0))
|
619
|
+
z1 = maxima(str(z1))
|
620
|
+
w = walltime()
|
621
|
+
(z0 * z1).expand()
|
622
|
+
return False, walltime(w)
|
623
|
+
|
624
|
+
def macaulay2(self):
|
625
|
+
"""
|
626
|
+
Time the computation in Macaulay2.
|
627
|
+
|
628
|
+
EXAMPLES::
|
629
|
+
|
630
|
+
sage: from sage.tests.benchmark import MPolynomialMult2
|
631
|
+
sage: B = MPolynomialMult2()
|
632
|
+
sage: isinstance(B.macaulay2()[1], float) # optional - macaulay2
|
633
|
+
True
|
634
|
+
"""
|
635
|
+
R = PolynomialRing(self.base, self.nvars, 'x')
|
636
|
+
k = self.nvars // 2
|
637
|
+
z0 = R(0)
|
638
|
+
z1 = R(0)
|
639
|
+
for i in range(k):
|
640
|
+
z0 += (i + 1) * R.gen(i)
|
641
|
+
for i in range(k, self.nvars):
|
642
|
+
z1 += (i + 1) * R.gen(i)
|
643
|
+
z0 = macaulay2(z0)
|
644
|
+
z1 = macaulay2(z1)
|
645
|
+
t = walltime()
|
646
|
+
z0 * z1
|
647
|
+
return False, walltime(t)
|
648
|
+
|
649
|
+
def maple(self):
|
650
|
+
"""
|
651
|
+
Time the computation in Maple.
|
652
|
+
|
653
|
+
EXAMPLES::
|
654
|
+
|
655
|
+
sage: from sage.tests.benchmark import MPolynomialMult2
|
656
|
+
sage: B = MPolynomialMult2()
|
657
|
+
sage: isinstance(B.maple()[1], float) # optional - maple
|
658
|
+
True
|
659
|
+
"""
|
660
|
+
R = PolynomialRing(self.base, self.nvars, 'x')
|
661
|
+
k = self.nvars // 2
|
662
|
+
z0 = R(0)
|
663
|
+
z1 = R(0)
|
664
|
+
for i in range(k):
|
665
|
+
z0 += (i + 1) * R.gen(i)
|
666
|
+
for i in range(k, self.nvars):
|
667
|
+
z1 += (i + 1) * R.gen(i)
|
668
|
+
z0 = maple(str(z0))
|
669
|
+
z1 = maple(str(z1))
|
670
|
+
w = walltime()
|
671
|
+
(z0 * z1).expand()
|
672
|
+
return False, walltime(w)
|
673
|
+
|
674
|
+
def mathematica(self):
|
675
|
+
"""
|
676
|
+
Time the computation in Mathematica.
|
677
|
+
|
678
|
+
EXAMPLES::
|
679
|
+
|
680
|
+
sage: from sage.tests.benchmark import MPolynomialMult2
|
681
|
+
sage: B = MPolynomialMult2()
|
682
|
+
sage: isinstance(B.mathematica()[1], float) # optional - mathematica
|
683
|
+
True
|
684
|
+
"""
|
685
|
+
R = PolynomialRing(self.base, self.nvars, 'x')
|
686
|
+
k = self.nvars // 2
|
687
|
+
z0 = R(0)
|
688
|
+
z1 = R(0)
|
689
|
+
for i in range(k):
|
690
|
+
z0 += (i + 1) * R.gen(i)
|
691
|
+
for i in range(k, self.nvars):
|
692
|
+
z1 += (i + 1) * R.gen(i)
|
693
|
+
z0 = mathematica(str(z0))
|
694
|
+
z1 = mathematica(str(z1))
|
695
|
+
w = walltime()
|
696
|
+
(z0 * z1).Expand()
|
697
|
+
return False, walltime(w)
|
698
|
+
|
699
|
+
def sage(self):
|
700
|
+
"""
|
701
|
+
Time the computation in Sage.
|
702
|
+
|
703
|
+
EXAMPLES::
|
704
|
+
|
705
|
+
sage: from sage.tests.benchmark import MPolynomialMult2
|
706
|
+
sage: B = MPolynomialMult2()
|
707
|
+
sage: isinstance(B.sage()[1], float)
|
708
|
+
True
|
709
|
+
"""
|
710
|
+
R = PolynomialRing(self.base, self.nvars, 'x')
|
711
|
+
k = self.nvars // 2
|
712
|
+
z0 = R(0)
|
713
|
+
z1 = R(0)
|
714
|
+
for i in range(k):
|
715
|
+
z0 += (i + 1) * R.gen(i)
|
716
|
+
for i in range(k, self.nvars):
|
717
|
+
z1 += (i + 1) * R.gen(i)
|
718
|
+
if self.allow_singular:
|
719
|
+
z0 = singular(z0)
|
720
|
+
z1 = singular(z1)
|
721
|
+
t = walltime()
|
722
|
+
z0 * z1
|
723
|
+
return False, walltime(t)
|
724
|
+
else:
|
725
|
+
t = cputime()
|
726
|
+
z0 * z1
|
727
|
+
return cputime(t)
|
728
|
+
|
729
|
+
def magma(self):
|
730
|
+
"""
|
731
|
+
Time the computation in Magma.
|
732
|
+
|
733
|
+
EXAMPLES::
|
734
|
+
|
735
|
+
sage: from sage.tests.benchmark import MPolynomialMult2
|
736
|
+
sage: B = MPolynomialMult2()
|
737
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
738
|
+
True
|
739
|
+
"""
|
740
|
+
R = magma.PolynomialRing(self.base, self.nvars)
|
741
|
+
z0 = R.gen(1)
|
742
|
+
k = self.nvars // 2
|
743
|
+
for i in range(2, k + 1):
|
744
|
+
z0 += magma(i) * R.gen(i)
|
745
|
+
z1 = R.gen(k + 1)
|
746
|
+
for i in range(k + 1, self.nvars + 1):
|
747
|
+
z1 += magma(i) * R.gen(i)
|
748
|
+
t = magma.cputime()
|
749
|
+
z0 * z1
|
750
|
+
return magma.cputime(t)
|
751
|
+
|
752
|
+
|
753
|
+
class CharPolyTp(Benchmark):
|
754
|
+
def __init__(self, N=37, k=2, p=2, sign=1):
|
755
|
+
self.N = N
|
756
|
+
self.k = k
|
757
|
+
self.p = p
|
758
|
+
self.sign = sign
|
759
|
+
self.repr_str = "Compute the charpoly (given the matrix) of T_%s on S_%s(Gamma_0(%s)) with sign %s." % (self.p, self.k, self.N, self.sign)
|
760
|
+
|
761
|
+
def matrix(self):
|
762
|
+
try:
|
763
|
+
return self._matrix
|
764
|
+
except AttributeError:
|
765
|
+
self._matrix = ModularSymbols(group=self.N, weight=self.k, sign=self.sign).T(self.p).matrix()
|
766
|
+
return self._matrix
|
767
|
+
|
768
|
+
def sage(self):
|
769
|
+
"""
|
770
|
+
Time the computation in Sage.
|
771
|
+
|
772
|
+
EXAMPLES::
|
773
|
+
|
774
|
+
sage: from sage.tests.benchmark import CharPolyTp
|
775
|
+
sage: B = CharPolyTp()
|
776
|
+
sage: isinstance(B.sage(), float)
|
777
|
+
True
|
778
|
+
"""
|
779
|
+
m = self.matrix()
|
780
|
+
t = cputime()
|
781
|
+
m.charpoly('x')
|
782
|
+
return cputime(t)
|
783
|
+
|
784
|
+
def gp(self):
|
785
|
+
"""
|
786
|
+
Time the computation in GP.
|
787
|
+
|
788
|
+
EXAMPLES::
|
789
|
+
|
790
|
+
sage: from sage.tests.benchmark import CharPolyTp
|
791
|
+
sage: B = CharPolyTp()
|
792
|
+
sage: isinstance(B.gp(), float)
|
793
|
+
True
|
794
|
+
"""
|
795
|
+
m = gp(self.matrix())
|
796
|
+
gp.eval('gettime')
|
797
|
+
m.charpoly('x')
|
798
|
+
return float(gp.eval('gettime/1000.0'))
|
799
|
+
|
800
|
+
def pari(self):
|
801
|
+
"""
|
802
|
+
Time the computation in Pari.
|
803
|
+
|
804
|
+
EXAMPLES::
|
805
|
+
|
806
|
+
sage: from sage.tests.benchmark import CharPolyTp
|
807
|
+
sage: B = CharPolyTp()
|
808
|
+
sage: isinstance(B.pari(), float)
|
809
|
+
True
|
810
|
+
"""
|
811
|
+
m = pari(self.matrix())
|
812
|
+
t = cputime()
|
813
|
+
m.charpoly('x')
|
814
|
+
return cputime(t)
|
815
|
+
|
816
|
+
def magma(self):
|
817
|
+
"""
|
818
|
+
Time the computation in Magma.
|
819
|
+
|
820
|
+
EXAMPLES::
|
821
|
+
|
822
|
+
sage: from sage.tests.benchmark import CharPolyTp
|
823
|
+
sage: B = CharPolyTp()
|
824
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
825
|
+
True
|
826
|
+
"""
|
827
|
+
m = magma(self.matrix())
|
828
|
+
t = magma.cputime()
|
829
|
+
m.CharacteristicPolynomial()
|
830
|
+
return magma.cputime(t)
|
831
|
+
|
832
|
+
|
833
|
+
class PolyFactor(Benchmark):
|
834
|
+
def __init__(self, n, R):
|
835
|
+
self.__n = n
|
836
|
+
self.__R = R
|
837
|
+
self.repr_str = "Factor a product of 2 polynomials of degree %s over %s." % (self.__n, self.__R)
|
838
|
+
|
839
|
+
def sage(self):
|
840
|
+
"""
|
841
|
+
Time the computation in Sage.
|
842
|
+
|
843
|
+
EXAMPLES::
|
844
|
+
|
845
|
+
sage: from sage.tests.benchmark import PolyFactor
|
846
|
+
sage: B = PolyFactor(3, QQ)
|
847
|
+
sage: isinstance(B.sage(), float)
|
848
|
+
True
|
849
|
+
"""
|
850
|
+
R = PolynomialRing(self.__R, 'x')
|
851
|
+
f = R(range(1, self.__n + 1))
|
852
|
+
g = R(range(self.__n + 1, 2 * (self.__n + 1)))
|
853
|
+
h = f * g
|
854
|
+
t = cputime()
|
855
|
+
h.factor()
|
856
|
+
return cputime(t)
|
857
|
+
|
858
|
+
def magma(self):
|
859
|
+
"""
|
860
|
+
Time the computation in Magma.
|
861
|
+
|
862
|
+
EXAMPLES::
|
863
|
+
|
864
|
+
sage: from sage.tests.benchmark import PolyFactor
|
865
|
+
sage: B = PolyFactor(3, QQ)
|
866
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
867
|
+
True
|
868
|
+
"""
|
869
|
+
R = magma(self.__R)
|
870
|
+
f = magma('PolynomialRing(%s)![1..%s]' % (R.name(), self.__n))
|
871
|
+
g = magma('PolynomialRing(%s)![%s+1..2*(%s+1)]' % (
|
872
|
+
R.name(), self.__n, self.__n))
|
873
|
+
h = f * g
|
874
|
+
t = magma.cputime()
|
875
|
+
h.Factorization()
|
876
|
+
return magma.cputime(t)
|
877
|
+
|
878
|
+
def gp(self):
|
879
|
+
"""
|
880
|
+
Time the computation in GP.
|
881
|
+
|
882
|
+
EXAMPLES::
|
883
|
+
|
884
|
+
sage: from sage.tests.benchmark import PolyFactor
|
885
|
+
sage: B = PolyFactor(3, QQ)
|
886
|
+
sage: isinstance(B.gp(), float)
|
887
|
+
True
|
888
|
+
"""
|
889
|
+
R = PolynomialRing(self.__R, 'x')
|
890
|
+
f = R(range(1, self.__n + 1))
|
891
|
+
g = R(range(self.__n + 1, 2 * (self.__n + 1)))
|
892
|
+
h = f * g
|
893
|
+
f = gp(h)
|
894
|
+
gp.eval('gettime')
|
895
|
+
f.factor()
|
896
|
+
return float(gp.eval('gettime/1000.0'))
|
897
|
+
|
898
|
+
|
899
|
+
class SquareInts(Benchmark):
|
900
|
+
def __init__(self, base=10, ndigits=10**5):
|
901
|
+
self.__ndigits = ndigits
|
902
|
+
self.base = base
|
903
|
+
self.repr_str = "Square the integer %s^%s" % (self.base, self.__ndigits)
|
904
|
+
|
905
|
+
def sage(self):
|
906
|
+
"""
|
907
|
+
Time the computation in Sage.
|
908
|
+
|
909
|
+
EXAMPLES::
|
910
|
+
|
911
|
+
sage: from sage.tests.benchmark import SquareInts
|
912
|
+
sage: B = SquareInts()
|
913
|
+
sage: isinstance(B.sage(), float)
|
914
|
+
True
|
915
|
+
"""
|
916
|
+
n = Integer(self.base)**self.__ndigits
|
917
|
+
t = cputime()
|
918
|
+
n**2
|
919
|
+
return cputime(t)
|
920
|
+
|
921
|
+
def gp(self):
|
922
|
+
"""
|
923
|
+
Time the computation in GP.
|
924
|
+
|
925
|
+
EXAMPLES::
|
926
|
+
|
927
|
+
sage: from sage.tests.benchmark import SquareInts
|
928
|
+
sage: B = SquareInts()
|
929
|
+
sage: isinstance(B.gp(), float)
|
930
|
+
True
|
931
|
+
"""
|
932
|
+
n = gp('%s^%s' % (self.base, self.__ndigits))
|
933
|
+
gp.eval('gettime')
|
934
|
+
n**2
|
935
|
+
return float(gp.eval('gettime/1000.0'))
|
936
|
+
|
937
|
+
def maxima(self):
|
938
|
+
"""
|
939
|
+
Time the computation in Maxima.
|
940
|
+
|
941
|
+
EXAMPLES::
|
942
|
+
|
943
|
+
sage: from sage.tests.benchmark import SquareInts
|
944
|
+
sage: B = SquareInts()
|
945
|
+
sage: isinstance(B.maxima()[1], float)
|
946
|
+
True
|
947
|
+
"""
|
948
|
+
n = maxima('%s^%s' % (self.base, self.__ndigits))
|
949
|
+
t = walltime()
|
950
|
+
n**2
|
951
|
+
return False, walltime(t)
|
952
|
+
|
953
|
+
def magma(self):
|
954
|
+
"""
|
955
|
+
Time the computation in Magma.
|
956
|
+
|
957
|
+
EXAMPLES::
|
958
|
+
|
959
|
+
sage: from sage.tests.benchmark import SquareInts
|
960
|
+
sage: B = SquareInts()
|
961
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
962
|
+
True
|
963
|
+
"""
|
964
|
+
n = magma('%s^%s' % (self.base, self.__ndigits))
|
965
|
+
t = magma.cputime()
|
966
|
+
n**2
|
967
|
+
return magma.cputime(t)
|
968
|
+
|
969
|
+
def python(self):
|
970
|
+
"""
|
971
|
+
Time the computation in Python.
|
972
|
+
|
973
|
+
EXAMPLES::
|
974
|
+
|
975
|
+
sage: from sage.tests.benchmark import SquareInts
|
976
|
+
sage: B = SquareInts()
|
977
|
+
sage: isinstance(B.python(), float)
|
978
|
+
True
|
979
|
+
"""
|
980
|
+
n = self.base**self.__ndigits
|
981
|
+
t = cputime()
|
982
|
+
n**2
|
983
|
+
return cputime(t)
|
984
|
+
|
985
|
+
def maple(self):
|
986
|
+
"""
|
987
|
+
Time the computation in Maple.
|
988
|
+
|
989
|
+
EXAMPLES::
|
990
|
+
|
991
|
+
sage: from sage.tests.benchmark import SquareInts
|
992
|
+
sage: B = SquareInts()
|
993
|
+
sage: isinstance(B.maple()[1], float) # optional - maple
|
994
|
+
True
|
995
|
+
"""
|
996
|
+
n = maple('%s^%s' % (self.base, self.__ndigits))
|
997
|
+
t = walltime()
|
998
|
+
n**2
|
999
|
+
return False, walltime(t)
|
1000
|
+
|
1001
|
+
def libgap(self):
|
1002
|
+
"""
|
1003
|
+
Time the computation in libGAP.
|
1004
|
+
|
1005
|
+
EXAMPLES::
|
1006
|
+
|
1007
|
+
sage: from sage.tests.benchmark import SquareInts
|
1008
|
+
sage: B = SquareInts()
|
1009
|
+
sage: isinstance(B.libgap()[1], float)
|
1010
|
+
True
|
1011
|
+
"""
|
1012
|
+
n = libgap(self.base)**libgap(self.__ndigits)
|
1013
|
+
t = walltime()
|
1014
|
+
n**2
|
1015
|
+
return False, walltime(t)
|
1016
|
+
|
1017
|
+
def mathematica(self):
|
1018
|
+
"""
|
1019
|
+
Time the computation in Mathematica.
|
1020
|
+
|
1021
|
+
EXAMPLES::
|
1022
|
+
|
1023
|
+
sage: from sage.tests.benchmark import SquareInts
|
1024
|
+
sage: B = SquareInts()
|
1025
|
+
sage: isinstance(B.mathematica()[1], float) # optional - mathematica
|
1026
|
+
True
|
1027
|
+
"""
|
1028
|
+
n = mathematica('%s^%s' % (self.base, self.__ndigits))
|
1029
|
+
t = walltime()
|
1030
|
+
n**2
|
1031
|
+
return False, walltime(t)
|
1032
|
+
|
1033
|
+
|
1034
|
+
class MatrixSquare(Benchmark):
|
1035
|
+
def __init__(self, n, R):
|
1036
|
+
self.__n = n
|
1037
|
+
self.__R = R
|
1038
|
+
self.repr_str = 'Square a matrix of degree %s over %s' % (self.__n, self.__R)
|
1039
|
+
|
1040
|
+
def sage(self):
|
1041
|
+
"""
|
1042
|
+
Time the computation in Sage.
|
1043
|
+
|
1044
|
+
EXAMPLES::
|
1045
|
+
|
1046
|
+
sage: from sage.tests.benchmark import MatrixSquare
|
1047
|
+
sage: B = MatrixSquare(3, QQ)
|
1048
|
+
sage: isinstance(B.sage(), float)
|
1049
|
+
True
|
1050
|
+
"""
|
1051
|
+
R = self.__R
|
1052
|
+
n = self.__n
|
1053
|
+
f = MatrixSpace(R, n)(list(range(n * n)))
|
1054
|
+
t = cputime()
|
1055
|
+
f**2
|
1056
|
+
return cputime(t)
|
1057
|
+
|
1058
|
+
def magma(self):
|
1059
|
+
"""
|
1060
|
+
Time the computation in Magma.
|
1061
|
+
|
1062
|
+
EXAMPLES::
|
1063
|
+
|
1064
|
+
sage: from sage.tests.benchmark import MatrixSquare
|
1065
|
+
sage: B = MatrixSquare(3, QQ)
|
1066
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
1067
|
+
True
|
1068
|
+
"""
|
1069
|
+
R = magma(self.__R)
|
1070
|
+
f = magma('MatrixAlgebra(%s, %s)![0..%s^2-1]' % (
|
1071
|
+
R.name(), self.__n, self.__n))
|
1072
|
+
t = magma.cputime()
|
1073
|
+
f * f
|
1074
|
+
return magma.cputime(t)
|
1075
|
+
|
1076
|
+
def gp(self):
|
1077
|
+
"""
|
1078
|
+
Time the computation in GP.
|
1079
|
+
|
1080
|
+
EXAMPLES::
|
1081
|
+
|
1082
|
+
sage: from sage.tests.benchmark import MatrixSquare
|
1083
|
+
sage: B = MatrixSquare(3, QQ)
|
1084
|
+
sage: isinstance(B.gp(), float)
|
1085
|
+
True
|
1086
|
+
"""
|
1087
|
+
n = self.__n
|
1088
|
+
m = gp('matrix(%s,%s,m,n,%s*(m-1)+(n-1))' % (n, n, n))
|
1089
|
+
gp('gettime')
|
1090
|
+
m * m
|
1091
|
+
return float(gp.eval('gettime/1000.0'))
|
1092
|
+
|
1093
|
+
def libgap(self):
|
1094
|
+
"""
|
1095
|
+
Time the computation in libGAP.
|
1096
|
+
|
1097
|
+
EXAMPLES::
|
1098
|
+
|
1099
|
+
sage: from sage.tests.benchmark import MatrixSquare
|
1100
|
+
sage: B = MatrixSquare(3, QQ)
|
1101
|
+
sage: isinstance(B.libgap()[1], float)
|
1102
|
+
True
|
1103
|
+
"""
|
1104
|
+
R = self.__R
|
1105
|
+
n = self.__n
|
1106
|
+
f = MatrixSpace(R, n)(list(range(n * n)))
|
1107
|
+
m = libgap(f)
|
1108
|
+
t = walltime()
|
1109
|
+
m * m
|
1110
|
+
return False, walltime(t)
|
1111
|
+
|
1112
|
+
|
1113
|
+
class Factorial(Benchmark):
|
1114
|
+
def __init__(self, n):
|
1115
|
+
self.__n = n
|
1116
|
+
self.repr_str = "Compute the factorial of %s" % self.__n
|
1117
|
+
|
1118
|
+
def sage(self):
|
1119
|
+
"""
|
1120
|
+
Time the computation in Sage.
|
1121
|
+
|
1122
|
+
EXAMPLES::
|
1123
|
+
|
1124
|
+
sage: from sage.tests.benchmark import Factorial
|
1125
|
+
sage: B = Factorial(10)
|
1126
|
+
sage: isinstance(B.sage(), float)
|
1127
|
+
True
|
1128
|
+
"""
|
1129
|
+
t = cputime()
|
1130
|
+
factorial(self.__n)
|
1131
|
+
return cputime(t)
|
1132
|
+
|
1133
|
+
def magma(self):
|
1134
|
+
"""
|
1135
|
+
Time the computation in Magma.
|
1136
|
+
|
1137
|
+
EXAMPLES::
|
1138
|
+
|
1139
|
+
sage: from sage.tests.benchmark import Factorial
|
1140
|
+
sage: B = Factorial(10)
|
1141
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
1142
|
+
True
|
1143
|
+
"""
|
1144
|
+
t = magma.cputime()
|
1145
|
+
magma('&*[1..%s]' % self.__n) # &* is way better than Factorial!!
|
1146
|
+
return magma.cputime(t)
|
1147
|
+
|
1148
|
+
def maple(self):
|
1149
|
+
"""
|
1150
|
+
Time the computation in Maple.
|
1151
|
+
|
1152
|
+
EXAMPLES::
|
1153
|
+
|
1154
|
+
sage: from sage.tests.benchmark import Factorial
|
1155
|
+
sage: B = Factorial(10)
|
1156
|
+
sage: isinstance(B.maple()[1], float) # optional - maple
|
1157
|
+
True
|
1158
|
+
"""
|
1159
|
+
n = maple(self.__n)
|
1160
|
+
t = walltime()
|
1161
|
+
n.factorial()
|
1162
|
+
return False, walltime(t)
|
1163
|
+
|
1164
|
+
def gp(self):
|
1165
|
+
"""
|
1166
|
+
Time the computation in GP.
|
1167
|
+
|
1168
|
+
EXAMPLES::
|
1169
|
+
|
1170
|
+
sage: from sage.tests.benchmark import Factorial
|
1171
|
+
sage: B = Factorial(10)
|
1172
|
+
sage: isinstance(B.gp(), float)
|
1173
|
+
True
|
1174
|
+
"""
|
1175
|
+
gp.eval('gettime')
|
1176
|
+
gp('%s!' % self.__n)
|
1177
|
+
return float(gp.eval('gettime/1000.0'))
|
1178
|
+
|
1179
|
+
|
1180
|
+
class Fibonacci(Benchmark):
|
1181
|
+
def __init__(self, n):
|
1182
|
+
self.__n = n
|
1183
|
+
self.repr_str = "Compute the %s-th Fibonacci number" % self.__n
|
1184
|
+
|
1185
|
+
def sage(self):
|
1186
|
+
"""
|
1187
|
+
Time the computation in Sage.
|
1188
|
+
|
1189
|
+
EXAMPLES::
|
1190
|
+
|
1191
|
+
sage: from sage.tests.benchmark import Fibonacci
|
1192
|
+
sage: B = Fibonacci(10)
|
1193
|
+
sage: isinstance(B.sage(), float)
|
1194
|
+
True
|
1195
|
+
"""
|
1196
|
+
t = cputime()
|
1197
|
+
fibonacci(self.__n)
|
1198
|
+
return cputime(t)
|
1199
|
+
|
1200
|
+
def magma(self):
|
1201
|
+
"""
|
1202
|
+
Time the computation in Magma.
|
1203
|
+
|
1204
|
+
EXAMPLES::
|
1205
|
+
|
1206
|
+
sage: from sage.tests.benchmark import Fibonacci
|
1207
|
+
sage: B = Fibonacci(10)
|
1208
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
1209
|
+
True
|
1210
|
+
"""
|
1211
|
+
t = magma.cputime()
|
1212
|
+
magma('Fibonacci(%s)' % self.__n)
|
1213
|
+
return magma.cputime(t)
|
1214
|
+
|
1215
|
+
def libgap(self):
|
1216
|
+
"""
|
1217
|
+
Time the computation in libGAP.
|
1218
|
+
|
1219
|
+
EXAMPLES::
|
1220
|
+
|
1221
|
+
sage: from sage.tests.benchmark import Fibonacci
|
1222
|
+
sage: B = Fibonacci(10)
|
1223
|
+
sage: isinstance(B.libgap()[1], float)
|
1224
|
+
True
|
1225
|
+
"""
|
1226
|
+
n = libgap(self.__n)
|
1227
|
+
t = walltime()
|
1228
|
+
n.Fibonacci()
|
1229
|
+
return False, walltime(t)
|
1230
|
+
|
1231
|
+
def mathematica(self):
|
1232
|
+
"""
|
1233
|
+
Time the computation in Mathematica.
|
1234
|
+
|
1235
|
+
EXAMPLES::
|
1236
|
+
|
1237
|
+
sage: from sage.tests.benchmark import Fibonacci
|
1238
|
+
sage: B = Fibonacci(10)
|
1239
|
+
sage: isinstance(B.mathematica()[1], float) # optional - mathematica
|
1240
|
+
True
|
1241
|
+
"""
|
1242
|
+
n = mathematica(self.__n)
|
1243
|
+
t = walltime()
|
1244
|
+
n.Fibonacci()
|
1245
|
+
return False, walltime(t)
|
1246
|
+
|
1247
|
+
def gp(self):
|
1248
|
+
"""
|
1249
|
+
Time the computation in GP.
|
1250
|
+
|
1251
|
+
EXAMPLES::
|
1252
|
+
|
1253
|
+
sage: from sage.tests.benchmark import Fibonacci
|
1254
|
+
sage: B = Fibonacci(10)
|
1255
|
+
sage: isinstance(B.gp(), float)
|
1256
|
+
True
|
1257
|
+
"""
|
1258
|
+
gp.eval('gettime')
|
1259
|
+
gp('fibonacci(%s)' % self.__n)
|
1260
|
+
return float(gp.eval('gettime/1000.0'))
|
1261
|
+
|
1262
|
+
|
1263
|
+
class SEA(Benchmark):
|
1264
|
+
def __init__(self, p):
|
1265
|
+
self.__p = p
|
1266
|
+
self.repr_str = "Do SEA on an elliptic curve over GF(%s)" % self.__p
|
1267
|
+
|
1268
|
+
def sage(self):
|
1269
|
+
"""
|
1270
|
+
Time the computation in Sage.
|
1271
|
+
|
1272
|
+
EXAMPLES::
|
1273
|
+
|
1274
|
+
sage: from sage.tests.benchmark import SEA
|
1275
|
+
sage: B = SEA(5)
|
1276
|
+
sage: isinstance(B.sage()[1], float)
|
1277
|
+
True
|
1278
|
+
"""
|
1279
|
+
E = EllipticCurve([1, 2, 3, 4, 5])
|
1280
|
+
t = walltime()
|
1281
|
+
# Note that from pari 2.4.3, the SEA algorithm is used by the
|
1282
|
+
# pari library, but only for large primes, so for a better
|
1283
|
+
# test a prime > 2^30 should be used and not 5. In fact
|
1284
|
+
# next_prime(2^100) works fine (<<1s).
|
1285
|
+
E.change_ring(GF(self.__p)).cardinality_pari()
|
1286
|
+
return False, walltime(t)
|
1287
|
+
|
1288
|
+
def magma(self):
|
1289
|
+
"""
|
1290
|
+
Time the computation in Magma.
|
1291
|
+
|
1292
|
+
EXAMPLES::
|
1293
|
+
|
1294
|
+
sage: from sage.tests.benchmark import SEA
|
1295
|
+
sage: B = SEA(5)
|
1296
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
1297
|
+
True
|
1298
|
+
"""
|
1299
|
+
magma(0)
|
1300
|
+
t = magma.cputime()
|
1301
|
+
magma('#EllipticCurve([GF(%s)|1,2,3,4,5])' % (self.__p))
|
1302
|
+
return magma.cputime(t)
|
1303
|
+
|
1304
|
+
|
1305
|
+
class MatrixKernel(Benchmark):
|
1306
|
+
def __init__(self, n, R):
|
1307
|
+
self.__n = n
|
1308
|
+
self.__R = R
|
1309
|
+
self.repr_str = 'Kernel of a matrix of degree %s over %s' % (self.__n, self.__R)
|
1310
|
+
|
1311
|
+
def sage(self):
|
1312
|
+
"""
|
1313
|
+
Time the computation in Sage.
|
1314
|
+
|
1315
|
+
EXAMPLES::
|
1316
|
+
|
1317
|
+
sage: from sage.tests.benchmark import MatrixKernel
|
1318
|
+
sage: B = MatrixKernel(3, QQ)
|
1319
|
+
sage: isinstance(B.sage(), float)
|
1320
|
+
True
|
1321
|
+
"""
|
1322
|
+
R = self.__R
|
1323
|
+
n = self.__n
|
1324
|
+
f = MatrixSpace(R, n, 2 * n)(list(range(n * (2 * n))))
|
1325
|
+
t = cputime()
|
1326
|
+
f.kernel()
|
1327
|
+
return cputime(t)
|
1328
|
+
|
1329
|
+
def magma(self):
|
1330
|
+
"""
|
1331
|
+
Time the computation in Magma.
|
1332
|
+
|
1333
|
+
EXAMPLES::
|
1334
|
+
|
1335
|
+
sage: from sage.tests.benchmark import MatrixKernel
|
1336
|
+
sage: B = MatrixKernel(3, QQ)
|
1337
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
1338
|
+
True
|
1339
|
+
"""
|
1340
|
+
R = magma(self.__R)
|
1341
|
+
f = magma('RMatrixSpace(%s, %s, %s)![0..(%s*2*%s)-1]' % (
|
1342
|
+
R.name(), self.__n, 2 * self.__n, self.__n, self.__n))
|
1343
|
+
t = magma.cputime()
|
1344
|
+
f.Kernel()
|
1345
|
+
return magma.cputime(t)
|
1346
|
+
|
1347
|
+
def gp(self):
|
1348
|
+
"""
|
1349
|
+
Time the computation in GP.
|
1350
|
+
|
1351
|
+
EXAMPLES::
|
1352
|
+
|
1353
|
+
sage: from sage.tests.benchmark import MatrixKernel
|
1354
|
+
sage: B = MatrixKernel(3, QQ)
|
1355
|
+
sage: isinstance(B.gp(), float)
|
1356
|
+
True
|
1357
|
+
"""
|
1358
|
+
n = self.__n
|
1359
|
+
m = gp('matrix(%s,%s,m,n,%s*(m-1)+(n-1))' % (n, 2 * n, n))
|
1360
|
+
gp('gettime')
|
1361
|
+
m.matker()
|
1362
|
+
return float(gp.eval('gettime/1000.0'))
|
1363
|
+
|
1364
|
+
|
1365
|
+
class ComplexMultiply(Benchmark):
|
1366
|
+
def __init__(self, bits_prec, times):
|
1367
|
+
self.__bits_prec = bits_prec
|
1368
|
+
self.__times = times
|
1369
|
+
self.repr_str = "List of multiplies of two complex numbers with %s bits of precision %s times" % (self.__bits_prec, self.__times)
|
1370
|
+
|
1371
|
+
def sage(self):
|
1372
|
+
"""
|
1373
|
+
Time the computation in Sage.
|
1374
|
+
|
1375
|
+
EXAMPLES::
|
1376
|
+
|
1377
|
+
sage: from sage.tests.benchmark import ComplexMultiply
|
1378
|
+
sage: B = ComplexMultiply(28, 2)
|
1379
|
+
sage: isinstance(B.sage(), float)
|
1380
|
+
True
|
1381
|
+
"""
|
1382
|
+
CC = ComplexField(self.__bits_prec)
|
1383
|
+
s = CC(2).sqrt() + (CC.gen() * 2).sqrt()
|
1384
|
+
t = cputime()
|
1385
|
+
[s * s for _ in range(self.__times)]
|
1386
|
+
return cputime(t)
|
1387
|
+
|
1388
|
+
def magma(self):
|
1389
|
+
"""
|
1390
|
+
Time the computation in Magma.
|
1391
|
+
|
1392
|
+
EXAMPLES::
|
1393
|
+
|
1394
|
+
sage: from sage.tests.benchmark import ComplexMultiply
|
1395
|
+
sage: B = ComplexMultiply(28, 2)
|
1396
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
1397
|
+
True
|
1398
|
+
|
1399
|
+
.. NOTE::
|
1400
|
+
|
1401
|
+
decimal digits (despite magma docs that say bits!!)
|
1402
|
+
"""
|
1403
|
+
n = int(self.__bits_prec / log(10, 2)) + 1
|
1404
|
+
CC = magma.ComplexField(n)
|
1405
|
+
s = CC(2).Sqrt() + CC.gen(1).Sqrt()
|
1406
|
+
t = magma.cputime()
|
1407
|
+
magma.eval('s := %s;' % s.name())
|
1408
|
+
magma('[s*s : i in [1..%s]]' % self.__times)
|
1409
|
+
return magma.cputime(t)
|
1410
|
+
|
1411
|
+
def gp(self):
|
1412
|
+
"""
|
1413
|
+
Time the computation in GP.
|
1414
|
+
|
1415
|
+
EXAMPLES::
|
1416
|
+
|
1417
|
+
sage: from sage.tests.benchmark import ComplexMultiply
|
1418
|
+
sage: B = ComplexMultiply(28, 2)
|
1419
|
+
sage: isinstance(B.gp(), float)
|
1420
|
+
True
|
1421
|
+
"""
|
1422
|
+
n = int(self.__bits_prec / log(10, 2)) + 1
|
1423
|
+
gp.set_real_precision(n)
|
1424
|
+
gp.eval('s = sqrt(2) + sqrt(2*I);')
|
1425
|
+
gp.eval('gettime;')
|
1426
|
+
gp('vector(%s,i,s*s)' % self.__times)
|
1427
|
+
return float(gp.eval('gettime/1000.0'))
|
1428
|
+
|
1429
|
+
|
1430
|
+
class ModularSymbols1(Benchmark):
|
1431
|
+
def __init__(self, N, k=2):
|
1432
|
+
self.__N = N
|
1433
|
+
self.__k = k
|
1434
|
+
self.repr_str = 'Presentation for modular symbols on Gamma_0(%s) of weight %s' % (self.__N, self.__k)
|
1435
|
+
|
1436
|
+
def sage(self):
|
1437
|
+
"""
|
1438
|
+
Time the computation in Sage.
|
1439
|
+
|
1440
|
+
EXAMPLES::
|
1441
|
+
|
1442
|
+
sage: from sage.tests.benchmark import ModularSymbols1
|
1443
|
+
sage: B = ModularSymbols1(11)
|
1444
|
+
sage: isinstance(B.sage(), float)
|
1445
|
+
True
|
1446
|
+
"""
|
1447
|
+
t = cputime()
|
1448
|
+
ModularSymbols(self.__N, self.__k)
|
1449
|
+
return cputime(t)
|
1450
|
+
|
1451
|
+
def magma(self):
|
1452
|
+
"""
|
1453
|
+
Time the computation in Magma.
|
1454
|
+
|
1455
|
+
EXAMPLES::
|
1456
|
+
|
1457
|
+
sage: from sage.tests.benchmark import ModularSymbols1
|
1458
|
+
sage: B = ModularSymbols1(11)
|
1459
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
1460
|
+
True
|
1461
|
+
"""
|
1462
|
+
magma = Magma() # new instance since otherwise modsyms are cached, and cache can't be cleared
|
1463
|
+
t = magma.cputime()
|
1464
|
+
magma('ModularSymbols(%s, %s)' % (self.__N, self.__k))
|
1465
|
+
return magma.cputime(t)
|
1466
|
+
|
1467
|
+
|
1468
|
+
class ModularSymbolsDecomp1(Benchmark):
|
1469
|
+
def __init__(self, N, k=2, sign=1, bnd=10):
|
1470
|
+
self.N = N
|
1471
|
+
self.k = k
|
1472
|
+
self.sign = sign
|
1473
|
+
self.bnd = bnd
|
1474
|
+
self.repr_str = 'Decomposition of modular symbols on Gamma_0(%s) of weight %s and sign %s' % (self.N, self.k, self.sign)
|
1475
|
+
|
1476
|
+
def sage(self):
|
1477
|
+
"""
|
1478
|
+
Time the computation in Sage.
|
1479
|
+
|
1480
|
+
EXAMPLES::
|
1481
|
+
|
1482
|
+
sage: from sage.tests.benchmark import ModularSymbolsDecomp1
|
1483
|
+
sage: B = ModularSymbolsDecomp1(11)
|
1484
|
+
sage: isinstance(B.sage(), float)
|
1485
|
+
True
|
1486
|
+
"""
|
1487
|
+
t = cputime()
|
1488
|
+
M = ModularSymbols(self.N, self.k, sign=self.sign, use_cache=False)
|
1489
|
+
M.decomposition(self.bnd)
|
1490
|
+
return cputime(t)
|
1491
|
+
|
1492
|
+
def magma(self):
|
1493
|
+
"""
|
1494
|
+
Time the computation in Magma.
|
1495
|
+
|
1496
|
+
EXAMPLES::
|
1497
|
+
|
1498
|
+
sage: from sage.tests.benchmark import ModularSymbolsDecomp1
|
1499
|
+
sage: B = ModularSymbolsDecomp1(11)
|
1500
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
1501
|
+
True
|
1502
|
+
"""
|
1503
|
+
m = Magma() # new instance since otherwise modsyms are cached, and cache can't be cleared
|
1504
|
+
t = m.cputime()
|
1505
|
+
m.eval('Decomposition(ModularSymbols(%s, %s, %s),%s);' % (
|
1506
|
+
self.N, self.k, self.sign, self.bnd))
|
1507
|
+
return m.cputime(t)
|
1508
|
+
|
1509
|
+
|
1510
|
+
class EllipticCurveTraces(Benchmark):
|
1511
|
+
def __init__(self, B):
|
1512
|
+
self.B = B
|
1513
|
+
self.repr_str = "Compute all a_p for the elliptic curve [1,2,3,4,5], for p < %s" % self.B
|
1514
|
+
|
1515
|
+
def sage(self):
|
1516
|
+
"""
|
1517
|
+
Time the computation in Sage.
|
1518
|
+
|
1519
|
+
EXAMPLES::
|
1520
|
+
|
1521
|
+
sage: from sage.tests.benchmark import EllipticCurveTraces
|
1522
|
+
sage: B = EllipticCurveTraces(11)
|
1523
|
+
sage: isinstance(B.sage(), float)
|
1524
|
+
Traceback (most recent call last):
|
1525
|
+
...
|
1526
|
+
TypeError: ...anlist() got an unexpected keyword argument 'pari_ints'
|
1527
|
+
"""
|
1528
|
+
E = EllipticCurve([1, 2, 3, 4, 5])
|
1529
|
+
t = cputime()
|
1530
|
+
E.anlist(self.B, pari_ints=True)
|
1531
|
+
return cputime(t)
|
1532
|
+
|
1533
|
+
def magma(self):
|
1534
|
+
"""
|
1535
|
+
Time the computation in Magma.
|
1536
|
+
|
1537
|
+
EXAMPLES::
|
1538
|
+
|
1539
|
+
sage: from sage.tests.benchmark import EllipticCurveTraces
|
1540
|
+
sage: B = EllipticCurveTraces(11)
|
1541
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
1542
|
+
True
|
1543
|
+
"""
|
1544
|
+
E = magma.EllipticCurve([1, 2, 3, 4, 5])
|
1545
|
+
t = magma.cputime()
|
1546
|
+
E.TracesOfFrobenius(self.B)
|
1547
|
+
return magma.cputime(t)
|
1548
|
+
|
1549
|
+
|
1550
|
+
class EllipticCurvePointMul(Benchmark):
|
1551
|
+
def __init__(self, n):
|
1552
|
+
self.n = n
|
1553
|
+
self.repr_str = "Compute %s*(0,0) on the elliptic curve [0, 0, 1, -1, 0] over QQ" % self.n
|
1554
|
+
|
1555
|
+
def sage(self):
|
1556
|
+
"""
|
1557
|
+
Time the computation in Sage.
|
1558
|
+
|
1559
|
+
EXAMPLES::
|
1560
|
+
|
1561
|
+
sage: from sage.tests.benchmark import EllipticCurvePointMul
|
1562
|
+
sage: B = EllipticCurvePointMul(11)
|
1563
|
+
sage: isinstance(B.sage(), float)
|
1564
|
+
True
|
1565
|
+
"""
|
1566
|
+
E = EllipticCurve([0, 0, 1, -1, 0])
|
1567
|
+
P = E([0, 0])
|
1568
|
+
t = cputime()
|
1569
|
+
self.n * P
|
1570
|
+
return cputime(t)
|
1571
|
+
|
1572
|
+
def magma(self):
|
1573
|
+
"""
|
1574
|
+
Time the computation in Magma.
|
1575
|
+
|
1576
|
+
EXAMPLES::
|
1577
|
+
|
1578
|
+
sage: from sage.tests.benchmark import EllipticCurvePointMul
|
1579
|
+
sage: B = EllipticCurvePointMul(11)
|
1580
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
1581
|
+
True
|
1582
|
+
"""
|
1583
|
+
E = magma.EllipticCurve('[0, 0, 1, -1, 0]')
|
1584
|
+
P = E('[0,0]')
|
1585
|
+
t = magma.cputime()
|
1586
|
+
magma(self.n) * P
|
1587
|
+
return magma.cputime(t)
|
1588
|
+
|
1589
|
+
def gp(self):
|
1590
|
+
"""
|
1591
|
+
Time the computation in GP.
|
1592
|
+
|
1593
|
+
EXAMPLES::
|
1594
|
+
|
1595
|
+
sage: from sage.tests.benchmark import EllipticCurvePointMul
|
1596
|
+
sage: B = EllipticCurvePointMul(11)
|
1597
|
+
sage: isinstance(B.gp(), float)
|
1598
|
+
True
|
1599
|
+
"""
|
1600
|
+
E = gp.ellinit('[0, 0, 1, -1, 0]')
|
1601
|
+
gp.eval('gettime')
|
1602
|
+
P = gp([0, 0])
|
1603
|
+
E.ellmul(P, self.n)
|
1604
|
+
return float(gp.eval('gettime/1000.0'))
|
1605
|
+
|
1606
|
+
def pari(self):
|
1607
|
+
"""
|
1608
|
+
Time the computation in Pari.
|
1609
|
+
|
1610
|
+
EXAMPLES::
|
1611
|
+
|
1612
|
+
sage: from sage.tests.benchmark import EllipticCurvePointMul
|
1613
|
+
sage: B = EllipticCurvePointMul(11)
|
1614
|
+
sage: isinstance(B.pari(), float)
|
1615
|
+
True
|
1616
|
+
"""
|
1617
|
+
E = pari('ellinit([0, 0, 1, -1, 0])')
|
1618
|
+
pari('gettime')
|
1619
|
+
P = pari([0, 0])
|
1620
|
+
E.ellmul(P, self.n)
|
1621
|
+
return float(pari('gettime/1000.0'))
|
1622
|
+
|
1623
|
+
|
1624
|
+
class EllipticCurveMW(Benchmark):
|
1625
|
+
def __init__(self, ainvs):
|
1626
|
+
self.ainvs = ainvs
|
1627
|
+
self.repr_str = "Compute generators for the Mordell-Weil group of the elliptic curve %s over QQ" % self.ainvs
|
1628
|
+
|
1629
|
+
def sage(self):
|
1630
|
+
"""
|
1631
|
+
Time the computation in Sage.
|
1632
|
+
|
1633
|
+
EXAMPLES::
|
1634
|
+
|
1635
|
+
sage: from sage.tests.benchmark import EllipticCurveMW
|
1636
|
+
sage: B = EllipticCurveMW([1,2,3,4,5])
|
1637
|
+
sage: isinstance(B.sage()[1], float)
|
1638
|
+
True
|
1639
|
+
"""
|
1640
|
+
E = EllipticCurve(self.ainvs)
|
1641
|
+
t = walltime()
|
1642
|
+
E.gens()
|
1643
|
+
return False, walltime(t)
|
1644
|
+
|
1645
|
+
def magma(self):
|
1646
|
+
"""
|
1647
|
+
Time the computation in Magma.
|
1648
|
+
|
1649
|
+
EXAMPLES::
|
1650
|
+
|
1651
|
+
sage: from sage.tests.benchmark import EllipticCurveMW
|
1652
|
+
sage: B = EllipticCurveMW([1,2,3,4,5])
|
1653
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
1654
|
+
True
|
1655
|
+
"""
|
1656
|
+
E = magma.EllipticCurve(str(self.ainvs))
|
1657
|
+
t = magma.cputime()
|
1658
|
+
E.Generators()
|
1659
|
+
return magma.cputime(t)
|
1660
|
+
|
1661
|
+
|
1662
|
+
class FiniteExtFieldMult(Benchmark):
|
1663
|
+
def __init__(self, field, times):
|
1664
|
+
self.__times = times
|
1665
|
+
self.field = field
|
1666
|
+
self.e = field.gen()**(field.cardinality() / 3)
|
1667
|
+
self.f = field.gen()**(2 * field.cardinality() / 3)
|
1668
|
+
self.repr_str = "Multiply a^(#K/3) with a^(2*#K/3) where a == K.gen()"
|
1669
|
+
|
1670
|
+
def sage(self):
|
1671
|
+
"""
|
1672
|
+
Time the computation in Sage.
|
1673
|
+
|
1674
|
+
EXAMPLES::
|
1675
|
+
|
1676
|
+
sage: from sage.tests.benchmark import FiniteExtFieldMult
|
1677
|
+
sage: B = FiniteExtFieldMult(GF(9, 'x'), 2)
|
1678
|
+
sage: isinstance(B.sage(), float)
|
1679
|
+
True
|
1680
|
+
"""
|
1681
|
+
e = self.e
|
1682
|
+
f = self.f
|
1683
|
+
t = cputime()
|
1684
|
+
[e * f for _ in range(self.__times)]
|
1685
|
+
return cputime(t)
|
1686
|
+
|
1687
|
+
def pari(self):
|
1688
|
+
"""
|
1689
|
+
Time the computation in Pari.
|
1690
|
+
|
1691
|
+
EXAMPLES::
|
1692
|
+
|
1693
|
+
sage: from sage.tests.benchmark import FiniteExtFieldMult
|
1694
|
+
sage: B = FiniteExtFieldMult(GF(9, 'x'), 2)
|
1695
|
+
sage: isinstance(B.pari(), float)
|
1696
|
+
True
|
1697
|
+
"""
|
1698
|
+
e = self.e.__pari__()
|
1699
|
+
f = self.f.__pari__()
|
1700
|
+
t = cputime()
|
1701
|
+
[e * f for _ in range(self.__times)]
|
1702
|
+
return cputime(t)
|
1703
|
+
|
1704
|
+
def magma(self):
|
1705
|
+
"""
|
1706
|
+
Time the computation in Magma.
|
1707
|
+
|
1708
|
+
EXAMPLES::
|
1709
|
+
|
1710
|
+
sage: from sage.tests.benchmark import FiniteExtFieldMult
|
1711
|
+
sage: B = FiniteExtFieldMult(GF(9, 'x'), 2)
|
1712
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
1713
|
+
True
|
1714
|
+
"""
|
1715
|
+
magma.eval('F<a> := GF(%s)' % (self.field.cardinality()))
|
1716
|
+
magma.eval('e := a^Floor(%s/3);' % (self.field.cardinality()))
|
1717
|
+
magma.eval('f := a^Floor(2*%s/3);' % (self.field.cardinality()))
|
1718
|
+
t = magma.cputime()
|
1719
|
+
magma('[e*f : i in [1..%s]]' % self.__times)
|
1720
|
+
return magma.cputime(t)
|
1721
|
+
|
1722
|
+
|
1723
|
+
class FiniteExtFieldAdd(Benchmark):
|
1724
|
+
def __init__(self, field, times):
|
1725
|
+
self.__times = times
|
1726
|
+
self.field = field
|
1727
|
+
self.e = field.gen()**(field.cardinality() / 3)
|
1728
|
+
self.f = field.gen()**(2 * field.cardinality() / 3)
|
1729
|
+
self.repr_str = "Add a^(#K/3) to a^(2*#K/3) where a == K.gen()"
|
1730
|
+
|
1731
|
+
def sage(self):
|
1732
|
+
"""
|
1733
|
+
Time the computation in Sage.
|
1734
|
+
|
1735
|
+
EXAMPLES::
|
1736
|
+
|
1737
|
+
sage: from sage.tests.benchmark import FiniteExtFieldAdd
|
1738
|
+
sage: B = FiniteExtFieldAdd(GF(9,'x'), 2)
|
1739
|
+
sage: isinstance(B.sage(), float)
|
1740
|
+
True
|
1741
|
+
"""
|
1742
|
+
e = self.e
|
1743
|
+
f = self.f
|
1744
|
+
t = cputime()
|
1745
|
+
[e + f for _ in range(self.__times)]
|
1746
|
+
return cputime(t)
|
1747
|
+
|
1748
|
+
def pari(self):
|
1749
|
+
"""
|
1750
|
+
Time the computation in Pari.
|
1751
|
+
|
1752
|
+
EXAMPLES::
|
1753
|
+
|
1754
|
+
sage: from sage.tests.benchmark import FiniteExtFieldAdd
|
1755
|
+
sage: B = FiniteExtFieldAdd(GF(9,'x'), 2)
|
1756
|
+
sage: isinstance(B.pari(), float)
|
1757
|
+
True
|
1758
|
+
"""
|
1759
|
+
e = self.e.__pari__()
|
1760
|
+
f = self.f.__pari__()
|
1761
|
+
t = cputime()
|
1762
|
+
[e + f for _ in range(self.__times)]
|
1763
|
+
return cputime(t)
|
1764
|
+
|
1765
|
+
def magma(self):
|
1766
|
+
"""
|
1767
|
+
Time the computation in Magma.
|
1768
|
+
|
1769
|
+
EXAMPLES::
|
1770
|
+
|
1771
|
+
sage: from sage.tests.benchmark import FiniteExtFieldAdd
|
1772
|
+
sage: B = FiniteExtFieldAdd(GF(9,'x'), 2)
|
1773
|
+
sage: isinstance(B.magma(), float) # optional - magma
|
1774
|
+
True
|
1775
|
+
"""
|
1776
|
+
magma.eval('F<a> := GF(%s)' % (self.field.cardinality()))
|
1777
|
+
magma.eval('e := a^Floor(%s/3);' % (self.field.cardinality()))
|
1778
|
+
magma.eval('f := a^Floor(2*%s/3);' % (self.field.cardinality()))
|
1779
|
+
t = magma.cputime()
|
1780
|
+
magma('[e+f : i in [1..%s]]' % self.__times)
|
1781
|
+
return magma.cputime(t)
|
1782
|
+
|
1783
|
+
|
1784
|
+
"""
|
1785
|
+
.. TODO::
|
1786
|
+
|
1787
|
+
* multiply reals
|
1788
|
+
* modular degree
|
1789
|
+
* anlist
|
1790
|
+
* MW group
|
1791
|
+
* symbolic det
|
1792
|
+
* poly factor
|
1793
|
+
* multivariate poly factor
|
1794
|
+
"""
|
1795
|
+
|
1796
|
+
|
1797
|
+
def suite1():
|
1798
|
+
PolySquare(10000, QQ).run()
|
1799
|
+
PolySquare(20000, ZZ).run()
|
1800
|
+
PolySquare(50000, GF(5)).run()
|
1801
|
+
PolySquare(20000, Integers(8)).run()
|
1802
|
+
|
1803
|
+
SquareInts(10, 2000000).run()
|
1804
|
+
|
1805
|
+
MatrixSquare(200, QQ).run()
|
1806
|
+
MatrixSquare(50, ZZ).run()
|
1807
|
+
|
1808
|
+
SquareInts(10, 150000).run()
|
1809
|
+
|
1810
|
+
Factorial(2 * 10**6).run(systems=['sage', 'magma'])
|
1811
|
+
Fibonacci(10**6).run()
|
1812
|
+
Fibonacci(2 * 10**7).run(systems=["sage", "magma", "mathematica"])
|
1813
|
+
|
1814
|
+
MatrixKernel(150, QQ).run()
|
1815
|
+
|
1816
|
+
ComplexMultiply(100000, 1000)
|
1817
|
+
ComplexMultiply(100, 100000)
|
1818
|
+
ComplexMultiply(53, 100000)
|
1819
|
+
|
1820
|
+
PolyFactor(300, ZZ)
|
1821
|
+
PolyFactor(300, GF(19))
|
1822
|
+
PolyFactor(700, GF(19))
|
1823
|
+
|
1824
|
+
PolyFactor(500, GF((9, 2), 'a'))
|
1825
|
+
PolyFactor(100, GF((10007, 3), 'a'))
|
1826
|
+
|
1827
|
+
CharPolyTp(54, 4).run()
|
1828
|
+
CharPolyTp(389, 2).run()
|
1829
|
+
CharPolyTp(389, 2, sign=0, p=3).run()
|
1830
|
+
CharPolyTp(1000, 2, sign=1, p=2).run(systems=['sage', 'magma'])
|
1831
|
+
CharPolyTp(1, 100, sign=1, p=5).run(systems=['sage', 'magma']) # Sage's multimodular really sucks here! (GP is way better, even)
|
1832
|
+
CharPolyTp(512, sign=1, p=3).run(systems=['sage', 'magma', 'gp'])
|
1833
|
+
CharPolyTp(512, sign=0, p=3).run(systems=['sage', 'magma', 'gp'])
|
1834
|
+
CharPolyTp(1024, sign=1, p=3).run(systems=['sage', 'magma', 'gp'])
|
1835
|
+
CharPolyTp(2006, sign=1, p=2).run(systems=['sage', 'magma', 'gp'])
|
1836
|
+
CharPolyTp(2006, sign=1, p=2).run(systems=['sage', 'magma']) # gp takes > 1 minute.
|
1837
|
+
|
1838
|
+
|
1839
|
+
def mpoly():
|
1840
|
+
# This includes a maxima benchmark. Note that
|
1841
|
+
# maxima is *shockingly* slow in comparison to Singular or MAGMA.
|
1842
|
+
# It is so slow as to be useless, basically, i.e., factor
|
1843
|
+
# of 5000 slower than Singular on this example!
|
1844
|
+
MPolynomialPower(nvars=6, exp=10).run()
|
1845
|
+
|
1846
|
+
main = ['sage', 'magma'] # just the main competitors
|
1847
|
+
MPolynomialPower(nvars=2, exp=200, allow_singular=False).run(main)
|
1848
|
+
MPolynomialPower(nvars=5, exp=10, allow_singular=False).run(main)
|
1849
|
+
MPolynomialPower(nvars=5, exp=30, allow_singular=True).run(main)
|
1850
|
+
MPolynomialPower(nvars=2, exp=1000, allow_singular=True).run(main)
|
1851
|
+
MPolynomialPower(nvars=10, exp=10, allow_singular=True).run(main)
|
1852
|
+
MPolynomialPower(nvars=4, exp=350, base=GF(7), allow_singular=True).run(main)
|
1853
|
+
MPolynomialMult(200, allow_singular=False).run(main)
|
1854
|
+
MPolynomialMult(400, allow_singular=True).run(main)
|
1855
|
+
MPolynomialMult(800, allow_singular=True).run(main)
|
1856
|
+
MPolynomialMult2(500, allow_singular=True).run(main)
|
1857
|
+
|
1858
|
+
|
1859
|
+
def mpoly_all(include_maple=False):
|
1860
|
+
"""
|
1861
|
+
Run benchmarks for multipoly arithmetic on all systems (except
|
1862
|
+
Maxima, since it is very very slow). You must have mathematica,
|
1863
|
+
maple, and magma.
|
1864
|
+
|
1865
|
+
.. NOTE::
|
1866
|
+
|
1867
|
+
* maple is depressingly slow on these benchmarks.
|
1868
|
+
* Singular (i.e., Sage) does shockingly well.
|
1869
|
+
* mathematica is sometimes amazing.
|
1870
|
+
* macaulay2 is also quite bad (though not as bad as maple).
|
1871
|
+
|
1872
|
+
EXAMPLES::
|
1873
|
+
|
1874
|
+
sage: from sage.tests.benchmark import mpoly_all
|
1875
|
+
sage: mpoly_all() # not tested
|
1876
|
+
<BLANKLINE>
|
1877
|
+
...
|
1878
|
+
...System min avg max trials cpu or wall
|
1879
|
+
...
|
1880
|
+
* sage...
|
1881
|
+
"""
|
1882
|
+
systems = ['sage', 'magma', 'mathematica', 'macaulay2']
|
1883
|
+
if include_maple:
|
1884
|
+
systems.append('maple')
|
1885
|
+
MPolynomialMult(200).run(systems=systems)
|
1886
|
+
MPolynomialMult(400).run(systems=systems)
|
1887
|
+
MPolynomialMult2(256).run(systems=systems)
|
1888
|
+
MPolynomialMult2(512).run(systems=systems)
|
1889
|
+
MPolynomialPower(nvars=4, exp=50).run(systems=systems) # mathematica wins
|
1890
|
+
MPolynomialPower(nvars=10, exp=10).run(systems=systems)
|
1891
|
+
|
1892
|
+
|
1893
|
+
def modsym_present():
|
1894
|
+
ModularSymbols1(2006, 2)
|
1895
|
+
ModularSymbols1(1, 50)
|
1896
|
+
ModularSymbols1(1, 100)
|
1897
|
+
ModularSymbols1(1, 150)
|
1898
|
+
ModularSymbols1(30, 8)
|
1899
|
+
ModularSymbols1(225, 4)
|
1900
|
+
ModularSymbols1(2, 50)
|
1901
|
+
ModularSymbols1(2, 100)
|
1902
|
+
|
1903
|
+
|
1904
|
+
def modsym_decomp():
|
1905
|
+
ModularSymbolsDecomp1(1, 24).run()
|
1906
|
+
ModularSymbolsDecomp1(125, 2).run()
|
1907
|
+
ModularSymbolsDecomp1(389, 2).run()
|
1908
|
+
ModularSymbolsDecomp1(1, 100).run()
|
1909
|
+
ModularSymbolsDecomp1(54, 4).run()
|
1910
|
+
|
1911
|
+
|
1912
|
+
def elliptic_curve():
|
1913
|
+
EllipticCurveTraces(100000).run()
|
1914
|
+
EllipticCurveTraces(500000).run()
|
1915
|
+
Divpoly(59).run()
|
1916
|
+
EllipticCurvePointMul(1000).run()
|
1917
|
+
EllipticCurvePointMul(2000).run()
|
1918
|
+
EllipticCurvePointMul(2500).run() # sage is clearly using the wrong algorithm -- maybe need a balanced rep!?
|
1919
|
+
|
1920
|
+
# NOTE -- Sage can also do these using Simon's program, which is
|
1921
|
+
# *way* *way* faster than MAGMA...
|
1922
|
+
EllipticCurveMW([5, 6, 7, 8, 9]).run()
|
1923
|
+
EllipticCurveMW([50, 6, 7, 8, 9]).run()
|
1924
|
+
EllipticCurveMW([1, -1, 0, -79, 289]).run(trials=1) # rank 4
|
1925
|
+
EllipticCurveMW([0, 0, 1, -79, 342]).run(trials=1) # rank 5 (Sage wins)
|