void-packages/srcpkgs/sagemath/patches/35848-flintlib_3.0.patch

1868 lines
77 KiB
Diff

diff --git a/build/pkgs/antic/SPKG.rst b/build/pkgs/antic/SPKG.rst
deleted file mode 100644
index d6c32377957..00000000000
--- a/build/pkgs/antic/SPKG.rst
+++ /dev/null
@@ -1,18 +0,0 @@
-antic: Algebraic Number Theory In C
-===================================
-
-Description
------------
-
-Algebraic Number Theory In C
-
-License
--------
-
-LGPL 2.1
-
-Upstream Contact
-----------------
-
-https://github.com/wbhart/antic
-
diff --git a/build/pkgs/antic/checksums.ini b/build/pkgs/antic/checksums.ini
deleted file mode 100644
index fc8711ecd13..00000000000
--- a/build/pkgs/antic/checksums.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-tarball=antic-VERSION.tar.gz
-sha1=940d8ea2c3512b9d49ee3101cf043f777764bd8f
-md5=4e896420dd6344b53b307871efb2cbb4
-cksum=1938565125
-upstream_url=https://github.com/wbhart/antic/archive/refs/tags/vVERSION.tar.gz
diff --git a/build/pkgs/antic/dependencies b/build/pkgs/antic/dependencies
deleted file mode 100644
index c95d2836ce5..00000000000
--- a/build/pkgs/antic/dependencies
+++ /dev/null
@@ -1,4 +0,0 @@
-$(MP_LIBRARY) mpfr flint
-
-----------
-All lines of this file are ignored except the first.
diff --git a/build/pkgs/antic/distros/arch.txt b/build/pkgs/antic/distros/arch.txt
deleted file mode 100644
index 83c7cab14e4..00000000000
--- a/build/pkgs/antic/distros/arch.txt
+++ /dev/null
@@ -1 +0,0 @@
-antic
diff --git a/build/pkgs/antic/distros/conda.txt b/build/pkgs/antic/distros/conda.txt
deleted file mode 100644
index 83c7cab14e4..00000000000
--- a/build/pkgs/antic/distros/conda.txt
+++ /dev/null
@@ -1 +0,0 @@
-antic
diff --git a/build/pkgs/antic/distros/debian.txt b/build/pkgs/antic/distros/debian.txt
deleted file mode 100644
index 8fdcd3e5721..00000000000
--- a/build/pkgs/antic/distros/debian.txt
+++ /dev/null
@@ -1 +0,0 @@
-libantic-dev
diff --git a/build/pkgs/antic/distros/fedora.txt b/build/pkgs/antic/distros/fedora.txt
deleted file mode 100644
index 1b16da9f64b..00000000000
--- a/build/pkgs/antic/distros/fedora.txt
+++ /dev/null
@@ -1 +0,0 @@
-antic-devel
diff --git a/build/pkgs/antic/distros/freebsd.txt b/build/pkgs/antic/distros/freebsd.txt
deleted file mode 100644
index 116ff3a26f3..00000000000
--- a/build/pkgs/antic/distros/freebsd.txt
+++ /dev/null
@@ -1 +0,0 @@
-math/antic
diff --git a/build/pkgs/antic/distros/opensuse.txt b/build/pkgs/antic/distros/opensuse.txt
deleted file mode 100644
index 1b16da9f64b..00000000000
--- a/build/pkgs/antic/distros/opensuse.txt
+++ /dev/null
@@ -1 +0,0 @@
-antic-devel
diff --git a/build/pkgs/antic/distros/repology.txt b/build/pkgs/antic/distros/repology.txt
deleted file mode 100644
index 83c7cab14e4..00000000000
--- a/build/pkgs/antic/distros/repology.txt
+++ /dev/null
@@ -1 +0,0 @@
-antic
diff --git a/build/pkgs/antic/package-version.txt b/build/pkgs/antic/package-version.txt
deleted file mode 100644
index 3a4036fb450..00000000000
--- a/build/pkgs/antic/package-version.txt
+++ /dev/null
@@ -1 +0,0 @@
-0.2.5
diff --git a/build/pkgs/antic/spkg-install.in b/build/pkgs/antic/spkg-install.in
deleted file mode 100644
index c57fa884a20..00000000000
--- a/build/pkgs/antic/spkg-install.in
+++ /dev/null
@@ -1,19 +0,0 @@
-cd src
-
-# Copied from build/pkgs/flint/spkg-install.in:
-# Trac #29607: We must always supply --with-gmp, --with-mpfr,
-# --with-ntl because otherwise FLINT's configure script uses
-# /usr/local, which is always wrong.
-# This is why we do not use $SAGE_CONFIGURE_GMP etc. here.
-# The value $SAGE_LOCAL is always a safe choice even if the library
-# is coming from the system and is found using what is in
-# LIBRARY_PATH or LDFLAGS etc.
-./configure \
- --disable-static \
- --prefix="$SAGE_LOCAL" \
- --with-gmp="$SAGE_LOCAL" \
- --with-mpfr="$SAGE_LOCAL" \
- --with-flint="$SAGE_LOCAL" || sdh_die "Error: Failed to configure antic."
-
-sdh_make verbose
-sdh_make_install
diff --git a/build/pkgs/antic/type b/build/pkgs/antic/type
deleted file mode 100644
index 134d9bc32d5..00000000000
--- a/build/pkgs/antic/type
+++ /dev/null
@@ -1 +0,0 @@
-optional
diff --git a/build/pkgs/arb/SPKG.rst b/build/pkgs/arb/SPKG.rst
deleted file mode 100644
index cff49ddb95b..00000000000
--- a/build/pkgs/arb/SPKG.rst
+++ /dev/null
@@ -1,27 +0,0 @@
-arb: Arbitrary-precision floating-point ball arithmetic
-=======================================================
-
-Description
------------
-
-Arb is a C library for arbitrary-precision floating-point ball
-arithmetic, developed by Fredrik Johansson
-(fredrik.johansson@gmail.com). It supports efficient high-precision
-computation with polynomials, power series, matrices and special
-functions over the real and complex numbers, with automatic, rigorous
-error control.
-
-License
--------
-
-GNU General Public License v2+
-
-
-Upstream Contact
-----------------
-
- - Fredrik Johansson: fredrik.johansson@gmail.com
-
- - https://arblib.org/
-
- - http://github.com/fredrik-johansson/arb/
diff --git a/build/pkgs/arb/checksums.ini b/build/pkgs/arb/checksums.ini
deleted file mode 100644
index 80ef43dad5d..00000000000
--- a/build/pkgs/arb/checksums.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-tarball=arb-VERSION.tar.gz
-sha1=a1efe035dd3af3613dd685971a156f652b86ff63
-md5=9b369e29f93cdf2d4f90b57a92526cce
-cksum=64252121
-upstream_url=https://github.com/fredrik-johansson/arb/archive/VERSION.tar.gz
diff --git a/build/pkgs/arb/dependencies b/build/pkgs/arb/dependencies
deleted file mode 100644
index c95d2836ce5..00000000000
--- a/build/pkgs/arb/dependencies
+++ /dev/null
@@ -1,4 +0,0 @@
-$(MP_LIBRARY) mpfr flint
-
-----------
-All lines of this file are ignored except the first.
diff --git a/build/pkgs/arb/distros/arch.txt b/build/pkgs/arb/distros/arch.txt
deleted file mode 100644
index 86c41dbaa5f..00000000000
--- a/build/pkgs/arb/distros/arch.txt
+++ /dev/null
@@ -1 +0,0 @@
-arb
diff --git a/build/pkgs/arb/distros/conda.txt b/build/pkgs/arb/distros/conda.txt
deleted file mode 100644
index 86c41dbaa5f..00000000000
--- a/build/pkgs/arb/distros/conda.txt
+++ /dev/null
@@ -1 +0,0 @@
-arb
diff --git a/build/pkgs/arb/distros/debian.txt b/build/pkgs/arb/distros/debian.txt
deleted file mode 100644
index 9fe71110712..00000000000
--- a/build/pkgs/arb/distros/debian.txt
+++ /dev/null
@@ -1 +0,0 @@
-libflint-arb-dev
diff --git a/build/pkgs/arb/distros/fedora.txt b/build/pkgs/arb/distros/fedora.txt
deleted file mode 100644
index 76794404627..00000000000
--- a/build/pkgs/arb/distros/fedora.txt
+++ /dev/null
@@ -1 +0,0 @@
-arb arb-devel
diff --git a/build/pkgs/arb/distros/freebsd.txt b/build/pkgs/arb/distros/freebsd.txt
deleted file mode 100644
index 2ef8c7cec0f..00000000000
--- a/build/pkgs/arb/distros/freebsd.txt
+++ /dev/null
@@ -1 +0,0 @@
-math/arb
diff --git a/build/pkgs/arb/distros/gentoo.txt b/build/pkgs/arb/distros/gentoo.txt
deleted file mode 100644
index 58e3d4f8008..00000000000
--- a/build/pkgs/arb/distros/gentoo.txt
+++ /dev/null
@@ -1 +0,0 @@
-sci-mathematics/arb
diff --git a/build/pkgs/arb/distros/homebrew.txt b/build/pkgs/arb/distros/homebrew.txt
deleted file mode 100644
index 86c41dbaa5f..00000000000
--- a/build/pkgs/arb/distros/homebrew.txt
+++ /dev/null
@@ -1 +0,0 @@
-arb
diff --git a/build/pkgs/arb/distros/nix.txt b/build/pkgs/arb/distros/nix.txt
deleted file mode 100644
index 86c41dbaa5f..00000000000
--- a/build/pkgs/arb/distros/nix.txt
+++ /dev/null
@@ -1 +0,0 @@
-arb
diff --git a/build/pkgs/arb/distros/opensuse.txt b/build/pkgs/arb/distros/opensuse.txt
deleted file mode 100644
index 3319855150c..00000000000
--- a/build/pkgs/arb/distros/opensuse.txt
+++ /dev/null
@@ -1 +0,0 @@
-arb-devel
diff --git a/build/pkgs/arb/distros/repology.txt b/build/pkgs/arb/distros/repology.txt
deleted file mode 100644
index 179c9d507e1..00000000000
--- a/build/pkgs/arb/distros/repology.txt
+++ /dev/null
@@ -1 +0,0 @@
-arb-fp
diff --git a/build/pkgs/arb/distros/void.txt b/build/pkgs/arb/distros/void.txt
deleted file mode 100644
index 3319855150c..00000000000
--- a/build/pkgs/arb/distros/void.txt
+++ /dev/null
@@ -1 +0,0 @@
-arb-devel
diff --git a/build/pkgs/arb/package-version.txt b/build/pkgs/arb/package-version.txt
deleted file mode 100644
index e9763f6bfed..00000000000
--- a/build/pkgs/arb/package-version.txt
+++ /dev/null
@@ -1 +0,0 @@
-2.23.0
diff --git a/build/pkgs/arb/spkg-check.in b/build/pkgs/arb/spkg-check.in
deleted file mode 100644
index 27cd9419538..00000000000
--- a/build/pkgs/arb/spkg-check.in
+++ /dev/null
@@ -1,2 +0,0 @@
-cd src
-$MAKE check
diff --git a/build/pkgs/arb/spkg-configure.m4 b/build/pkgs/arb/spkg-configure.m4
deleted file mode 100644
index ef2dd0aac4a..00000000000
--- a/build/pkgs/arb/spkg-configure.m4
+++ /dev/null
@@ -1,23 +0,0 @@
-SAGE_SPKG_CONFIGURE([arb], [
- AC_REQUIRE([SAGE_SPKG_CONFIGURE_FLINT])
- SAGE_ARB_LIBRARY="arb"
- AC_MSG_CHECKING([installing flint? ])
- if test x$sage_spkg_install_flint = xyes; then
- AC_MSG_RESULT([yes; install arb as well])
- sage_spkg_install_arb=yes
- else
- AC_CHECK_HEADER(arb.h, [
- dnl below function added in version 2.16 of arb
- AC_CHECK_LIB([arb], [acb_mat_eig_simple], [],
- [dnl in Debian the name of dylib is different.
- AC_CHECK_LIB([flint-arb], [acb_mat_eig_simple],
- [SAGE_ARB_LIBRARY="flint-arb"], [sage_spkg_install_arb=yes])])
- ], [sage_spkg_install_arb=yes])
- fi
-], [], [], [
- if test x$sage_spkg_install_arb = xyes; then
- AC_SUBST(SAGE_ARB_LIBRARY,["arb"])
- else
- AC_SUBST(SAGE_ARB_LIBRARY,[$SAGE_ARB_LIBRARY])
- fi
-])
diff --git a/build/pkgs/arb/spkg-install.in b/build/pkgs/arb/spkg-install.in
deleted file mode 100644
index 9322f04c912..00000000000
--- a/build/pkgs/arb/spkg-install.in
+++ /dev/null
@@ -1,17 +0,0 @@
-cd src
-
-# Trac #29607: We must always supply --with-gmp, --with-mpfr,
-# --with-flint because otherwise ARB's configure script uses
-# /usr/local, which is always wrong.
-# This is why we do not use $SAGE_CONFIGURE_GMP etc. here.
-# The value $SAGE_LOCAL is always a safe choice even if the library
-# is coming from the system and is found using what is in
-# LIBRARY_PATH or LDFLAGS etc.
-./configure --disable-static --prefix="$SAGE_LOCAL" \
- --with-gmp="$SAGE_LOCAL" \
- --with-mpfr="$SAGE_LOCAL" \
- --with-flint="$SAGE_LOCAL" || \
- sdh_die "Error configuring arb."
-
-sdh_make verbose
-sdh_make_install
diff --git a/build/pkgs/arb/type b/build/pkgs/arb/type
deleted file mode 100644
index a6a7b9cd726..00000000000
--- a/build/pkgs/arb/type
+++ /dev/null
@@ -1 +0,0 @@
-standard
diff --git a/build/pkgs/e_antic/dependencies b/build/pkgs/e_antic/dependencies
index fea1ffbda45..8e977a55c13 100644
--- a/build/pkgs/e_antic/dependencies
+++ b/build/pkgs/e_antic/dependencies
@@ -1,4 +1,4 @@
-$(MP_LIBRARY) flint arb antic boost_cropped
+$(MP_LIBRARY) flint boost_cropped
----------
All lines of this file are ignored except the first.
diff --git a/build/pkgs/flint/SPKG.rst b/build/pkgs/flint/SPKG.rst
index f91de70d1ff..d9dcea0903b 100644
--- a/build/pkgs/flint/SPKG.rst
+++ b/build/pkgs/flint/SPKG.rst
@@ -4,8 +4,8 @@ flint: Fast Library for Number Theory
Description
-----------
-FLINT is a C library for doing number theory, maintained by William
-Hart.
+FLINT is a C library for doing number theory, maintained by
+Fredrik Johansson.
Website: http://www.flintlib.org
@@ -20,4 +20,4 @@ Upstream Contact
- flint-devel Gougle Group
(http://groups.google.co.uk/group/flint-devel)
-- William Hart
+- Fredrik Johansson
diff --git a/build/pkgs/flint/checksums.ini b/build/pkgs/flint/checksums.ini
index 3d449d98064..ab836606657 100644
--- a/build/pkgs/flint/checksums.ini
+++ b/build/pkgs/flint/checksums.ini
@@ -1,5 +1,5 @@
tarball=flint-VERSION.tar.gz
-sha1=63d90f8242c8f8ab4011fbcfb44b86c154f43abd
-md5=c2d3cec326438f159a530c66eb07fafe
-cksum=4244948341
-upstream_url=http://flintlib.org/flint-VERSION.tar.gz
+sha1=65be9297c06edd7e24f20874b7bd6130cee56723
+md5=5189f67b0ec12e4a54d6782851642b81
+cksum=172350473
+upstream_url=https://github.com/flintlib/flint/releases/download/vVERSION/flint-VERSION.tar.gz
diff --git a/build/pkgs/flint/dependencies b/build/pkgs/flint/dependencies
index 385df4faa7d..1108dc4fb21 100644
--- a/build/pkgs/flint/dependencies
+++ b/build/pkgs/flint/dependencies
@@ -1,4 +1,4 @@
-$(MP_LIBRARY) mpfr ntl
+$(MP_LIBRARY) mpfr
----------
All lines of this file are ignored except the first.
diff --git a/build/pkgs/flint/package-version.txt b/build/pkgs/flint/package-version.txt
index c8e38b61405..cb2b00e4f7a 100644
--- a/build/pkgs/flint/package-version.txt
+++ b/build/pkgs/flint/package-version.txt
@@ -1 +1 @@
-2.9.0
+3.0.1
diff --git a/build/pkgs/flint/patches/0001-Makefile.in-fix-handling-of-DESTDIR.patch b/build/pkgs/flint/patches/0001-Makefile.in-fix-handling-of-DESTDIR.patch
new file mode 100644
index 00000000000..48a32f5d894
--- /dev/null
+++ b/build/pkgs/flint/patches/0001-Makefile.in-fix-handling-of-DESTDIR.patch
@@ -0,0 +1,106 @@
+From 54277f054f13254898c9a57c2c7eb869877e1252 Mon Sep 17 00:00:00 2001
+From: Marc Mezzarobba <marc@mezzarobba.net>
+Date: Mon, 13 Nov 2023 10:23:54 +0100
+Subject: [PATCH] Makefile.in: fix handling of $DESTDIR
+
+---
+ Makefile.in | 54 ++++++++++++++++++++++++++---------------------------
+ 1 file changed, 27 insertions(+), 27 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 08db6837c..2827b9da1 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -34,9 +34,9 @@ FLINT_SOLIB:=@FLINT_SOLIB@
+ prefix:=@prefix@
+ exec_prefix:=@exec_prefix@
+
+-INCLUDEDIR:=$(DESTDIR)@includedir@
+-LIBDIR:=$(DESTDIR)@libdir@
+-BINDIR:=$(DESTDIR)@bindir@
++INCLUDEDIR:=@includedir@
++LIBDIR:=@libdir@
++BINDIR:=@bindir@
+ PKGCONFIGDIR:=$(LIBDIR)/pkgconfig
+
+ HOST_OS:=@host_os@
+@@ -202,10 +202,10 @@ BUILD_DIRS += \
+ endif
+
+ INSTALL_DIRS := \
+- $(LIBDIR) $(INCLUDEDIR)/flint \
+- $(PKGCONFIGDIR)
++ $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCLUDEDIR)/flint \
++ $(DESTDIR)$(PKGCONFIGDIR)
+ ifneq ($(FLINT_DLLLIB),0)
+-INSTALL_DIRS += $(BINDIR)
++INSTALL_DIRS += $(DESTDIR)$(BINDIR)
+ endif
+
+ ################################################################################
+@@ -722,41 +722,41 @@ distclean: clean
+ ################################################################################
+
+ install: library | $(INSTALL_DIRS)
+- $(CP) flint.pc $(PKGCONFIGDIR)/flint.pc
++ $(CP) flint.pc $(DESTDIR)$(PKGCONFIGDIR)/flint.pc
+ ifneq ($(SHARED), 0)
+ ifneq ($(FLINT_DLLLIB),0)
+- $(CP_A) $(FLINT_DIR)/$(FLINT_LIB) $(BINDIR)
+- $(CP_A) $(FLINT_DIR)/$(FLINT_LIB_MAJOR) $(BINDIR)
+- $(CP_A) $(FLINT_DIR)/$(FLINT_LIB_FULL) $(BINDIR)
+- $(CP) $(FLINT_DIR)/$(FLINT_IMPLIB) $(LIBDIR)
++ $(CP_A) $(FLINT_DIR)/$(FLINT_LIB) $(DESTDIR)$(BINDIR)
++ $(CP_A) $(FLINT_DIR)/$(FLINT_LIB_MAJOR) $(DESTDIR)$(BINDIR)
++ $(CP_A) $(FLINT_DIR)/$(FLINT_LIB_FULL) $(DESTDIR)$(BINDIR)
++ $(CP) $(FLINT_DIR)/$(FLINT_IMPLIB) $(DESTDIR)$(LIBDIR)
+ else
+- $(CP_A) $(FLINT_DIR)/$(FLINT_LIB) $(LIBDIR)
+- $(CP_A) $(FLINT_DIR)/$(FLINT_LIB_MAJOR) $(LIBDIR)
+- $(CP_A) $(FLINT_DIR)/$(FLINT_LIB_FULL) $(LIBDIR)
++ $(CP_A) $(FLINT_DIR)/$(FLINT_LIB) $(DESTDIR)$(LIBDIR)
++ $(CP_A) $(FLINT_DIR)/$(FLINT_LIB_MAJOR) $(DESTDIR)$(LIBDIR)
++ $(CP_A) $(FLINT_DIR)/$(FLINT_LIB_FULL) $(DESTDIR)$(LIBDIR)
+ endif
+ ifneq ($(FLINT_DYLIB),0)
+- install_name_tool -id $(LIBDIR)/$(FLINT_LIB_FULL) $(LIBDIR)/$(FLINT_LIB)
++ install_name_tool -id $(LIBDIR)/$(FLINT_LIB_FULL) $(DESTDIR)$(LIBDIR)/$(FLINT_LIB)
+ endif
+ endif
+ ifneq ($(STATIC), 0)
+- $(CP) $(FLINT_DIR)/$(FLINT_LIB_STATIC) $(LIBDIR)
++ $(CP) $(FLINT_DIR)/$(FLINT_LIB_STATIC) $(DESTDIR)$(LIBDIR)
+ endif
+- $(CP) $(HEADERS) $(INCLUDEDIR)/flint
++ $(CP) $(HEADERS) $(DESTDIR)$(INCLUDEDIR)/flint
+
+ uninstall:
+- $(RM_F) $(PKGCONFIGDIR)/flint.pc
++ $(RM_F) $(DESTDIR)$(PKGCONFIGDIR)/flint.pc
+ ifneq ($(FLINT_DLLLIB),0)
+- $(RM_F) $(BINDIR)/$(FLINT_LIB)
+- $(RM_F) $(BINDIR)/$(FLINT_LIB_MAJOR)
+- $(RM_F) $(BINDIR)/$(FLINT_LIB_FULL)
+- $(RM_F) $(LIBDIR)/$(FLINT_IMPLIB)
++ $(RM_F) $(DESTDIR)$(BINDIR)/$(FLINT_LIB)
++ $(RM_F) $(DESTDIR)$(BINDIR)/$(FLINT_LIB_MAJOR)
++ $(RM_F) $(DESTDIR)$(BINDIR)/$(FLINT_LIB_FULL)
++ $(RM_F) $(DESTDIR)$(LIBDIR)/$(FLINT_IMPLIB)
+ else
+- $(RM_F) $(LIBDIR)/$(FLINT_LIB)
+- $(RM_F) $(LIBDIR)/$(FLINT_LIB_MAJOR)
+- $(RM_F) $(LIBDIR)/$(FLINT_LIB_FULL)
++ $(RM_F) $(DESTDIR)$(LIBDIR)/$(FLINT_LIB)
++ $(RM_F) $(DESTDIR)$(LIBDIR)/$(FLINT_LIB_MAJOR)
++ $(RM_F) $(DESTDIR)$(LIBDIR)/$(FLINT_LIB_FULL)
+ endif
+- $(RM_F) $(LIBDIR)/$(FLINT_LIB_STATIC)
+- $(RM_RF) $(INCLUDEDIR)/flint
++ $(RM_F) $(DESTDIR)$(LIBDIR)/$(FLINT_LIB_STATIC)
++ $(RM_RF) $(DESTDIR)$(INCLUDEDIR)/flint
+
+ ################################################################################
+ # maintainer stuff
+--
+2.42.0
+
diff --git a/build/pkgs/flint/spkg-build.in b/build/pkgs/flint/spkg-build.in
new file mode 100644
index 00000000000..ffb822c8a97
--- /dev/null
+++ b/build/pkgs/flint/spkg-build.in
@@ -0,0 +1,3 @@
+cd src
+sdh_configure
+sdh_make
diff --git a/build/pkgs/flint/spkg-configure.m4 b/build/pkgs/flint/spkg-configure.m4
index a58108c9d6e..9576e4cc1e9 100644
--- a/build/pkgs/flint/spkg-configure.m4
+++ b/build/pkgs/flint/spkg-configure.m4
@@ -1,25 +1,8 @@
SAGE_SPKG_CONFIGURE([flint], [
- SAGE_SPKG_DEPCHECK([mpfr ntl], [
+ SAGE_SPKG_DEPCHECK([mpfr], [
AC_CHECK_HEADER(flint/flint.h, [
- dnl flint_parallel_binary_splitting appears in Flint 2.9.0, needed by arb 2.23
- AC_SEARCH_LIBS([flint_parallel_binary_splitting], [flint], [
- dnl check that NTL is linked in
- AC_SEARCH_LIBS([fmpz_poly_get_ZZX], [flint], [
-
- AC_MSG_CHECKING([that GC is not enabled in Flint... ])
- AC_RUN_IFELSE([
- AC_LANG_PROGRAM([[#include <flint/flint.h>]], [
- [#ifdef HAVE_GC]
- [return HAVE_GC;]
- [#else]
- [return 0;]
- [#endif]])],
- [AC_MSG_RESULT([GC not enabled. Good.])],
- [AC_MSG_RESULT([GC enabled. Incompatible with Sage.])
- sage_spkg_install_flint=yes],
- [AC_MSG_RESULT(["cross compiling. assuming GC is not enabled"])])
- ], [sage_spkg_install_flint=yes])
- ], [sage_spkg_install_flint=yes])
+ dnl gr_get_fexpr appears in Flint 3.0
+ AC_SEARCH_LIBS([gr_get_fexpr], [flint], [], [sage_spkg_install_flint=yes])
], [sage_spkg_install_flint=yes])
])
], [], [], [
diff --git a/build/pkgs/flint/spkg-install.in b/build/pkgs/flint/spkg-install.in
index eacd7b6e491..3ea8c053669 100644
--- a/build/pkgs/flint/spkg-install.in
+++ b/build/pkgs/flint/spkg-install.in
@@ -1,36 +1,2 @@
-###############################################################################
-#
-# FLINT Sage install script
-#
-###############################################################################
-if [ "$SAGE_DEBUG" = "yes" ]; then
- echo "Building a debug version of FLINT."
- FLINT_TUNE=" $FLINT_TUNE"; export FLINT_TUNE
- FLINT_CONFIGURE="--enable-assert $FLINT_CONFIGURE"
-fi
-
cd src
-
-echo "Configuring FLINT."
-# Trac #29607: We must always supply --with-gmp, --with-mpfr,
-# --with-ntl because otherwise FLINT's configure script uses
-# /usr/local, which is always wrong.
-# This is why we do not use $SAGE_CONFIGURE_GMP etc. here.
-# The value $SAGE_LOCAL is always a safe choice even if the library
-# is coming from the system and is found using what is in
-# LIBRARY_PATH or LDFLAGS etc.
-./configure \
- --disable-static \
- --prefix="$SAGE_LOCAL" \
- --with-gmp="$SAGE_LOCAL" \
- --with-mpfr="$SAGE_LOCAL" \
- --with-ntl="$SAGE_LOCAL" \
- $FLINT_CONFIGURE || sdh_die "Error: Failed to configure FLINT."
-
-sdh_make verbose
-
-echo "Deleting old FLINT files."
-rm -f $SAGE_LOCAL/lib/libflint*
-rm -rf $SAGE_LOCAL/include/flint
-
sdh_make_install
diff --git a/build/pkgs/gmp/spkg-configure.m4 b/build/pkgs/gmp/spkg-configure.m4
index 61d7c5f3b2f..4000200db2c 100644
--- a/build/pkgs/gmp/spkg-configure.m4
+++ b/build/pkgs/gmp/spkg-configure.m4
@@ -2,8 +2,10 @@ SAGE_SPKG_CONFIGURE([gmp], [
sage_spkg_install_gmp=no
AC_CHECK_HEADER(gmp.h, [], [sage_spkg_install_gmp=yes])
AC_CHECK_HEADER(gmpxx.h, [], [sage_spkg_install_gmp=yes])
- dnl mpq_cmp_z appeared in GMP 6.1.0 and is used by pynac
- AC_SEARCH_LIBS([__gmpq_cmp_z], [gmp], [],
+ dnl mpn_gcd_11 appeared in GMP 6.2.1
+ dnl It is undocumented but is used by Flint when built with default
+ dnl flags.
+ AC_SEARCH_LIBS([__gmpn_gcd_11], [gmp], [],
[sage_spkg_install_gmp=yes])
], [], [], [
if test x$sage_spkg_install_gmp = xyes; then
diff --git a/build/pkgs/msolve/patches/0001-Make-msolve-build-with-flint3.patch b/build/pkgs/msolve/patches/0001-Make-msolve-build-with-flint3.patch
new file mode 100644
index 00000000000..27a642a13b0
--- /dev/null
+++ b/build/pkgs/msolve/patches/0001-Make-msolve-build-with-flint3.patch
@@ -0,0 +1,53 @@
+From fe730579476de0b2d4181a38efa7f63dff9c81d7 Mon Sep 17 00:00:00 2001
+From: Marc Mezzarobba <marc@mezzarobba.net>
+Date: Tue, 12 Sep 2023 08:23:08 +0200
+Subject: [PATCH] Make msolve build with flint3
+
+---
+ src/fglm/berlekamp_massey.c | 3 +++
+ src/fglm/data_fglm.c | 7 +++++--
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/src/fglm/berlekamp_massey.c b/src/fglm/berlekamp_massey.c
+index b0f2052..998af1c 100644
+--- a/src/fglm/berlekamp_massey.c
++++ b/src/fglm/berlekamp_massey.c
+@@ -30,6 +30,9 @@
+ */
+
+ #include <stdlib.h>
++#if __FLINT_VERSION >= 3
++# include <flint/nmod.h>
++#endif
+ //#include "nmod_poly.h"
+ //#include "mpn_extras.h"
+
+diff --git a/src/fglm/data_fglm.c b/src/fglm/data_fglm.c
+index 0726760..0e1da6f 100644
+--- a/src/fglm/data_fglm.c
++++ b/src/fglm/data_fglm.c
+@@ -24,6 +24,7 @@
+ #include <flint/mpn_extras.h>
+ #include <flint/nmod_poly.h>
+ #include <flint/nmod_poly_factor.h>
++#include <flint/ulong_extras.h>
+
+
+ typedef uint32_t szmat_t;
+@@ -299,9 +300,11 @@ static inline void nmod_poly_set_prime(nmod_poly_t poly,
+ mp_limb_t ninv = n_preinvert_limb(prime);
+ poly->mod.n = prime;
+ poly->mod.ninv = ninv;
++#if __FLINT_VERSION < 3
+ count_leading_zeros(poly->mod.norm, prime);
+- /* poly->mod.norm = flint_clz(prime); */
+-
++#else
++ poly->mod.norm = flint_clz(prime);
++#endif
+ }
+
+ static inline void fglm_param_set_prime(param_t *param, mp_limb_t prime){
+--
+2.40.1
+
diff --git a/build/pkgs/sagelib/dependencies b/build/pkgs/sagelib/dependencies
index 5dc2efe1d31..fa6e98df7db 100644
--- a/build/pkgs/sagelib/dependencies
+++ b/build/pkgs/sagelib/dependencies
@@ -1,4 +1,4 @@
-FORCE $(SCRIPTS) arb boost_cropped $(BLAS) brial cliquer cypari cysignals cython ecl eclib ecm flint libgd gap giac givaro glpk gmpy2 gsl iml importlib_metadata importlib_resources jupyter_core lcalc lrcalc_python libbraiding libhomfly libpng linbox m4ri m4rie memory_allocator mpc mpfi mpfr $(MP_LIBRARY) ntl numpy pari pip pkgconfig planarity ppl pplpy primesieve primecount primecountpy pycygwin $(PYTHON) requests rw sage_conf singular symmetrica typing_extensions $(PCFILES) | $(PYTHON_TOOLCHAIN) sage_setup $(PYTHON) pythran
+FORCE $(SCRIPTS) boost_cropped $(BLAS) brial cliquer cypari cysignals cython ecl eclib ecm flint libgd gap giac givaro glpk gmpy2 gsl iml importlib_metadata importlib_resources jupyter_core lcalc lrcalc_python libbraiding libhomfly libpng linbox m4ri m4rie memory_allocator mpc mpfi mpfr $(MP_LIBRARY) ntl numpy pari pip pkgconfig planarity ppl pplpy primesieve primecount primecountpy pycygwin $(PYTHON) requests rw sage_conf singular symmetrica typing_extensions $(PCFILES) | $(PYTHON_TOOLCHAIN) sage_setup $(PYTHON) pythran
----------
All lines of this file are ignored except the first.
diff --git a/build/pkgs/symengine/dependencies b/build/pkgs/symengine/dependencies
index 1fc34963eda..7795d486018 100644
--- a/build/pkgs/symengine/dependencies
+++ b/build/pkgs/symengine/dependencies
@@ -1,4 +1,4 @@
-$(MP_LIBRARY) arb ecm flint mpc mpfr | cmake
+$(MP_LIBRARY) ecm flint mpc mpfr | cmake
----------
All lines of this file are ignored except the first.
diff --git a/pkgs/sage-conf/_sage_conf/_conf.py.in b/pkgs/sage-conf/_sage_conf/_conf.py.in
index 87b27ca05cb..895d6572d1e 100644
--- a/pkgs/sage-conf/_sage_conf/_conf.py.in
+++ b/pkgs/sage-conf/_sage_conf/_conf.py.in
@@ -19,8 +19,6 @@ MAXIMA_FAS = "@SAGE_MAXIMA_FAS@".replace('${prefix}', SAGE_LOCAL)
# Delete this line if your ECL can load Kenzo without further prodding.
KENZO_FAS = "@SAGE_KENZO_FAS@".replace('${prefix}', SAGE_LOCAL)
-ARB_LIBRARY = "@SAGE_ARB_LIBRARY@"
-
NTL_INCDIR = "@NTL_INCDIR@"
NTL_LIBDIR = "@NTL_LIBDIR@"
diff --git a/src/sage/env.py b/src/sage/env.py
index 4515e90e912..9ab6b1e1864 100644
--- a/src/sage/env.py
+++ b/src/sage/env.py
@@ -223,7 +223,6 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st
FOURTITWO_PPI = var("FOURTITWO_PPI")
FOURTITWO_CIRCUITS = var("FOURTITWO_CIRCUITS")
FOURTITWO_GROEBNER = var("FOURTITWO_GROEBNER")
-ARB_LIBRARY = var("ARB_LIBRARY", "arb")
CBLAS_PC_MODULES = var("CBLAS_PC_MODULES", "cblas:openblas:blas")
ECL_CONFIG = var("ECL_CONFIG", "ecl-config")
NTL_INCDIR = var("NTL_INCDIR")
@@ -356,8 +355,7 @@ def cython_aliases(required_modules=None,
sage: cython_aliases()
{...}
sage: sorted(cython_aliases().keys())
- ['ARB_LIBRARY',
- 'CBLAS_CFLAGS',
+ ['CBLAS_CFLAGS',
...,
'ZLIB_LIBRARIES']
sage: cython_aliases(required_modules=('module-that-is-assumed-to-not-exist'))
@@ -475,8 +473,6 @@ def uname_specific(name, value, alternative):
if "LINBOX_CFLAGS" in aliases:
aliases["LINBOX_CFLAGS"].append("-std=gnu++11")
- aliases["ARB_LIBRARY"] = ARB_LIBRARY
-
# TODO: Remove Cygwin hack by installing a suitable cblas.pc
if os.path.exists('/usr/lib/libblas.dll.a'):
aliases["CBLAS_LIBS"] = ['gslcblas']
diff --git a/src/sage/features/sagemath.py b/src/sage/features/sagemath.py
index bc34d35dd1c..4097d3512b9 100644
--- a/src/sage/features/sagemath.py
+++ b/src/sage/features/sagemath.py
@@ -777,7 +777,7 @@ class sage__rings__number_field(JoinFeature):
A :class:`~sage.features.Feature` describing the presence of :mod:`sage.rings.number_field`.
Number fields are implemented in Sage using a complicated mixture of various libraries,
- including :ref:`arb <spkg_arb>`, :ref:`FLINT <spkg_flint>`, :ref:`GAP <spkg_gap>`,
+ including :ref:`FLINT <spkg_flint>`, :ref:`GAP <spkg_gap>`,
:ref:`MPFI <spkg_mpfi>`, :ref:`NTL <spkg_ntl>`, and :ref:`PARI <spkg_pari>`.
EXAMPLES:
diff --git a/src/sage/libs/arb/acb.pxd b/src/sage/libs/arb/acb.pxd
index 5148dc43991..851488d803a 100644
--- a/src/sage/libs/arb/acb.pxd
+++ b/src/sage/libs/arb/acb.pxd
@@ -1,4 +1,4 @@
-# distutils: libraries = gmp flint ARB_LIBRARY
+# distutils: libraries = gmp flint
# distutils: depends = acb.h
from sage.libs.arb.types cimport *
@@ -152,10 +152,6 @@ cdef extern from "arb_wrap.h":
void acb_sech(acb_t s, const acb_t z, long prec)
void acb_csch(acb_t c, const acb_t z, long prec)
- void acb_rising_ui_bs(acb_t z, const acb_t x, unsigned long n, long prec)
- void acb_rising_ui_rs(acb_t z, const acb_t x, unsigned long n, unsigned long step, long prec)
- void acb_rising_ui_rec(acb_t z, const acb_t x, unsigned long n, long prec)
- void acb_rising_ui(acb_t z, const acb_t x, unsigned long n, long prec)
void acb_rising(acb_t z, const acb_t x, const acb_t n, long prec)
void acb_gamma(acb_t y, const acb_t x, long prec)
diff --git a/src/sage/libs/arb/acb_calc.pxd b/src/sage/libs/arb/acb_calc.pxd
index a5dbf360b5e..67bd2ed57dc 100644
--- a/src/sage/libs/arb/acb_calc.pxd
+++ b/src/sage/libs/arb/acb_calc.pxd
@@ -1,4 +1,4 @@
-# distutils: libraries = gmp flint ARB_LIBRARY
+# distutils: libraries = gmp flint
# distutils: depends = acb_calc.h
from sage.libs.arb.types cimport *
diff --git a/src/sage/libs/arb/acb_elliptic.pxd b/src/sage/libs/arb/acb_elliptic.pxd
index 176f68df00e..e3480e9f73b 100644
--- a/src/sage/libs/arb/acb_elliptic.pxd
+++ b/src/sage/libs/arb/acb_elliptic.pxd
@@ -1,4 +1,4 @@
-# distutils: libraries = gmp flint ARB_LIBRARY
+# distutils: libraries = gmp flint
# distutils: depends = acb_elliptic.h
from sage.libs.arb.types cimport *
diff --git a/src/sage/libs/arb/acb_hypgeom.pxd b/src/sage/libs/arb/acb_hypgeom.pxd
index 418e766f10d..c43e5c0623b 100644
--- a/src/sage/libs/arb/acb_hypgeom.pxd
+++ b/src/sage/libs/arb/acb_hypgeom.pxd
@@ -1,4 +1,4 @@
-# distutils: libraries = gmp flint ARB_LIBRARY
+# distutils: libraries = gmp flint
# distutils: depends = acb_hypgeom.h
from sage.libs.arb.types cimport *
diff --git a/src/sage/libs/arb/acb_modular.pxd b/src/sage/libs/arb/acb_modular.pxd
index c708e9bf97d..cdc413c92da 100644
--- a/src/sage/libs/arb/acb_modular.pxd
+++ b/src/sage/libs/arb/acb_modular.pxd
@@ -1,4 +1,4 @@
-# distutils: libraries = gmp flint ARB_LIBRARY
+# distutils: libraries = gmp flint
# distutils: depends = acb_modular.h
from sage.libs.arb.types cimport *
diff --git a/src/sage/libs/arb/acb_poly.pxd b/src/sage/libs/arb/acb_poly.pxd
index 69f4320055b..ae02757ffd9 100644
--- a/src/sage/libs/arb/acb_poly.pxd
+++ b/src/sage/libs/arb/acb_poly.pxd
@@ -1,4 +1,4 @@
-# distutils: libraries = gmp flint ARB_LIBRARY
+# distutils: libraries = gmp flint
# distutils: depends = acb_poly.h
from sage.libs.arb.types cimport *
@@ -79,24 +79,10 @@ cdef extern from "arb_wrap.h":
void _acb_poly_divrem(acb_ptr Q, acb_ptr R, acb_srcptr A, long lenA, acb_srcptr B, long lenB, long prec)
bint acb_poly_divrem(acb_poly_t Q, acb_poly_t R, const acb_poly_t A, const acb_poly_t B, long prec)
void _acb_poly_div_root(acb_ptr Q, acb_t R, acb_srcptr A, long len, const acb_t c, long prec)
- void _acb_poly_taylor_shift_horner(acb_ptr g, const acb_t c, long n, long prec)
- void acb_poly_taylor_shift_horner(acb_poly_t g, const acb_poly_t f, const acb_t c, long prec)
- void _acb_poly_taylor_shift_divconquer(acb_ptr g, const acb_t c, long n, long prec)
- void acb_poly_taylor_shift_divconquer(acb_poly_t g, const acb_poly_t f, const acb_t c, long prec)
- void _acb_poly_taylor_shift_convolution(acb_ptr g, const acb_t c, long n, long prec)
- void acb_poly_taylor_shift_convolution(acb_poly_t g, const acb_poly_t f, const acb_t c, long prec)
void _acb_poly_taylor_shift(acb_ptr g, const acb_t c, long n, long prec)
void acb_poly_taylor_shift(acb_poly_t g, const acb_poly_t f, const acb_t c, long prec)
- void _acb_poly_compose_horner(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long prec)
- void acb_poly_compose_horner(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec)
- void _acb_poly_compose_divconquer(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long prec)
- void acb_poly_compose_divconquer(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec)
void _acb_poly_compose(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long prec)
void acb_poly_compose(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec)
- void _acb_poly_compose_series_horner(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec)
- void acb_poly_compose_series_horner(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec)
- void _acb_poly_compose_series_brent_kung(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec)
- void acb_poly_compose_series_brent_kung(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec)
void _acb_poly_compose_series(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec)
void acb_poly_compose_series(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec)
void _acb_poly_revert_series_lagrange(acb_ptr h, acb_srcptr f, long flen, long n, long prec)
@@ -161,10 +147,6 @@ cdef extern from "arb_wrap.h":
void acb_poly_exp_series_basecase(acb_poly_t f, const acb_poly_t h, long n, long prec)
void _acb_poly_exp_series(acb_ptr f, acb_srcptr h, long hlen, long n, long prec)
void acb_poly_exp_series(acb_poly_t f, const acb_poly_t h, long n, long prec)
- void _acb_poly_sin_cos_series_basecase(acb_ptr s, acb_ptr c, acb_srcptr h, long hlen, long n, long prec, int times_pi)
- void acb_poly_sin_cos_series_basecase(acb_poly_t s, acb_poly_t c, const acb_poly_t h, long n, long prec, int times_pi)
- void _acb_poly_sin_cos_series_tangent(acb_ptr s, acb_ptr c, acb_srcptr h, long hlen, long n, long prec, int times_pi)
- void acb_poly_sin_cos_series_tangent(acb_poly_t s, acb_poly_t c, const acb_poly_t h, long n, long prec, int times_pi)
void _acb_poly_sin_cos_series(acb_ptr s, acb_ptr c, acb_srcptr h, long hlen, long n, long prec)
void acb_poly_sin_cos_series(acb_poly_t s, acb_poly_t c, const acb_poly_t h, long n, long prec)
void _acb_poly_sin_series(acb_ptr s, acb_srcptr h, long hlen, long n, long prec)
diff --git a/src/sage/libs/arb/arb.pxd b/src/sage/libs/arb/arb.pxd
index c82b94de30f..acd232ab816 100644
--- a/src/sage/libs/arb/arb.pxd
+++ b/src/sage/libs/arb/arb.pxd
@@ -1,4 +1,4 @@
-# distutils: libraries = gmp flint ARB_LIBRARY
+# distutils: libraries = gmp flint
# distutils: depends = arb.h
from sage.libs.arb.types cimport *
@@ -224,15 +224,8 @@ cdef extern from "arb_wrap.h":
void arb_lambertw(arb_t res, const arb_t x, int flags, long prec)
- void arb_rising_ui_bs(arb_t z, const arb_t x, unsigned long n, long prec)
- void arb_rising_ui_rs(arb_t z, const arb_t x, unsigned long n, unsigned long step, long prec)
- void arb_rising_ui_rec(arb_t z, const arb_t x, unsigned long n, long prec)
- void arb_rising_ui(arb_t z, const arb_t x, unsigned long n, long prec)
void arb_rising(arb_t z, const arb_t x, const arb_t n, long prec)
void arb_rising_fmpq_ui(arb_t z, const fmpq_t x, unsigned long n, long prec)
- void arb_rising2_ui_bs(arb_t u, arb_t v, const arb_t x, unsigned long n, long prec)
- void arb_rising2_ui_rs(arb_t u, arb_t v, const arb_t x, unsigned long n, unsigned long step, long prec)
- void arb_rising2_ui(arb_t u, arb_t v, const arb_t x, unsigned long n, long prec)
void arb_fac_ui(arb_t z, unsigned long n, long prec)
void arb_bin_ui(arb_t z, const arb_t n, unsigned long k, long prec)
void arb_bin_uiui(arb_t z, unsigned long n, unsigned long k, long prec)
diff --git a/src/sage/libs/arb/arb_fmpz_poly.pxd b/src/sage/libs/arb/arb_fmpz_poly.pxd
index 079f76e9d9e..55daa705238 100644
--- a/src/sage/libs/arb/arb_fmpz_poly.pxd
+++ b/src/sage/libs/arb/arb_fmpz_poly.pxd
@@ -1,4 +1,4 @@
-# distutils: libraries = gmp flint ARB_LIBRARY
+# distutils: libraries = gmp flint
# distutils: depends = arb_fmpz_poly.h
from sage.libs.arb.types cimport *
@@ -22,5 +22,4 @@ cdef extern from "arb_wrap.h":
unsigned long arb_fmpz_poly_deflation(const fmpz_poly_t poly)
void arb_fmpz_poly_deflate(fmpz_poly_t res, const fmpz_poly_t poly, unsigned long deflation)
void arb_fmpz_poly_complex_roots(acb_ptr roots, const fmpz_poly_t poly, int flags, long prec)
- void arb_fmpz_poly_cos_minpoly(fmpz_poly_t res, unsigned long n)
void arb_fmpz_poly_gauss_period_minpoly(fmpz_poly_t res, unsigned long q, unsigned long n)
diff --git a/src/sage/libs/arb/arb_hypgeom.pxd b/src/sage/libs/arb/arb_hypgeom.pxd
index fb1c40ddaa8..139b987d669 100644
--- a/src/sage/libs/arb/arb_hypgeom.pxd
+++ b/src/sage/libs/arb/arb_hypgeom.pxd
@@ -1,4 +1,4 @@
-# distutils: libraries = gmp flint ARB_LIBRARY
+# distutils: libraries = gmp flint
# distutils: depends = arb_hypgeom.h
from sage.libs.flint.types cimport fmpz_t
diff --git a/src/sage/libs/arb/arb_wrap.h b/src/sage/libs/arb/arb_wrap.h
index 49997075ee5..488bb376d5e 100644
--- a/src/sage/libs/arb/arb_wrap.h
+++ b/src/sage/libs/arb/arb_wrap.h
@@ -5,25 +5,27 @@
* by arb, most of which rely on flint's ulong and slong defines.
*/
+#include <mpfr.h>
+
#undef ulong
#undef slong
#define ulong mp_limb_t
#define slong mp_limb_signed_t
-#include <acb.h>
-#include <acb_calc.h>
-#include <acb_elliptic.h>
-#include <acb_hypgeom.h>
-#include <acb_mat.h>
-#include <acb_modular.h>
-#include <acb_poly.h>
-#include <arb.h>
-#include <arb_fmpz_poly.h>
-#include <arb_hypgeom.h>
-#include <arf.h>
-#include <bernoulli.h>
-#include <mag.h>
+#include <flint/acb.h>
+#include <flint/acb_calc.h>
+#include <flint/acb_elliptic.h>
+#include <flint/acb_hypgeom.h>
+#include <flint/acb_mat.h>
+#include <flint/acb_modular.h>
+#include <flint/acb_poly.h>
+#include <flint/arb.h>
+#include <flint/arb_fmpz_poly.h>
+#include <flint/arb_hypgeom.h>
+#include <flint/arf.h>
+#include <flint/bernoulli.h>
+#include <flint/mag.h>
#undef ulong
#undef slong
diff --git a/src/sage/libs/arb/arf.pxd b/src/sage/libs/arb/arf.pxd
index b8b83fefcdc..84778fe9f09 100644
--- a/src/sage/libs/arb/arf.pxd
+++ b/src/sage/libs/arb/arf.pxd
@@ -1,4 +1,4 @@
-# distutils: libraries = gmp flint ARB_LIBRARY
+# distutils: libraries = gmp flint
# distutils: depends = arf.h
from sage.libs.arb.types cimport *
@@ -30,7 +30,6 @@ cdef extern from "arb_wrap.h":
void arf_set_ui(arf_t y, unsigned long x)
void arf_set_si(arf_t y, long x)
void arf_set_mpfr(arf_t y, const mpfr_t x)
- # void arf_set_fmpr(arf_t y, const fmpr_t x)
void arf_set_d(arf_t y, double x)
void arf_swap(arf_t y, arf_t x)
void arf_init_set_ui(arf_t y, unsigned long x)
@@ -46,7 +45,6 @@ cdef extern from "arb_wrap.h":
int arf_set_round_fmpz_2exp(arf_t y, const fmpz_t x, const fmpz_t e, long prec, arf_rnd_t rnd)
void arf_get_fmpz_2exp(fmpz_t m, fmpz_t e, const arf_t x)
double arf_get_d(const arf_t x, arf_rnd_t rnd)
- # void arf_get_fmpr(fmpr_t y, const arf_t x)
int arf_get_mpfr(mpfr_t y, const arf_t x, mpfr_rnd_t rnd)
void arf_get_fmpz(fmpz_t z, const arf_t x, arf_rnd_t rnd)
long arf_get_si(const arf_t x, arf_rnd_t rnd)
diff --git a/src/sage/libs/arb/bernoulli.pxd b/src/sage/libs/arb/bernoulli.pxd
index f859ebfb8d7..95a84dd5179 100644
--- a/src/sage/libs/arb/bernoulli.pxd
+++ b/src/sage/libs/arb/bernoulli.pxd
@@ -1,4 +1,4 @@
-# distutils: libraries = gmp flint ARB_LIBRARY
+# distutils: libraries = gmp flint
# distutils: depends = bernoulli.h
from sage.libs.flint.types cimport fmpq_t, ulong
diff --git a/src/sage/libs/arb/mag.pxd b/src/sage/libs/arb/mag.pxd
index d5d8693ea8f..69dfb990ae0 100644
--- a/src/sage/libs/arb/mag.pxd
+++ b/src/sage/libs/arb/mag.pxd
@@ -1,4 +1,4 @@
-# distutils: libraries = gmp flint ARB_LIBRARY
+# distutils: libraries = gmp flint
# distutils: depends = mag.h
from sage.libs.arb.types cimport *
@@ -27,13 +27,11 @@ cdef extern from "arb_wrap.h":
# void mag_randtest(mag_t x, flint_rand_t state, long expbits)
# void mag_randtest_special(mag_t x, flint_rand_t state, long expbits)
void mag_set_d(mag_t y, double x)
- # void mag_set_fmpr(mag_t y, const fmpr_t x)
void mag_set_ui(mag_t y, unsigned long x)
void mag_set_fmpz(mag_t y, const fmpz_t x)
void mag_set_d_2exp_fmpz(mag_t z, double x, const fmpz_t y)
void mag_set_fmpz_2exp_fmpz(mag_t z, const fmpz_t x, const fmpz_t y)
void mag_set_ui_2exp_si(mag_t z, unsigned long x, long y)
- # void mag_get_fmpr(fmpr_t y, const mag_t x)
void mag_get_fmpq(fmpq_t y, const mag_t x)
void mag_set_ui_lower(mag_t z, unsigned long x)
void mag_set_fmpz_lower(mag_t z, const fmpz_t x)
diff --git a/src/sage/libs/flint/flint_wrap.h b/src/sage/libs/flint/flint_wrap.h
index 266535c3835..4db72b97660 100644
--- a/src/sage/libs/flint/flint_wrap.h
+++ b/src/sage/libs/flint/flint_wrap.h
@@ -15,6 +15,7 @@
*/
#include <gmp.h>
+#include <mpfr.h>
/* Save previous definition of ulong if any, as pari also uses it */
/* Should work on GCC, clang, MSVC */
@@ -33,6 +34,7 @@
#include <flint/arith.h>
#include <flint/fmpq.h>
+#include <flint/fmpq_vec.h>
#include <flint/fmpq_mat.h>
#include <flint/fmpq_poly.h>
#include <flint/fmpz.h>
@@ -47,6 +49,7 @@
#include <flint/fq.h>
#include <flint/fq_nmod.h>
#include <flint/nmod_poly.h>
+#include <flint/nmod_poly_factor.h>
#include <flint/nmod_vec.h>
#include <flint/padic.h>
#include <flint/padic_poly.h>
diff --git a/src/sage/libs/flint/fmpq.pxd b/src/sage/libs/flint/fmpq.pxd
index 5e64c82102f..0616c0a7408 100644
--- a/src/sage/libs/flint/fmpq.pxd
+++ b/src/sage/libs/flint/fmpq.pxd
@@ -12,6 +12,8 @@ cdef extern from "flint_wrap.h":
fmpz * fmpq_denref(fmpq_t)
void fmpq_init(fmpq_t)
void fmpq_clear(fmpq_t)
+ void fmpq_init_set_readonly(fmpq_t, const mpq_t)
+ void fmpq_clear_readonly(fmpq_t)
void fmpq_one(fmpq_t)
void fmpq_zero(fmpq_t)
bint fmpq_is_zero(fmpq_t)
diff --git a/src/sage/libs/flint/fmpq_poly.pxd b/src/sage/libs/flint/fmpq_poly.pxd
index 6050c487835..afa16e5bbdd 100644
--- a/src/sage/libs/flint/fmpq_poly.pxd
+++ b/src/sage/libs/flint/fmpq_poly.pxd
@@ -30,6 +30,9 @@ cdef extern from "flint_wrap.h":
void fmpq_poly_canonicalise(fmpq_poly_t)
int fmpq_poly_is_canonical(const fmpq_poly_t)
+ void _fmpq_poly_set_length(fmpq_poly_t, slong)
+ void _fmpq_poly_normalise(fmpq_poly_t)
+
# Polynomial parameters
slong fmpq_poly_degree(const fmpq_poly_t)
ulong fmpq_poly_length(const fmpq_poly_t)
@@ -46,10 +49,7 @@ cdef extern from "flint_wrap.h":
void fmpq_poly_set_ui(fmpq_poly_t, ulong)
void fmpq_poly_set_fmpz(fmpq_poly_t, const fmpz_t)
void fmpq_poly_set_fmpq(fmpq_poly_t, const fmpq_t)
- void fmpq_poly_set_mpz(fmpq_poly_t, const mpz_t)
- void fmpq_poly_set_mpq(fmpq_poly_t, const mpq_t)
void fmpq_poly_set_fmpz_poly(fmpq_poly_t, const fmpz_poly_t)
- void fmpq_poly_set_array_mpq(fmpq_poly_t, const mpq_t *, slong)
void fmpq_poly_set_str(fmpq_poly_t, const char *)
char *fmpq_poly_get_str(const fmpq_poly_t)
@@ -67,7 +67,6 @@ cdef extern from "flint_wrap.h":
void fmpq_poly_reverse(fmpq_poly_t, const fmpq_poly_t, slong)
void fmpq_poly_get_coeff_fmpq(fmpq_t, const fmpq_poly_t, slong)
- void fmpq_poly_get_coeff_mpq(mpq_t, const fmpq_poly_t, slong)
void fmpq_poly_get_coeff_si(slong, const fmpq_poly_t, slong)
void fmpq_poly_get_coeff_ui(ulong, const fmpq_poly_t, slong)
@@ -75,8 +74,6 @@ cdef extern from "flint_wrap.h":
void fmpq_poly_set_coeff_ui(fmpq_poly_t, slong, ulong)
void fmpq_poly_set_coeff_fmpz(fmpq_poly_t, slong, const fmpz_t)
void fmpq_poly_set_coeff_fmpq(fmpq_poly_t, slong, const fmpq_t)
- void fmpq_poly_set_coeff_mpz(fmpq_poly_t, slong, const mpz_t)
- void fmpq_poly_set_coeff_mpq(fmpq_poly_t, slong, const mpq_t)
# Comparison
int fmpq_poly_equal(const fmpq_poly_t, const fmpq_poly_t)
@@ -100,8 +97,6 @@ cdef extern from "flint_wrap.h":
fmpq_poly_t, const fmpq_poly_t, const fmpz_t)
void fmpq_poly_scalar_mul_fmpq(
fmpq_poly_t, const fmpq_poly_t, const fmpq_t)
- void fmpq_poly_scalar_mul_mpz(fmpq_poly_t, const fmpq_poly_t, const mpz_t)
- void fmpq_poly_scalar_mul_mpq(fmpq_poly_t, const fmpq_poly_t, const mpq_t)
void fmpq_poly_scalar_div_si(fmpq_poly_t, const fmpq_poly_t, slong)
void fmpq_poly_scalar_div_ui(fmpq_poly_t, const fmpq_poly_t, ulong)
@@ -109,8 +104,6 @@ cdef extern from "flint_wrap.h":
fmpq_poly_t, const fmpq_poly_t, const fmpz_t)
void fmpq_poly_scalar_div_fmpq(
fmpq_poly_t, const fmpq_poly_t, const fmpq_t)
- void fmpq_poly_scalar_div_mpz(fmpq_poly_t, const fmpq_poly_t, const mpz_t)
- void fmpq_poly_scalar_div_mpq(fmpq_poly_t, const fmpq_poly_t, const mpq_t)
# Multiplication
void fmpq_poly_mul(fmpq_poly_t, const fmpq_poly_t, const fmpq_poly_t)
@@ -155,8 +148,6 @@ cdef extern from "flint_wrap.h":
# Evaluation
void fmpq_poly_evaluate_fmpz(fmpq_t, const fmpq_poly_t, const fmpz_t)
void fmpq_poly_evaluate_fmpq(fmpq_t, const fmpq_poly_t, const fmpq_t)
- void fmpq_poly_evaluate_mpz(mpq_t, const fmpq_poly_t, const mpz_t)
- void fmpq_poly_evaluate_mpq(mpq_t, const fmpq_poly_t, const mpq_t)
# Composition
void fmpq_poly_compose(fmpq_poly_t, const fmpq_poly_t, const fmpq_poly_t)
@@ -189,3 +180,11 @@ cdef extern from "flint_wrap.h":
# since the fmpq_poly header seems to be lacking this inline function
cdef inline sage_fmpq_poly_max_limbs(const fmpq_poly_t poly) noexcept:
return _fmpz_vec_max_limbs(fmpq_poly_numref(poly), fmpq_poly_length(poly))
+
+# functions removed from flint but still needed in sage
+cdef void fmpq_poly_scalar_mul_mpz(fmpq_poly_t, const fmpq_poly_t, const mpz_t)
+cdef void fmpq_poly_scalar_mul_mpq(fmpq_poly_t, const fmpq_poly_t, const mpq_t)
+cdef void fmpq_poly_set_coeff_mpq(fmpq_poly_t, slong, const mpq_t)
+cdef void fmpq_poly_get_coeff_mpq(mpq_t, const fmpq_poly_t, slong)
+cdef void fmpq_poly_set_mpz(fmpq_poly_t, const mpz_t)
+cdef void fmpq_poly_set_mpq(fmpq_poly_t, const mpq_t)
diff --git a/src/sage/libs/flint/fmpq_poly.pyx b/src/sage/libs/flint/fmpq_poly.pyx
new file mode 100644
index 00000000000..3b8a0cf0c51
--- /dev/null
+++ b/src/sage/libs/flint/fmpq_poly.pyx
@@ -0,0 +1,45 @@
+# Functions removed from flint but still needed in Sage. Code adapted from
+# earlier versions of flint.
+
+from sage.libs.gmp.mpq cimport *
+from sage.libs.flint.fmpz cimport *
+from sage.libs.flint.fmpq cimport *
+
+cdef void fmpq_poly_scalar_mul_mpz(fmpq_poly_t rop, const fmpq_poly_t op, const mpz_t c):
+ cdef fmpz_t f
+ fmpz_init_set_readonly(f, c)
+ fmpq_poly_scalar_mul_fmpz(rop, op, f)
+ fmpz_clear_readonly(f)
+
+cdef void fmpq_poly_scalar_mul_mpq(fmpq_poly_t rop, const fmpq_poly_t op, const mpq_t c):
+ cdef fmpq_t f
+ fmpq_init_set_readonly(f, c)
+ fmpq_poly_scalar_mul_fmpq(rop, op, f)
+ fmpq_clear_readonly(f)
+
+cdef void fmpq_poly_set_coeff_mpq(fmpq_poly_t poly, slong n, const mpq_t x):
+ cdef fmpq_t t
+ fmpq_init_set_readonly(t, x)
+ fmpq_poly_set_coeff_fmpq(poly, n, t)
+ fmpq_clear_readonly(t)
+
+cdef void fmpq_poly_get_coeff_mpq(mpq_t x, const fmpq_poly_t poly, slong n):
+ cdef fmpq_t t
+ fmpq_init(t)
+ fmpq_poly_get_coeff_fmpq(t, poly, n)
+ fmpq_get_mpq(x, t)
+ fmpq_clear(t)
+
+cdef void fmpq_poly_set_mpq(fmpq_poly_t poly, const mpq_t x):
+ fmpq_poly_fit_length(poly, 1)
+ fmpz_set_mpz(fmpq_poly_numref(poly), mpq_numref(x))
+ fmpz_set_mpz(fmpq_poly_denref(poly), mpq_denref(x))
+ _fmpq_poly_set_length(poly, 1)
+ _fmpq_poly_normalise(poly)
+
+cdef void fmpq_poly_set_mpz(fmpq_poly_t poly, const mpz_t x):
+ fmpq_poly_fit_length(poly, 1)
+ fmpz_set_mpz(fmpq_poly_numref(poly), x)
+ fmpz_one(fmpq_poly_denref(poly))
+ _fmpq_poly_set_length(poly, 1)
+ _fmpq_poly_normalise(poly)
diff --git a/src/sage/libs/flint/fmpz.pxd b/src/sage/libs/flint/fmpz.pxd
index 01058d0f130..b97fbe1eae0 100644
--- a/src/sage/libs/flint/fmpz.pxd
+++ b/src/sage/libs/flint/fmpz.pxd
@@ -16,6 +16,9 @@ cdef extern from "flint_wrap.h":
void fmpz_init_set(fmpz_t, fmpz_t)
void fmpz_init_set_ui(fmpz_t, ulong)
+ void fmpz_init_set_readonly(fmpz_t, const mpz_t)
+ void fmpz_clear_readonly(fmpz_t)
+
# Conversion
void fmpz_set(fmpz_t f, fmpz_t g)
void fmpz_set_ui(fmpz_t, ulong)
diff --git a/src/sage/libs/flint/fmpz_mod_poly.pxd b/src/sage/libs/flint/fmpz_mod_poly.pxd
index 24b653eb3b7..2727246da98 100644
--- a/src/sage/libs/flint/fmpz_mod_poly.pxd
+++ b/src/sage/libs/flint/fmpz_mod_poly.pxd
@@ -67,13 +67,6 @@ cdef extern from "flint_wrap.h":
void fmpz_mod_poly_get_coeff_fmpz(fmpz_t x, const fmpz_mod_poly_t poly,
slong n, const fmpz_mod_ctx_t ctx)
- void fmpz_mod_poly_set_coeff_mpz(fmpz_mod_poly_t poly,
- slong n, const mpz_t x, const fmpz_mod_ctx_t ctx)
-
- void fmpz_mod_poly_get_coeff_mpz(mpz_t x,
- const fmpz_mod_poly_t poly, slong n, const fmpz_mod_ctx_t ctx)
-
-
void _fmpz_mod_poly_shift_left(fmpz * res, const fmpz * poly,
slong len, slong n)
@@ -194,14 +187,6 @@ cdef extern from "flint_wrap.h":
const fmpz_mod_poly_t A, const fmpz_mod_poly_t B,
const fmpz_mod_ctx_t ctx)
- void fmpz_mod_poly_div_basecase(fmpz_mod_poly_t Q,
- const fmpz_mod_poly_t A, const fmpz_mod_poly_t B,
- const fmpz_mod_ctx_t ctx)
-
- void fmpz_mod_poly_div_newton_n_preinv(fmpz_mod_poly_t Q,
- const fmpz_mod_poly_t A, const fmpz_mod_poly_t B,
- const fmpz_mod_poly_t Binv, const fmpz_mod_ctx_t ctx)
-
void fmpz_mod_poly_divrem_newton_n_preinv(fmpz_mod_poly_t Q,
fmpz_mod_poly_t R, const fmpz_mod_poly_t A, const fmpz_mod_poly_t B,
const fmpz_mod_poly_t Binv, const fmpz_mod_ctx_t ctx)
@@ -213,10 +198,6 @@ cdef extern from "flint_wrap.h":
const fmpz_mod_poly_t A, const fmpz_mod_poly_t B,
const fmpz_mod_ctx_t ctx)
- void fmpz_mod_poly_divrem_divconquer(fmpz_mod_poly_t Q,
- fmpz_mod_poly_t R, const fmpz_mod_poly_t A, const fmpz_mod_poly_t B,
- const fmpz_mod_ctx_t ctx)
-
void fmpz_mod_poly_divrem(fmpz_mod_poly_t Q, fmpz_mod_poly_t R,
const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, const fmpz_mod_ctx_t ctx)
@@ -254,40 +235,13 @@ cdef extern from "flint_wrap.h":
void fmpz_mod_poly_make_monic_f(fmpz_t f, fmpz_mod_poly_t res,
const fmpz_mod_poly_t poly, const fmpz_mod_ctx_t ctx)
- void fmpz_mod_poly_gcd_euclidean(fmpz_mod_poly_t G,
- const fmpz_mod_poly_t A, const fmpz_mod_poly_t B,
- const fmpz_mod_ctx_t ctx)
-
- void fmpz_mod_poly_gcd_euclidean_f(fmpz_t f, fmpz_mod_poly_t G,
- const fmpz_mod_poly_t A, const fmpz_mod_poly_t B,
- const fmpz_mod_ctx_t ctx)
-
void fmpz_mod_poly_gcd_f(fmpz_t f, fmpz_mod_poly_t G, const fmpz_mod_poly_t A,
const fmpz_mod_poly_t B, const fmpz_mod_ctx_t ctx)
- void fmpz_mod_poly_gcd_hgcd(fmpz_mod_poly_t G,
- const fmpz_mod_poly_t A, const fmpz_mod_poly_t B,
- const fmpz_mod_ctx_t ctx)
-
-
void fmpz_mod_poly_gcd(fmpz_mod_poly_t G, const fmpz_mod_poly_t A,
const fmpz_mod_poly_t B, const fmpz_mod_ctx_t ctx)
- void fmpz_mod_poly_xgcd_euclidean(fmpz_mod_poly_t G,
- fmpz_mod_poly_t S, fmpz_mod_poly_t T,
- const fmpz_mod_poly_t A, const fmpz_mod_poly_t B,
- const fmpz_mod_ctx_t ctx)
-
- void fmpz_mod_poly_xgcd_euclidean_f(fmpz_t f, fmpz_mod_poly_t G,
- fmpz_mod_poly_t S, fmpz_mod_poly_t T,
- const fmpz_mod_poly_t A, const fmpz_mod_poly_t B,
- const fmpz_mod_ctx_t ctx)
-
- void fmpz_mod_poly_xgcd_hgcd(fmpz_mod_poly_t G, fmpz_mod_poly_t S,
- fmpz_mod_poly_t T, const fmpz_mod_poly_t A, const fmpz_mod_poly_t B,
- const fmpz_mod_ctx_t ctx)
-
void fmpz_mod_poly_xgcd(fmpz_mod_poly_t G, fmpz_mod_poly_t S, fmpz_mod_poly_t T,
const fmpz_mod_poly_t A, const fmpz_mod_poly_t B,
const fmpz_mod_ctx_t ctx)
@@ -361,14 +315,6 @@ cdef extern from "flint_wrap.h":
const fmpz_mod_poly_t poly, const fmpz * xs, slong n,
const fmpz_mod_ctx_t ctx)
- void fmpz_mod_poly_compose_horner(fmpz_mod_poly_t res,
- const fmpz_mod_poly_t poly1, const fmpz_mod_poly_t poly2,
- const fmpz_mod_ctx_t ctx)
-
- void fmpz_mod_poly_compose_divconquer(fmpz_mod_poly_t res,
- const fmpz_mod_poly_t poly1, const fmpz_mod_poly_t poly2,
- const fmpz_mod_ctx_t ctx)
-
void fmpz_mod_poly_compose(fmpz_mod_poly_t res, const fmpz_mod_poly_t poly1,
const fmpz_mod_poly_t poly2, const fmpz_mod_ctx_t ctx)
diff --git a/src/sage/libs/flint/fmpz_poly.pxd b/src/sage/libs/flint/fmpz_poly.pxd
index 18b36672d30..c8bc6d3ca0a 100644
--- a/src/sage/libs/flint/fmpz_poly.pxd
+++ b/src/sage/libs/flint/fmpz_poly.pxd
@@ -28,7 +28,6 @@ cdef extern from "flint_wrap.h":
void fmpz_poly_set_ui(fmpz_poly_t, ulong)
void fmpz_poly_set_si(fmpz_poly_t, slong)
void fmpz_poly_set_fmpz(fmpz_poly_t, const fmpz_t)
- void fmpz_poly_set_mpz(fmpz_poly_t, const mpz_t)
int fmpz_poly_set_str(fmpz_poly_t, const char *)
char *fmpz_poly_get_str(const fmpz_poly_t)
@@ -70,7 +69,6 @@ cdef extern from "flint_wrap.h":
# Scalar multiplication and division
void fmpz_poly_scalar_mul_fmpz(
fmpz_poly_t, const fmpz_poly_t, const fmpz_t)
- void fmpz_poly_scalar_mul_mpz(fmpz_poly_t, const fmpz_poly_t, const mpz_t)
void fmpz_poly_scalar_mul_si(fmpz_poly_t, const fmpz_poly_t, slong)
void fmpz_poly_scalar_mul_ui(fmpz_poly_t, const fmpz_poly_t, ulong)
void fmpz_poly_scalar_mul_2exp(fmpz_poly_t, const fmpz_poly_t, ulong)
@@ -310,12 +308,14 @@ cdef extern from "flint_wrap.h":
fmpz_poly_t,
const fmpz_poly_t, const fmpz_t, const nmod_poly_t, int)
- # Some functions for backwards compatibility
- void fmpz_poly_scalar_mul_mpz(fmpz_poly_t, const fmpz_poly_t, const mpz_t)
- void fmpz_poly_scalar_divexact_mpz(fmpz_poly_t, const fmpz_poly_t, const mpz_t)
- void fmpz_poly_scalar_fdiv_mpz(fmpz_poly_t, const fmpz_poly_t, const mpz_t)
- void fmpz_poly_set_coeff_mpz(fmpz_poly_t, slong, const mpz_t)
- void fmpz_poly_get_coeff_mpz(mpz_t, const fmpz_poly_t, slong)
+
+# functions removed from flint but still needed in sage
+cdef void fmpz_poly_scalar_mul_mpz(fmpz_poly_t, const fmpz_poly_t, const mpz_t)
+cdef void fmpz_poly_scalar_divexact_mpz(fmpz_poly_t, const fmpz_poly_t, const mpz_t)
+cdef void fmpz_poly_scalar_fdiv_mpz(fmpz_poly_t, const fmpz_poly_t, const mpz_t)
+cdef void fmpz_poly_set_coeff_mpz(fmpz_poly_t, slong, const mpz_t)
+cdef void fmpz_poly_get_coeff_mpz(mpz_t, const fmpz_poly_t, slong)
+cdef void fmpz_poly_set_mpz(fmpz_poly_t, const mpz_t)
# Wrapper Cython class
diff --git a/src/sage/libs/flint/fmpz_poly.pyx b/src/sage/libs/flint/fmpz_poly.pyx
index 74915b37612..cfcbea9090c 100644
--- a/src/sage/libs/flint/fmpz_poly.pyx
+++ b/src/sage/libs/flint/fmpz_poly.pyx
@@ -25,10 +25,10 @@ from cysignals.memory cimport sig_free
from sage.arith.long cimport pyobject_to_long
from sage.cpython.string cimport char_to_str, str_to_bytes
+from sage.libs.flint.fmpz cimport *
from sage.structure.sage_object cimport SageObject
from sage.rings.integer cimport Integer
-
cdef class Fmpz_poly(SageObject):
def __cinit__(self):
@@ -455,3 +455,44 @@ cdef class Fmpz_poly(SageObject):
"""
from sage.rings.integer_ring import ZZ
return ZZ[var](self.list())
+
+
+# Functions removed from flint but still needed in Sage. Code adapted from
+# earlier versions of flint.
+
+cdef void fmpz_poly_scalar_mul_mpz(fmpz_poly_t rop, const fmpz_poly_t op, const mpz_t c):
+ cdef fmpz_t f
+ fmpz_init_set_readonly(f, c)
+ fmpz_poly_scalar_mul_fmpz(rop, op, f)
+ fmpz_clear_readonly(f)
+
+cdef void fmpz_poly_scalar_divexact_mpz(fmpz_poly_t rop, const fmpz_poly_t op, const mpz_t c):
+ cdef fmpz_t f
+ fmpz_init_set_readonly(f, c)
+ fmpz_poly_scalar_divexact_fmpz(rop, op, f)
+ fmpz_clear_readonly(f)
+
+cdef void fmpz_poly_scalar_fdiv_mpz(fmpz_poly_t rop, const fmpz_poly_t op, const mpz_t c):
+ cdef fmpz_t f
+ fmpz_init_set_readonly(f, c)
+ fmpz_poly_scalar_fdiv_fmpz(rop, op, f)
+ fmpz_clear_readonly(f)
+
+cdef void fmpz_poly_set_coeff_mpz(fmpz_poly_t poly, slong n, const mpz_t x):
+ cdef fmpz_t t
+ fmpz_init_set_readonly(t, x)
+ fmpz_poly_set_coeff_fmpz(poly, n, t)
+ fmpz_clear_readonly(t)
+
+cdef void fmpz_poly_get_coeff_mpz(mpz_t x, const fmpz_poly_t poly, slong n):
+ cdef fmpz_t t
+ fmpz_init(t)
+ fmpz_poly_get_coeff_fmpz(t, poly, n)
+ fmpz_get_mpz(x, t)
+ fmpz_clear(t)
+
+cdef void fmpz_poly_set_mpz(fmpz_poly_t poly, const mpz_t x):
+ fmpz_poly_fit_length(poly, 1)
+ fmpz_set_mpz(poly.coeffs, x)
+ _fmpz_poly_set_length(poly, 1)
+ _fmpz_poly_normalise(poly)
diff --git a/src/sage/libs/flint/fmpz_poly_q.pxd b/src/sage/libs/flint/fmpz_poly_q.pxd
index 846542dc0d8..63c13355bf6 100644
--- a/src/sage/libs/flint/fmpz_poly_q.pxd
+++ b/src/sage/libs/flint/fmpz_poly_q.pxd
@@ -49,11 +49,7 @@ cdef extern from "flint_wrap.h":
#* Scalar multiplication and division ****************************************/
void fmpz_poly_q_scalar_mul_si(fmpz_poly_q_t rop, const fmpz_poly_q_t op, long x)
- void fmpz_poly_q_scalar_mul_mpz(fmpz_poly_q_t rop, const fmpz_poly_q_t op, const mpz_t x)
- void fmpz_poly_q_scalar_mul_mpq(fmpz_poly_q_t rop, const fmpz_poly_q_t op, const mpq_t x)
void fmpz_poly_q_scalar_div_si(fmpz_poly_q_t rop, const fmpz_poly_q_t op, long x)
- void fmpz_poly_q_scalar_div_mpz(fmpz_poly_q_t rop, const fmpz_poly_q_t op, const mpz_t x)
- void fmpz_poly_q_scalar_div_mpq(fmpz_poly_q_t rop, const fmpz_poly_q_t op, const mpq_t x)
#* Multiplication and division ***********************************************/
void fmpz_poly_q_mul(fmpz_poly_q_t rop,
@@ -67,9 +63,6 @@ cdef extern from "flint_wrap.h":
#* Derivative ****************************************************************/
void fmpz_poly_q_derivative(fmpz_poly_q_t rop, const fmpz_poly_q_t op)
- #* Evaluation ****************************************************************/
- int fmpz_poly_q_evaluate(mpq_t rop, const fmpz_poly_q_t f, const mpq_t a)
-
#* Input and output **********************************************************/
int fmpz_poly_q_set_str(fmpz_poly_q_t rop, const char *s)
char * fmpz_poly_q_get_str(const fmpz_poly_q_t op)
diff --git a/src/sage/libs/linbox/linbox_flint_interface.pyx b/src/sage/libs/linbox/linbox_flint_interface.pyx
index 1979ac0f0a4..37a340c457f 100644
--- a/src/sage/libs/linbox/linbox_flint_interface.pyx
+++ b/src/sage/libs/linbox/linbox_flint_interface.pyx
@@ -33,6 +33,7 @@ and C. Pernet. The functions available are:
# https://www.gnu.org/licenses/
# ****************************************************************************
+from sage.libs.gmp.types cimport mpz_t
from sage.libs.flint.types cimport fmpz_t
from sage.libs.flint.fmpz cimport fmpz_get_mpz, fmpz_set_mpz
from sage.libs.flint.fmpz_mat cimport fmpz_mat_entry, fmpz_mat_nrows, fmpz_mat_ncols
@@ -80,11 +81,13 @@ cdef void fmpz_poly_set_linbox(fmpz_poly_t p, PolynomialRing_integer.Element& q)
(the .pxd file) in order to keep the header C-compatible
"""
cdef size_t i
+ cdef mpz_t tmp
fmpz_poly_fit_length(p, q.size())
for i in range(q.size()):
- fmpz_poly_set_coeff_mpz(p, i, q[i].get_mpz_const())
+ tmp = q[i].get_mpz_const()
+ fmpz_poly_set_coeff_mpz(p, i, tmp)
_fmpz_poly_set_length(p, q.size())
diff --git a/src/sage/matrix/matrix_complex_ball_dense.pyx b/src/sage/matrix/matrix_complex_ball_dense.pyx
index e5414abdd9e..2f0131f4064 100644
--- a/src/sage/matrix/matrix_complex_ball_dense.pyx
+++ b/src/sage/matrix/matrix_complex_ball_dense.pyx
@@ -1,4 +1,4 @@
-# distutils: libraries = ARB_LIBRARY
+# distutils: libraries = flint
r"""
Arbitrary precision complex ball matrices using Arb
diff --git a/src/sage/matrix/matrix_integer_sparse.pyx b/src/sage/matrix/matrix_integer_sparse.pyx
index 27f5cdfac0f..6c5c20dbc6b 100644
--- a/src/sage/matrix/matrix_integer_sparse.pyx
+++ b/src/sage/matrix/matrix_integer_sparse.pyx
@@ -847,6 +847,7 @@ cdef class Matrix_integer_sparse(Matrix_sparse):
sage: matrix(ZZ, 1, 1, sparse=True)._charpoly_linbox()
x
"""
+ cdef mpz_t tmp
if self._nrows != self._ncols:
raise ArithmeticError('only valid for square matrix')
@@ -869,7 +870,8 @@ cdef class Matrix_integer_sparse(Matrix_sparse):
cdef size_t i
fmpz_poly_fit_length(g._poly, p.size())
for i in range(p.size()):
- fmpz_poly_set_coeff_mpz(g._poly, i, p[0][i].get_mpz_const())
+ tmp = p[0][i].get_mpz_const()
+ fmpz_poly_set_coeff_mpz(g._poly, i, tmp)
_fmpz_poly_set_length(g._poly, p.size())
del M
@@ -966,9 +968,11 @@ cdef class Matrix_integer_sparse(Matrix_sparse):
sig_off()
cdef size_t i
+ cdef mpz_t tmp
fmpz_poly_fit_length(g._poly, p.size())
for i in range(p.size()):
- fmpz_poly_set_coeff_mpz(g._poly, i, p[0][i].get_mpz_const())
+ tmp = p[0][i].get_mpz_const()
+ fmpz_poly_set_coeff_mpz(g._poly, i, tmp)
_fmpz_poly_set_length(g._poly, p.size())
del M
diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx
index 1e3085c9215..0786de7fc81 100644
--- a/src/sage/rings/complex_arb.pyx
+++ b/src/sage/rings/complex_arb.pyx
@@ -1360,12 +1360,13 @@ cdef class ComplexBall(RingElement):
sage: CBF100(-3r)
-3.000000000000000000000000000000
- sage: ComplexBall(CBF100, 10^100)
- 1.000000000000000000000000000000e+100
sage: ComplexBall(CBF100, CIF(1, 2))
1.000000000000000000000000000000 + 2.000000000000000000000000000000*I
sage: ComplexBall(CBF100, RBF(1/3), RBF(1))
[0.3333333333333333 +/- ...e-17] + 1.000000000000000000000000000000*I
+ sage: ComplexBall(CBF100, 10^100)
+ [1.000000000000000000000000000000e+100 +/- ...]
+
sage: NF.<a> = QuadraticField(-1, embedding=CC(0, -1))
sage: CBF(a)
-1.000000000000000*I
@@ -3009,7 +3010,7 @@ cdef class ComplexBall(RingElement):
sage: CBF(1).rising_factorial(2**64)
[+/- ...e+347382171326740403407]
sage: ComplexBallField(128)(1).rising_factorial(2**64)
- [2.343691126796861348e+347382171305201285713 +/- ...e+347382171305201285694]
+ [2.34369112679686134...e+347382171305201285713 +/- ...]
sage: CBF(1/2).rising_factorial(CBF(2,3)) # abs tol 1e-15
[-0.123060451458124 +/- 3.06e-16] + [0.0406412631676552 +/- 7.57e-17]*I
diff --git a/src/sage/rings/polynomial/polynomial_rational_flint.pyx b/src/sage/rings/polynomial/polynomial_rational_flint.pyx
index 04eaefc9fed..d99f0d3b98c 100644
--- a/src/sage/rings/polynomial/polynomial_rational_flint.pyx
+++ b/src/sage/rings/polynomial/polynomial_rational_flint.pyx
@@ -222,7 +222,7 @@ cdef class Polynomial_rational_flint(Polynomial):
cdef unsigned long n
cdef Rational c
cdef list L1
- cdef mpq_t * L2
+ cdef fmpq_t q
Polynomial.__init__(self, parent, is_gen=is_gen)
@@ -253,14 +253,11 @@ cdef class Polynomial_rational_flint(Polynomial):
L1 = [e if isinstance(e, Rational) else Rational(e) for e in x]
n = <unsigned long> len(x)
sig_on()
- L2 = <mpq_t *> check_allocarray(n, sizeof(mpq_t))
+ fmpq_poly_fit_length(self._poly, n)
for deg from 0 <= deg < n:
- mpq_init(L2[deg])
- mpq_set(L2[deg], (<Rational> L1[deg]).value)
- fmpq_poly_set_array_mpq(self._poly, L2, n)
- for deg from 0 <= deg < n:
- mpq_clear(L2[deg])
- sig_free(L2)
+ fmpq_init_set_readonly(q, (<Rational> L1[deg]).value)
+ fmpq_poly_set_coeff_fmpq(self._poly, deg, q)
+ fmpq_clear_readonly(q)
sig_off()
# deg = 0
@@ -435,6 +432,7 @@ cdef class Polynomial_rational_flint(Polynomial):
utmost care.
"""
cdef bint do_sig = _do_sig(self._poly)
+ cdef fmpz_t tmpfz
if isinstance(value, int):
if do_sig: sig_str("FLINT exception")
@@ -442,7 +440,9 @@ cdef class Polynomial_rational_flint(Polynomial):
if do_sig: sig_off()
elif isinstance(value, Integer):
if do_sig: sig_str("FLINT exception")
- fmpq_poly_set_coeff_mpz(self._poly, n, (<Integer> value).value)
+ fmpz_init_set_readonly(tmpfz, (<Integer> value).value)
+ fmpq_poly_set_coeff_fmpz(self._poly, n, tmpfz)
+ fmpz_clear_readonly(tmpfz)
if do_sig: sig_off()
elif isinstance(value, Rational):
if do_sig: sig_str("FLINT exception")
@@ -492,7 +492,7 @@ cdef class Polynomial_rational_flint(Polynomial):
cdef Polynomial_rational_flint f
cdef Rational r
cdef fmpz_t tmpfz
- cdef fmpq_t tmpfq
+ cdef fmpq_t tmpfq, tmpfq1
cdef RealBall arb_a, arb_z
cdef ComplexBall acb_a, acb_z
@@ -508,13 +508,23 @@ cdef class Polynomial_rational_flint(Polynomial):
elif isinstance(a, Rational):
r = Rational.__new__(Rational)
sig_str("FLINT exception")
- fmpq_poly_evaluate_mpq(r.value, self._poly, (<Rational> a).value)
+ fmpq_init_set_readonly(tmpfq, (<Rational> a).value)
+ fmpq_init(tmpfq1)
+ fmpq_poly_evaluate_fmpq(tmpfq1, self._poly, tmpfq)
+ fmpq_get_mpq(r.value, tmpfq1)
+ fmpq_clear(tmpfq1)
+ fmpq_clear_readonly(tmpfq)
sig_off()
return r
elif isinstance(a, Integer):
r = Rational.__new__(Rational)
sig_str("FLINT exception")
- fmpq_poly_evaluate_mpz(r.value, self._poly, (<Integer> a).value)
+ fmpz_init_set_readonly(tmpfz, (<Integer> a).value)
+ fmpq_init(tmpfq)
+ fmpq_poly_evaluate_fmpz(tmpfq, self._poly, tmpfz)
+ fmpq_get_mpq(r.value, tmpfq)
+ fmpq_clear(tmpfq)
+ fmpz_clear_readonly(tmpfz)
sig_off()
return r
elif isinstance(a, int):
@@ -1321,6 +1331,7 @@ cdef class Polynomial_rational_flint(Polynomial):
"""
cdef Polynomial_rational_flint res
cdef bint do_sig
+ cdef fmpq_t tmpfq
if right == 0:
raise ZeroDivisionError("division by zero polynomial")
@@ -1331,8 +1342,9 @@ cdef class Polynomial_rational_flint(Polynomial):
do_sig = _do_sig(self._poly)
if do_sig: sig_str("FLINT exception")
- fmpq_poly_scalar_div_mpq(res._poly, self._poly,
- (<Rational> QQ(right)).value)
+ fmpq_init_set_readonly(tmpfq, (<Rational> QQ(right)).value)
+ fmpq_poly_scalar_div_fmpq(res._poly, self._poly, tmpfq)
+ fmpq_clear_readonly(tmpfq)
if do_sig: sig_off()
return res
diff --git a/src/sage/rings/polynomial/polynomial_zmod_flint.pyx b/src/sage/rings/polynomial/polynomial_zmod_flint.pyx
index 6e7f7498329..3a66198d568 100644
--- a/src/sage/rings/polynomial/polynomial_zmod_flint.pyx
+++ b/src/sage/rings/polynomial/polynomial_zmod_flint.pyx
@@ -658,6 +658,11 @@ cdef class Polynomial_zmod_flint(Polynomial_template):
...
NotImplementedError: square free factorization of polynomials over rings with composite characteristic is not implemented
+ :trac:`20003`::
+
+ sage: P.<x> = GF(7)[]
+ sage: (6*x+3).squarefree_decomposition()
+ (6) * (x + 4)
"""
if not self.base_ring().is_field():
raise NotImplementedError("square free factorization of polynomials over rings with composite characteristic is not implemented")
diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx
index 17961ac36b2..8509b19cc66 100644
--- a/src/sage/rings/real_arb.pyx
+++ b/src/sage/rings/real_arb.pyx
@@ -898,7 +898,7 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField):
sage: RBF.gamma(5)
24.00000000000000
sage: RBF.gamma(10**20)
- [+/- ...e+1956570552410610660600]
+ [1.932849514310098...+1956570551809674817225 +/- ...]
sage: RBF.gamma(1/3)
[2.678938534707747 +/- ...e-16]
sage: RBF.gamma(-5)
@@ -1102,7 +1102,7 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField):
15.00000000000000,
48.00000000000000]
sage: RBF.double_factorial(2**20)
- [1.4483729903e+2928836 +/- ...e+2928825]
+ [1.448372990...e+2928836 +/- ...]
sage: RBF.double_factorial(2**1000)
Traceback (most recent call last):
...
diff --git a/src/sage/schemes/plane_conics/con_rational_function_field.py b/src/sage/schemes/plane_conics/con_rational_function_field.py
index 05d24e78a85..581102b5c5b 100644
--- a/src/sage/schemes/plane_conics/con_rational_function_field.py
+++ b/src/sage/schemes/plane_conics/con_rational_function_field.py
@@ -198,38 +198,6 @@ def has_rational_point(self, point=False, algorithm='default',
Fraction Field of Univariate Polynomial Ring in u over Rational
Field with modulus v^2 - u^3 - 1
- ``has_rational_point`` fails for some conics over function fields
- over finite fields, due to :trac:`20003`::
-
- sage: K.<t> = PolynomialRing(GF(7))
- sage: C = Conic([5*t^2 + 4, t^2 + 3*t + 3, 6*t^2 + 3*t + 2,
- ....: 5*t^2 + 5, 4*t + 3, 4*t^2 + t + 5])
- sage: C.has_rational_point() # needs sage.libs.singular
- Traceback (most recent call last):
- ...
- TypeError: self (=Scheme morphism:
- From: Projective Conic Curve over Fraction Field of Univariate
- Polynomial Ring in t over Finite Field of size 7 defined by
- (-2*t^2 - 3)*x^2 + (-t^3 + 3*t^2 - 2*t - 2)/(t + 3)*y^2 + (-t^6 + 3*t^5 + t^3 - t^2 - t + 2)/(t^4 + t^3 - 3*t^2 + 3*t + 1)*z^2
- To: Projective Conic Curve over Fraction Field of Univariate
- Polynomial Ring in t over Finite Field of size 7 defined by
- (-2*t^2 - 3)*x^2 + (t^2 + 3*t + 3)*x*y + (-2*t^2 - 2)*y^2 + (-t^2 + 3*t + 2)*x*z + (-3*t + 3)*y*z + (-3*t^2 + t - 2)*z^2
- Defn: Defined on coordinates by sending (x : y : z) to
- (x + (2*t - 2)/(t + 3)*y + (3*t^4 + 2*t^3 - 2*t^2 - 2*t + 3)/(t^4 + t^3 - 3*t^2 + 3*t + 1)*z
- : y + (-t^3 - t^2 + 3*t - 1)/(t^3 - 3*t^2 + 2*t + 2)*z : z))
- domain must equal right (=Scheme morphism:
- From: Projective Conic Curve over Fraction Field of Univariate
- Polynomial Ring in t over Finite Field of size 7 defined by
- (-2*t^3 - t^2 + 3*t + 3)*x^2 + (t - 3)*y^2 + (-t^7 + 2*t^5 + t^4 + 2*t^3 + 3*t^2 - t - 1)*z^2
- To: Projective Conic Curve over Fraction Field of Univariate
- Polynomial Ring in t over Finite Field of size 7 defined by
- -2/(t^3 - 3*t^2 + 2*t + 2)*x^2 + 1/(t^3 + 3*t^2 - 2*t + 1)*y^2 + (-t^6 + 3*t^5 + t^3 - t^2 - t + 2)/(t^9 - 2*t^8 + t^7 - t^6 + 3*t^5 - 3*t^3 + t^2 - 2*t + 3)*z^2
- Defn: Defined on coordinates by sending (x : y : z) to
- ((t^3 - 3*t^2 + 2*t + 2)*x : (t^2 - 2)*y : (t^5 - 3*t^4 + t^2 + 3*t + 3)*z))
- codomain
-
-
-
TESTS::
sage: K.<t> = FractionField(PolynomialRing(QQ, 't'))
@@ -250,6 +218,16 @@ def has_rational_point(self, point=False, algorithm='default',
sage: C.has_rational_point(point=True) # long time (4 seconds) # needs sage.libs.singular
(True,
((-2/117*t^8 + 304/1053*t^7 + 40/117*t^6 - 1/27*t^5 - 110/351*t^4 - 2/195*t^3 + 11/351*t^2 + 1/117)/(t^4 + 2/39*t^3 + 4/117*t^2 + 2/39*t + 14/39) : -5/3*t^4 + 19*t^3 : 1))
+
+ ``has_rational_point`` used to fail for some conics over function fields
+ over finite fields, due to :trac:`20003`::
+
+ sage: K.<t> = PolynomialRing(GF(7))
+ sage: C = Conic([5*t^2 + 4, t^2 + 3*t + 3, 6*t^2 + 3*t + 2,
+ ....: 5*t^2 + 5, 4*t + 3, 4*t^2 + t + 5])
+ sage: C.has_rational_point()
+ True
+
"""
from .constructor import Conic
diff --git a/src/sage/symbolic/ginac/inifcns_orthopoly.cpp b/src/sage/symbolic/ginac/inifcns_orthopoly.cpp
index a591cb4cd7c..a90f2050c59 100644
--- a/src/sage/symbolic/ginac/inifcns_orthopoly.cpp
+++ b/src/sage/symbolic/ginac/inifcns_orthopoly.cpp
@@ -20,6 +20,7 @@
#include "utils.h"
#include "gmp.h"
+#include "flint/fmpz_poly.h"
#include "flint/fmpq_poly.h"
#include "flint/fmpq.h"
@@ -63,7 +64,7 @@ static ex chebyt_eval(const ex& n_, const ex& x)
for (int i = 0; i<len; ++i) {
mpz_t bigint;
mpz_init(bigint);
- fmpz_poly_get_coeff_mpz(bigint, p, i);
+ fmpz_get_mpz(bigint, fmpz_poly_get_coeff_ptr(p, i));
numeric coeff(bigint);
if (not coeff.is_zero())
vec.emplace_back(currx, coeff);
@@ -122,7 +123,7 @@ static ex chebyu_eval(const ex& n_, const ex& x)
for (int i = 0; i<len; ++i) {
mpz_t bigint;
mpz_init(bigint);
- fmpz_poly_get_coeff_mpz(bigint, p, i);
+ fmpz_get_mpz(bigint, fmpz_poly_get_coeff_ptr(p, i));
numeric coeff(bigint);
if (not coeff.is_zero())
vec.emplace_back(currx, coeff);
diff --git a/src/sage/symbolic/ginac/useries.cpp b/src/sage/symbolic/ginac/useries.cpp
index 40fbd7ab360..b9a8b867648 100644
--- a/src/sage/symbolic/ginac/useries.cpp
+++ b/src/sage/symbolic/ginac/useries.cpp
@@ -467,10 +467,17 @@ void add::useries(flint_series_t& fp, int order) const
fmpq_poly_set_ui(fp.ft, 0);
else if (oc.is_long())
fmpq_poly_set_si(fp.ft, oc.to_long());
- else if (oc.is_mpz())
- fmpq_poly_set_mpz(fp.ft, oc.as_mpz());
- else
- fmpq_poly_set_mpq(fp.ft, oc.as_mpq());
+ else if (oc.is_mpz()) {
+ fmpz_t tmpfz;
+ fmpz_init_set_readonly(tmpfz, oc.as_mpz());
+ fmpq_poly_set_fmpz(fp.ft, tmpfz);
+ fmpz_clear_readonly(tmpfz);
+ } else {
+ fmpq_t tmpfq;
+ fmpq_init_set_readonly(tmpfq, oc.as_mpq());
+ fmpq_poly_set_fmpq(fp.ft, tmpfq);
+ fmpq_clear_readonly(tmpfq);
+ }
for (const auto & elem : seq) {
const ex& t = recombine_pair_to_ex(elem);
@@ -505,10 +512,17 @@ void mul::useries(flint_series_t& fp, int order) const
if (oc.is_long())
fmpq_poly_scalar_mul_si(fp.ft, fp.ft, oc.to_long());
- else if (oc.is_mpz())
- fmpq_poly_scalar_mul_mpz(fp.ft, fp.ft, oc.as_mpz());
- else
- fmpq_poly_scalar_mul_mpq(fp.ft, fp.ft, oc.as_mpq());
+ else if (oc.is_mpz()) {
+ fmpz_t tmpfz;
+ fmpz_init_set_readonly(tmpfz, oc.as_mpz());
+ fmpq_poly_scalar_mul_fmpz(fp.ft, fp.ft, tmpfz);
+ fmpz_clear_readonly(tmpfz);
+ } else {
+ fmpq_t tmpfq;
+ fmpq_init_set_readonly(tmpfq, oc.as_mpq());
+ fmpq_poly_scalar_mul_fmpq(fp.ft, fp.ft, tmpfq);
+ fmpq_clear_readonly(tmpfq);
+ }
}
void power::useries(flint_series_t& fp, int order) const
@@ -563,7 +577,10 @@ void power::useries(flint_series_t& fp, int order) const
}
check_poly_ccoeff_one(fp1);
fmpq_poly_log_series(fp1.ft, fp1.ft, order);
- fmpq_poly_scalar_mul_mpq(fp1.ft, fp1.ft, nexp.as_mpq());
+ fmpq_t tmp;
+ fmpq_init_set_readonly(tmp, nexp.as_mpq());
+ fmpq_poly_scalar_mul_fmpq(fp1.ft, fp1.ft, tmp);
+ fmpq_clear_readonly(tmp);
fmpq_poly_exp_series(fp.ft, fp1.ft, order);
return;
}
@@ -608,10 +625,17 @@ void numeric::useries(flint_series_t& fp, int order) const
{
if (is_long())
fmpq_poly_set_si(fp.ft, to_long());
- else if (is_mpz())
- fmpq_poly_set_mpz(fp.ft, as_mpz());
- else
- fmpq_poly_set_mpq(fp.ft, as_mpq());
+ else if (is_mpz()) {
+ fmpz_t tmpfz;
+ fmpz_init_set_readonly(tmpfz, as_mpz());
+ fmpq_poly_set_fmpz(fp.ft, tmpfz);
+ fmpz_clear_readonly(tmpfz);
+ } else {
+ fmpq_t tmpfq;
+ fmpq_init_set_readonly(tmpfq, as_mpq());
+ fmpq_poly_set_fmpq(fp.ft, tmpfq);
+ fmpq_clear_readonly(tmpfq);
+ }
}
} // namespace GiNaC
diff --git a/src/sage_setup/library_order.py b/src/sage_setup/library_order.py
index f40690f8d22..9ae0d2579a7 100644
--- a/src/sage_setup/library_order.py
+++ b/src/sage_setup/library_order.py
@@ -16,17 +16,12 @@
aliases = cython_aliases(required_modules=(), optional_modules=modules)
-if "ARB_LIBRARY" in aliases:
- arb_dylib_names = [aliases["ARB_LIBRARY"]]
-else:
- arb_dylib_names = []
-
library_order_list = aliases.get("SINGULAR_LIBRARIES", []) + [
"giac", "intl", "curl",
"ec", "ecm"
] + aliases.get("LINBOX_LIBRARIES", []) + aliases.get("FFLASFFPACK_LIBRARIES", []) + aliases.get("GSL_LIBRARIES", []) + [
"pari", "flint", "ecl", "glpk", "ppl",
-] + arb_dylib_names + [
+] + [
"mpfi", "mpfr", "mpc", "ntl", "gmp", "gmpxx",
"brial",
"brial_groebner",