Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support flint 3.1 in sagelib #37484

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/.relint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@
magic doctest comments should appear on the "sage:" line, not "....:" lines
# see optional_regex in src/sage/doctest/parsing.py
# "indirect doctest" is from src/bin/sage-coverage
pattern: '^[ ]*[.][.][.][.]:.*#.*(arb216|arb218|py2|py3|long time|not implemented|not tested|known bug|optional|indirect doctest)'
pattern: '^[ ]*[.][.][.][.]:.*#.*(py2|py3|long time|not implemented|not tested|known bug|optional|indirect doctest)'
8 changes: 0 additions & 8 deletions src/sage/doctest/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,6 @@

auto_optional_tags = set()

try:
from sage.libs.arb.arb_version import version as arb_vers
arb_tag = 'arb2' + arb_vers().split('.')[1]
auto_optional_tags.add(arb_tag)
except ImportError:
pass


class DocTestDefaults(SageObject):
"""
This class is used for doctesting the Sage doctest module.
Expand Down
4 changes: 1 addition & 3 deletions src/sage/doctest/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def fake_RIFtol(*args):
ansi_escape_sequence = re.compile(r"(\x1b[@-Z\\-~]|\x1b\[.*?[@-~]|\x9b.*?[@-~])")

special_optional_regex = (
"arb216|arb218|py2|long time|not implemented|not tested|optional|needs|known bug"
"py2|long time|not implemented|not tested|optional|needs|known bug"
)
tag_with_explanation_regex = r"((?:\w|[.])*)\s*(?:\((?P<cmd_explanation>.*?)\))?"
optional_regex = re.compile(
Expand Down Expand Up @@ -136,8 +136,6 @@ def parse_optional_tags(
- ``'not tested'``
- ``'known bug'`` (possible values are ``None``, ``linux`` and ``macos``)
- ``'py2'``
- ``'arb216'``
- ``'arb218'``
- ``'optional - FEATURE...'`` or ``'needs FEATURE...'`` --
the dictionary will just have the key ``'FEATURE'``

Expand Down
23 changes: 0 additions & 23 deletions src/sage/libs/arb/arb_version.pyx

This file was deleted.

2 changes: 0 additions & 2 deletions src/sage/libs/flint/flint_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@
#include <flint/hypgeom.h>
#include <flint/long_extras.h>
#include <flint/mag.h>
#include <flint/mpf_mat.h>
#include <flint/mpf_vec.h>
#include <flint/mpfr_mat.h>
#include <flint/mpfr_vec.h>
#include <flint/mpn_extras.h>
Expand Down
2 changes: 0 additions & 2 deletions src/sage/libs/flint/fmpq.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ cdef extern from "flint_wrap.h":
void fmpq_height(fmpz_t height, const fmpq_t x) noexcept
flint_bitcnt_t fmpq_height_bits(const fmpq_t x) noexcept
void fmpq_set_fmpz_frac(fmpq_t res, const fmpz_t p, const fmpz_t q) noexcept
void fmpq_get_mpz_frac(mpz_t a, mpz_t b, fmpq_t c) noexcept
void fmpq_set_si(fmpq_t res, slong p, ulong q) noexcept
void _fmpq_set_si(fmpz_t rnum, fmpz_t rden, slong p, ulong q) noexcept
void fmpq_set_ui(fmpq_t res, ulong p, ulong q) noexcept
void _fmpq_set_ui(fmpz_t rnum, fmpz_t rden, ulong p, ulong q) noexcept
void fmpq_set_mpq(fmpq_t dest, const mpq_t src) noexcept
int fmpq_set_str(fmpq_t dest, const char * s, int base) noexcept
void fmpq_init_set_mpz_frac_readonly(fmpq_t z, const mpz_t p, const mpz_t q) noexcept
double fmpq_get_d(const fmpq_t f) noexcept
void fmpq_get_mpq(mpq_t dest, const fmpq_t src) noexcept
int fmpq_get_mpfr(mpfr_t dest, const fmpq_t src, mpfr_rnd_t rnd) noexcept
Expand Down
8 changes: 2 additions & 6 deletions src/sage/rings/complex_arb.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4792,18 +4792,14 @@ cdef class ComplexBall(RingElement):

sage: n = CBF(1,1)
sage: m = CBF(-2/3, 3/5)
sage: n.elliptic_pi_inc(CBF.pi()/2, m) # arb216
[0.8934793755173 +/- ...e-14] + [0.95707868710750 +/- ...e-15]*I
sage: n.elliptic_pi_inc(CBF.pi()/2, m) # arb218 - this is a regression, see :trac:28623
sage: n.elliptic_pi_inc(CBF.pi()/2, m) # this is a regression, see :trac:28623
nan + nan*I
sage: n.elliptic_pi(m)
[0.8934793755173...] + [0.957078687107...]*I

sage: n = CBF(2, 3/7)
sage: m = CBF(-1/3, 2/9)
sage: n.elliptic_pi_inc(CBF.pi()/2, m) # arb216
[0.2969588746419 +/- ...e-14] + [1.3188795332738 +/- ...e-14]*I
sage: n.elliptic_pi_inc(CBF.pi()/2, m) # arb218 - this is a regression, see :trac:28623
sage: n.elliptic_pi_inc(CBF.pi()/2, m) # this is a regression, see :trac:28623
nan + nan*I
sage: n.elliptic_pi(m)
[0.296958874641...] + [1.318879533273...]*I
Expand Down
12 changes: 2 additions & 10 deletions src/sage/rings/real_arb.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,7 @@ cdef int arb_to_mpfi(mpfi_t target, arb_t source, const long precision) except -

EXAMPLES::

sage: RIF(RBF(2)**(2**100)) # arb216 # indirect doctest
Traceback (most recent call last):
...
ArithmeticError: Error converting arb to mpfi. Overflow?
sage: RIF(RBF(2)**(2**100)) # arb218 # indirect doctest
sage: RIF(RBF(2)**(2**100))
[5.8756537891115869e1388255822130839282 .. +infinity] # 64-bit
[2.098... .. +infinity] # 32-bit

Expand Down Expand Up @@ -1729,11 +1725,7 @@ cdef class RealBall(RingElement):
::

sage: b = RBF(2)^(2^1000)
sage: b.mid() # arb216
Traceback (most recent call last):
...
RuntimeError: unable to convert to MPFR (exponent out of range?)
sage: b.mid() # arb218
sage: b.mid()
+infinity

.. SEEALSO:: :meth:`rad`, :meth:`squash`
Expand Down
3 changes: 0 additions & 3 deletions src/sage/symbolic/ginac/useries-flint.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
#include "flint/fmpq_poly.h"
#include "flint/fmpq.h"

extern "C" void fmpq_get_mpz_frac(mpz_t a, mpz_t b, fmpq_t c);
extern "C" void fmpq_init_set_mpz_frac_readonly(fmpq_t z, const mpz_t p, const mpz_t q);

#include <stdexcept>


Expand Down
6 changes: 4 additions & 2 deletions src/sage/symbolic/ginac/useries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,14 +550,16 @@ void power::useries(flint_series_t& fp, int order) const
mpz_t cnum, cden;
mpz_init(cnum);
mpz_init(cden);
fmpq_get_mpz_frac(cnum, cden, c);
fmpz_get_mpz(cnum, fmpq_numref(c));
fmpz_get_mpz(cden, fmpq_denref(c));
if (not mpz_perfect_square_p(cnum)
or not mpz_perfect_square_p(cden))
throw flint_error();
mpz_sqrt(cnum, cnum);
mpz_sqrt(cden, cden);
fmpq_t cc;
fmpq_init_set_mpz_frac_readonly(cc, cnum, cden);
fmpz_init_set_readonly(fmpq_numref(cc), cnum);
fmpz_init_set_readonly(fmpq_denref(cc), cden);
mpz_clear(cnum);
mpz_clear(cden);

Expand Down
Loading