# Cython interface to Cremona’s eclib library (also known as mwrank)¶

EXAMPLES:

sage: from sage.libs.eclib.mwrank import _Curvedata, _mw
sage: c = _Curvedata(1,2,3,4,5)

sage: print(c)
[1,2,3,4,5]
b2 = 9       b4 = 11         b6 = 29         b8 = 35
c4 = -183           c6 = -3429
disc = -10351       (# real components = 1)
#torsion not yet computed

sage: t= _mw(c)
sage: t.search(10)
sage: t
[[1:2:1]]

sage.libs.eclib.mwrank.get_precision()

Returns the working floating point bit precision of mwrank, which is equal to the global NTL real number precision.

OUTPUT:

(int) The current precision in bits.

See also set_precision().

EXAMPLES:

sage: mwrank_get_precision()
150

sage.libs.eclib.mwrank.initprimes(filename, verb=False)

Initialises mwrank/eclib’s internal prime list.

INPUT:

• filename (string) – the name of a file of primes.
• verb (bool: default False) – verbose or not?

EXAMPLES:

sage: file = os.path.join(SAGE_TMP, 'PRIMES')
sage: with open(file, 'w') as fobj:
....:     _ = fobj.write(' '.join([str(p) for p in prime_range(10^7,10^7+20)]))
sage: mwrank_initprimes(file, verb=True)
Computed 78519 primes, largest is 1000253
finished reading primes from file ...
Extra primes in list: 10000019

sage: mwrank_initprimes("x" + file, True)
Traceback (most recent call last):
...
IOError: No such file or directory: ...

sage.libs.eclib.mwrank.set_precision(n)

Sets the working floating point bit precision of mwrank, which is equal to the global NTL real number precision.

NTL real number bit precision. This has a massive effect on the speed of mwrank calculations. The default (used if this function is not called) is n=150, but it might have to be increased if a computation fails.

INPUT:

• n – a positive integer: the number of bits of precision.

Warning

This change is global and affects all future calls of eclib functions by Sage.

Note

The minimal value to which the precision may be set is 53. Lower values will be increased to 53.

See also get_precision().

EXAMPLES:

sage: from sage.libs.eclib.mwrank import set_precision, get_precision
sage: old_prec = get_precision(); old_prec
150
sage: set_precision(50)
sage: get_precision()
53
sage: set_precision(old_prec)
sage: get_precision()
150