From 969c88443f6b3cba58e8eaa8daa372e8c61490cf Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 3 Aug 2023 19:32:03 +0100 Subject: [PATCH 01/13] Bump flint to 3.0.0-alpha1 --- bin/build_dependencies_unix.sh | 241 +++++++++++++++++++++++---------- bin/build_variables.sh | 11 +- setup.py | 14 +- 3 files changed, 181 insertions(+), 85 deletions(-) diff --git a/bin/build_dependencies_unix.sh b/bin/build_dependencies_unix.sh index b7753b8f..ea0548e8 100755 --- a/bin/build_dependencies_unix.sh +++ b/bin/build_dependencies_unix.sh @@ -16,19 +16,46 @@ set -o errexit # # # ------------------------------------------------------------------------- # +SKIP_GMP=no +SKIP_MPFR=no + USE_GMP=gmp PATCH_GMP_ARM64=no +BUILD_ARB=no while [[ $# -gt 0 ]] do key="$1" case $key in -h|--help) - echo "bin/download_dependencies.sh [--gmp gmp|mpir] [--host HOST]" + echo "bin/download_dependencies.sh [options]" + echo + echo "Build local installs of python-flint's dependencies." + echo + echo "Supported options:" + echo " --help - show this help message" + echo " --host - set the host (target) for GMP build" + echo " --skip-gmp - skip building GMP" + echo " --skip-mpfr - skip building MPFR" + echo + echo "Legacy options:" + echo " --gmp gmp - build based on GMP (default)" + echo " --gmp mpir - build based on MPIR (no longer works)" + echo " --patch-gmp-arm64 - apply patch to GMP 6.2.1 for OSX arm64" + echo " --arb - build Arb (only needed for flint < 3.0.0)" + echo exit ;; + --host) + # e.g. --host x86_64-unknown-linux-gnu + # or --host x86_64-apple-darwin + HOST_ARG="$2" + shift + shift + ;; --gmp) # e.g. --gmp gmp or --gmp mpir + # The mpir build no longer works because the download fails. USE_GMP="$2" if [[ "$USE_GMP" != "gmp" && "$USE_GMP" != "mpir" ]]; then echo "--gmp option should be gmp or mpir" @@ -37,14 +64,27 @@ do shift shift ;; - --host) - # e.g. --host x86_64-unknown-linux-gnu - # or --host x86_64-apple-darwin - HOST_ARG="$2" + --arb) + # With flint >= 3.0.0 Arb is included so we do not need to build it + # separately. Pass --arb if building for older versions of flint. + BUILD_ARB=yes + shift + ;; + --skip-gmp) + # If you already have a local install of GMP you can pass --skip-gmp + # to skip building it. + SKIP_GMP=yes shift + ;; + --skip-mpfr) + # If you already have a local install of MPFR you can pass --skip-mpfr + # to skip building it. + SKIP_MPFR=yes shift ;; --patch-gmp-arm64) + # Needed only for GMP 6.2.1 on OSX arm64 (Apple M1) hardware + # As of GMP 6.3.0 this patch is no longer needed PATCH_GMP_ARM64=yes shift ;; @@ -86,42 +126,57 @@ if [ $USE_GMP = "gmp" ]; then # # # ----------------------------------------------------------------------- # - if [ $USE_GMP_GITHUB_MIRROR = "yes" ]; then - # Needed in GitHub Actions because it is blocked from gmplib.org - git clone https://github.com/oscarbenjamin/gmp_mirror.git - cp gmp_mirror/gmp-$GMPVER.tar.xz . + if [ $SKIP_GMP = "yes" ]; then + echo + echo -------------------------------------------- + echo " skipping GMP" + echo -------------------------------------------- + echo else - curl -O https://gmplib.org/download/gmp/gmp-$GMPVER.tar.xz - fi + echo + echo -------------------------------------------- + echo " building GMP" + echo -------------------------------------------- + echo + + if [ $USE_GMP_GITHUB_MIRROR = "yes" ]; then + # Needed in GitHub Actions because it is blocked from gmplib.org + git clone https://github.com/oscarbenjamin/gmp_mirror.git + cp gmp_mirror/gmp-$GMPVER.tar.xz . + else + curl -O https://gmplib.org/download/gmp/gmp-$GMPVER.tar.xz + fi - tar xf gmp-$GMPVER.tar.xz - cd gmp-$GMPVER + tar xf gmp-$GMPVER.tar.xz + cd gmp-$GMPVER + + # + # See https://github.com/aleaxit/gmpy/issues/350 + # + # We need to patch GMP for OSX arm64 (Apple M1) hardware. This patch is + # from the GMP repo but was applied after the release of GMP 6.2.1. + # This patch is no longer needed for GMP 6.3.0. + # + if [ $PATCH_GMP_ARM64 = "yes" ]; then + echo + echo -------------------------------------------- + echo " patching GMP" + echo -------------------------------------------- + patch -N -Z -p0 < ../../../bin/patch-arm64.diff + fi - # - # See https://github.com/aleaxit/gmpy/issues/350 - # - # We need to patch GMP for OSX arm64 (Apple M1) hardware for GMP 6.2.1. - # Now with GMP 6.3.0 this should not be needed any more. - # - if [ $PATCH_GMP_ARM64 = "yes" ]; then - echo - echo -------------------------------------------- - echo " patching GMP" - echo -------------------------------------------- - patch -N -Z -p0 < ../../../bin/patch-arm64.diff - fi + # Show the output of configfsf.guess + ./configfsf.guess + ./configure --prefix=$PREFIX\ + --enable-fat\ + --enable-shared=yes\ + --enable-static=no\ + --host=$HOST_ARG + make -j3 + make install + cd .. - # Show the output of configfsf.guess - chmod +x configfsf.guess - ./configfsf.guess - ./configure --prefix=$PREFIX\ - --enable-fat\ - --enable-shared=yes\ - --enable-static=no\ - --host=$HOST_ARG - make -j3 - make install - cd .. + fi FLINTARB_WITHGMP="--with-gmp=$PREFIX" @@ -182,16 +237,30 @@ fi # # # ------------------------------------------------------------------------- # -curl -O https://ftp.gnu.org/gnu/mpfr/mpfr-$MPFRVER.tar.gz -tar xf mpfr-$MPFRVER.tar.gz -cd mpfr-$MPFRVER - ./configure --prefix=$PREFIX\ - --with-gmp=$PREFIX\ - --enable-shared=yes\ - --enable-static=no - make -j3 - make install -cd .. +if [ $SKIP_MPFR = "yes" ]; then + echo + echo -------------------------------------------- + echo " skipping MPFR" + echo -------------------------------------------- + echo +else + echo + echo -------------------------------------------- + echo " building MPFR" + echo -------------------------------------------- + echo + + curl -O https://ftp.gnu.org/gnu/mpfr/mpfr-$MPFRVER.tar.gz + tar xf mpfr-$MPFRVER.tar.gz + cd mpfr-$MPFRVER + ./configure --prefix=$PREFIX\ + --with-gmp=$PREFIX\ + --enable-shared=yes\ + --enable-static=no + make -j3 + make install + cd .. +fi # ------------------------------------------------------------------------- # # # @@ -199,9 +268,16 @@ cd .. # # # ------------------------------------------------------------------------- # +echo +echo -------------------------------------------- +echo " building Flint" +echo -------------------------------------------- +echo + curl -O -L https://www.flintlib.org/flint-$FLINTVER.tar.gz tar xf flint-$FLINTVER.tar.gz cd flint-$FLINTVER + ./bootstrap.sh ./configure --prefix=$PREFIX\ $FLINTARB_WITHGMP\ --with-mpfr=$PREFIX\ @@ -216,25 +292,34 @@ cd .. # # # ------------------------------------------------------------------------- # -curl -O -L https://github.com/fredrik-johansson/arb/archive/refs/tags/$ARBVER.tar.gz -mv $ARBVER.tar.gz arb-$ARBVER.tar.gz -tar xf arb-$ARBVER.tar.gz -cd arb-$ARBVER - ./configure --prefix=$PREFIX\ - --with-flint=$PREFIX\ - $FLINTARB_WITHGMP\ - --with-mpfr=$PREFIX\ - --disable-static - make -j3 - make install - # - # Set PATH so that DLLs are picked up on Windows. - # - PATH=$PATH:$PREFIX/lib:$PREFIX/bin \ - ARB_TEST_MULTIPLIER=0.1 \ - # Skip Arb tests now because they are slow. - # make check -cd .. +if [ $BUILD_ARB = "yes" ]; then + + echo + echo -------------------------------------------- + echo " building Arb" + echo -------------------------------------------- + echo + + curl -O -L https://github.com/fredrik-johansson/arb/archive/refs/tags/$ARBVER.tar.gz + mv $ARBVER.tar.gz arb-$ARBVER.tar.gz + tar xf arb-$ARBVER.tar.gz + cd arb-$ARBVER + ./configure --prefix=$PREFIX\ + --with-flint=$PREFIX\ + $FLINTARB_WITHGMP\ + --with-mpfr=$PREFIX\ + --disable-static + make -j3 + make install + # + # Set PATH so that DLLs are picked up on Windows. + # + PATH=$PATH:$PREFIX/lib:$PREFIX/bin \ + ARB_TEST_MULTIPLIER=0.1 \ + # Skip Arb tests now because they are slow. + # make check + cd .. +fi # ------------------------------------------------------------------------- # # # @@ -249,14 +334,28 @@ echo Build dependencies for python-flint compiled as shared libraries in: echo $PREFIX echo echo Versions: -if [[ $USE_GMP = "gmp" ]]; then - echo GMP: $GMPVER + +if [ $SKIP_GMP = "yes" ]; then + echo GMP: skipped else - echo MPIR: $MPIRVER + if [[ $USE_GMP = "gmp" ]]; then + echo GMP: $GMPVER + else + echo MPIR: $MPIRVER + fi fi -echo MPFR: $MPFRVER + +if [ $SKIP_MPFR = "yes" ]; then + echo MPFR: skipped +else + echo MPFR: $MPFRVER +fi + echo Flint: $FLINTVER -echo Arb: $ARBVER + +if [ $BUILD_ARB = "yes" ]; then + echo Arb: $ARBVER +fi echo echo ----------------------------------------------------------------------- echo diff --git a/bin/build_variables.sh b/bin/build_variables.sh index b7b4b113..5c65f628 100644 --- a/bin/build_variables.sh +++ b/bin/build_variables.sh @@ -13,9 +13,12 @@ PREFIX=$(pwd)/.local mkdir -p $PREFIX +ARBVER=2.23.0 # Not needed with flint >= 3.0.0 (Arb is included in flint) + +YASMVER=1.3.0 # Only needed for MPIR +MPIRVER=3.0.0 # MPIR build no longer works (not clear where to download from) + +# These are the actual dependencies used (at least by default): GMPVER=6.3.0 -YASMVER=1.3.0 -MPIRVER=3.0.0 MPFRVER=4.1.0 -FLINTVER=2.9.0 -ARBVER=2.23.0 +FLINTVER=3.0.0-alpha1 diff --git a/setup.py b/setup.py index e1de4165..8f28bea4 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ # This is used in CI to build wheels with mingw64 # if os.getenv('PYTHON_FLINT_MINGW64'): - libraries = ["arb", "flint", "mpfr", "gmp"] + libraries = ["flint", "mpfr", "gmp"] includedir = os.path.join(os.path.dirname(__file__), '.local', 'include') librarydir1 = os.path.join(os.path.dirname(__file__), '.local', 'bin') librarydir2 = os.path.join(os.path.dirname(__file__), '.local', 'lib') @@ -29,18 +29,12 @@ elif os.getenv('PYTHON_FLINT_MINGW64_TMP'): # This would be used to build under Windows against these libraries if # they have been installed somewhere other than .local - libraries = ["arb", "flint", "mpfr", "gmp"] + libraries = ["flint", "mpfr", "gmp"] else: # For the MSVC toolchain link with mpir instead of gmp - libraries = ["arb", "flint", "mpir", "mpfr", "pthreads"] + libraries = ["flint", "mpir", "mpfr", "pthreads"] else: - # On Ubuntu libarb.so is called libflint-arb.so - if os.getenv('PYTHON_FLINT_LIBFLINT_ARB'): - arb = 'flint-arb' - else: - arb = 'arb' - - libraries = [arb, "flint"] + libraries = ["flint"] (opt,) = get_config_vars('OPT') os.environ['OPT'] = " ".join(flag for flag in opt.split() if flag != '-Wstrict-prototypes') From ca909ff2d96c6f6a3f802ef28eae5c6f33548b17 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 3 Aug 2023 19:38:44 +0100 Subject: [PATCH 02/13] chmod +x configfsf.guess --- bin/build_dependencies_unix.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/build_dependencies_unix.sh b/bin/build_dependencies_unix.sh index ea0548e8..65b77e72 100755 --- a/bin/build_dependencies_unix.sh +++ b/bin/build_dependencies_unix.sh @@ -166,7 +166,9 @@ if [ $USE_GMP = "gmp" ]; then fi # Show the output of configfsf.guess + chmod +x configfsf.guess ./configfsf.guess + ./configure --prefix=$PREFIX\ --enable-fat\ --enable-shared=yes\ @@ -174,6 +176,7 @@ if [ $USE_GMP = "gmp" ]; then --host=$HOST_ARG make -j3 make install + cd .. fi From 5f1a2bf958c3c4b89fb540942410c2b4e4a24ed4 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 3 Aug 2023 19:54:07 +0100 Subject: [PATCH 03/13] brew install automake --- bin/cibw_before_all_macosx_arm64.sh | 2 ++ bin/cibw_before_all_macosx_x86_64.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/bin/cibw_before_all_macosx_arm64.sh b/bin/cibw_before_all_macosx_arm64.sh index 5a306c75..9a8b4caa 100755 --- a/bin/cibw_before_all_macosx_arm64.sh +++ b/bin/cibw_before_all_macosx_arm64.sh @@ -3,6 +3,8 @@ export CPPFLAGS=" --target=arm64-apple-macos11" export LDFLAGS=" -arch arm64" +brew install automake + bin/build_dependencies_unix.sh\ --gmp gmp\ --host aarch64-apple-darwin\ diff --git a/bin/cibw_before_all_macosx_x86_64.sh b/bin/cibw_before_all_macosx_x86_64.sh index 2eda5411..1e080629 100755 --- a/bin/cibw_before_all_macosx_x86_64.sh +++ b/bin/cibw_before_all_macosx_x86_64.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +brew install automake + bin/build_dependencies_unix.sh\ --gmp gmp\ --host x86_64-apple-darwin\ From 53a2e3e6fa84aa7c06062b56d931969ba4c46775 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 3 Aug 2023 19:58:45 +0100 Subject: [PATCH 04/13] brew install libtool --- bin/cibw_before_all_macosx_arm64.sh | 2 +- bin/cibw_before_all_macosx_x86_64.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cibw_before_all_macosx_arm64.sh b/bin/cibw_before_all_macosx_arm64.sh index 9a8b4caa..29c34cb0 100755 --- a/bin/cibw_before_all_macosx_arm64.sh +++ b/bin/cibw_before_all_macosx_arm64.sh @@ -3,7 +3,7 @@ export CPPFLAGS=" --target=arm64-apple-macos11" export LDFLAGS=" -arch arm64" -brew install automake +brew install automake libtool bin/build_dependencies_unix.sh\ --gmp gmp\ diff --git a/bin/cibw_before_all_macosx_x86_64.sh b/bin/cibw_before_all_macosx_x86_64.sh index 1e080629..3df4966d 100755 --- a/bin/cibw_before_all_macosx_x86_64.sh +++ b/bin/cibw_before_all_macosx_x86_64.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -brew install automake +brew install automake libtool bin/build_dependencies_unix.sh\ --gmp gmp\ From 83a4efd65b379b1133d84173c2a2582b19e78c11 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 3 Aug 2023 20:08:31 +0100 Subject: [PATCH 05/13] Add base-devel in mingw --- bin/cibw_before_all_windows.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/cibw_before_all_windows.sh b/bin/cibw_before_all_windows.sh index 479ce126..ada9e118 100755 --- a/bin/cibw_before_all_windows.sh +++ b/bin/cibw_before_all_windows.sh @@ -13,8 +13,14 @@ echo '[build]' > setup.cfg echo 'compiler = mingw32' >> setup.cfg cat setup.cfg -# Install the mingw-w64 toolchain -pacman -S --noconfirm mingw-w64-x86_64-gcc m4 make mingw-w64-x86_64-tools-git +# Install the mingw-w64 toolchain and build tools +pacman -S --noconfirm \ + mingw-w64-x86_64-gcc\ + mingw-w64-x86_64-tools-git\ + m4\ + make\ + base-devel\ + # # This takes ~30mins bin/build_dependencies_unix.sh --use-gmp-github-mirror From aa7d63286e6a265f18151a9ee9260b1c68cd5add Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 3 Aug 2023 20:31:11 +0100 Subject: [PATCH 06/13] Add autoconf-wrapper in mingw --- bin/cibw_before_all_windows.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/cibw_before_all_windows.sh b/bin/cibw_before_all_windows.sh index ada9e118..367cb59f 100755 --- a/bin/cibw_before_all_windows.sh +++ b/bin/cibw_before_all_windows.sh @@ -20,6 +20,7 @@ pacman -S --noconfirm \ m4\ make\ base-devel\ + autoconf-wrapper\ # # This takes ~30mins From f88460ebceab367f1b1927024f82e706a287b80f Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 3 Aug 2023 20:50:44 +0100 Subject: [PATCH 07/13] Add automake-wrapper to minge --- bin/cibw_before_all_windows.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/cibw_before_all_windows.sh b/bin/cibw_before_all_windows.sh index 367cb59f..6e69235f 100755 --- a/bin/cibw_before_all_windows.sh +++ b/bin/cibw_before_all_windows.sh @@ -21,6 +21,7 @@ pacman -S --noconfirm \ make\ base-devel\ autoconf-wrapper\ + automake-wrapper\ # # This takes ~30mins From 2badf4b0f28ed6e20a6d67747c520955b32c99f6 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 3 Aug 2023 21:08:56 +0100 Subject: [PATCH 08/13] Add libtool to mingw --- bin/cibw_before_all_windows.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/cibw_before_all_windows.sh b/bin/cibw_before_all_windows.sh index 6e69235f..1b45da64 100755 --- a/bin/cibw_before_all_windows.sh +++ b/bin/cibw_before_all_windows.sh @@ -22,6 +22,7 @@ pacman -S --noconfirm \ base-devel\ autoconf-wrapper\ automake-wrapper\ + libtool\ # # This takes ~30mins From 6daf435113316f7c5452f534a374131e6e0312c4 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Fri, 4 Aug 2023 11:22:48 +0100 Subject: [PATCH 09/13] Only source DLLs from .local/bin --- bin/cibw_repair_wheel_command_windows.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/cibw_repair_wheel_command_windows.sh b/bin/cibw_repair_wheel_command_windows.sh index c4827867..0c843d31 100755 --- a/bin/cibw_repair_wheel_command_windows.sh +++ b/bin/cibw_repair_wheel_command_windows.sh @@ -29,8 +29,11 @@ wheeldir=$(dirname $WHEELNAME) echo $wheeldir # delvewheel requires DLLs created by mingw64 to be stripped. This strips the -# DLLs for GMP etc that will have been build previously. -strip .local/bin/*.dll .local/lib/*.dll +# DLLs for GMP etc that will have been built in the CIBW_BEFORE_ALL step. +# +# Previously the Arb DLLs would have been placed in .local/lib, but as of +# flint 3.0.0 all DLLs aRe in .local/bin. +strip .local/bin/*.dll # Make sure to leave the wheel in the same directory wheeldir=$(dirname $WHEELNAME) @@ -47,4 +50,4 @@ popd # .pyd files that are needed for the wheel. delvewheel repair $WHEELNAME \ -w $WHEELHOUSE \ - --add-path .local/bin:.local/lib/ + --add-path .local/bin From ddfafbd679167957689d247908b41b6f14f5221c Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Fri, 11 Aug 2023 19:50:31 +0100 Subject: [PATCH 10/13] Update the Linux build demo script for flint 3 --- bin/pip_install_ubuntu.sh | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/bin/pip_install_ubuntu.sh b/bin/pip_install_ubuntu.sh index 5f7b7516..49930ade 100755 --- a/bin/pip_install_ubuntu.sh +++ b/bin/pip_install_ubuntu.sh @@ -14,39 +14,16 @@ set -o errexit # Install runtime and build dependencies -# The commented commands below would attempt to build python-flint against a -# system installation of Flint and Arb in Ubuntu. -# -# Ubuntu 23.04 has Flint 2.9.0 and Arb 2.23.0, so this script might work there -# (for python-flint 0.4.x). That is untested though (23.04 not available in CI). -# -# With Ubuntu 22.04, this will build but then crashes when running the tests. -# most likely this is because the versions of flint and flint-arb are too old. -# At the time of writing in Ubuntu 22.04 there is Flint 2.8.4 and Arb 2.22. The -# main CI tests and wheels for python-flint 0.4.x are built with Flint 2.9.0 -# and Arb 2.23.0. -# -# Link against libflint-arb instead of libarb on Ubuntu -# export PYTHON_FLINT_LIBFLINT_ARB=1 -# sudo apt-get update -# sudo apt-get install libflint-dev libflint-arb-dev - - -# Build Flint and Arb manually -# # First install their dependencies and build dependencies sudo apt-get update sudo apt-get install libgmp-dev libmpfr-dev xz-utils -# Only these *EXACT* versions will work. -FLINTVER=2.9.0 -ARBVER=2.23.0 +# Only Flint 3 or newer will work. +FLINTVER=3.0.0-alpha1 # This will default to installing in /usr/local. If you want to install in a # non-standard location then configure flint with # ./configure --disable-static --prefix=$PREFIX -# and arb with -# ./configure --disable-static --prefix=$PREFIX --with-flint=$PREFIX # If $PREFIX is no in default search paths, then at build time set # export C_INCLUDE_PATH=$PREFIX/include # and at runtime set @@ -55,15 +32,7 @@ ARBVER=2.23.0 curl -O -L https://www.flintlib.org/flint-$FLINTVER.tar.gz tar xf flint-$FLINTVER.tar.gz cd flint-$FLINTVER - ./configure --disable-static - make -j - sudo make install -cd .. - -curl -O -L https://github.com/fredrik-johansson/arb/archive/refs/tags/$ARBVER.tar.gz -mv $ARBVER.tar.gz arb-$ARBVER.tar.gz -tar xf arb-$ARBVER.tar.gz -cd arb-$ARBVER + ./bootstrap.sh ./configure --disable-static make -j sudo make install From 6b3a711ed414b336a48431675ed6e38f55061d60 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Wed, 6 Sep 2023 22:26:08 +0100 Subject: [PATCH 11/13] Use flint/ for arb headers --- src/flint/flintlib/acb.pxd | 2 +- src/flint/flintlib/acb_calc.pxd | 2 +- src/flint/flintlib/acb_dft.pxd | 2 +- src/flint/flintlib/acb_dirichlet.pxd | 2 +- src/flint/flintlib/acb_elliptic.pxd | 2 +- src/flint/flintlib/acb_hypgeom.pxd | 2 +- src/flint/flintlib/acb_mat.pxd | 2 +- src/flint/flintlib/acb_modular.pxd | 2 +- src/flint/flintlib/acb_poly.pxd | 2 +- src/flint/flintlib/arb.pxd | 2 +- src/flint/flintlib/arb_fmpz_poly.pxd | 2 +- src/flint/flintlib/arb_hypgeom.pxd | 2 +- src/flint/flintlib/arb_mat.pxd | 2 +- src/flint/flintlib/arb_poly.pxd | 2 +- src/flint/flintlib/arf.pxd | 2 +- src/flint/flintlib/bernoulli.pxd | 2 +- src/flint/flintlib/dirichlet.pxd | 2 +- src/flint/flintlib/mag.pxd | 2 +- src/flint/flintlib/partitions.pxd | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/flint/flintlib/acb.pxd b/src/flint/flintlib/acb.pxd index c74b3c03..32138390 100644 --- a/src/flint/flintlib/acb.pxd +++ b/src/flint/flintlib/acb.pxd @@ -5,7 +5,7 @@ from flint.flintlib.fmpz cimport fmpz_t from flint.flintlib.arf cimport arf_t from flint.flintlib.mag cimport mag_t -cdef extern from "acb.h": +cdef extern from "flint/acb.h": ctypedef struct acb_struct: arb_struct real arb_struct imag diff --git a/src/flint/flintlib/acb_calc.pxd b/src/flint/flintlib/acb_calc.pxd index 18dd8fee..013820f5 100644 --- a/src/flint/flintlib/acb_calc.pxd +++ b/src/flint/flintlib/acb_calc.pxd @@ -1,7 +1,7 @@ from flint.flintlib.acb cimport acb_t, acb_ptr from flint.flintlib.mag cimport mag_t -cdef extern from "acb_calc.h": +cdef extern from "flint/acb_calc.h": ctypedef int (*acb_calc_func_t)(acb_ptr out, const acb_t inp, void * param, long order, long prec) ctypedef struct acb_calc_integrate_opt_struct: diff --git a/src/flint/flintlib/acb_dft.pxd b/src/flint/flintlib/acb_dft.pxd index edbe3593..bdd98046 100644 --- a/src/flint/flintlib/acb_dft.pxd +++ b/src/flint/flintlib/acb_dft.pxd @@ -1,5 +1,5 @@ from flint.flintlib.acb cimport acb_ptr, acb_srcptr -cdef extern from "acb_dft.h": +cdef extern from "flint/acb_dft.h": void acb_dft(acb_ptr w, acb_srcptr v, long n, long prec) void acb_dft_inverse(acb_ptr w, acb_srcptr v, long n, long prec) diff --git a/src/flint/flintlib/acb_dirichlet.pxd b/src/flint/flintlib/acb_dirichlet.pxd index 74886cda..20c78fc2 100644 --- a/src/flint/flintlib/acb_dirichlet.pxd +++ b/src/flint/flintlib/acb_dirichlet.pxd @@ -6,7 +6,7 @@ from flint.flintlib.fmpz cimport fmpz_t from flint.flintlib.arb cimport arb_t -cdef extern from "acb_dirichlet.h": +cdef extern from "flint/acb_dirichlet.h": void acb_dirichlet_eta(acb_t res, const acb_t s, long prec) void acb_dirichlet_chi(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, ulong n, long prec) diff --git a/src/flint/flintlib/acb_elliptic.pxd b/src/flint/flintlib/acb_elliptic.pxd index d5f906dd..682a7814 100644 --- a/src/flint/flintlib/acb_elliptic.pxd +++ b/src/flint/flintlib/acb_elliptic.pxd @@ -1,6 +1,6 @@ from flint.flintlib.acb cimport acb_t -cdef extern from "acb_elliptic.h": +cdef extern from "flint/acb_elliptic.h": void acb_elliptic_rf(acb_t res, const acb_t x, const acb_t y, const acb_t z, int flags, long prec) void acb_elliptic_rj(acb_t res, const acb_t x, const acb_t y, const acb_t z, const acb_t p, int flags, long prec) void acb_elliptic_rg(acb_t res, const acb_t x, const acb_t y, const acb_t z, int flags, long prec) diff --git a/src/flint/flintlib/acb_hypgeom.pxd b/src/flint/flintlib/acb_hypgeom.pxd index 2e46ed57..5a2da85f 100644 --- a/src/flint/flintlib/acb_hypgeom.pxd +++ b/src/flint/flintlib/acb_hypgeom.pxd @@ -2,7 +2,7 @@ from flint.flintlib.acb cimport acb_t, acb_srcptr, acb_ptr from flint.flintlib.acb_poly cimport acb_poly_t, acb_poly_struct from flint.flintlib.mag cimport mag_t -cdef extern from "acb_hypgeom.h": +cdef extern from "flint/acb_hypgeom.h": void acb_hypgeom_bessel_j(acb_t res, const acb_t nu, const acb_t z, long prec) void acb_hypgeom_bessel_k(acb_t res, const acb_t nu, const acb_t z, long prec) void acb_hypgeom_bessel_i(acb_t res, const acb_t nu, const acb_t z, long prec) diff --git a/src/flint/flintlib/acb_mat.pxd b/src/flint/flintlib/acb_mat.pxd index fa2023e4..91463096 100644 --- a/src/flint/flintlib/acb_mat.pxd +++ b/src/flint/flintlib/acb_mat.pxd @@ -7,7 +7,7 @@ from flint.flintlib.acb_poly cimport acb_poly_t from flint.flintlib.arb cimport arb_t from flint.flintlib.acb cimport acb_ptr, acb_struct, acb_t, acb_srcptr -cdef extern from "acb_mat.h": +cdef extern from "flint/acb_mat.h": ctypedef struct acb_mat_struct: acb_ptr entries long r diff --git a/src/flint/flintlib/acb_modular.pxd b/src/flint/flintlib/acb_modular.pxd index 4361e164..a3c72899 100644 --- a/src/flint/flintlib/acb_modular.pxd +++ b/src/flint/flintlib/acb_modular.pxd @@ -2,7 +2,7 @@ from flint.flintlib.acb cimport acb_t, acb_ptr from flint.flintlib.acb_poly cimport acb_poly_t from flint.flintlib.fmpz_poly cimport fmpz_poly_t -cdef extern from "acb_modular.h": +cdef extern from "flint/acb_modular.h": void acb_modular_theta(acb_t theta1, acb_t theta2, acb_t theta3, acb_t theta4, const acb_t z, const acb_t tau, long prec) void acb_modular_theta_jet(acb_ptr theta1, acb_ptr theta2, acb_ptr theta3, acb_ptr theta4, const acb_t z, const acb_t tau, long len, long prec) void acb_modular_theta_series(acb_poly_t theta1, acb_poly_t theta2, acb_poly_t theta3, acb_poly_t theta4, const acb_poly_t z, const acb_t tau, long len, long prec) diff --git a/src/flint/flintlib/acb_poly.pxd b/src/flint/flintlib/acb_poly.pxd index 137d23a3..5a381590 100644 --- a/src/flint/flintlib/acb_poly.pxd +++ b/src/flint/flintlib/acb_poly.pxd @@ -6,7 +6,7 @@ from flint.flintlib.fmpz_poly cimport fmpz_poly_t from flint.flintlib.mag cimport mag_t from flint.flintlib.fmpz cimport fmpz_t -cdef extern from "acb_poly.h": +cdef extern from "flint/acb_poly.h": ctypedef struct acb_poly_struct: acb_ptr coeffs long length diff --git a/src/flint/flintlib/arb.pxd b/src/flint/flintlib/arb.pxd index c846592c..68dee23d 100644 --- a/src/flint/flintlib/arb.pxd +++ b/src/flint/flintlib/arb.pxd @@ -4,7 +4,7 @@ from flint.flintlib.fmpq cimport fmpq_t from flint.flintlib.arf cimport arf_struct, arf_ptr, arf_t from flint.flintlib.mag cimport mag_struct, mag_ptr, mag_t -cdef extern from "arb.h": +cdef extern from "flint/arb.h": ctypedef struct arb_struct: arf_struct mid mag_struct rad diff --git a/src/flint/flintlib/arb_fmpz_poly.pxd b/src/flint/flintlib/arb_fmpz_poly.pxd index 60be9a79..a9c04b27 100644 --- a/src/flint/flintlib/arb_fmpz_poly.pxd +++ b/src/flint/flintlib/arb_fmpz_poly.pxd @@ -3,7 +3,7 @@ from flint.flintlib.acb cimport acb_t, acb_ptr from flint.flintlib.fmpz_poly cimport fmpz_poly_t from flint._flint cimport ulong -cdef extern from "arb_fmpz_poly.h": +cdef extern from "flint/arb_fmpz_poly.h": void arb_fmpz_poly_evaluate_arb(arb_t res, const fmpz_poly_t poly, const arb_t x, long prec) void arb_fmpz_poly_evaluate_acb(acb_t res, const fmpz_poly_t poly, const acb_t x, long prec) void arb_fmpz_poly_complex_roots(acb_ptr roots, const fmpz_poly_t poly, int flags, long prec) diff --git a/src/flint/flintlib/arb_hypgeom.pxd b/src/flint/flintlib/arb_hypgeom.pxd index bca0d1f4..3c189bdf 100644 --- a/src/flint/flintlib/arb_hypgeom.pxd +++ b/src/flint/flintlib/arb_hypgeom.pxd @@ -3,7 +3,7 @@ from flint.flintlib.arb_poly cimport arb_poly_t from flint.flintlib.fmpz cimport fmpz_t from flint._flint cimport ulong -cdef extern from "arb_hypgeom.h": +cdef extern from "flint/arb_hypgeom.h": void arb_hypgeom_pfq(arb_t res, arb_srcptr a, long p, arb_srcptr b, long q, const arb_t z, int regularized, long prec) void arb_hypgeom_0f1(arb_t res, const arb_t a, const arb_t z, int regularized, long prec) void arb_hypgeom_m(arb_t res, const arb_t a, const arb_t b, const arb_t z, int regularized, long prec) diff --git a/src/flint/flintlib/arb_mat.pxd b/src/flint/flintlib/arb_mat.pxd index 3220a516..a0acf681 100644 --- a/src/flint/flintlib/arb_mat.pxd +++ b/src/flint/flintlib/arb_mat.pxd @@ -7,7 +7,7 @@ from flint.flintlib.fmpz cimport fmpz_t from flint.flintlib.arb cimport arb_t from flint.flintlib.arb_poly cimport arb_poly_t -cdef extern from "arb_mat.h": +cdef extern from "flint/arb_mat.h": ctypedef struct arb_mat_struct: arb_ptr entries long r diff --git a/src/flint/flintlib/arb_poly.pxd b/src/flint/flintlib/arb_poly.pxd index 9476d313..249ac164 100644 --- a/src/flint/flintlib/arb_poly.pxd +++ b/src/flint/flintlib/arb_poly.pxd @@ -4,7 +4,7 @@ from flint.flintlib.fmpz_poly cimport fmpz_poly_t from flint.flintlib.fmpq_poly cimport fmpq_poly_t from flint.flintlib.acb cimport acb_t -cdef extern from "arb_poly.h": +cdef extern from "flint/arb_poly.h": ctypedef struct arb_poly_struct: arb_ptr coeffs long length diff --git a/src/flint/flintlib/arf.pxd b/src/flint/flintlib/arf.pxd index 38ac745a..e92c4436 100644 --- a/src/flint/flintlib/arf.pxd +++ b/src/flint/flintlib/arf.pxd @@ -3,7 +3,7 @@ from flint._flint cimport mp_limb_t, ulong, flint_rand_t from flint.flintlib.fmpq cimport fmpq_t from flint.flintlib.mag cimport mag_t -cdef extern from "arf.h": +cdef extern from "flint/arf.h": ctypedef struct arf_struct: fmpz_struct exp long size diff --git a/src/flint/flintlib/bernoulli.pxd b/src/flint/flintlib/bernoulli.pxd index a1fb9ee2..513cdfe6 100644 --- a/src/flint/flintlib/bernoulli.pxd +++ b/src/flint/flintlib/bernoulli.pxd @@ -1,6 +1,6 @@ from flint._flint cimport ulong from flint.flintlib.fmpq cimport fmpq_t -cdef extern from "bernoulli.h": +cdef extern from "flint/bernoulli.h": void bernoulli_fmpq_ui(fmpq_t, ulong) void bernoulli_cache_compute(long n) diff --git a/src/flint/flintlib/dirichlet.pxd b/src/flint/flintlib/dirichlet.pxd index 6ab7306f..0237d68f 100644 --- a/src/flint/flintlib/dirichlet.pxd +++ b/src/flint/flintlib/dirichlet.pxd @@ -1,7 +1,7 @@ from flint._flint cimport ulong from flint.flintlib.nmod_vec cimport nmod_t -cdef extern from "dirichlet.h": +cdef extern from "flint/dirichlet.h": ctypedef struct dirichlet_group_struct: ulong q ulong q_even diff --git a/src/flint/flintlib/mag.pxd b/src/flint/flintlib/mag.pxd index fe25de18..acabe7e2 100644 --- a/src/flint/flintlib/mag.pxd +++ b/src/flint/flintlib/mag.pxd @@ -1,7 +1,7 @@ from flint._flint cimport ulong, mp_limb_t from flint.flintlib.fmpz cimport fmpz_struct -cdef extern from "mag.h": +cdef extern from "flint/mag.h": ctypedef struct mag_struct: fmpz_struct exp mp_limb_t man diff --git a/src/flint/flintlib/partitions.pxd b/src/flint/flintlib/partitions.pxd index ac523b55..bd3221b6 100644 --- a/src/flint/flintlib/partitions.pxd +++ b/src/flint/flintlib/partitions.pxd @@ -1,4 +1,4 @@ from flint.flintlib.fmpz cimport fmpz_t -cdef extern from "partitions.h": +cdef extern from "flint/partitions.h": void partitions_fmpz_fmpz(fmpz_t, const fmpz_t, int) From 81ca58a8485aa501ed0f9577ea8d722b6b6cb26c Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Wed, 6 Sep 2023 22:48:40 +0100 Subject: [PATCH 12/13] Add nmod_poly_factor.h --- src/flint/flintlib/nmod_poly.pxd | 14 -------------- src/flint/flintlib/nmod_poly_factor.pxd | 17 +++++++++++++++++ src/flint/types/nmod_poly.pyx | 1 + 3 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 src/flint/flintlib/nmod_poly_factor.pxd diff --git a/src/flint/flintlib/nmod_poly.pxd b/src/flint/flintlib/nmod_poly.pxd index acdd779a..5b98a1b6 100644 --- a/src/flint/flintlib/nmod_poly.pxd +++ b/src/flint/flintlib/nmod_poly.pxd @@ -10,13 +10,6 @@ cdef extern from "flint/nmod_poly.h": nmod_t mod ctypedef nmod_poly_struct nmod_poly_t[1] - ctypedef struct nmod_poly_factor_struct: - nmod_poly_struct *p - long *exp - long num - long alloc - ctypedef nmod_poly_factor_struct nmod_poly_factor_t[1] - void nmod_poly_init(nmod_poly_t poly, mp_limb_t n) void nmod_poly_init_preinv(nmod_poly_t poly, mp_limb_t n, mp_limb_t ninv) void nmod_poly_init2(nmod_poly_t poly, mp_limb_t n, long alloc) @@ -76,10 +69,3 @@ cdef extern from "flint/nmod_poly.h": void nmod_poly_tanh_series(nmod_poly_t g, nmod_poly_t h, long n) void nmod_poly_log_series(nmod_poly_t res, nmod_poly_t f, long n) void nmod_poly_exp_series(nmod_poly_t f, nmod_poly_t h, long n) - - int nmod_poly_is_irreducible(nmod_poly_t f) - mp_limb_t nmod_poly_factor_with_berlekamp(nmod_poly_factor_t result, nmod_poly_t poly) - mp_limb_t nmod_poly_factor_with_cantor_zassenhaus(nmod_poly_factor_t result, nmod_poly_t poly) - mp_limb_t nmod_poly_factor(nmod_poly_factor_t result, nmod_poly_t input) - void nmod_poly_factor_init(nmod_poly_factor_t fac) - void nmod_poly_factor_clear(nmod_poly_factor_t fac) diff --git a/src/flint/flintlib/nmod_poly_factor.pxd b/src/flint/flintlib/nmod_poly_factor.pxd new file mode 100644 index 00000000..c6e39945 --- /dev/null +++ b/src/flint/flintlib/nmod_poly_factor.pxd @@ -0,0 +1,17 @@ +from flint._flint cimport mp_limb_t +from flint.flintlib.nmod_poly cimport nmod_poly_struct, nmod_poly_t + +cdef extern from "flint/nmod_poly_factor.h": + ctypedef struct nmod_poly_factor_struct: + nmod_poly_struct *p + long *exp + long num + long alloc + ctypedef nmod_poly_factor_struct nmod_poly_factor_t[1] + + int nmod_poly_is_irreducible(nmod_poly_t f) + mp_limb_t nmod_poly_factor_with_berlekamp(nmod_poly_factor_t result, nmod_poly_t poly) + mp_limb_t nmod_poly_factor_with_cantor_zassenhaus(nmod_poly_factor_t result, nmod_poly_t poly) + mp_limb_t nmod_poly_factor(nmod_poly_factor_t result, nmod_poly_t input) + void nmod_poly_factor_init(nmod_poly_factor_t fac) + void nmod_poly_factor_clear(nmod_poly_factor_t fac) diff --git a/src/flint/types/nmod_poly.pyx b/src/flint/types/nmod_poly.pyx index 6128eca9..8c7b297b 100644 --- a/src/flint/types/nmod_poly.pyx +++ b/src/flint/types/nmod_poly.pyx @@ -8,6 +8,7 @@ from flint.types.nmod cimport nmod from flint.flintlib.nmod_vec cimport * from flint.flintlib.nmod_poly cimport * +from flint.flintlib.nmod_poly_factor cimport * from flint.flintlib.fmpz_poly cimport fmpz_poly_get_nmod_poly cdef any_as_nmod_poly(obj, nmod_t mod): From a635d59ddd74b785fa59f665429c73015b06f1f0 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Wed, 6 Sep 2023 23:14:11 +0100 Subject: [PATCH 13/13] nmod_vec -> nmod --- src/flint/flintlib/dirichlet.pxd | 2 +- src/flint/flintlib/{nmod_vec.pxd => nmod.pxd} | 2 +- src/flint/flintlib/nmod_mat.pxd | 2 +- src/flint/flintlib/nmod_poly.pxd | 2 +- src/flint/types/nmod.pxd | 2 +- src/flint/types/nmod.pyx | 2 +- src/flint/types/nmod_poly.pyx | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) rename src/flint/flintlib/{nmod_vec.pxd => nmod.pxd} (92%) diff --git a/src/flint/flintlib/dirichlet.pxd b/src/flint/flintlib/dirichlet.pxd index 0237d68f..654c8f9f 100644 --- a/src/flint/flintlib/dirichlet.pxd +++ b/src/flint/flintlib/dirichlet.pxd @@ -1,5 +1,5 @@ from flint._flint cimport ulong -from flint.flintlib.nmod_vec cimport nmod_t +from flint.flintlib.nmod cimport nmod_t cdef extern from "flint/dirichlet.h": ctypedef struct dirichlet_group_struct: diff --git a/src/flint/flintlib/nmod_vec.pxd b/src/flint/flintlib/nmod.pxd similarity index 92% rename from src/flint/flintlib/nmod_vec.pxd rename to src/flint/flintlib/nmod.pxd index 9a154a18..3697750b 100644 --- a/src/flint/flintlib/nmod_vec.pxd +++ b/src/flint/flintlib/nmod.pxd @@ -1,6 +1,6 @@ from flint._flint cimport mp_limb_t, mp_bitcnt_t -cdef extern from "flint/nmod_vec.h": +cdef extern from "flint/nmod.h": ctypedef struct nmod_t: mp_limb_t n mp_limb_t ninv diff --git a/src/flint/flintlib/nmod_mat.pxd b/src/flint/flintlib/nmod_mat.pxd index aa0a16c4..f50d29e5 100644 --- a/src/flint/flintlib/nmod_mat.pxd +++ b/src/flint/flintlib/nmod_mat.pxd @@ -1,6 +1,6 @@ from flint._flint cimport mp_limb_t, flint_rand_t, mp_ptr from flint._flint cimport mp_srcptr -from flint.flintlib.nmod_vec cimport nmod_t +from flint.flintlib.nmod cimport nmod_t from flint.flintlib.nmod_poly cimport nmod_poly_t cdef extern from "flint/nmod_mat.h": diff --git a/src/flint/flintlib/nmod_poly.pxd b/src/flint/flintlib/nmod_poly.pxd index 5b98a1b6..b9954137 100644 --- a/src/flint/flintlib/nmod_poly.pxd +++ b/src/flint/flintlib/nmod_poly.pxd @@ -1,6 +1,6 @@ from flint._flint cimport mp_ptr, mp_limb_t, mp_bitcnt_t from flint._flint cimport flint_rand_t, ulong -from flint.flintlib.nmod_vec cimport nmod_t +from flint.flintlib.nmod cimport nmod_t cdef extern from "flint/nmod_poly.h": ctypedef struct nmod_poly_struct: diff --git a/src/flint/types/nmod.pxd b/src/flint/types/nmod.pxd index 0a441fec..c1cfc6c7 100644 --- a/src/flint/types/nmod.pxd +++ b/src/flint/types/nmod.pxd @@ -1,6 +1,6 @@ from flint.flint_base.flint_base cimport flint_scalar from flint._flint cimport mp_limb_t -from flint.flintlib.nmod_vec cimport nmod_t +from flint.flintlib.nmod cimport nmod_t cdef int any_as_nmod(mp_limb_t * val, obj, nmod_t mod) except -1 diff --git a/src/flint/types/nmod.pyx b/src/flint/types/nmod.pyx index bf83f4da..deb28c70 100644 --- a/src/flint/types/nmod.pyx +++ b/src/flint/types/nmod.pyx @@ -6,7 +6,7 @@ from flint.types.fmpz cimport fmpz from flint.types.fmpq cimport fmpq from flint.flintlib.fmpz cimport fmpz_t -from flint.flintlib.nmod_vec cimport * +from flint.flintlib.nmod cimport * from flint.flintlib.fmpz cimport fmpz_fdiv_ui, fmpz_init, fmpz_clear from flint.flintlib.fmpz cimport fmpz_set_ui, fmpz_get_ui from flint.flintlib.fmpq cimport fmpq_mod_fmpz diff --git a/src/flint/types/nmod_poly.pyx b/src/flint/types/nmod_poly.pyx index 8c7b297b..4fb24610 100644 --- a/src/flint/types/nmod_poly.pyx +++ b/src/flint/types/nmod_poly.pyx @@ -6,7 +6,7 @@ from flint.types.fmpz_poly cimport fmpz_poly from flint.types.nmod cimport any_as_nmod from flint.types.nmod cimport nmod -from flint.flintlib.nmod_vec cimport * +from flint.flintlib.nmod cimport * from flint.flintlib.nmod_poly cimport * from flint.flintlib.nmod_poly_factor cimport * from flint.flintlib.fmpz_poly cimport fmpz_poly_get_nmod_poly