From b2a518d7e6174bbd12f3e77bdbb2b4bbe6fc8fdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Fri, 4 Oct 2024 22:49:33 +0200 Subject: [PATCH 001/114] Add configure option for sanity check Adds a lot of compiler warnings, and turns warnings into errors. Maintainer-level only. --- configure.ac | 76 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 23 deletions(-) diff --git a/configure.ac b/configure.ac index 65720e0f64..7290f67ab0 100644 --- a/configure.ac +++ b/configure.ac @@ -231,6 +231,26 @@ yes|no) esac], enable_coverage="no") +# NOTE: Maintainer-level only. Does not optimize, and turns on a lot of +# warnings, all of which are turned to errors. Defaults debugging to no. +AC_ARG_ENABLE(sanity-check,[], +[case $enableval in +yes|no) + ;; +*) + AC_MSG_ERROR([Bad value $enableval for --enable-sanity-check. Need yes or no.]) + ;; +esac +if test "$enableval" = "yes" && test "$cflags_set" = "yes"; +then + AC_MSG_ERROR([Cannot enable sanity check and push other CFLAGS at the same time.]) +fi], +enable_sanity_check="no") + +# NOTE: -Wdeclaration-after-statement and -Wcast-qual is not in here. We also +# remove -Wcast-function-type for GR. +sanity_check_CFLAGS="-Werror -Wall -Wextra -Wno-cast-function-type -Wcast-align -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -pedantic -std=c11 -O0" + AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],[Compile FLINT with debug information [default=yes]])], [case $enableval in @@ -244,7 +264,12 @@ yes|no) AC_MSG_ERROR([Bad value $enableval for --enable-debug. Need yes or no.]) ;; esac], -enable_debug="yes") +if test "$enable_sanity_check" = "no"; +then + enable_debug="yes" +else + enable_debug="no" +fi) AC_ARG_ENABLE(dependency-tracking, [AS_HELP_STRING([--enable-dependency-tracking],[Enable GCC automated dependency tracking [default=yes]])], @@ -323,18 +348,6 @@ yes|no) esac], enable_mpfr_check="yes") -# NOTE: Maintainer level only. Avoids any sort of optimization to speed up -# builds. -AC_ARG_ENABLE(fast-build,[], -[case $enableval in -yes|no) - ;; -*) - AC_MSG_ERROR([Bad value $enableval for --enable-fast-build. Need yes or no.]) - ;; -esac], -enable_fast_build="no") - ################################################################################ # packages ################################################################################ @@ -534,11 +547,7 @@ fi # architecture specifics ################################################################################ -if test "$enable_fast_build" = "no"; -then - gcc_cflags="-O3 " -fi -gcc_cflags="$gcc_cflags-pedantic -std=c11" +gcc_cflags="-O3 -pedantic -std=c11" gcc_warnings="-Werror=implicit-function-declaration -Wall -Wno-stringop-overread -Wno-stringop-overflow -Wno-maybe-uninitialized" dnl We only try to provide specifics for those systems that currently supports @@ -1240,7 +1249,30 @@ then [AC_MSG_ERROR([$CC does not support the flag -mavx512f needed for AVX512 instructions])]) fi -if test "$cflags_set" = "no"; +if test "$enable_sanity_check" = "yes"; +then + for flag in $sanity_check_CFLAGS; + do + AX_CHECK_COMPILE_FLAG([$flag],[save_CFLAGS="$flag $save_CFLAGS"], + [AC_MSG_ERROR([$CC does not support $flag needed for sanity check.])]) + done + found_single="no" + for flag in $gcc_cflags_arch; + do + if test "$found_single" = "yes"; + then + found_single="no" + break + else + AX_CHECK_COMPILE_FLAG([$flag], + [save_CFLAGS="$flag $save_CFLAGS" + found_single="yes"], + [unset flint_cv_have_fft_small_x86_i + unset flint_cv_have_fft_small_arm_i]) + fi + done + CFLAGS="$save_CFLAGS" +elif test "$cflags_set" = "no"; then for flag in $gcc_cflags $gcc_warnings; do @@ -1272,10 +1304,8 @@ then fi done done - if test "$enable_fast_build" = no; - then - AX_CHECK_COMPILE_FLAG([-funroll-loops],[unroll_loops="yes"]) - fi + + AX_CHECK_COMPILE_FLAG([-funroll-loops],[unroll_loops="yes"]) if test "$unroll_loops" = "yes"; then AC_SUBST(UNROLL_LOOPS,1) From ed1620323d350e88cb275d087fa75d7cfd5186fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Fri, 4 Oct 2024 23:25:41 +0200 Subject: [PATCH 002/114] Do not push -Wmissing-prototypes on inlines.c --- Makefile.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile.in b/Makefile.in index 5b170b9069..4cab9c7e5e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -80,6 +80,7 @@ GC_LIB_PATH:=@GC_LIB_PATH@ NTL_LIB_PATH:=@NTL_LIB_PATH@ CFLAGS:=@CFLAGS@ +CFLAGS_INLINE:=$(filter-out -Wmissing-declarations -Wmissing-prototypes,$(CFLAGS)) TESTCFLAGS:=@TESTCFLAGS@ CPPFLAGS:=-I$(ABS_SRC_DIR) -I$(SRC_DIR) @CPPFLAGS@ -DBUILDING_FLINT CPPFLAGS2:=-L$(ABS_FLINT_DIR) $(CPPFLAGS) @@ -592,6 +593,10 @@ define xxx_OBJS_rule $(BUILD_DIR)/$(1)/%.o: $(ABS_SRC_DIR)/$(1)/%.c | $(BUILD_DIR)/$(1) @echo " CC $$(<:$(ABS_SRC_DIR)/%=%)" @$(CC) $(CFLAGS) $($(1)_CFLAGS) $(CPPFLAGS) $(LIB_CPPFLAGS) -c $$< -o $$@ $$(DEPFLAGS) + +$(BUILD_DIR)/$(1)/inlines.o: $(ABS_SRC_DIR)/$(1)/inlines.c | $(BUILD_DIR)/$(1) + @echo " CC $$(<:$(ABS_SRC_DIR)/%=%)" + @$(CC) $(CFLAGS_INLINE) $($(1)_CFLAGS) $(CPPFLAGS) $(LIB_CPPFLAGS) -c $$< -o $$@ $$(DEPFLAGS) endef ifeq ($(IS_OUT_OF_TREE),1) @@ -618,6 +623,10 @@ define xxx_LOBJS_rule $(BUILD_DIR)/$(1)/%.lo: $(ABS_SRC_DIR)/$(1)/%.c | $(BUILD_DIR)/$(1) @echo " CC $$(<:$(ABS_SRC_DIR)/%=%)" @$(CC) $(PIC_FLAG) $(CFLAGS) $($(1)_CFLAGS) $(CPPFLAGS) $(LIB_CPPFLAGS) -c $$< -o $$@ $$(DEPFLAGS) + +$(BUILD_DIR)/$(1)/inlines.lo: $(ABS_SRC_DIR)/$(1)/inlines.c | $(BUILD_DIR)/$(1) + @echo " CC $$(<:$(ABS_SRC_DIR)/%=%)" + @$(CC) $(PIC_FLAG) $(CFLAGS_INLINE) $($(1)_CFLAGS) $(CPPFLAGS) $(LIB_CPPFLAGS) -c $$< -o $$@ $$(DEPFLAGS) endef ifeq ($(IS_OUT_OF_TREE),1) From 3f85860ca8f6bdec12ebb1e34da3b89a4e0c1768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sat, 5 Oct 2024 18:23:14 +0200 Subject: [PATCH 003/114] Remove FLINT_UNUSED from header files --- src/crt_helpers.h | 10 +++--- src/fft.h | 2 +- src/fmpq_mpoly.h | 32 +++++++++--------- src/fmpq_mpoly_factor.h | 12 +++---- src/fmpq_poly.h | 8 ++--- src/fmpz.h | 2 +- src/fmpz_mod.h | 6 ++-- src/fmpz_mod_mat.h | 60 +++++++++++++++++----------------- src/fmpz_mod_mpoly.h | 30 ++++++++--------- src/fmpz_mod_mpoly_factor.h | 44 ++++++++++++------------- src/fmpz_mod_poly.h | 58 ++++++++++++++++---------------- src/fmpz_mod_poly_factor.h | 6 ++-- src/fmpz_mpoly.h | 46 +++++++++++++------------- src/fmpz_mpoly_factor.h | 26 +++++++-------- src/fq.h | 30 ++++++++--------- src/fq_mat_templates.h | 14 ++++---- src/fq_nmod.h | 32 +++++++++--------- src/fq_nmod_mpoly.h | 54 +++++++++++++++--------------- src/fq_nmod_mpoly_factor.h | 12 +++---- src/fq_poly_factor_templates.h | 2 +- src/fq_poly_templates.h | 14 ++++---- src/fq_zech.h | 18 +++++----- src/fq_zech_mpoly.h | 24 +++++++------- src/fq_zech_mpoly_factor.h | 34 +++++++++---------- src/gr_mat.h | 8 ++--- src/gr_poly.h | 4 +-- src/gr_vec.h | 2 +- src/mpn_mod.h | 4 +-- src/mpoly.h | 18 +++++----- src/nmod_mpoly.h | 60 +++++++++++++++++----------------- src/nmod_mpoly_factor.h | 16 ++++----- src/nmod_poly.h | 8 ++--- src/padic.h | 2 +- src/padic_mat.h | 2 +- src/padic_poly.h | 8 ++--- src/thread_pool.h | 2 +- src/ulong_extras.h | 2 +- 37 files changed, 356 insertions(+), 356 deletions(-) diff --git a/src/crt_helpers.h b/src/crt_helpers.h index 2de185deb7..4380c0ea6c 100644 --- a/src/crt_helpers.h +++ b/src/crt_helpers.h @@ -99,7 +99,7 @@ FLINT_FORCE_INLINE unsigned char _subborrow_ulong(unsigned char cf, ulong x, ulo # error crt_helpers.h requires AVX2 or Neon instructions #endif -FLINT_FORCE_INLINE void multi_add_0(ulong FLINT_UNUSED(z[]), const ulong FLINT_UNUSED(a[])) +FLINT_FORCE_INLINE void multi_add_0(ulong z[], const ulong a[]) { } @@ -157,7 +157,7 @@ FLINT_FORCE_INLINE void multi_add_8(ulong z[], const ulong a[]) a[7],a[6],a[5],a[4],a[3],a[2],a[1],a[0]); } -FLINT_FORCE_INLINE void multi_sub_0(ulong FLINT_UNUSED(z[]), const ulong FLINT_UNUSED(a[])) +FLINT_FORCE_INLINE void multi_sub_0(ulong z[], const ulong a[]) { } @@ -215,7 +215,7 @@ FLINT_FORCE_INLINE void multi_sub_8(ulong z[], const ulong a[]) a[7],a[6],a[5],a[4],a[3],a[2],a[1],a[0]); } -FLINT_FORCE_INLINE void multi_rsub_0(ulong FLINT_UNUSED(z[]), const ulong FLINT_UNUSED(a[])) +FLINT_FORCE_INLINE void multi_rsub_0(ulong z[], const ulong a[]) { } @@ -348,12 +348,12 @@ FLINT_FORCE_INLINE void _madd(ulong* hi, ulong* lo, ulong y, ulong x) #endif /* NOTE: Define these manually to avoid compiler warnings or errors */ -FLINT_FORCE_INLINE void CAT3(_big_mul, 1, 0)(ulong r[], ulong FLINT_UNUSED(t[]), ulong FLINT_UNUSED(C[]), ulong FLINT_UNUSED(y)) +FLINT_FORCE_INLINE void CAT3(_big_mul, 1, 0)(ulong r[], ulong t[], ulong C[], ulong y) { r[0] = 0; } -FLINT_FORCE_INLINE void CAT3(_big_addmul, 1, 0)(ulong FLINT_UNUSED(r[]), ulong FLINT_UNUSED(t[]), ulong FLINT_UNUSED(C[]), ulong FLINT_UNUSED(y)) +FLINT_FORCE_INLINE void CAT3(_big_addmul, 1, 0)(ulong r[], ulong t[], ulong C[], ulong y) { } diff --git a/src/fft.h b/src/fft.h index 09959b9f14..031cb4dc77 100644 --- a/src/fft.h +++ b/src/fft.h @@ -181,7 +181,7 @@ void fft_mfa_truncate_sqrt2_outer(mp_limb_t ** ii, mp_size_t n, void fft_mfa_truncate_sqrt2_inner(mp_limb_t ** ii, mp_limb_t ** jj, mp_size_t n, flint_bitcnt_t w, mp_limb_t ** t1, mp_limb_t ** t2, - mp_limb_t ** FLINT_UNUSED(temp), mp_size_t n1, mp_size_t trunc, mp_limb_t ** tt); + mp_limb_t ** temp, mp_size_t n1, mp_size_t trunc, mp_limb_t ** tt); void ifft_mfa_truncate_sqrt2_outer(mp_limb_t ** ii, mp_size_t n, flint_bitcnt_t w, mp_limb_t ** t1, mp_limb_t ** t2, diff --git a/src/fmpq_mpoly.h b/src/fmpq_mpoly.h index f2f0f1c1c3..d0836cbb25 100644 --- a/src/fmpq_mpoly.h +++ b/src/fmpq_mpoly.h @@ -63,19 +63,19 @@ ordering_t fmpq_mpoly_ctx_ord(const fmpq_mpoly_ctx_t ctx) /* Polynomials over Q ********************************************************/ FMPQ_MPOLY_INLINE -fmpq * fmpq_mpoly_content_ref(fmpq_mpoly_t A, const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)) +fmpq * fmpq_mpoly_content_ref(fmpq_mpoly_t A, const fmpq_mpoly_ctx_t ctx) { return A->content; } FMPQ_MPOLY_INLINE -fmpz_mpoly_struct * fmpq_mpoly_zpoly_ref(fmpq_mpoly_t A, const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)) +fmpz_mpoly_struct * fmpq_mpoly_zpoly_ref(fmpq_mpoly_t A, const fmpq_mpoly_ctx_t ctx) { return A->zpoly; } FMPQ_MPOLY_INLINE -fmpz * fmpq_mpoly_zpoly_term_coeff_ref(fmpq_mpoly_t A, slong i, const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)) +fmpz * fmpq_mpoly_zpoly_term_coeff_ref(fmpq_mpoly_t A, slong i, const fmpq_mpoly_ctx_t ctx) { FLINT_ASSERT(i < A->zpoly->length); return A->zpoly->coeffs + i; @@ -203,7 +203,7 @@ int fmpq_mpoly_equal(const fmpq_mpoly_t A, const fmpq_mpoly_t B, FMPQ_MPOLY_INLINE void fmpq_mpoly_swap(fmpq_mpoly_t A, - fmpq_mpoly_t B, const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)) + fmpq_mpoly_t B, const fmpq_mpoly_ctx_t ctx) { FLINT_SWAP(fmpq_mpoly_struct, *A, *B); } @@ -259,7 +259,7 @@ int fmpq_mpoly_equal_si(const fmpq_mpoly_t A, slong c, const fmpq_mpoly_ctx_t ctx); FMPQ_MPOLY_INLINE -int fmpq_mpoly_is_zero(const fmpq_mpoly_t A, const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)) +int fmpq_mpoly_is_zero(const fmpq_mpoly_t A, const fmpq_mpoly_ctx_t ctx) { return A->zpoly->length == WORD(0); } @@ -297,12 +297,12 @@ void fmpq_mpoly_used_vars(int * used, const fmpq_mpoly_t A, /* Coefficients **************************************************************/ FMPQ_MPOLY_INLINE -void fmpq_mpoly_get_denominator(fmpz_t d, const fmpq_mpoly_t A, const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)) +void fmpq_mpoly_get_denominator(fmpz_t d, const fmpq_mpoly_t A, const fmpq_mpoly_ctx_t ctx) { fmpz_set(d, fmpq_denref(A->content)); } -int fmpq_mpoly_is_monic(const fmpq_mpoly_t A, const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)); +int fmpq_mpoly_is_monic(const fmpq_mpoly_t A, const fmpq_mpoly_ctx_t ctx); void fmpq_mpoly_get_coeff_fmpq_monomial(fmpq_t c, const fmpq_mpoly_t A, const fmpq_mpoly_t M, @@ -357,7 +357,7 @@ int fmpq_mpoly_is_canonical(const fmpq_mpoly_t A, const fmpq_mpoly_ctx_t ctx); FMPQ_MPOLY_INLINE -slong fmpq_mpoly_length(const fmpq_mpoly_t A, const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)) +slong fmpq_mpoly_length(const fmpq_mpoly_t A, const fmpq_mpoly_ctx_t ctx) { return A->zpoly->length; } @@ -476,7 +476,7 @@ void fmpq_mpoly_assert_canonical(const fmpq_mpoly_t poly, const fmpq_mpoly_ctx_t ctx); void _fmpq_mpoly_push_rescale(fmpq_mpoly_t A, - fmpq_t C, const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)); + fmpq_t C, const fmpq_mpoly_ctx_t ctx); /* Random generation *********************************************************/ @@ -585,7 +585,7 @@ void fmpq_mpoly_scalar_div_si(fmpq_mpoly_t A, void fmpq_mpoly_make_monic(fmpq_mpoly_t A, const fmpq_mpoly_t B, const fmpq_mpoly_ctx_t ctx); -void _fmpq_mpoly_make_monic_inplace(fmpq_mpoly_t A, const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)); +void _fmpq_mpoly_make_monic_inplace(fmpq_mpoly_t A, const fmpq_mpoly_ctx_t ctx); /* Differentiation/Integration ***********************************************/ @@ -670,7 +670,7 @@ int fmpq_mpoly_is_square(const fmpq_mpoly_t A, const fmpq_mpoly_ctx_t ctx) FMPQ_MPOLY_INLINE void fmpq_mpoly_content(fmpq_t g, const fmpq_mpoly_t A, - const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpq_mpoly_ctx_t ctx) { fmpq_abs(g, A->content); } @@ -727,7 +727,7 @@ int fmpq_mpoly_repack_bits(fmpq_mpoly_t A, const fmpq_mpoly_t B, /* Univariates ***************************************************************/ void fmpq_mpoly_univar_init(fmpq_mpoly_univar_t A, - const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)); + const fmpq_mpoly_ctx_t ctx); void fmpq_mpoly_univar_clear(fmpq_mpoly_univar_t A, const fmpq_mpoly_ctx_t ctx); @@ -752,28 +752,28 @@ void fmpq_mpoly_from_univar(fmpq_mpoly_t A, FMPQ_MPOLY_INLINE void fmpq_mpoly_univar_swap(fmpq_mpoly_univar_t A, fmpq_mpoly_univar_t B, - const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpq_mpoly_ctx_t ctx) { FLINT_SWAP(fmpq_mpoly_univar_struct, *A, *B); } FMPQ_MPOLY_INLINE int fmpq_mpoly_univar_degree_fits_si(const fmpq_mpoly_univar_t A, - const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpq_mpoly_ctx_t ctx) { return A->length == 0 || fmpz_fits_si(A->exps + 0); } FMPQ_MPOLY_INLINE slong fmpq_mpoly_univar_length(const fmpq_mpoly_univar_t A, - const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpq_mpoly_ctx_t ctx) { return A->length; } FMPQ_MPOLY_INLINE slong fmpq_mpoly_univar_get_term_exp_si(fmpq_mpoly_univar_t A, slong i, - const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpq_mpoly_ctx_t ctx) { FLINT_ASSERT((ulong)i < (ulong)A->length); return fmpz_get_si(A->exps + i); diff --git a/src/fmpq_mpoly_factor.h b/src/fmpq_mpoly_factor.h index 06b4301c20..6009329787 100644 --- a/src/fmpq_mpoly_factor.h +++ b/src/fmpq_mpoly_factor.h @@ -25,7 +25,7 @@ extern "C" { #endif void fmpq_mpoly_factor_init(fmpq_mpoly_factor_t f, - const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)); + const fmpq_mpoly_ctx_t ctx); void fmpq_mpoly_factor_realloc(fmpq_mpoly_factor_t f, slong alloc, const fmpq_mpoly_ctx_t ctx); @@ -38,14 +38,14 @@ void fmpq_mpoly_factor_clear(fmpq_mpoly_factor_t f, FMPQ_MPOLY_FACTOR_INLINE slong fmpq_mpoly_factor_length(const fmpq_mpoly_factor_t f, - const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpq_mpoly_ctx_t ctx) { return f->num; } FMPQ_MPOLY_FACTOR_INLINE void fmpq_mpoly_factor_get_constant_fmpq(fmpq_t c, - const fmpq_mpoly_factor_t f, const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpq_mpoly_factor_t f, const fmpq_mpoly_ctx_t ctx) { fmpq_set(c, f->constant); } @@ -68,7 +68,7 @@ void fmpq_mpoly_factor_swap_base(fmpq_mpoly_t p, fmpq_mpoly_factor_t f, FMPQ_MPOLY_FACTOR_INLINE slong fmpq_mpoly_factor_get_exp_si(fmpq_mpoly_factor_t f, - slong i, const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)) + slong i, const fmpq_mpoly_ctx_t ctx) { FLINT_ASSERT(i < (ulong) f->num); return fmpz_get_si(f->exp + i); @@ -79,10 +79,10 @@ void fmpq_mpoly_factor_sort(fmpq_mpoly_factor_t f, const fmpq_mpoly_ctx_t ctx); int fmpq_mpoly_factor_make_monic(fmpq_mpoly_factor_t f, - const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)); + const fmpq_mpoly_ctx_t ctx); int fmpq_mpoly_factor_make_integral(fmpq_mpoly_factor_t f, - const fmpq_mpoly_ctx_t FLINT_UNUSED(ctx)); + const fmpq_mpoly_ctx_t ctx); int fmpq_mpoly_factor_squarefree(fmpq_mpoly_factor_t f, const fmpq_mpoly_t A, const fmpq_mpoly_ctx_t ctx); diff --git a/src/fmpq_poly.h b/src/fmpq_poly.h index 0db6b01f40..4d6c3781f9 100644 --- a/src/fmpq_poly.h +++ b/src/fmpq_poly.h @@ -370,7 +370,7 @@ void fmpq_poly_shift_right(fmpq_poly_t res, const fmpq_poly_t poly, slong n); #ifdef FMPZ_H void _fmpq_poly_divrem(fmpz * Q, fmpz_t q, fmpz * R, fmpz_t r, const fmpz * A, const fmpz_t a, slong lenA, const fmpz * B, const fmpz_t b, slong lenB, const fmpz_preinvn_t inv); void _fmpq_poly_div(fmpz * Q, fmpz_t q, const fmpz * A, const fmpz_t a, slong lenA, const fmpz * B, const fmpz_t b, slong lenB, const fmpz_preinvn_t inv); -void _fmpq_poly_rem(fmpz * R, fmpz_t r, const fmpz * A, const fmpz_t a, slong lenA, const fmpz * B, const fmpz_t FLINT_UNUSED(b), slong lenB, const fmpz_preinvn_t inv); +void _fmpq_poly_rem(fmpz * R, fmpz_t r, const fmpz * A, const fmpz_t a, slong lenA, const fmpz * B, const fmpz_t b, slong lenB, const fmpz_preinvn_t inv); #endif void fmpq_poly_divrem(fmpq_poly_t Q, fmpq_poly_t R, const fmpq_poly_t poly1, const fmpq_poly_t poly2); @@ -379,7 +379,7 @@ void fmpq_poly_rem(fmpq_poly_t R, const fmpq_poly_t poly1, const fmpq_poly_t pol /* Precomputed inverse *****************************************************/ -fmpq_poly_struct * _fmpq_poly_powers_precompute(const fmpz * B, const fmpz_t FLINT_UNUSED(denB), slong len); +fmpq_poly_struct * _fmpq_poly_powers_precompute(const fmpz * B, const fmpz_t denB, slong len); void fmpq_poly_powers_precompute(fmpq_poly_powers_precomp_t pinv, fmpq_poly_t poly); void _fmpq_poly_powers_clear(fmpq_poly_struct * powers, slong len); @@ -694,7 +694,7 @@ void _fmpq_poly_content(fmpq_t res, void fmpq_poly_content(fmpq_t res, const fmpq_poly_t poly); void _fmpq_poly_primitive_part(fmpz * rpoly, fmpz_t rden, - const fmpz * poly, const fmpz_t FLINT_UNUSED(den), slong len); + const fmpz * poly, const fmpz_t den, slong len); void fmpq_poly_primitive_part(fmpq_poly_t res, const fmpq_poly_t poly); @@ -703,7 +703,7 @@ int _fmpq_poly_is_monic(const fmpz * poly, const fmpz_t den, slong len); int fmpq_poly_is_monic(const fmpq_poly_t poly); void _fmpq_poly_make_monic(fmpz * rpoly, fmpz_t rden, - const fmpz * poly, const fmpz_t FLINT_UNUSED(den), slong len); + const fmpz * poly, const fmpz_t den, slong len); void fmpq_poly_make_monic(fmpq_poly_t res, const fmpq_poly_t poly); diff --git a/src/fmpz.h b/src/fmpz.h index 140d0fc299..6c15f64974 100644 --- a/src/fmpz.h +++ b/src/fmpz.h @@ -689,7 +689,7 @@ void fmpz_lucas_chain_double(fmpz_t U2m, fmpz_t U2m1, const fmpz_t Um, const fmp void fmpz_lucas_chain_add(fmpz_t Umn, fmpz_t Umn1, const fmpz_t Um, const fmpz_t Um1, const fmpz_t Un, const fmpz_t Un1, const fmpz_t A, const fmpz_t B, const fmpz_t n); void fmpz_lucas_chain_mul(fmpz_t Ukm, fmpz_t Ukm1, const fmpz_t Um, const fmpz_t Um1, const fmpz_t A, const fmpz_t B, const fmpz_t k, const fmpz_t n); -void fmpz_lucas_chain_VtoU(fmpz_t Um, fmpz_t Um1, const fmpz_t Vm, const fmpz_t Vm1, const fmpz_t A, const fmpz_t FLINT_UNUSED(B), const fmpz_t Dinv, const fmpz_t n); +void fmpz_lucas_chain_VtoU(fmpz_t Um, fmpz_t Um1, const fmpz_t Vm, const fmpz_t Vm1, const fmpz_t A, const fmpz_t B, const fmpz_t Dinv, const fmpz_t n); int fmpz_is_probabprime_lucas(const fmpz_t n); int fmpz_is_probabprime_BPSW(const fmpz_t n); diff --git a/src/fmpz_mod.h b/src/fmpz_mod.h index 6037cf682d..7fd7d427ae 100644 --- a/src/fmpz_mod.h +++ b/src/fmpz_mod.h @@ -66,7 +66,7 @@ void fmpz_mod_set_ui(fmpz_t a, ulong b, const fmpz_mod_ctx_t ctx); void fmpz_mod_set_si(fmpz_t a, slong b, const fmpz_mod_ctx_t ctx); void _fmpz_mod_add1(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx); -void _fmpz_mod_add2s(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void _fmpz_mod_add2s(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx); void _fmpz_mod_add2(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx); void _fmpz_mod_addN(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx); @@ -81,7 +81,7 @@ void fmpz_mod_add_ui(fmpz_t a, const fmpz_t b, ulong c, const fmpz_mod_ctx_t ctx void fmpz_mod_add_si(fmpz_t a, const fmpz_t b, slong c, const fmpz_mod_ctx_t ctx); void _fmpz_mod_sub1(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx); -void _fmpz_mod_sub2s(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void _fmpz_mod_sub2s(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx); void _fmpz_mod_sub2(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx); void _fmpz_mod_subN(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx); @@ -101,7 +101,7 @@ void fmpz_mod_si_sub(fmpz_t a, slong b, const fmpz_t c, const fmpz_mod_ctx_t ctx void fmpz_mod_neg(fmpz_t a, const fmpz_t b, const fmpz_mod_ctx_t ctx); void _fmpz_mod_mul1(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx); -void _fmpz_mod_mul2s(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void _fmpz_mod_mul2s(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx); void _fmpz_mod_mul2(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx); void _fmpz_mod_mulN(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx); diff --git a/src/fmpz_mod_mat.h b/src/fmpz_mod_mat.h index 9d108c5954..f76ffb1b9f 100644 --- a/src/fmpz_mod_mat.h +++ b/src/fmpz_mod_mat.h @@ -36,27 +36,27 @@ fmpz * fmpz_mod_mat_entry(const fmpz_mod_mat_t mat, slong i, slong j) return fmpz_mat_entry(mat, i, j); } -void fmpz_mod_mat_set_entry(fmpz_mod_mat_t mat, slong i, slong j, const fmpz_t val, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); -void fmpz_mod_mat_get_entry(fmpz_t x, const fmpz_mod_mat_t mat, slong i, slong j, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mod_mat_set_entry(fmpz_mod_mat_t mat, slong i, slong j, const fmpz_t val, const fmpz_mod_ctx_t ctx); +void fmpz_mod_mat_get_entry(fmpz_t x, const fmpz_mod_mat_t mat, slong i, slong j, const fmpz_mod_ctx_t ctx); /* Memory management ********************************************************/ -void fmpz_mod_mat_init(fmpz_mod_mat_t mat, slong rows, slong cols, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mod_mat_init(fmpz_mod_mat_t mat, slong rows, slong cols, const fmpz_mod_ctx_t ctx); -void fmpz_mod_mat_init_set(fmpz_mod_mat_t mat, const fmpz_mod_mat_t src, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mod_mat_init_set(fmpz_mod_mat_t mat, const fmpz_mod_mat_t src, const fmpz_mod_ctx_t ctx); -void fmpz_mod_mat_clear(fmpz_mod_mat_t mat, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mod_mat_clear(fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx); /* Basic manipulation ********************************************************/ FMPZ_MOD_MAT_INLINE -slong fmpz_mod_mat_nrows(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +slong fmpz_mod_mat_nrows(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx) { return fmpz_mat_nrows(mat); } FMPZ_MOD_MAT_INLINE -slong fmpz_mod_mat_ncols(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +slong fmpz_mod_mat_ncols(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx) { return fmpz_mat_ncols(mat); } @@ -71,39 +71,39 @@ void fmpz_mod_mat_one(fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx) } FMPZ_MOD_MAT_INLINE -void fmpz_mod_mat_zero(fmpz_mod_mat_t mat, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mod_mat_zero(fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx) { fmpz_mat_zero(mat); } FMPZ_MOD_MAT_INLINE -int fmpz_mod_mat_is_empty(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +int fmpz_mod_mat_is_empty(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx) { return fmpz_mat_is_empty(mat); } FMPZ_MOD_MAT_INLINE -int fmpz_mod_mat_is_square(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +int fmpz_mod_mat_is_square(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx) { return fmpz_mat_is_square(mat); } -void fmpz_mod_mat_swap(fmpz_mod_mat_t mat1, fmpz_mod_mat_t mat2, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mod_mat_swap(fmpz_mod_mat_t mat1, fmpz_mod_mat_t mat2, const fmpz_mod_ctx_t ctx); void fmpz_mod_mat_swap_entrywise(fmpz_mod_mat_t mat1, fmpz_mod_mat_t mat2, const fmpz_mod_ctx_t ctx); -void fmpz_mod_mat_set(fmpz_mod_mat_t B, const fmpz_mod_mat_t A, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mod_mat_set(fmpz_mod_mat_t B, const fmpz_mod_mat_t A, const fmpz_mod_ctx_t ctx); /* Conversions */ FMPZ_MOD_MAT_INLINE -void fmpz_mod_mat_set_nmod_mat(fmpz_mod_mat_t A, const nmod_mat_t B, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mod_mat_set_nmod_mat(fmpz_mod_mat_t A, const nmod_mat_t B, const fmpz_mod_ctx_t ctx) { fmpz_mat_set_nmod_mat_unsigned(A, B); } void fmpz_mod_mat_set_fmpz_mat(fmpz_mod_mat_t A, const fmpz_mat_t B, const fmpz_mod_ctx_t ctx); -void fmpz_mod_mat_get_fmpz_mat(fmpz_mat_t A, const fmpz_mod_mat_t B, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mod_mat_get_fmpz_mat(fmpz_mat_t A, const fmpz_mod_mat_t B, const fmpz_mod_ctx_t ctx); FMPZ_MOD_MAT_INLINE void _fmpz_mod_mat_reduce(fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx) { @@ -129,14 +129,14 @@ void fmpz_mod_mat_randops(fmpz_mod_mat_t mat, flint_rand_t state, slong count, c /* Windows and concatenation */ -void fmpz_mod_mat_window_init(fmpz_mod_mat_t window, const fmpz_mod_mat_t mat, slong r1, slong c1, slong r2, slong c2, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mod_mat_window_init(fmpz_mod_mat_t window, const fmpz_mod_mat_t mat, slong r1, slong c1, slong r2, slong c2, const fmpz_mod_ctx_t ctx); -void fmpz_mod_mat_window_clear(fmpz_mod_mat_t window, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mod_mat_window_clear(fmpz_mod_mat_t window, const fmpz_mod_ctx_t ctx); FMPZ_MOD_MAT_INLINE void fmpz_mod_mat_concat_horizontal(fmpz_mod_mat_t res, const fmpz_mod_mat_t mat1, - const fmpz_mod_mat_t mat2, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_mat_t mat2, const fmpz_mod_ctx_t ctx) { fmpz_mat_concat_horizontal(res, mat1, mat2); } @@ -144,7 +144,7 @@ void fmpz_mod_mat_concat_horizontal(fmpz_mod_mat_t res, FMPZ_MOD_MAT_INLINE void fmpz_mod_mat_concat_vertical(fmpz_mod_mat_t res, const fmpz_mod_mat_t mat1, - const fmpz_mod_mat_t mat2, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_mat_t mat2, const fmpz_mod_ctx_t ctx) { fmpz_mat_concat_vertical(res, mat1, mat2); } @@ -152,23 +152,23 @@ void fmpz_mod_mat_concat_vertical(fmpz_mod_mat_t res, /* Input/output */ #ifdef FLINT_HAVE_FILE -int fmpz_mod_mat_fprint(FILE * file, const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); -int fmpz_mod_mat_fprint_pretty(FILE * file, const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +int fmpz_mod_mat_fprint(FILE * file, const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx); +int fmpz_mod_mat_fprint_pretty(FILE * file, const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx); #endif -int fmpz_mod_mat_print(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); -void fmpz_mod_mat_print_pretty(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +int fmpz_mod_mat_print(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx); +void fmpz_mod_mat_print_pretty(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx); /* Comparison */ -int fmpz_mod_mat_equal(const fmpz_mod_mat_t mat1, const fmpz_mod_mat_t mat2, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); -int fmpz_mod_mat_is_zero(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); -int fmpz_mod_mat_is_one(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +int fmpz_mod_mat_equal(const fmpz_mod_mat_t mat1, const fmpz_mod_mat_t mat2, const fmpz_mod_ctx_t ctx); +int fmpz_mod_mat_is_zero(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx); +int fmpz_mod_mat_is_one(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx); /* Transpose */ FMPZ_MOD_MAT_INLINE -void fmpz_mod_mat_transpose(fmpz_mod_mat_t B, const fmpz_mod_mat_t A, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mod_mat_transpose(fmpz_mod_mat_t B, const fmpz_mod_mat_t A, const fmpz_mod_ctx_t ctx) { fmpz_mat_transpose(B, A); } @@ -262,25 +262,25 @@ void fmpz_mod_mat_similarity(fmpz_mod_mat_t A, slong r, fmpz_t d, const fmpz_mod /* Permutations ************************************************************/ FMPZ_MOD_MAT_INLINE -void fmpz_mod_mat_swap_rows(fmpz_mod_mat_t mat, slong * perm, slong r, slong s, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mod_mat_swap_rows(fmpz_mod_mat_t mat, slong * perm, slong r, slong s, const fmpz_mod_ctx_t ctx) { fmpz_mat_swap_rows(mat, perm, r, s); } FMPZ_MOD_MAT_INLINE -void fmpz_mod_mat_invert_rows(fmpz_mod_mat_t mat, slong * perm, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mod_mat_invert_rows(fmpz_mod_mat_t mat, slong * perm, const fmpz_mod_ctx_t ctx) { fmpz_mat_invert_rows(mat, perm); } FMPZ_MOD_MAT_INLINE -void fmpz_mod_mat_swap_cols(fmpz_mod_mat_t mat, slong * perm, slong r, slong s, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mod_mat_swap_cols(fmpz_mod_mat_t mat, slong * perm, slong r, slong s, const fmpz_mod_ctx_t ctx) { fmpz_mat_swap_cols(mat, perm, r, s); } FMPZ_MOD_MAT_INLINE -void fmpz_mod_mat_invert_cols(fmpz_mod_mat_t mat, slong * perm, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mod_mat_invert_cols(fmpz_mod_mat_t mat, slong * perm, const fmpz_mod_ctx_t ctx) { fmpz_mat_invert_cols(mat, perm); } diff --git a/src/fmpz_mod_mpoly.h b/src/fmpz_mod_mpoly.h index e103095110..cc6040c076 100644 --- a/src/fmpz_mod_mpoly.h +++ b/src/fmpz_mod_mpoly.h @@ -90,7 +90,7 @@ void fmpz_mod_mpoly_ctx_get_modulus(fmpz_t m, const fmpz_mod_mpoly_ctx_t ctx) FMPZ_MOD_MPOLY_INLINE -void fmpz_mod_mpoly_init(fmpz_mod_mpoly_t A, const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mod_mpoly_init(fmpz_mod_mpoly_t A, const fmpz_mod_mpoly_ctx_t ctx) { A->coeffs = NULL; A->exps = NULL; @@ -100,7 +100,7 @@ void fmpz_mod_mpoly_init(fmpz_mod_mpoly_t A, const fmpz_mod_mpoly_ctx_t FLINT_UN A->exps_alloc = 0; } -void fmpz_mod_mpoly_clear(fmpz_mod_mpoly_t A, const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mod_mpoly_clear(fmpz_mod_mpoly_t A, const fmpz_mod_mpoly_ctx_t ctx); void fmpz_mod_mpoly_init2(fmpz_mod_mpoly_t A, slong alloc, const fmpz_mod_mpoly_ctx_t ctx); @@ -148,7 +148,7 @@ void _fmpz_mod_mpoly_fit_length( FMPZ_MOD_MPOLY_INLINE void _fmpz_mod_mpoly_set_length(fmpz_mod_mpoly_t A, slong newlen, - const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_mpoly_ctx_t ctx) { FLINT_ASSERT(newlen <= A->coeffs_alloc); FLINT_ASSERT(mpoly_words_per_exp(A->bits, ctx->minfo)*newlen <= A->exps_alloc); @@ -158,7 +158,7 @@ void _fmpz_mod_mpoly_set_length(fmpz_mod_mpoly_t A, slong newlen, FMPZ_MOD_MPOLY_INLINE void fmpz_mod_mpoly_truncate(fmpz_mod_mpoly_t A, slong newlen, - const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_mpoly_ctx_t ctx) { if (A->length > newlen) { @@ -202,7 +202,7 @@ int fmpz_mod_mpoly_equal(const fmpz_mod_mpoly_t A, FMPZ_MOD_MPOLY_INLINE void fmpz_mod_mpoly_swap(fmpz_mod_mpoly_t A, fmpz_mod_mpoly_t B, - const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_mpoly_ctx_t ctx) { FLINT_SWAP(fmpz_mod_mpoly_struct, *A, *B); } @@ -250,7 +250,7 @@ int fmpz_mod_mpoly_equal_si(const fmpz_mod_mpoly_t A, FMPZ_MOD_MPOLY_INLINE int fmpz_mod_mpoly_is_zero(const fmpz_mod_mpoly_t A, - const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_mpoly_ctx_t ctx) { return A->length < 1; } @@ -356,7 +356,7 @@ int fmpz_mod_mpoly_is_canonical(const fmpz_mod_mpoly_t A, FMPZ_MOD_MPOLY_INLINE slong fmpz_mod_mpoly_length(const fmpz_mod_mpoly_t A, - const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_mpoly_ctx_t ctx) { return A->length; } @@ -365,7 +365,7 @@ void fmpz_mod_mpoly_resize(fmpz_mod_mpoly_t A, slong new_length, const fmpz_mod_mpoly_ctx_t ctx); void fmpz_mod_mpoly_get_term_coeff_fmpz(fmpz_t c, - const fmpz_mod_mpoly_t A, slong i, const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)); + const fmpz_mod_mpoly_t A, slong i, const fmpz_mod_mpoly_ctx_t ctx); void fmpz_mod_mpoly_set_term_coeff_fmpz(fmpz_mod_mpoly_t A, slong i, const fmpz_t c, const fmpz_mod_mpoly_ctx_t ctx); @@ -757,7 +757,7 @@ void fmpz_mod_mpoly_inflate(fmpz_mod_mpoly_t A, /* Univariates ***************************************************************/ void fmpz_mod_mpoly_univar_init(fmpz_mod_mpoly_univar_t A, - const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)); + const fmpz_mod_mpoly_ctx_t ctx); void fmpz_mod_mpoly_univar_clear(fmpz_mod_mpoly_univar_t A, const fmpz_mod_mpoly_ctx_t ctx); @@ -773,7 +773,7 @@ void fmpz_mod_mpoly_univar_assert_canonical(fmpz_mod_mpoly_univar_t A, FMPZ_MOD_MPOLY_INLINE void fmpz_mod_mpoly_univar_zero(fmpz_mod_mpoly_univar_t A, - const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_mpoly_ctx_t ctx) { A->length = 0; } @@ -794,28 +794,28 @@ void fmpz_mod_mpoly_from_univar(fmpz_mod_mpoly_t A, FMPZ_MOD_MPOLY_INLINE void fmpz_mod_mpoly_univar_swap(fmpz_mod_mpoly_univar_t A, - fmpz_mod_mpoly_univar_t B, const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + fmpz_mod_mpoly_univar_t B, const fmpz_mod_mpoly_ctx_t ctx) { FLINT_SWAP(fmpz_mod_mpoly_univar_struct, *A, *B); } FMPZ_MOD_MPOLY_INLINE int fmpz_mod_mpoly_univar_degree_fits_si(const fmpz_mod_mpoly_univar_t A, - const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_mpoly_ctx_t ctx) { return A->length == 0 || fmpz_fits_si(A->exps + 0); } FMPZ_MOD_MPOLY_INLINE slong fmpz_mod_mpoly_univar_length(const fmpz_mod_mpoly_univar_t A, - const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_mpoly_ctx_t ctx) { return A->length; } FMPZ_MOD_MPOLY_INLINE slong fmpz_mod_mpoly_univar_get_term_exp_si(fmpz_mod_mpoly_univar_t A, slong i, - const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_mpoly_ctx_t ctx) { FLINT_ASSERT(i < (ulong)A->length); return fmpz_get_si(A->exps + i); @@ -923,7 +923,7 @@ void _fmpz_mod_mpoly_from_fmpz_mod_poly_inflate(fmpz_mod_mpoly_t A, void _fmpz_mod_mpoly_set_nmod_mpoly(fmpz_mod_mpoly_t A, const fmpz_mod_mpoly_ctx_t ctx, const nmod_mpoly_t nA, - const nmod_mpoly_ctx_t FLINT_UNUSED(nctx)); + const nmod_mpoly_ctx_t nctx); void _fmpz_mod_mpoly_get_nmod_mpoly(nmod_mpoly_t nA, const nmod_mpoly_ctx_t nctx, const fmpz_mod_mpoly_t A, diff --git a/src/fmpz_mod_mpoly_factor.h b/src/fmpz_mod_mpoly_factor.h index 4a93c1817d..9f6c02039b 100644 --- a/src/fmpz_mod_mpoly_factor.h +++ b/src/fmpz_mod_mpoly_factor.h @@ -27,7 +27,7 @@ extern "C" { FMPZ_MOD_MPOLY_FACTOR_INLINE void fmpz_mod_mpoly_factor_init(fmpz_mod_mpoly_factor_t f, - const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_mpoly_ctx_t ctx) { fmpz_init_set_ui(f->constant, 1); f->poly = NULL; @@ -50,14 +50,14 @@ void fmpz_mod_mpoly_factor_clear(fmpz_mod_mpoly_factor_t f, FMPZ_MOD_MPOLY_FACTOR_INLINE slong fmpz_mod_mpoly_factor_length(const fmpz_mod_mpoly_factor_t f, - const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_mpoly_ctx_t ctx) { return f->num; } FMPZ_MOD_MPOLY_FACTOR_INLINE void fmpz_mod_mpoly_factor_get_constant_fmpz(fmpz_t c, - const fmpz_mod_mpoly_factor_t f, const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_mpoly_factor_t f, const fmpz_mod_mpoly_ctx_t ctx) { fmpz_set(c, f->constant); } @@ -80,7 +80,7 @@ void fmpz_mod_mpoly_factor_swap_base(fmpz_mod_mpoly_t p, FMPZ_MOD_MPOLY_FACTOR_INLINE slong fmpz_mod_mpoly_factor_get_exp_si(fmpz_mod_mpoly_factor_t f, - slong i, const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + slong i, const fmpz_mod_mpoly_ctx_t ctx) { FLINT_ASSERT(i < (ulong) f->num); return fmpz_get_si(f->exp + i); @@ -88,7 +88,7 @@ slong fmpz_mod_mpoly_factor_get_exp_si(fmpz_mod_mpoly_factor_t f, FMPZ_MOD_MPOLY_FACTOR_INLINE void fmpz_mod_mpoly_factor_swap(fmpz_mod_mpoly_factor_t f, - fmpz_mod_mpoly_factor_t g, const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + fmpz_mod_mpoly_factor_t g, const fmpz_mod_mpoly_ctx_t ctx) { fmpz_mod_mpoly_factor_struct t = *f; *f = *g; @@ -263,7 +263,7 @@ void fmpz_mod_mpoly_factor_append_fmpz_swap(fmpz_mod_mpoly_factor_t f, FMPZ_MOD_MPOLY_FACTOR_INLINE void fmpz_mod_mpoly_factor_one(fmpz_mod_mpoly_factor_t f, - const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_mpoly_ctx_t ctx) { fmpz_one(f->constant); f->num = 0; @@ -479,7 +479,7 @@ slong fmpz_mod_polyun_stack_size(const fmpz_mod_polyun_stack_t S) void fmpz_mod_mpolyn_stack_init(fmpz_mod_mpolyn_stack_t S, - flint_bitcnt_t bits, const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)); + flint_bitcnt_t bits, const fmpz_mod_mpoly_ctx_t ctx); void fmpz_mod_mpolyn_stack_clear(fmpz_mod_mpolyn_stack_t S, const fmpz_mod_mpoly_ctx_t ctx); @@ -574,7 +574,7 @@ int fmpz_mod_polyun_is_canonical(const fmpz_mod_polyun_t A, const fmpz_mod_ctx_t ctx); FMPZ_MOD_MPOLY_INLINE -void fmpz_mod_polyun_init(fmpz_mod_polyun_t A, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mod_polyun_init(fmpz_mod_polyun_t A, const fmpz_mod_ctx_t ctx) { A->length = 0; A->alloc = 0; @@ -625,10 +625,10 @@ void fmpz_mod_mpoly_set_polyu1n(fmpz_mod_mpoly_t B, /* mpolyn ********************************************************************/ void fmpz_mod_mpolyn_init(fmpz_mod_mpolyn_t A, flint_bitcnt_t bits, - const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)); + const fmpz_mod_mpoly_ctx_t ctx); FMPZ_MOD_MPOLY_INLINE void fmpz_mod_mpolyn_swap(fmpz_mod_mpolyn_t A, - fmpz_mod_mpolyn_t B, const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + fmpz_mod_mpolyn_t B, const fmpz_mod_mpoly_ctx_t ctx) { fmpz_mod_mpolyn_struct t = *A; *A = *B; @@ -833,7 +833,7 @@ FMPZ_MOD_MPOLY_FACTOR_INLINE void fmpz_mod_polyu_fit_length( fmpz_mod_polyu_t a, slong len, - const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_ctx_t ctx) { if (len > a->alloc) fmpz_mod_polyu_realloc(a, len); @@ -850,7 +850,7 @@ void fmpz_mod_polyu3_print_pretty( const char * var0, const char * var1, const char * var2, - const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); + const fmpz_mod_ctx_t ctx); /* mpolyu ********************************************************************/ @@ -868,7 +868,7 @@ int fmpz_mod_bpoly_is_canonical(const fmpz_mod_bpoly_t A, const fmpz_mod_ctx_t ctx); FMPZ_MOD_MPOLY_FACTOR_INLINE -void fmpz_mod_bpoly_init(fmpz_mod_bpoly_t A, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mod_bpoly_init(fmpz_mod_bpoly_t A, const fmpz_mod_ctx_t ctx) { A->coeffs = NULL; A->alloc = 0; @@ -879,7 +879,7 @@ void fmpz_mod_bpoly_clear(fmpz_mod_bpoly_t A, const fmpz_mod_ctx_t ctx); FMPZ_MOD_MPOLY_FACTOR_INLINE void fmpz_mod_bpoly_swap(fmpz_mod_bpoly_t A, fmpz_mod_bpoly_t B, - const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_ctx_t ctx) { fmpz_mod_bpoly_struct t = *A; *A = *B; @@ -899,7 +899,7 @@ void fmpz_mod_bpoly_get_coeff(fmpz_t c, const fmpz_mod_bpoly_t A, FMPZ_MOD_MPOLY_FACTOR_INLINE -slong fmpz_mod_bpoly_degree0(const fmpz_mod_bpoly_t A, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +slong fmpz_mod_bpoly_degree0(const fmpz_mod_bpoly_t A, const fmpz_mod_ctx_t ctx) { return A->length - 1; } @@ -942,7 +942,7 @@ int fmpz_mod_bpoly_is_one(const fmpz_mod_bpoly_t A, const fmpz_mod_ctx_t ctx) } slong fmpz_mod_bpoly_degree1(const fmpz_mod_bpoly_t A, - const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); + const fmpz_mod_ctx_t ctx); void fmpz_mod_bpoly_print_pretty(const fmpz_mod_bpoly_t A, const char * xvar, const char * yvar, const fmpz_mod_ctx_t ctx); @@ -953,7 +953,7 @@ void fmpz_mod_bpoly_fit_length(fmpz_mod_bpoly_t A, slong len, void fmpz_mod_bpoly_set_coeff(fmpz_mod_bpoly_t A, slong xi, slong yi, const fmpz_t c, const fmpz_mod_ctx_t ctx); -void fmpz_mod_bpoly_zero(fmpz_mod_bpoly_t A, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mod_bpoly_zero(fmpz_mod_bpoly_t A, const fmpz_mod_ctx_t ctx); void fmpz_mod_bpoly_reverse_vars(fmpz_mod_bpoly_t A, const fmpz_mod_bpoly_t B, const fmpz_mod_ctx_t ctx); @@ -1026,7 +1026,7 @@ void fmpz_mod_bpoly_make_monic_series( FMPZ_MOD_MPOLY_INLINE -void fmpz_mod_tpoly_init(fmpz_mod_tpoly_t A, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mod_tpoly_init(fmpz_mod_tpoly_t A, const fmpz_mod_ctx_t ctx) { A->coeffs = NULL; A->alloc = 0; @@ -1035,7 +1035,7 @@ void fmpz_mod_tpoly_init(fmpz_mod_tpoly_t A, const fmpz_mod_ctx_t FLINT_UNUSED(c FMPZ_MOD_MPOLY_INLINE void fmpz_mod_tpoly_swap(fmpz_mod_tpoly_t A, fmpz_mod_tpoly_t B, - const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_ctx_t ctx) { fmpz_mod_tpoly_struct t = *A; *A = *B; @@ -1093,7 +1093,7 @@ typedef struct typedef fmpz_mod_mpolyv_struct fmpz_mod_mpolyv_t[1]; FMPZ_MOD_MPOLY_FACTOR_INLINE -void fmpz_mod_mpolyv_init(fmpz_mod_mpolyv_t A, const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mod_mpolyv_init(fmpz_mod_mpolyv_t A, const fmpz_mod_mpoly_ctx_t ctx) { A->coeffs = NULL; A->alloc = 0; @@ -1102,7 +1102,7 @@ void fmpz_mod_mpolyv_init(fmpz_mod_mpolyv_t A, const fmpz_mod_mpoly_ctx_t FLINT_ FMPZ_MOD_MPOLY_FACTOR_INLINE void fmpz_mod_mpolyv_swap(fmpz_mod_mpolyv_t A, fmpz_mod_mpolyv_t B, - const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_mpoly_ctx_t ctx) { fmpz_mod_mpolyv_struct t = *A; *A = *B; @@ -1359,7 +1359,7 @@ void fmpz_mod_mpoly_mock_eval_coeff( fmpz_mod_polyun_t mock, const fmpz_mod_mpoly_t A, const fmpz_mod_polyun_t Aeh_inc, - const fmpz_mod_mpoly_ctx_t FLINT_UNUSED(ctx)); + const fmpz_mod_mpoly_ctx_t ctx); slong fmpz_mod_polyun_product_roots( fmpz_mod_polyun_t M, diff --git a/src/fmpz_mod_poly.h b/src/fmpz_mod_poly.h index e4b372fdb1..c12530f76e 100644 --- a/src/fmpz_mod_poly.h +++ b/src/fmpz_mod_poly.h @@ -88,7 +88,7 @@ fmpz_mod_poly_compose_mod_precomp_preinv_arg_t; /* Initialisation and memory management *************************************/ FMPZ_MOD_POLY_INLINE -void fmpz_mod_poly_init(fmpz_mod_poly_t poly, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mod_poly_init(fmpz_mod_poly_t poly, const fmpz_mod_ctx_t ctx) { poly->coeffs = NULL; poly->alloc = 0; @@ -96,9 +96,9 @@ void fmpz_mod_poly_init(fmpz_mod_poly_t poly, const fmpz_mod_ctx_t FLINT_UNUSED( } void fmpz_mod_poly_init2(fmpz_mod_poly_t poly, slong alloc, - const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); + const fmpz_mod_ctx_t ctx); -void fmpz_mod_poly_clear(fmpz_mod_poly_t poly, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mod_poly_clear(fmpz_mod_poly_t poly, const fmpz_mod_ctx_t ctx); void fmpz_mod_poly_realloc(fmpz_mod_poly_t poly, slong alloc, const fmpz_mod_ctx_t ctx); @@ -107,7 +107,7 @@ void _fmpz_mod_poly_fit_length(fmpz_mod_poly_t poly, slong len); FMPZ_MOD_POLY_INLINE void fmpz_mod_poly_fit_length(fmpz_mod_poly_t poly, slong len, - const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mod_ctx_t ctx) { _fmpz_mod_poly_fit_length(poly, len); } @@ -126,7 +126,7 @@ void _fmpz_mod_poly_normalise(fmpz_mod_poly_t poly) void _fmpz_mod_poly_set_length(fmpz_mod_poly_t poly, slong len); -void fmpz_mod_poly_truncate(fmpz_mod_poly_t poly, slong len, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mod_poly_truncate(fmpz_mod_poly_t poly, slong len, const fmpz_mod_ctx_t ctx); void fmpz_mod_poly_set_trunc(fmpz_mod_poly_t res, const fmpz_mod_poly_t poly, slong n, const fmpz_mod_ctx_t ctx); @@ -171,18 +171,18 @@ void fmpz_mod_poly_randtest_sparse_irreducible(fmpz_mod_poly_t poly, /* Attributes ***************************************************************/ FMPZ_MOD_POLY_INLINE -slong fmpz_mod_poly_length(const fmpz_mod_poly_t poly, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +slong fmpz_mod_poly_length(const fmpz_mod_poly_t poly, const fmpz_mod_ctx_t ctx) { return poly->length; } FMPZ_MOD_POLY_INLINE -slong fmpz_mod_poly_degree(const fmpz_mod_poly_t poly, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +slong fmpz_mod_poly_degree(const fmpz_mod_poly_t poly, const fmpz_mod_ctx_t ctx) { return poly->length - 1; } FMPZ_MOD_POLY_INLINE -fmpz * fmpz_mod_poly_lead(const fmpz_mod_poly_t poly, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +fmpz * fmpz_mod_poly_lead(const fmpz_mod_poly_t poly, const fmpz_mod_ctx_t ctx) { if (poly->length) return poly->coeffs + (poly->length - 1); @@ -191,19 +191,19 @@ fmpz * fmpz_mod_poly_lead(const fmpz_mod_poly_t poly, const fmpz_mod_ctx_t FLINT } FMPZ_MOD_POLY_INLINE -int fmpz_mod_poly_is_monic(const fmpz_mod_poly_t f, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +int fmpz_mod_poly_is_monic(const fmpz_mod_poly_t f, const fmpz_mod_ctx_t ctx) { return f->length > 0 && f->coeffs[f->length - 1] == WORD(1); } FMPZ_MOD_POLY_INLINE -int fmpz_mod_poly_is_one(const fmpz_mod_poly_t poly, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +int fmpz_mod_poly_is_one(const fmpz_mod_poly_t poly, const fmpz_mod_ctx_t ctx) { return poly->length == 1 && poly->coeffs[0] == WORD(1); } FMPZ_MOD_POLY_INLINE -int fmpz_mod_poly_is_gen(const fmpz_mod_poly_t op, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +int fmpz_mod_poly_is_gen(const fmpz_mod_poly_t op, const fmpz_mod_ctx_t ctx) { return op->length == 2 && op->coeffs[1] == WORD(1) && op->coeffs[0] == WORD(0); } @@ -217,7 +217,7 @@ void fmpz_mod_poly_set(fmpz_mod_poly_t poly1, FMPZ_MOD_POLY_INLINE void fmpz_mod_poly_swap(fmpz_mod_poly_t poly1, - fmpz_mod_poly_t poly2, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) + fmpz_mod_poly_t poly2, const fmpz_mod_ctx_t ctx) { FLINT_SWAP(fmpz_mod_poly_struct, *poly1, *poly2); } @@ -228,7 +228,7 @@ void fmpz_mod_poly_reverse(fmpz_mod_poly_t res, const fmpz_mod_poly_t poly, slong n, const fmpz_mod_ctx_t ctx); FMPZ_MOD_POLY_INLINE -void fmpz_mod_poly_zero(fmpz_mod_poly_t poly, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mod_poly_zero(fmpz_mod_poly_t poly, const fmpz_mod_ctx_t ctx) { _fmpz_mod_poly_set_length(poly, 0); } @@ -237,9 +237,9 @@ void fmpz_mod_poly_one(fmpz_mod_poly_t poly, const fmpz_mod_ctx_t ctx); void fmpz_mod_poly_gen(fmpz_mod_poly_t poly, const fmpz_mod_ctx_t ctx); -void fmpz_mod_poly_zero_coeffs(fmpz_mod_poly_t poly, slong i, slong j, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mod_poly_zero_coeffs(fmpz_mod_poly_t poly, slong i, slong j, const fmpz_mod_ctx_t ctx); -ulong fmpz_mod_poly_deflation(const fmpz_mod_poly_t input, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +ulong fmpz_mod_poly_deflation(const fmpz_mod_poly_t input, const fmpz_mod_ctx_t ctx); void fmpz_mod_poly_deflate(fmpz_mod_poly_t result, const fmpz_mod_poly_t input, ulong deflation, const fmpz_mod_ctx_t ctx); void fmpz_mod_poly_inflate(fmpz_mod_poly_t result, const fmpz_mod_poly_t input, ulong inflation, const fmpz_mod_ctx_t ctx); @@ -251,14 +251,14 @@ void fmpz_mod_poly_set_fmpz(fmpz_mod_poly_t poly, const fmpz_t c, const fmpz_mod void fmpz_mod_poly_set_fmpz_poly(fmpz_mod_poly_t f, const fmpz_poly_t g, const fmpz_mod_ctx_t ctx); void fmpz_mod_poly_get_nmod_poly(nmod_poly_t f, const fmpz_mod_poly_t g); -void fmpz_mod_poly_get_fmpz_poly(fmpz_poly_t f, const fmpz_mod_poly_t g, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mod_poly_get_fmpz_poly(fmpz_poly_t f, const fmpz_mod_poly_t g, const fmpz_mod_ctx_t ctx); /* Comparison ***************************************************************/ -int fmpz_mod_poly_equal(const fmpz_mod_poly_t poly1, const fmpz_mod_poly_t poly2, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); -int fmpz_mod_poly_equal_trunc(const fmpz_mod_poly_t poly1, const fmpz_mod_poly_t poly2, slong n, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +int fmpz_mod_poly_equal(const fmpz_mod_poly_t poly1, const fmpz_mod_poly_t poly2, const fmpz_mod_ctx_t ctx); +int fmpz_mod_poly_equal_trunc(const fmpz_mod_poly_t poly1, const fmpz_mod_poly_t poly2, slong n, const fmpz_mod_ctx_t ctx); -int fmpz_mod_poly_is_zero(const fmpz_mod_poly_t poly, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +int fmpz_mod_poly_is_zero(const fmpz_mod_poly_t poly, const fmpz_mod_ctx_t ctx); /* Getting and setting coefficients *****************************************/ @@ -266,7 +266,7 @@ void fmpz_mod_poly_set_coeff_fmpz(fmpz_mod_poly_t poly, slong n, const fmpz_t x, void fmpz_mod_poly_set_coeff_ui(fmpz_mod_poly_t poly, slong n, ulong x, const fmpz_mod_ctx_t ctx); void fmpz_mod_poly_set_coeff_si(fmpz_mod_poly_t poly, slong n, slong x, const fmpz_mod_ctx_t ctx); -void fmpz_mod_poly_get_coeff_fmpz(fmpz_t x, const fmpz_mod_poly_t poly, slong n, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mod_poly_get_coeff_fmpz(fmpz_t x, const fmpz_mod_poly_t poly, slong n, const fmpz_mod_ctx_t ctx); /* Shifting *****************************************************************/ @@ -424,7 +424,7 @@ void fmpz_mod_poly_divrem_basecase(fmpz_mod_poly_t Q, fmpz_mod_poly_t R, const fmpz_mod_ctx_t ctx); void _fmpz_mod_poly_div_newton_n_preinv (fmpz* Q, const fmpz* A, slong lenA, - const fmpz* FLINT_UNUSED(B), slong lenB, const fmpz* Binv, + const fmpz* B, slong lenB, const fmpz* Binv, slong lenBinv, const fmpz_mod_ctx_t ctx); void fmpz_mod_poly_div_newton_n_preinv(fmpz_mod_poly_t Q, @@ -562,7 +562,7 @@ void fmpz_mod_poly_xgcd_euclidean_f(fmpz_t f, fmpz_mod_poly_t G, slong _fmpz_mod_poly_xgcd(fmpz *G, fmpz *S, fmpz *T, const fmpz *A, slong lenA, const fmpz *B, slong lenB, - const fmpz_t FLINT_UNUSED(invB), const fmpz_mod_ctx_t ctx); + const fmpz_t invB, 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, @@ -587,7 +587,7 @@ fmpz_mod_poly_xgcd_f(fmpz_t f, fmpz_mod_poly_t G, fmpz_mod_poly_t S, slong _fmpz_mod_poly_gcdinv_euclidean_f(fmpz_t f, fmpz *G, fmpz *S, const fmpz *A, slong lenA, const fmpz *B, slong lenB, - const fmpz_t FLINT_UNUSED(invA), const fmpz_mod_ctx_t ctx); + const fmpz_t invA, const fmpz_mod_ctx_t ctx); void fmpz_mod_poly_gcdinv_euclidean_f(fmpz_t f, fmpz_mod_poly_t G, fmpz_mod_poly_t S, const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, @@ -767,7 +767,7 @@ void fmpz_mod_poly_compose_mod_horner(fmpz_mod_poly_t res, void _fmpz_mod_poly_compose_mod_brent_kung_vec_preinv(fmpz_mod_poly_struct * res, const fmpz_mod_poly_struct * - polys, slong FLINT_UNUSED(lenpolys), slong l, + polys, slong lenpolys, slong l, const fmpz * g, slong glen, const fmpz * poly, slong len, const fmpz * polyinv, @@ -781,7 +781,7 @@ void fmpz_mod_poly_compose_mod_brent_kung_vec_preinv( void _fmpz_mod_poly_compose_mod_brent_kung_vec_preinv_threaded_pool(fmpz_mod_poly_struct * res, const fmpz_mod_poly_struct * polys, - slong FLINT_UNUSED(lenpolys), slong l, + slong lenpolys, slong l, const fmpz * g, slong glen, const fmpz * poly, slong len, const fmpz * polyinv, slong leninv, @@ -803,7 +803,7 @@ fmpz_mod_poly_compose_mod_brent_kung_vec_preinv_threaded(fmpz_mod_poly_struct * /* Norms *********************************************************************/ -slong fmpz_mod_poly_hamming_weight(const fmpz_mod_poly_t A, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +slong fmpz_mod_poly_hamming_weight(const fmpz_mod_poly_t A, const fmpz_mod_ctx_t ctx); /* Radix conversion *********************************************************/ @@ -836,13 +836,13 @@ void fmpz_mod_poly_radix(fmpz_mod_poly_struct **B, const fmpz_mod_poly_t F, /* Input and output *********************************************************/ -char * fmpz_mod_poly_get_str(const fmpz_mod_poly_t poly, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); -char * fmpz_mod_poly_get_str_pretty(const fmpz_mod_poly_t poly, const char * x, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +char * fmpz_mod_poly_get_str(const fmpz_mod_poly_t poly, const fmpz_mod_ctx_t ctx); +char * fmpz_mod_poly_get_str_pretty(const fmpz_mod_poly_t poly, const char * x, const fmpz_mod_ctx_t ctx); #ifdef FLINT_HAVE_FILE int _fmpz_mod_poly_fprint(FILE * file, const fmpz *poly, slong len, const fmpz_t p); int fmpz_mod_poly_fprint(FILE * file, const fmpz_mod_poly_t poly, const fmpz_mod_ctx_t ctx); -int fmpz_mod_poly_fprint_pretty(FILE * file, const fmpz_mod_poly_t poly, const char * x, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); +int fmpz_mod_poly_fprint_pretty(FILE * file, const fmpz_mod_poly_t poly, const char * x, const fmpz_mod_ctx_t ctx); int fmpz_mod_poly_fread(FILE * file, fmpz_mod_poly_t poly, fmpz_mod_ctx_t ctx); #endif diff --git a/src/fmpz_mod_poly_factor.h b/src/fmpz_mod_poly_factor.h index e33fb72524..bbcfffdb2f 100644 --- a/src/fmpz_mod_poly_factor.h +++ b/src/fmpz_mod_poly_factor.h @@ -28,7 +28,7 @@ extern "C" { /* Factoring ****************************************************************/ void fmpz_mod_poly_factor_init(fmpz_mod_poly_factor_t fac, - const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); + const fmpz_mod_ctx_t ctx); typedef struct { @@ -57,7 +57,7 @@ void fmpz_mod_poly_factor_set(fmpz_mod_poly_factor_t res, FMPZ_MOD_POLY_FACTOR_INLINE void fmpz_mod_poly_factor_swap(fmpz_mod_poly_factor_t a, - fmpz_mod_poly_factor_t b, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) + fmpz_mod_poly_factor_t b, const fmpz_mod_ctx_t ctx) { fmpz_mod_poly_factor_struct t = *a; *a = *b; @@ -79,7 +79,7 @@ void fmpz_mod_poly_factor_concat(fmpz_mod_poly_factor_t res, const fmpz_mod_poly_factor_t fac, const fmpz_mod_ctx_t ctx); void fmpz_mod_poly_factor_pow(fmpz_mod_poly_factor_t fac, slong exp, - const fmpz_mod_ctx_t FLINT_UNUSED(ctx)); + const fmpz_mod_ctx_t ctx); int fmpz_mod_poly_is_irreducible(const fmpz_mod_poly_t f, const fmpz_mod_ctx_t ctx); diff --git a/src/fmpz_mpoly.h b/src/fmpz_mpoly.h index a2bb2e1cb9..34756c7339 100644 --- a/src/fmpz_mpoly.h +++ b/src/fmpz_mpoly.h @@ -28,7 +28,7 @@ extern "C" { FMPZ_MPOLY_INLINE fmpz * fmpz_mpoly_term_coeff_ref(fmpz_mpoly_t A, slong i, - const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mpoly_ctx_t ctx) { FLINT_ASSERT(i < A->length); return A->coeffs + i; @@ -100,7 +100,7 @@ ordering_t fmpz_mpoly_ctx_ord(const fmpz_mpoly_ctx_t ctx) /* Memory management ********************************************************/ -void fmpz_mpoly_init(fmpz_mpoly_t A, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mpoly_init(fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx); void fmpz_mpoly_init2(fmpz_mpoly_t A, slong alloc, const fmpz_mpoly_ctx_t ctx); @@ -122,11 +122,11 @@ void fmpz_mpoly_fit_length(fmpz_mpoly_t A, slong len, void fmpz_mpoly_fit_length_reset_bits(fmpz_mpoly_t A, slong len, flint_bitcnt_t bits, const fmpz_mpoly_ctx_t ctx); -void fmpz_mpoly_clear(fmpz_mpoly_t A, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mpoly_clear(fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx); -void _fmpz_mpoly_set_length(fmpz_mpoly_t A, slong newlen, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); +void _fmpz_mpoly_set_length(fmpz_mpoly_t A, slong newlen, const fmpz_mpoly_ctx_t ctx); -void fmpz_mpoly_truncate(fmpz_mpoly_t A, slong newlen, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mpoly_truncate(fmpz_mpoly_t A, slong newlen, const fmpz_mpoly_ctx_t ctx); void fmpz_mpoly_fit_bits(fmpz_mpoly_t A, flint_bitcnt_t bits, const fmpz_mpoly_ctx_t ctx); @@ -164,7 +164,7 @@ int _fmpz_mpoly_equal(fmpz * poly1, ulong * exps1, const fmpz * poly2, const ulo int fmpz_mpoly_equal(const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx); FMPZ_MPOLY_INLINE -void fmpz_mpoly_swap(fmpz_mpoly_t A, fmpz_mpoly_t B, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mpoly_swap(fmpz_mpoly_t A, fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) { FLINT_SWAP(fmpz_mpoly_struct, *A, *B); } @@ -210,7 +210,7 @@ int fmpz_mpoly_equal_ui(const fmpz_mpoly_t A, ulong c, const fmpz_mpoly_ctx_t ct int fmpz_mpoly_equal_fmpz(const fmpz_mpoly_t A, const fmpz_t c, const fmpz_mpoly_ctx_t ctx); FMPZ_MPOLY_INLINE -int fmpz_mpoly_is_zero(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)) +int fmpz_mpoly_is_zero(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) { return A->length == 0; } @@ -286,20 +286,20 @@ int fmpz_mpoly_cmp(const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ int fmpz_mpoly_is_canonical(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx); FMPZ_MPOLY_INLINE -slong fmpz_mpoly_length(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)) +slong fmpz_mpoly_length(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) { return A->length; } void fmpz_mpoly_resize(fmpz_mpoly_t A, slong new_length, const fmpz_mpoly_ctx_t ctx); -void fmpz_mpoly_get_term_coeff_fmpz(fmpz_t c, const fmpz_mpoly_t A, slong i, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); -ulong fmpz_mpoly_get_term_coeff_ui(const fmpz_mpoly_t A, slong i, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); -slong fmpz_mpoly_get_term_coeff_si(const fmpz_mpoly_t A, slong i, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mpoly_get_term_coeff_fmpz(fmpz_t c, const fmpz_mpoly_t A, slong i, const fmpz_mpoly_ctx_t ctx); +ulong fmpz_mpoly_get_term_coeff_ui(const fmpz_mpoly_t A, slong i, const fmpz_mpoly_ctx_t ctx); +slong fmpz_mpoly_get_term_coeff_si(const fmpz_mpoly_t A, slong i, const fmpz_mpoly_ctx_t ctx); -void fmpz_mpoly_set_term_coeff_fmpz(fmpz_mpoly_t A, slong i, const fmpz_t c, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); -void fmpz_mpoly_set_term_coeff_ui(fmpz_mpoly_t A, slong i, ulong c, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); -void fmpz_mpoly_set_term_coeff_si(fmpz_mpoly_t A, slong i, slong c, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mpoly_set_term_coeff_fmpz(fmpz_mpoly_t A, slong i, const fmpz_t c, const fmpz_mpoly_ctx_t ctx); +void fmpz_mpoly_set_term_coeff_ui(fmpz_mpoly_t A, slong i, ulong c, const fmpz_mpoly_ctx_t ctx); +void fmpz_mpoly_set_term_coeff_si(fmpz_mpoly_t A, slong i, slong c, const fmpz_mpoly_ctx_t ctx); int fmpz_mpoly_term_exp_fits_ui(const fmpz_mpoly_t A, slong i, const fmpz_mpoly_ctx_t ctx); int fmpz_mpoly_term_exp_fits_si(const fmpz_mpoly_t A, slong i, const fmpz_mpoly_ctx_t ctx); @@ -615,7 +615,7 @@ int fmpz_mpoly_gcd(fmpz_mpoly_t G, const fmpz_mpoly_t A, const fmpz_mpoly_t B, c /* Univariates ***************************************************************/ -void fmpz_mpoly_univar_init(fmpz_mpoly_univar_t A, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mpoly_univar_init(fmpz_mpoly_univar_t A, const fmpz_mpoly_ctx_t ctx); void fmpz_mpoly_univar_clear(fmpz_mpoly_univar_t A, const fmpz_mpoly_ctx_t ctx); void fmpz_mpoly_univar_fit_length(fmpz_mpoly_univar_t A, slong length, const fmpz_mpoly_ctx_t ctx); @@ -625,7 +625,7 @@ void fmpz_mpoly_univar_print_pretty(const fmpz_mpoly_univar_t A, const char ** x void fmpz_mpoly_univar_assert_canonical(fmpz_mpoly_univar_t A, const fmpz_mpoly_ctx_t ctx); FMPZ_MPOLY_INLINE -void fmpz_mpoly_univar_zero(fmpz_mpoly_univar_t A, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mpoly_univar_zero(fmpz_mpoly_univar_t A, const fmpz_mpoly_ctx_t ctx) { A->length = 0; } @@ -644,21 +644,21 @@ void fmpz_mpoly_from_univar(fmpz_mpoly_t A, FMPZ_MPOLY_INLINE void fmpz_mpoly_univar_swap(fmpz_mpoly_univar_t A, fmpz_mpoly_univar_t B, - const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mpoly_ctx_t ctx) { FLINT_SWAP(fmpz_mpoly_univar_struct, *A, *B); } -int fmpz_mpoly_univar_degree_fits_si(const fmpz_mpoly_univar_t A, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); +int fmpz_mpoly_univar_degree_fits_si(const fmpz_mpoly_univar_t A, const fmpz_mpoly_ctx_t ctx); FMPZ_MPOLY_INLINE slong fmpz_mpoly_univar_length(const fmpz_mpoly_univar_t A, - const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mpoly_ctx_t ctx) { return A->length; } -slong fmpz_mpoly_univar_get_term_exp_si(fmpz_mpoly_univar_t A, slong i, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); +slong fmpz_mpoly_univar_get_term_exp_si(fmpz_mpoly_univar_t A, slong i, const fmpz_mpoly_ctx_t ctx); FMPZ_MPOLY_INLINE void fmpz_mpoly_univar_get_term_coeff(fmpz_mpoly_t c, @@ -714,7 +714,7 @@ typedef fmpz_mpoly_vec_struct fmpz_mpoly_vec_t[1]; void fmpz_mpoly_vec_init(fmpz_mpoly_vec_t vec, slong len, const fmpz_mpoly_ctx_t ctx); void fmpz_mpoly_vec_print(const fmpz_mpoly_vec_t F, const fmpz_mpoly_ctx_t ctx); -void fmpz_mpoly_vec_swap(fmpz_mpoly_vec_t x, fmpz_mpoly_vec_t y, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mpoly_vec_swap(fmpz_mpoly_vec_t x, fmpz_mpoly_vec_t y, const fmpz_mpoly_ctx_t ctx); void fmpz_mpoly_vec_fit_length(fmpz_mpoly_vec_t vec, slong len, const fmpz_mpoly_ctx_t ctx); void fmpz_mpoly_vec_clear(fmpz_mpoly_vec_t vec, const fmpz_mpoly_ctx_t ctx); void fmpz_mpoly_vec_set(fmpz_mpoly_vec_t dest, const fmpz_mpoly_vec_t src, const fmpz_mpoly_ctx_t ctx); @@ -824,8 +824,8 @@ void fmpz_mpoly_from_mpoly_perm_inflate( const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t lctx, const slong * perm, const ulong * shift, const ulong * stride); -void fmpz_mpoly_height(fmpz_t max, const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); -void fmpz_mpoly_heights(fmpz_t max, fmpz_t sum, const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mpoly_height(fmpz_t max, const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx); +void fmpz_mpoly_heights(fmpz_t max, fmpz_t sum, const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx); /* geobuckets ****************************************************************/ diff --git a/src/fmpz_mpoly_factor.h b/src/fmpz_mpoly_factor.h index 2c3b3fed01..98d79fc980 100644 --- a/src/fmpz_mpoly_factor.h +++ b/src/fmpz_mpoly_factor.h @@ -36,7 +36,7 @@ void tuple_next(fmpz * alpha, slong n); /*****************************************************************************/ FMPZ_MPOLY_FACTOR_INLINE -void fmpz_mpoly_factor_init(fmpz_mpoly_factor_t f, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mpoly_factor_init(fmpz_mpoly_factor_t f, const fmpz_mpoly_ctx_t ctx) { *f->constant = 1; *f->constant_den = 1; @@ -60,13 +60,13 @@ void fmpz_mpoly_factor_clear(fmpz_mpoly_factor_t f, FMPZ_MPOLY_FACTOR_INLINE slong fmpz_mpoly_factor_length(const fmpz_mpoly_factor_t f, - const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mpoly_ctx_t ctx) { return f->num; } -void fmpz_mpoly_factor_get_constant_fmpz(fmpz_t c, const fmpz_mpoly_factor_t f, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); -void fmpz_mpoly_factor_get_constant_fmpq(fmpq_t c, const fmpz_mpoly_factor_t f, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mpoly_factor_get_constant_fmpz(fmpz_t c, const fmpz_mpoly_factor_t f, const fmpz_mpoly_ctx_t ctx); +void fmpz_mpoly_factor_get_constant_fmpq(fmpq_t c, const fmpz_mpoly_factor_t f, const fmpz_mpoly_ctx_t ctx); FMPZ_MPOLY_FACTOR_INLINE void fmpz_mpoly_factor_get_base(fmpz_mpoly_t p, const fmpz_mpoly_factor_t f, @@ -84,7 +84,7 @@ void fmpz_mpoly_factor_swap_base(fmpz_mpoly_t p, fmpz_mpoly_factor_t f, fmpz_mpoly_swap(p, f->poly + i, ctx); } -slong fmpz_mpoly_factor_get_exp_si(fmpz_mpoly_factor_t f, slong i, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); +slong fmpz_mpoly_factor_get_exp_si(fmpz_mpoly_factor_t f, slong i, const fmpz_mpoly_ctx_t ctx); void fmpz_mpoly_factor_set(fmpz_mpoly_factor_t f, const fmpz_mpoly_factor_t g, const fmpz_mpoly_ctx_t ctx); @@ -106,16 +106,16 @@ int fmpz_mpoly_factor(fmpz_mpoly_factor_t f, FMPZ_MPOLY_FACTOR_INLINE void fmpz_mpoly_factor_swap(fmpz_mpoly_factor_t f, fmpz_mpoly_factor_t g, - const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mpoly_ctx_t ctx) { fmpz_mpoly_factor_struct t = *f; *f = *g; *g = t; } -void fmpz_mpoly_factor_set_fmpz(fmpz_mpoly_factor_t f, const fmpz_t a, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); -void fmpz_mpoly_factor_zero(fmpz_mpoly_factor_t f, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); -void fmpz_mpoly_factor_one(fmpz_mpoly_factor_t f, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)); +void fmpz_mpoly_factor_set_fmpz(fmpz_mpoly_factor_t f, const fmpz_t a, const fmpz_mpoly_ctx_t ctx); +void fmpz_mpoly_factor_zero(fmpz_mpoly_factor_t f, const fmpz_mpoly_ctx_t ctx); +void fmpz_mpoly_factor_one(fmpz_mpoly_factor_t f, const fmpz_mpoly_ctx_t ctx); void fmpz_mpoly_factor_sort(fmpz_mpoly_factor_t f, const fmpz_mpoly_ctx_t ctx); @@ -153,7 +153,7 @@ void fmpz_mpoly_interp_reduce_p(nmod_mpoly_t Ap, const fmpz_mpoly_ctx_t ctx); int fmpz_mpoly_interp_mcrt_p(flint_bitcnt_t * coeffbits, - fmpz_mpoly_t H, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx), const fmpz_t m, + fmpz_mpoly_t H, const fmpz_mpoly_ctx_t ctx, const fmpz_t m, const nmod_mpoly_t A, const nmod_mpoly_ctx_t ctxp); void fmpz_mpoly_interp_reduce_p_mpolyn(nmod_mpolyn_t E, @@ -180,7 +180,7 @@ typedef struct typedef fmpz_mpolyv_struct fmpz_mpolyv_t[1]; FMPZ_MPOLY_FACTOR_INLINE -void fmpz_mpolyv_init(fmpz_mpolyv_t A, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)) +void fmpz_mpolyv_init(fmpz_mpolyv_t A, const fmpz_mpoly_ctx_t ctx) { A->coeffs = NULL; A->alloc = 0; @@ -189,7 +189,7 @@ void fmpz_mpolyv_init(fmpz_mpolyv_t A, const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)) FMPZ_MPOLY_FACTOR_INLINE void fmpz_mpolyv_swap(fmpz_mpolyv_t A, fmpz_mpolyv_t B, - const fmpz_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fmpz_mpoly_ctx_t ctx) { fmpz_mpolyv_struct t = *A; *A = *B; @@ -467,7 +467,7 @@ int fmpz_mpoly_factor_lcc_wang(fmpz_mpoly_struct * lc_divs, const fmpz_mpoly_ctx_t ctx); int fmpz_mpoly_factor_irred_zassenhaus(fmpz_mpolyv_t fac, - const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx, zassenhaus_prune_t FLINT_UNUSED(Z)); + const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx, zassenhaus_prune_t Z); int fmpz_mpoly_factor_irred_wang(fmpz_mpolyv_t fac, const fmpz_mpoly_t A, const fmpz_mpoly_factor_t lcAfac, diff --git a/src/fq.h b/src/fq.h index ec5113436b..cd1fa3a6e9 100644 --- a/src/fq.h +++ b/src/fq.h @@ -67,10 +67,10 @@ void fq_ctx_print(const fq_ctx_t ctx); /* Memory management *********************************************************/ -void fq_init(fq_t rop, const fq_ctx_t FLINT_UNUSED(ctx)); +void fq_init(fq_t rop, const fq_ctx_t ctx); void fq_init2(fq_t rop, const fq_ctx_t ctx); -void fq_clear(fq_t rop, const fq_ctx_t FLINT_UNUSED(ctx)); +void fq_clear(fq_t rop, const fq_ctx_t ctx); void _fq_sparse_reduce(fmpz * R, slong lenR, const fq_ctx_t ctx); void _fq_dense_reduce(fmpz * R, slong lenR, const fq_ctx_t ctx); @@ -118,41 +118,41 @@ void fq_rand_not_zero(fq_t rop, flint_rand_t state, const fq_ctx_t ctx); /* Comparison ****************************************************************/ -int fq_equal(const fq_t op1, const fq_t op2, const fq_ctx_t FLINT_UNUSED(ctx)); +int fq_equal(const fq_t op1, const fq_t op2, const fq_ctx_t ctx); -int fq_is_zero(const fq_t op, const fq_ctx_t FLINT_UNUSED(ctx)); -int fq_is_one(const fq_t op, const fq_ctx_t FLINT_UNUSED(ctx)); +int fq_is_zero(const fq_t op, const fq_ctx_t ctx); +int fq_is_one(const fq_t op, const fq_ctx_t ctx); /* Assignments and conversions ***********************************************/ -void fq_set(fq_t rop, const fq_t op, const fq_ctx_t FLINT_UNUSED(ctx)); +void fq_set(fq_t rop, const fq_t op, const fq_ctx_t ctx); void fq_set_ui(fq_t rop, const ulong x, const fq_ctx_t ctx); void fq_set_si(fq_t rop, const slong x, const fq_ctx_t ctx); void fq_set_fmpz(fq_t rop, const fmpz_t x, const fq_ctx_t ctx); void fq_set_fmpz_poly(fq_t a, const fmpz_poly_t b, const fq_ctx_t ctx); void fq_set_fmpz_mod_poly(fq_t a, const fmpz_mod_poly_t b, const fq_ctx_t ctx); -int fq_get_fmpz(fmpz_t a, const fq_t b, const fq_ctx_t FLINT_UNUSED(ctx)); -void fq_get_fmpz_poly(fmpz_poly_t a, const fq_t b, const fq_ctx_t FLINT_UNUSED(ctx)); +int fq_get_fmpz(fmpz_t a, const fq_t b, const fq_ctx_t ctx); +void fq_get_fmpz_poly(fmpz_poly_t a, const fq_t b, const fq_ctx_t ctx); void fq_get_fmpz_mod_poly(fmpz_mod_poly_t a, const fq_t b, const fq_ctx_t ctx); -void fq_zero(fq_t rop, const fq_ctx_t FLINT_UNUSED(ctx)); -void fq_one(fq_t rop, const fq_ctx_t FLINT_UNUSED(ctx)); +void fq_zero(fq_t rop, const fq_ctx_t ctx); +void fq_one(fq_t rop, const fq_ctx_t ctx); -void fq_swap(fq_t op1, fq_t op2, const fq_ctx_t FLINT_UNUSED(ctx)); +void fq_swap(fq_t op1, fq_t op2, const fq_ctx_t ctx); void fq_gen(fq_t rop, const fq_ctx_t ctx); /* Output ********************************************************************/ #ifdef FLINT_HAVE_FILE -int fq_fprint(FILE * file, const fq_t op, const fq_ctx_t FLINT_UNUSED(ctx)); -void fq_print(const fq_t op, const fq_ctx_t FLINT_UNUSED(ctx)); +int fq_fprint(FILE * file, const fq_t op, const fq_ctx_t ctx); +void fq_print(const fq_t op, const fq_ctx_t ctx); int fq_fprint_pretty(FILE * file, const fq_t op, const fq_ctx_t ctx); int fq_print_pretty(const fq_t op, const fq_ctx_t ctx); #endif -char * fq_get_str(const fq_t op, const fq_ctx_t FLINT_UNUSED(ctx)); +char * fq_get_str(const fq_t op, const fq_ctx_t ctx); char * fq_get_str_pretty(const fq_t op, const fq_ctx_t ctx); /* Special functions *********************************************************/ @@ -169,7 +169,7 @@ void fq_norm(fmpz_t rop, const fq_t op, const fq_ctx_t ctx); /* Bit packing ******************************************************/ -void fq_bit_pack(fmpz_t f, const fq_t op, flint_bitcnt_t bit_size, const fq_ctx_t FLINT_UNUSED(ctx)); +void fq_bit_pack(fmpz_t f, const fq_t op, flint_bitcnt_t bit_size, const fq_ctx_t ctx); void fq_bit_unpack(fq_t rop, const fmpz_t f, flint_bitcnt_t bit_size, const fq_ctx_t ctx); diff --git a/src/fq_mat_templates.h b/src/fq_mat_templates.h index c70771e3b1..895316af04 100644 --- a/src/fq_mat_templates.h +++ b/src/fq_mat_templates.h @@ -30,14 +30,14 @@ void TEMPLATE(T, mat_init_set)(TEMPLATE(T, mat_t) mat, const TEMPLATE(T, mat_t) FQ_MAT_TEMPLATES_INLINE slong TEMPLATE(T, mat_nrows)(const TEMPLATE(T, mat_t) mat, - const TEMPLATE(T, ctx_t) FLINT_UNUSED(ctx)) + const TEMPLATE(T, ctx_t) ctx) { return mat->r; } FQ_MAT_TEMPLATES_INLINE slong TEMPLATE(T, mat_ncols)(const TEMPLATE(T, mat_t) mat, - const TEMPLATE(T, ctx_t) FLINT_UNUSED(ctx)) + const TEMPLATE(T, ctx_t) ctx) { return mat->c; } @@ -53,7 +53,7 @@ void TEMPLATE(T, mat_entry_set)(TEMPLATE(T, mat_t) mat, slong i, slong j, const TEMPLATE(T, ctx_t) ctx); void TEMPLATE(T, mat_swap)(TEMPLATE(T, mat_t) mat1, TEMPLATE(T, mat_t) mat2, - const TEMPLATE(T, ctx_t) FLINT_UNUSED(ctx)); + const TEMPLATE(T, ctx_t) ctx); void TEMPLATE(T, mat_swap_entrywise)(TEMPLATE(T, mat_t) mat1, TEMPLATE(T, mat_t) mat2, const TEMPLATE(T, ctx_t) ctx); @@ -75,14 +75,14 @@ int TEMPLATE(T, mat_is_one)(const TEMPLATE(T, mat_t) mat, FQ_MAT_TEMPLATES_INLINE int TEMPLATE(T, mat_is_empty)(const TEMPLATE(T, mat_t) mat, - const TEMPLATE(T, ctx_t) FLINT_UNUSED(ctx)) + const TEMPLATE(T, ctx_t) ctx) { return (mat->r == 0) || (mat->c == 0); } FQ_MAT_TEMPLATES_INLINE int TEMPLATE(T, mat_is_square)(const TEMPLATE(T, mat_t) mat, - const TEMPLATE(T, ctx_t) FLINT_UNUSED(ctx)) + const TEMPLATE(T, ctx_t) ctx) { return (mat->r == mat->c); } @@ -131,10 +131,10 @@ void TEMPLATE(T, mat_set_fmpz_mod_mat) (TEMPLATE(T, mat_t) mat1, void TEMPLATE(T, mat_window_init)(TEMPLATE(T, mat_t) window, const TEMPLATE(T, mat_t) mat, slong r1, slong c1, slong r2, slong c2, - const TEMPLATE(T, ctx_t) FLINT_UNUSED(ctx)); + const TEMPLATE(T, ctx_t) ctx); void TEMPLATE(T, mat_window_clear)(TEMPLATE(T, mat_t) window, - const TEMPLATE(T, ctx_t) FLINT_UNUSED(ctx)); + const TEMPLATE(T, ctx_t) ctx); void TEMPLATE(T, mat_concat_horizontal)(TEMPLATE(T, mat_t) res, const TEMPLATE(T, mat_t) mat1, const TEMPLATE(T, mat_t) mat2, diff --git a/src/fq_nmod.h b/src/fq_nmod.h index 8335be0730..0b65b62fba 100644 --- a/src/fq_nmod.h +++ b/src/fq_nmod.h @@ -72,7 +72,7 @@ void fq_nmod_ctx_print(const fq_nmod_ctx_t ctx); void fq_nmod_init(fq_nmod_t rop, const fq_nmod_ctx_t ctx); void fq_nmod_init2(fq_nmod_t rop, const fq_nmod_ctx_t ctx); -void fq_nmod_clear(fq_nmod_t rop, const fq_nmod_ctx_t FLINT_UNUSED(ctx)); +void fq_nmod_clear(fq_nmod_t rop, const fq_nmod_ctx_t ctx); void _fq_nmod_sparse_reduce(ulong *R, slong lenR, const fq_nmod_ctx_t ctx); void _fq_nmod_dense_reduce(ulong* R, slong lenR, const fq_nmod_ctx_t ctx); @@ -82,14 +82,14 @@ void fq_nmod_reduce(fq_nmod_t rop, const fq_nmod_ctx_t ctx); /* Basic arithmetic **********************************************************/ void fq_nmod_add(fq_nmod_t rop, const fq_nmod_t op1, - const fq_nmod_t op2, const fq_nmod_ctx_t FLINT_UNUSED(ctx)); + const fq_nmod_t op2, const fq_nmod_ctx_t ctx); void fq_nmod_sub(fq_nmod_t rop, const fq_nmod_t op1, const fq_nmod_t op2, const fq_nmod_ctx_t ctx); void fq_nmod_sub_one(fq_nmod_t rop, const fq_nmod_t op1, const fq_nmod_ctx_t ctx); -void fq_nmod_neg(fq_nmod_t rop, const fq_nmod_t op1, const fq_nmod_ctx_t FLINT_UNUSED(ctx)); +void fq_nmod_neg(fq_nmod_t rop, const fq_nmod_t op1, const fq_nmod_ctx_t ctx); void fq_nmod_mul(fq_nmod_t rop, const fq_nmod_t op1, const fq_nmod_t op2, const fq_nmod_ctx_t ctx); @@ -139,40 +139,40 @@ void fq_nmod_rand_not_zero(fq_nmod_t rop, flint_rand_t state, const fq_nmod_ctx_ /* Comparison ****************************************************************/ -int fq_nmod_equal(const fq_nmod_t op1, const fq_nmod_t op2, const fq_nmod_ctx_t FLINT_UNUSED(ctx)); -int fq_nmod_is_zero(const fq_nmod_t op, const fq_nmod_ctx_t FLINT_UNUSED(ctx)); -int fq_nmod_is_one(const fq_nmod_t op, const fq_nmod_ctx_t FLINT_UNUSED(ctx)); -int fq_nmod_cmp(const fq_nmod_t a, const fq_nmod_t b, const fq_nmod_ctx_t FLINT_UNUSED(ctx)); +int fq_nmod_equal(const fq_nmod_t op1, const fq_nmod_t op2, const fq_nmod_ctx_t ctx); +int fq_nmod_is_zero(const fq_nmod_t op, const fq_nmod_ctx_t ctx); +int fq_nmod_is_one(const fq_nmod_t op, const fq_nmod_ctx_t ctx); +int fq_nmod_cmp(const fq_nmod_t a, const fq_nmod_t b, const fq_nmod_ctx_t ctx); /* Assignments and conversions ***********************************************/ -void fq_nmod_set(fq_nmod_t rop, const fq_nmod_t op, const fq_nmod_ctx_t FLINT_UNUSED(ctx)); +void fq_nmod_set(fq_nmod_t rop, const fq_nmod_t op, const fq_nmod_ctx_t ctx); void fq_nmod_set_si(fq_nmod_t rop, const slong x, const fq_nmod_ctx_t ctx); void fq_nmod_set_ui(fq_nmod_t rop, const ulong x, const fq_nmod_ctx_t ctx); void fq_nmod_set_fmpz(fq_nmod_t rop, const fmpz_t x, const fq_nmod_ctx_t ctx); void fq_nmod_set_nmod_poly(fq_nmod_t a, const nmod_poly_t b, const fq_nmod_ctx_t ctx); -int fq_nmod_get_fmpz(fmpz_t a, const fq_nmod_t b, const fq_nmod_ctx_t FLINT_UNUSED(ctx)); +int fq_nmod_get_fmpz(fmpz_t a, const fq_nmod_t b, const fq_nmod_ctx_t ctx); void fq_nmod_get_nmod_poly(nmod_poly_t a, const fq_nmod_t b, const fq_nmod_ctx_t ctx); -void fq_nmod_swap(fq_nmod_t op1, fq_nmod_t op2, const fq_nmod_ctx_t FLINT_UNUSED(ctx)); +void fq_nmod_swap(fq_nmod_t op1, fq_nmod_t op2, const fq_nmod_ctx_t ctx); -void fq_nmod_zero(fq_nmod_t rop, const fq_nmod_ctx_t FLINT_UNUSED(ctx)); -void fq_nmod_one(fq_nmod_t rop, const fq_nmod_ctx_t FLINT_UNUSED(ctx)); +void fq_nmod_zero(fq_nmod_t rop, const fq_nmod_ctx_t ctx); +void fq_nmod_one(fq_nmod_t rop, const fq_nmod_ctx_t ctx); void fq_nmod_gen(fq_nmod_t rop, const fq_nmod_ctx_t ctx); /* Output ********************************************************************/ #ifdef FLINT_HAVE_FILE -int fq_nmod_fprint(FILE * file, const fq_nmod_t op, const fq_nmod_ctx_t FLINT_UNUSED(ctx)); +int fq_nmod_fprint(FILE * file, const fq_nmod_t op, const fq_nmod_ctx_t ctx); int fq_nmod_fprint_pretty(FILE * file, const fq_nmod_t op, const fq_nmod_ctx_t ctx); #endif -void fq_nmod_print(const fq_nmod_t op, const fq_nmod_ctx_t FLINT_UNUSED(ctx)); +void fq_nmod_print(const fq_nmod_t op, const fq_nmod_ctx_t ctx); void fq_nmod_print_pretty(const fq_nmod_t op, const fq_nmod_ctx_t ctx); -char * fq_nmod_get_str(const fq_nmod_t op, const fq_nmod_ctx_t FLINT_UNUSED(ctx)); +char * fq_nmod_get_str(const fq_nmod_t op, const fq_nmod_ctx_t ctx); char * fq_nmod_get_str_pretty(const fq_nmod_t op, const fq_nmod_ctx_t ctx); /* Special functions *********************************************************/ @@ -195,7 +195,7 @@ void fq_nmod_norm(fmpz_t rop, const fq_nmod_t op, const fq_nmod_ctx_t ctx); /* Bit packing ******************************************************/ void fq_nmod_bit_pack(fmpz_t f, const fq_nmod_t op, flint_bitcnt_t bit_size, - const fq_nmod_ctx_t FLINT_UNUSED(ctx)); + const fq_nmod_ctx_t ctx); void fq_nmod_bit_unpack(fq_nmod_t rop, const fmpz_t f, flint_bitcnt_t bit_size, const fq_nmod_ctx_t ctx); diff --git a/src/fq_nmod_mpoly.h b/src/fq_nmod_mpoly.h index 9fd30fc815..e26055cd25 100644 --- a/src/fq_nmod_mpoly.h +++ b/src/fq_nmod_mpoly.h @@ -161,8 +161,8 @@ bad_fq_nmod_embed_struct * bad_fq_nmod_mpoly_embed_chooser_init( void bad_fq_nmod_mpoly_embed_chooser_clear( bad_fq_nmod_mpoly_embed_chooser_t embc, fq_nmod_mpoly_ctx_t ectx, - const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx), - flint_rand_t FLINT_UNUSED(randstate)); + const fq_nmod_mpoly_ctx_t ctx, + flint_rand_t randstate); bad_fq_nmod_embed_struct * bad_fq_nmod_mpoly_embed_chooser_next( bad_fq_nmod_mpoly_embed_chooser_t embc, @@ -201,7 +201,7 @@ ordering_t fq_nmod_mpoly_ctx_ord(const fq_nmod_mpoly_ctx_t ctx) /* Memory management ********************************************************/ FQ_NMOD_MPOLY_INLINE -void fq_nmod_mpoly_init(fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +void fq_nmod_mpoly_init(fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx) { A->coeffs = NULL; A->exps = NULL; @@ -212,7 +212,7 @@ void fq_nmod_mpoly_init(fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t FLINT_UNUSE } FQ_NMOD_MPOLY_INLINE -void fq_nmod_mpoly_clear(fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +void fq_nmod_mpoly_clear(fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx) { if (A->coeffs_alloc > 0) flint_free(A->coeffs); @@ -265,7 +265,7 @@ void _fq_nmod_mpoly_fit_length( FQ_NMOD_MPOLY_INLINE void _fq_nmod_mpoly_set_length(fq_nmod_mpoly_t A, slong newlen, - const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fq_nmod_mpoly_ctx_t ctx) { FLINT_ASSERT(fq_nmod_ctx_degree(ctx->fqctx)*newlen <= A->coeffs_alloc); FLINT_ASSERT(mpoly_words_per_exp(A->bits, ctx->minfo)*newlen <= A->exps_alloc); @@ -274,7 +274,7 @@ void _fq_nmod_mpoly_set_length(fq_nmod_mpoly_t A, slong newlen, FQ_NMOD_MPOLY_INLINE void fq_nmod_mpoly_truncate(fq_nmod_mpoly_t A, slong newlen, - const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fq_nmod_mpoly_ctx_t ctx) { if (A->length > newlen) { @@ -313,7 +313,7 @@ int fq_nmod_mpoly_equal(const fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, FQ_NMOD_MPOLY_INLINE void fq_nmod_mpoly_swap(fq_nmod_mpoly_t A, fq_nmod_mpoly_t B, - const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fq_nmod_mpoly_ctx_t ctx) { FLINT_SWAP(fq_nmod_mpoly_struct, *A, *B); } @@ -323,7 +323,7 @@ void fq_nmod_mpoly_swap(fq_nmod_mpoly_t A, fq_nmod_mpoly_t B, FQ_NMOD_MPOLY_INLINE ulong * fq_nmod_mpoly_get_nonzero_n_fq(const fq_nmod_mpoly_t A, - const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fq_nmod_mpoly_ctx_t ctx) { FLINT_ASSERT(A->length == 1); FLINT_ASSERT(mpoly_monomial_is_zero(A->exps, @@ -365,7 +365,7 @@ void fq_nmod_mpoly_one(fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx); FQ_NMOD_MPOLY_INLINE -int fq_nmod_mpoly_is_zero(const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +int fq_nmod_mpoly_is_zero(const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx) { return A->length == 0; } @@ -426,7 +426,7 @@ void fq_nmod_mpoly_get_coeff_vars_ui(fq_nmod_mpoly_t C, slong length, const fq_nmod_mpoly_ctx_t ctx); FQ_NMOD_MPOLY_INLINE ulong * _fq_nmod_mpoly_leadcoeff( - const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx) { FLINT_ASSERT(A->length > 0); return A->coeffs + 0; @@ -461,7 +461,7 @@ int fq_nmod_mpoly_is_canonical(const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx); FQ_NMOD_MPOLY_INLINE -slong fq_nmod_mpoly_length(const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +slong fq_nmod_mpoly_length(const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx) { return A->length; } @@ -889,7 +889,7 @@ void fq_nmod_mpoly_ctx_change_modulus(fq_nmod_mpoly_ctx_t ctx, /* Univariates ***************************************************************/ void fq_nmod_mpoly_univar_init(fq_nmod_mpoly_univar_t A, - const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); + const fq_nmod_mpoly_ctx_t ctx); void fq_nmod_mpoly_univar_clear(fq_nmod_mpoly_univar_t A, const fq_nmod_mpoly_ctx_t ctx); @@ -905,7 +905,7 @@ void fq_nmod_mpoly_univar_assert_canonical(fq_nmod_mpoly_univar_t A, FQ_NMOD_MPOLY_INLINE void fq_nmod_mpoly_univar_zero(fq_nmod_mpoly_univar_t A, - const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fq_nmod_mpoly_ctx_t ctx) { A->length = 0; } @@ -924,21 +924,21 @@ void fq_nmod_mpoly_from_univar(fq_nmod_mpoly_t A, FQ_NMOD_MPOLY_INLINE void fq_nmod_mpoly_univar_swap(fq_nmod_mpoly_univar_t A, - fq_nmod_mpoly_univar_t B, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + fq_nmod_mpoly_univar_t B, const fq_nmod_mpoly_ctx_t ctx) { FLINT_SWAP(fq_nmod_mpoly_univar_struct, *A, *B); } -int fq_nmod_mpoly_univar_degree_fits_si(const fq_nmod_mpoly_univar_t A, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); +int fq_nmod_mpoly_univar_degree_fits_si(const fq_nmod_mpoly_univar_t A, const fq_nmod_mpoly_ctx_t ctx); FQ_NMOD_MPOLY_INLINE slong fq_nmod_mpoly_univar_length(const fq_nmod_mpoly_univar_t A, - const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fq_nmod_mpoly_ctx_t ctx) { return A->length; } -slong fq_nmod_mpoly_univar_get_term_exp_si(fq_nmod_mpoly_univar_t A, slong i, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); +slong fq_nmod_mpoly_univar_get_term_exp_si(fq_nmod_mpoly_univar_t A, slong i, const fq_nmod_mpoly_ctx_t ctx); FQ_NMOD_MPOLY_INLINE void fq_nmod_mpoly_univar_get_term_coeff(fq_nmod_mpoly_t c, @@ -980,14 +980,14 @@ int fq_nmod_mpolyu_is_canonical(const fq_nmod_mpolyu_t poly, const fq_nmod_mpoly_ctx_t ctx); void fq_nmod_mpolyu_init(fq_nmod_mpolyu_t A, flint_bitcnt_t bits, - const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); + const fq_nmod_mpoly_ctx_t ctx); void fq_nmod_mpolyu_clear(fq_nmod_mpolyu_t A, const fq_nmod_mpoly_ctx_t uctx); FQ_NMOD_MPOLY_INLINE void fq_nmod_mpolyu_swap(fq_nmod_mpolyu_t A, fq_nmod_mpolyu_t B, - const fq_nmod_mpoly_ctx_t FLINT_UNUSED(uctx)) + const fq_nmod_mpoly_ctx_t uctx) { fq_nmod_mpolyu_struct t = *B; *B = *A; @@ -1079,20 +1079,20 @@ FQ_NMOD_MPOLY_INLINE ulong * fq_nmod_mpolyu_leadcoeff( /* mpolyn ********************************************************************/ void fq_nmod_mpolyn_init(fq_nmod_mpolyn_t A, flint_bitcnt_t bits, - const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); + const fq_nmod_mpoly_ctx_t ctx); -void fq_nmod_mpolyn_clear(fq_nmod_mpolyn_t A, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); +void fq_nmod_mpolyn_clear(fq_nmod_mpolyn_t A, const fq_nmod_mpoly_ctx_t ctx); void fq_nmod_mpolyn_swap(fq_nmod_mpolyn_t A, fq_nmod_mpolyn_t B); int fq_nmod_mpolyn_is_canonical(const fq_nmod_mpolyn_t A, const fq_nmod_mpoly_ctx_t ctx); -void fq_nmod_mpolyn_zero(fq_nmod_mpolyn_t A, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); +void fq_nmod_mpolyn_zero(fq_nmod_mpolyn_t A, const fq_nmod_mpoly_ctx_t ctx); void fq_nmod_mpolyn_one(fq_nmod_mpolyn_t A, const fq_nmod_mpoly_ctx_t ctx); -int fq_nmod_mpolyn_is_zero(fq_nmod_mpolyn_t A, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); +int fq_nmod_mpolyn_is_zero(fq_nmod_mpolyn_t A, const fq_nmod_mpoly_ctx_t ctx); void fq_nmod_mpolyn_print_pretty(const fq_nmod_mpolyn_t A, const char ** x_in, const fq_nmod_mpoly_ctx_t ctx); @@ -1119,7 +1119,7 @@ FQ_NMOD_MPOLY_INLINE ulong * fq_nmod_mpolyn_leadcoeff( } FQ_NMOD_MPOLY_INLINE n_poly_struct * fq_nmod_mpolyn_leadcoeff_poly( - const fq_nmod_mpolyn_t A, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fq_nmod_mpolyn_t A, const fq_nmod_mpoly_ctx_t ctx) { FLINT_ASSERT(A->length > 0); return A->coeffs + 0; @@ -1138,7 +1138,7 @@ void fq_nmod_mpoly_from_mpolyn_perm_inflate(fq_nmod_mpoly_t A, const slong * perm, const ulong * shift, const ulong * stride); void fq_nmod_mpolyun_init(fq_nmod_mpolyun_t A, - flint_bitcnt_t bits, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); + flint_bitcnt_t bits, const fq_nmod_mpoly_ctx_t ctx); void fq_nmod_mpolyun_clear(fq_nmod_mpolyun_t A, const fq_nmod_mpoly_ctx_t ctx); @@ -1198,9 +1198,9 @@ void fq_nmod_mpolyn_content_poly(fq_nmod_poly_t g, void fq_nmod_mpolyun_content_poly(fq_nmod_poly_t g, fq_nmod_mpolyun_t B, const fq_nmod_mpoly_ctx_t ctx); -slong fq_nmod_mpolyn_lastdeg(fq_nmod_mpolyn_t A, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); +slong fq_nmod_mpolyn_lastdeg(fq_nmod_mpolyn_t A, const fq_nmod_mpoly_ctx_t ctx); -slong fq_nmod_mpolyun_lastdeg(fq_nmod_mpolyun_t A, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); +slong fq_nmod_mpolyun_lastdeg(fq_nmod_mpolyun_t A, const fq_nmod_mpoly_ctx_t ctx); void fq_nmod_mpolyun_set( fq_nmod_mpolyun_t A, diff --git a/src/fq_nmod_mpoly_factor.h b/src/fq_nmod_mpoly_factor.h index 92a48cf4f1..ef05aa6cb6 100644 --- a/src/fq_nmod_mpoly_factor.h +++ b/src/fq_nmod_mpoly_factor.h @@ -50,7 +50,7 @@ void fq_nmod_mpoly_factor_clear(fq_nmod_mpoly_factor_t f, FQ_NMOD_MPOLY_FACTOR_INLINE slong fq_nmod_mpoly_factor_length(const fq_nmod_mpoly_factor_t f, - const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fq_nmod_mpoly_ctx_t ctx) { return f->num; } @@ -73,7 +73,7 @@ void fq_nmod_mpoly_factor_swap_base(fq_nmod_mpoly_t p, fq_nmod_mpoly_swap(p, f->poly + i, ctx); } -slong fq_nmod_mpoly_factor_get_exp_si(fq_nmod_mpoly_factor_t f, slong i, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); +slong fq_nmod_mpoly_factor_get_exp_si(fq_nmod_mpoly_factor_t f, slong i, const fq_nmod_mpoly_ctx_t ctx); void fq_nmod_mpoly_factor_set(fq_nmod_mpoly_factor_t a, const fq_nmod_mpoly_factor_t b, const fq_nmod_mpoly_ctx_t ctx); @@ -107,7 +107,7 @@ int fq_nmod_mpoly_factor_cmp(const fq_nmod_mpoly_factor_t A, FQ_NMOD_MPOLY_FACTOR_INLINE void fq_nmod_mpoly_factor_swap(fq_nmod_mpoly_factor_t A, - fq_nmod_mpoly_factor_t B, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + fq_nmod_mpoly_factor_t B, const fq_nmod_mpoly_ctx_t ctx) { fq_nmod_mpoly_factor_struct t = *A; *A = *B; @@ -266,7 +266,7 @@ typedef struct typedef fq_nmod_mpolyv_struct fq_nmod_mpolyv_t[1]; FQ_NMOD_MPOLY_FACTOR_INLINE -void fq_nmod_mpolyv_init(fq_nmod_mpolyv_t A, const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +void fq_nmod_mpolyv_init(fq_nmod_mpolyv_t A, const fq_nmod_mpoly_ctx_t ctx) { A->coeffs = NULL; A->alloc = 0; @@ -275,7 +275,7 @@ void fq_nmod_mpolyv_init(fq_nmod_mpolyv_t A, const fq_nmod_mpoly_ctx_t FLINT_UNU FQ_NMOD_MPOLY_FACTOR_INLINE void fq_nmod_mpolyv_swap(fq_nmod_mpolyv_t A, fq_nmod_mpolyv_t B, - const fq_nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fq_nmod_mpoly_ctx_t ctx) { fq_nmod_mpolyv_struct t = *A; *A = *B; @@ -472,7 +472,7 @@ int n_fq_bpoly_hlift( const fq_nmod_t alpha, slong degree_inner, /* required degree in x */ const fq_nmod_ctx_t ctx, - n_poly_bpoly_stack_t FLINT_UNUSED(St)); + n_poly_bpoly_stack_t St); int n_fq_polyu3_hlift( slong r, diff --git a/src/fq_poly_factor_templates.h b/src/fq_poly_factor_templates.h index 83982ef594..c2727f4488 100644 --- a/src/fq_poly_factor_templates.h +++ b/src/fq_poly_factor_templates.h @@ -53,7 +53,7 @@ void TEMPLATE(T, poly_factor_concat)(TEMPLATE(T, poly_factor_t) res, const TEMPLATE(T, ctx_t) ctx); void TEMPLATE(T, poly_factor_pow)(TEMPLATE(T, poly_factor_t) fac, slong exp, - const TEMPLATE(T, ctx_t) FLINT_UNUSED(ctx)); + const TEMPLATE(T, ctx_t) ctx); int _TEMPLATE(T, poly_is_squarefree)(const TEMPLATE(T, struct) * f, slong len, const TEMPLATE(T, ctx_t) ctx); diff --git a/src/fq_poly_templates.h b/src/fq_poly_templates.h index 0fd82b426a..fe9a291dbe 100644 --- a/src/fq_poly_templates.h +++ b/src/fq_poly_templates.h @@ -23,7 +23,7 @@ extern "C" { /* Memory management ********************************************************/ -void TEMPLATE(T, poly_init)(TEMPLATE(T, poly_t) poly, const TEMPLATE(T, ctx_t) FLINT_UNUSED(ctx)); +void TEMPLATE(T, poly_init)(TEMPLATE(T, poly_t) poly, const TEMPLATE(T, ctx_t) ctx); void TEMPLATE(T, poly_init2)(TEMPLATE(T, poly_t) poly, slong alloc, const TEMPLATE(T, ctx_t) ctx); @@ -56,21 +56,21 @@ void _TEMPLATE(T, poly_set_length)(TEMPLATE(T, poly_t) poly, slong len, FQ_POLY_TEMPLATES_INLINE slong TEMPLATE(T, poly_length)(const TEMPLATE(T, poly_t) poly, - const TEMPLATE(T, ctx_t) FLINT_UNUSED(ctx)) + const TEMPLATE(T, ctx_t) ctx) { return poly->length; } FQ_POLY_TEMPLATES_INLINE slong TEMPLATE(T, poly_degree)(const TEMPLATE(T, poly_t) poly, - const TEMPLATE(T, ctx_t) FLINT_UNUSED(ctx)) + const TEMPLATE(T, ctx_t) ctx) { return poly->length - 1; } FQ_POLY_TEMPLATES_INLINE TEMPLATE(T, struct) * TEMPLATE(T, poly_lead)(const TEMPLATE(T, poly_t) poly, - const TEMPLATE(T, ctx_t) FLINT_UNUSED(ctx)) + const TEMPLATE(T, ctx_t) ctx) { return poly->length > 0 ? poly->coeffs + (poly->length - 1) : NULL; } @@ -111,7 +111,7 @@ void TEMPLATE(T, poly_set_nmod_poly)(TEMPLATE(T, poly_t) rop, const TEMPLATE(T, ctx_t) ctx); void TEMPLATE(T, poly_swap)(TEMPLATE(T, poly_t) op1, TEMPLATE(T, poly_t) op2, - const TEMPLATE(T, ctx_t) FLINT_UNUSED(ctx)); + const TEMPLATE(T, ctx_t) ctx); void _TEMPLATE(T, poly_zero)(TEMPLATE(T, struct) *rop, slong len, const TEMPLATE(T, ctx_t) ctx); void TEMPLATE(T, poly_zero)(TEMPLATE(T, poly_t) poly, const TEMPLATE(T, ctx_t) ctx); @@ -173,7 +173,7 @@ int TEMPLATE(T, poly_equal_trunc)(const TEMPLATE(T, poly_t) poly1, FQ_POLY_TEMPLATES_INLINE int TEMPLATE(T, poly_is_zero)(const TEMPLATE(T, poly_t) poly, - const TEMPLATE(T, ctx_t) FLINT_UNUSED(ctx)) + const TEMPLATE(T, ctx_t) ctx) { return (poly->length == 0); } @@ -731,7 +731,7 @@ void TEMPLATE(T, poly_div_series)(TEMPLATE(T, poly_t) Q, void _TEMPLATE(T, poly_div_newton_n_preinv) ( TEMPLATE(T, struct) *Q, const TEMPLATE(T, struct) *A, slong lenA, - const TEMPLATE(T, struct)* FLINT_UNUSED(B), slong lenB, + const TEMPLATE(T, struct)* B, slong lenB, const TEMPLATE(T, struct)* Binv, slong lenBinv, const TEMPLATE(T, ctx_t) ctx); diff --git a/src/fq_zech.h b/src/fq_zech.h index c60ba12607..60ab1e3478 100644 --- a/src/fq_zech.h +++ b/src/fq_zech.h @@ -92,7 +92,7 @@ fq_zech_init2(fq_zech_t rop, const fq_zech_ctx_t ctx) } FQ_ZECH_INLINE void -fq_zech_clear(fq_zech_t FLINT_UNUSED(rop), const fq_zech_ctx_t FLINT_UNUSED(ctx)) +fq_zech_clear(fq_zech_t rop, const fq_zech_ctx_t ctx) { } @@ -171,7 +171,7 @@ void fq_zech_rand_not_zero(fq_zech_t rop, flint_rand_t state, /* Comparison ****************************************************************/ FQ_ZECH_INLINE int -fq_zech_equal(const fq_zech_t op1, const fq_zech_t op2, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +fq_zech_equal(const fq_zech_t op1, const fq_zech_t op2, const fq_zech_ctx_t ctx) { return op1->value == op2->value; } @@ -183,7 +183,7 @@ fq_zech_is_zero(const fq_zech_t op, const fq_zech_ctx_t ctx) } FQ_ZECH_INLINE int -fq_zech_is_one(const fq_zech_t op, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +fq_zech_is_one(const fq_zech_t op, const fq_zech_ctx_t ctx) { return op->value == 0; } @@ -191,7 +191,7 @@ fq_zech_is_one(const fq_zech_t op, const fq_zech_ctx_t FLINT_UNUSED(ctx)) /* Assignments and conversions ***********************************************/ FQ_ZECH_INLINE void -fq_zech_set(fq_zech_t rop, const fq_zech_t op, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +fq_zech_set(fq_zech_t rop, const fq_zech_t op, const fq_zech_ctx_t ctx) { rop->value = op->value; } @@ -202,7 +202,7 @@ void fq_zech_set_si(fq_zech_t rop, const slong x, const fq_zech_ctx_t ctx); void fq_zech_set_ui(fq_zech_t rop, const ulong x, const fq_zech_ctx_t ctx); FQ_ZECH_INLINE void -fq_zech_swap(fq_zech_t op1, fq_zech_t op2, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +fq_zech_swap(fq_zech_t op1, fq_zech_t op2, const fq_zech_ctx_t ctx) { slong temp; temp = op2->value; @@ -217,13 +217,13 @@ fq_zech_zero(fq_zech_t rop, const fq_zech_ctx_t ctx) } FQ_ZECH_INLINE void -fq_zech_one(fq_zech_t rop, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +fq_zech_one(fq_zech_t rop, const fq_zech_ctx_t ctx) { rop->value = 0; } FQ_ZECH_INLINE void -fq_zech_gen(fq_zech_t rop, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +fq_zech_gen(fq_zech_t rop, const fq_zech_ctx_t ctx) { rop->value = 1; } @@ -248,14 +248,14 @@ void fq_zech_set_nmod_poly(fq_zech_t a, const nmod_poly_t b, /* Output ********************************************************************/ #ifdef FLINT_HAVE_FILE -int fq_zech_fprint(FILE * file, const fq_zech_t op, const fq_zech_ctx_t FLINT_UNUSED(ctx)); +int fq_zech_fprint(FILE * file, const fq_zech_t op, const fq_zech_ctx_t ctx); int fq_zech_fprint_pretty(FILE * file, const fq_zech_t op, const fq_zech_ctx_t ctx); #endif void fq_zech_print(const fq_zech_t op, const fq_zech_ctx_t ctx); void fq_zech_print_pretty(const fq_zech_t op, const fq_zech_ctx_t ctx); -char * fq_zech_get_str(const fq_zech_t op, const fq_zech_ctx_t FLINT_UNUSED(ctx)); +char * fq_zech_get_str(const fq_zech_t op, const fq_zech_ctx_t ctx); char * fq_zech_get_str_pretty(const fq_zech_t op, const fq_zech_ctx_t ctx); diff --git a/src/fq_zech_mpoly.h b/src/fq_zech_mpoly.h index db8ff7c21a..22bf796a51 100644 --- a/src/fq_zech_mpoly.h +++ b/src/fq_zech_mpoly.h @@ -185,7 +185,7 @@ void fq_zech_mpoly_clear(fq_zech_mpoly_t A, FQ_ZECH_MPOLY_INLINE void _fq_zech_mpoly_set_length(fq_zech_mpoly_t A, slong newlen, - const fq_zech_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fq_zech_mpoly_ctx_t ctx) { FLINT_ASSERT(newlen <= A->alloc); A->length = newlen; @@ -193,7 +193,7 @@ void _fq_zech_mpoly_set_length(fq_zech_mpoly_t A, slong newlen, FQ_ZECH_MPOLY_INLINE void fq_zech_mpoly_truncate(fq_zech_mpoly_t A, slong newlen, - const fq_zech_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fq_zech_mpoly_ctx_t ctx) { if (A->length > newlen) { @@ -233,7 +233,7 @@ int fq_zech_mpoly_equal(const fq_zech_mpoly_t A, const fq_zech_mpoly_t B, FQ_ZECH_MPOLY_INLINE void fq_zech_mpoly_swap(fq_zech_mpoly_t A, fq_zech_mpoly_t B, - const fq_zech_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fq_zech_mpoly_ctx_t ctx) { FLINT_SWAP(fq_zech_mpoly_struct, *A, *B); } @@ -272,7 +272,7 @@ void fq_zech_mpoly_one(fq_zech_mpoly_t A, const fq_zech_mpoly_ctx_t ctx) } FQ_ZECH_MPOLY_INLINE -int fq_zech_mpoly_is_zero(const fq_zech_mpoly_t A, const fq_zech_mpoly_ctx_t FLINT_UNUSED(ctx)) +int fq_zech_mpoly_is_zero(const fq_zech_mpoly_t A, const fq_zech_mpoly_ctx_t ctx) { return A->length == 0; } @@ -331,7 +331,7 @@ void fq_zech_mpoly_get_coeff_vars_ui(fq_zech_mpoly_t C, slong length, const fq_zech_mpoly_ctx_t ctx); FQ_ZECH_MPOLY_INLINE fq_zech_struct * fq_zech_mpoly_leadcoeff( - const fq_zech_mpoly_t A, const fq_zech_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fq_zech_mpoly_t A, const fq_zech_mpoly_ctx_t ctx) { FLINT_ASSERT(A->length > 0); return A->coeffs + 0; @@ -350,7 +350,7 @@ int fq_zech_mpoly_is_canonical(const fq_zech_mpoly_t A, const fq_zech_mpoly_ctx_t ctx); FQ_ZECH_MPOLY_INLINE -slong fq_zech_mpoly_length(const fq_zech_mpoly_t A, const fq_zech_mpoly_ctx_t FLINT_UNUSED(ctx)) +slong fq_zech_mpoly_length(const fq_zech_mpoly_t A, const fq_zech_mpoly_ctx_t ctx) { return A->length; } @@ -626,7 +626,7 @@ void fq_zech_mpoly_inflate(fq_zech_mpoly_t A, const fq_zech_mpoly_t B, /* Univariates ***************************************************************/ void fq_zech_mpoly_univar_init(fq_zech_mpoly_univar_t A, - const fq_zech_mpoly_ctx_t FLINT_UNUSED(ctx)); + const fq_zech_mpoly_ctx_t ctx); void fq_zech_mpoly_univar_clear(fq_zech_mpoly_univar_t A, const fq_zech_mpoly_ctx_t ctx); @@ -651,21 +651,21 @@ void fq_zech_mpoly_from_univar(fq_zech_mpoly_t A, FQ_ZECH_MPOLY_INLINE void fq_zech_mpoly_univar_swap(fq_zech_mpoly_univar_t A, - fq_zech_mpoly_univar_t B, const fq_zech_mpoly_ctx_t FLINT_UNUSED(ctx)) + fq_zech_mpoly_univar_t B, const fq_zech_mpoly_ctx_t ctx) { FLINT_SWAP(fq_zech_mpoly_univar_struct, *A, *B); } -int fq_zech_mpoly_univar_degree_fits_si(const fq_zech_mpoly_univar_t A, const fq_zech_mpoly_ctx_t FLINT_UNUSED(ctx)); +int fq_zech_mpoly_univar_degree_fits_si(const fq_zech_mpoly_univar_t A, const fq_zech_mpoly_ctx_t ctx); FQ_ZECH_MPOLY_INLINE slong fq_zech_mpoly_univar_length(const fq_zech_mpoly_univar_t A, - const fq_zech_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fq_zech_mpoly_ctx_t ctx) { return A->length; } -slong fq_zech_mpoly_univar_get_term_exp_si(fq_zech_mpoly_univar_t A, slong i, const fq_zech_mpoly_ctx_t FLINT_UNUSED(ctx)); +slong fq_zech_mpoly_univar_get_term_exp_si(fq_zech_mpoly_univar_t A, slong i, const fq_zech_mpoly_ctx_t ctx); FQ_ZECH_MPOLY_INLINE void fq_zech_mpoly_univar_get_term_coeff(fq_zech_mpoly_t c, @@ -738,7 +738,7 @@ int fq_zech_mpolyu_is_canonical(const fq_zech_mpolyu_t poly, const fq_zech_mpoly_ctx_t ctx); void fq_zech_mpolyu_init(fq_zech_mpolyu_t A, flint_bitcnt_t bits, - const fq_zech_mpoly_ctx_t FLINT_UNUSED(ctx)); + const fq_zech_mpoly_ctx_t ctx); void fq_zech_mpolyu_clear(fq_zech_mpolyu_t A, const fq_zech_mpoly_ctx_t uctx); diff --git a/src/fq_zech_mpoly_factor.h b/src/fq_zech_mpoly_factor.h index cfdd314388..825df1a74a 100644 --- a/src/fq_zech_mpoly_factor.h +++ b/src/fq_zech_mpoly_factor.h @@ -69,7 +69,7 @@ typedef fq_zech_polyun_struct fq_zech_polyun_t[1]; /*****************************************************************************/ FQ_ZECH_MPOLY_FACTOR_INLINE -void fq_zech_bpoly_init(fq_zech_bpoly_t A, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +void fq_zech_bpoly_init(fq_zech_bpoly_t A, const fq_zech_ctx_t ctx) { A->coeffs = NULL; A->alloc = 0; @@ -79,7 +79,7 @@ void fq_zech_bpoly_init(fq_zech_bpoly_t A, const fq_zech_ctx_t FLINT_UNUSED(ctx) void fq_zech_bpoly_clear(fq_zech_bpoly_t A, const fq_zech_ctx_t ctx); FQ_ZECH_MPOLY_FACTOR_INLINE -void fq_zech_bpoly_swap(fq_zech_bpoly_t A, fq_zech_bpoly_t B, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +void fq_zech_bpoly_swap(fq_zech_bpoly_t A, fq_zech_bpoly_t B, const fq_zech_ctx_t ctx) { fq_zech_bpoly_struct t = *A; *A = *B; @@ -98,13 +98,13 @@ void fq_zech_bpoly_fit_length(fq_zech_bpoly_t A, slong len, const fq_zech_ctx_t } FQ_ZECH_MPOLY_FACTOR_INLINE -void fq_zech_bpoly_zero(fq_zech_bpoly_t A, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +void fq_zech_bpoly_zero(fq_zech_bpoly_t A, const fq_zech_ctx_t ctx) { A->length = 0; } FQ_ZECH_MPOLY_FACTOR_INLINE -int fq_zech_bpoly_is_zero(const fq_zech_bpoly_t A, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +int fq_zech_bpoly_is_zero(const fq_zech_bpoly_t A, const fq_zech_ctx_t ctx) { return A->length == 0; } @@ -114,12 +114,12 @@ int fq_zech_bpoly_equal(const fq_zech_bpoly_t A, const fq_zech_bpoly_t B, const void fq_zech_bpoly_get_coeff(fq_zech_t c, const fq_zech_bpoly_t A, slong e0, slong e1, const fq_zech_ctx_t ctx); FQ_ZECH_MPOLY_FACTOR_INLINE -slong fq_zech_bpoly_degree0(const fq_zech_bpoly_t A, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +slong fq_zech_bpoly_degree0(const fq_zech_bpoly_t A, const fq_zech_ctx_t ctx) { return A->length - 1; } -slong fq_zech_bpoly_degree1(const fq_zech_bpoly_t A, const fq_zech_ctx_t FLINT_UNUSED(ctx)); +slong fq_zech_bpoly_degree1(const fq_zech_bpoly_t A, const fq_zech_ctx_t ctx); void fq_zech_bpoly_set_poly_var1(fq_zech_bpoly_t A, const fq_zech_poly_t B, const fq_zech_ctx_t ctx); @@ -259,7 +259,7 @@ int fq_zech_bpoly_factor_lgprime( /*****************************************************************************/ FQ_ZECH_MPOLY_FACTOR_INLINE -void fq_zech_tpoly_init(fq_zech_tpoly_t A, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +void fq_zech_tpoly_init(fq_zech_tpoly_t A, const fq_zech_ctx_t ctx) { A->coeffs = NULL; A->alloc = 0; @@ -267,7 +267,7 @@ void fq_zech_tpoly_init(fq_zech_tpoly_t A, const fq_zech_ctx_t FLINT_UNUSED(ctx) } FQ_ZECH_MPOLY_FACTOR_INLINE -void fq_zech_tpoly_swap(fq_zech_tpoly_t A, fq_zech_tpoly_t B, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +void fq_zech_tpoly_swap(fq_zech_tpoly_t A, fq_zech_tpoly_t B, const fq_zech_ctx_t ctx) { fq_zech_tpoly_struct t = *A; *A = *B; @@ -282,7 +282,7 @@ void fq_zech_tpoly_clear(fq_zech_tpoly_t A, const fq_zech_ctx_t ctx); /*****************************************************************************/ FQ_ZECH_MPOLY_FACTOR_INLINE -void fq_zech_polyu_init(fq_zech_polyu_t A, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +void fq_zech_polyu_init(fq_zech_polyu_t A, const fq_zech_ctx_t ctx) { A->coeffs = NULL; A->exps = NULL; @@ -290,7 +290,7 @@ void fq_zech_polyu_init(fq_zech_polyu_t A, const fq_zech_ctx_t FLINT_UNUSED(ctx) A->alloc = 0; } -void fq_zech_polyu_clear(fq_zech_polyu_t A, const fq_zech_ctx_t FLINT_UNUSED(ctx)); +void fq_zech_polyu_clear(fq_zech_polyu_t A, const fq_zech_ctx_t ctx); void fq_zech_polyu_realloc(fq_zech_polyu_t A, slong len, const fq_zech_ctx_t ctx); @@ -303,7 +303,7 @@ void fq_zech_polyu_fit_length(fq_zech_polyu_t A, slong len, const fq_zech_ctx_t } FQ_ZECH_MPOLY_FACTOR_INLINE -void fq_zech_polyu_swap(fq_zech_polyu_t A, fq_zech_polyu_t B, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +void fq_zech_polyu_swap(fq_zech_polyu_t A, fq_zech_polyu_t B, const fq_zech_ctx_t ctx) { fq_zech_polyu_struct t = *B; *B = *A; @@ -330,7 +330,7 @@ int fq_zech_polyu_is_canonical( /*****************************************************************************/ FQ_ZECH_MPOLY_FACTOR_INLINE -void fq_zech_polyun_init(fq_zech_polyun_t A, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +void fq_zech_polyun_init(fq_zech_polyun_t A, const fq_zech_ctx_t ctx) { A->coeffs = NULL; A->exps = NULL; @@ -350,7 +350,7 @@ void fq_zech_polyun_fit_length(fq_zech_polyun_t A, slong len, const fq_zech_ctx_ } FQ_ZECH_MPOLY_FACTOR_INLINE -void fq_zech_polyun_swap(fq_zech_polyun_t A, fq_zech_polyun_t B, const fq_zech_ctx_t FLINT_UNUSED(ctx)) +void fq_zech_polyun_swap(fq_zech_polyun_t A, fq_zech_polyun_t B, const fq_zech_ctx_t ctx) { fq_zech_polyun_struct t = *B; *B = *A; @@ -447,7 +447,7 @@ int fq_zech_mpoly_factor(fq_zech_mpoly_factor_t f, FQ_ZECH_MPOLY_FACTOR_INLINE void fq_zech_mpoly_factor_swap(fq_zech_mpoly_factor_t A, - fq_zech_mpoly_factor_t B, const fq_zech_mpoly_ctx_t FLINT_UNUSED(ctx)) + fq_zech_mpoly_factor_t B, const fq_zech_mpoly_ctx_t ctx) { fq_zech_mpoly_factor_struct t = *A; *A = *B; @@ -495,7 +495,7 @@ typedef struct typedef fq_zech_mpolyv_struct fq_zech_mpolyv_t[1]; FQ_ZECH_MPOLY_FACTOR_INLINE -void fq_zech_mpolyv_init(fq_zech_mpolyv_t A, const fq_zech_mpoly_ctx_t FLINT_UNUSED(ctx)) +void fq_zech_mpolyv_init(fq_zech_mpolyv_t A, const fq_zech_mpoly_ctx_t ctx) { A->coeffs = NULL; A->alloc = 0; @@ -504,7 +504,7 @@ void fq_zech_mpolyv_init(fq_zech_mpolyv_t A, const fq_zech_mpoly_ctx_t FLINT_UNU FQ_ZECH_MPOLY_FACTOR_INLINE void fq_zech_mpolyv_swap(fq_zech_mpolyv_t A, fq_zech_mpolyv_t B, - const fq_zech_mpoly_ctx_t FLINT_UNUSED(ctx)) + const fq_zech_mpoly_ctx_t ctx) { fq_zech_mpolyv_struct t = *A; *A = *B; @@ -745,7 +745,7 @@ void _fq_zech_mpoly_set_fq_zech_bpoly_var1_zero( /* misc **********************************************************************/ -int fq_zech_next(fq_zech_t x, const fq_zech_ctx_t FLINT_UNUSED(ctx)); +int fq_zech_next(fq_zech_t x, const fq_zech_ctx_t ctx); #ifdef __cplusplus } diff --git a/src/gr_mat.h b/src/gr_mat.h index 68b36147f1..8a3d83c29c 100644 --- a/src/gr_mat.h +++ b/src/gr_mat.h @@ -61,7 +61,7 @@ WARN_UNUSED_RESULT int gr_mat_init_set(gr_mat_t res, const gr_mat_t mat, gr_ctx_ void gr_mat_clear(gr_mat_t mat, gr_ctx_t ctx); GR_MAT_INLINE void -gr_mat_swap(gr_mat_t mat1, gr_mat_t mat2, gr_ctx_t FLINT_UNUSED(ctx)) +gr_mat_swap(gr_mat_t mat1, gr_mat_t mat2, gr_ctx_t ctx) { FLINT_SWAP(gr_mat_struct, *mat1, *mat2); } @@ -74,7 +74,7 @@ WARN_UNUSED_RESULT int gr_mat_invert_cols(gr_mat_t mat, slong * perm, gr_ctx_t c void gr_mat_window_init(gr_mat_t window, const gr_mat_t mat, slong r1, slong c1, slong r2, slong c2, gr_ctx_t ctx); GR_MAT_INLINE void -gr_mat_window_clear(gr_mat_t window, gr_ctx_t FLINT_UNUSED(ctx)) +gr_mat_window_clear(gr_mat_t window, gr_ctx_t ctx) { flint_free(window->rows); } @@ -91,13 +91,13 @@ WARN_UNUSED_RESULT int gr_mat_randpermdiag(int * parity, gr_mat_t mat, flint_ran WARN_UNUSED_RESULT int gr_mat_randrank(gr_mat_t mat, flint_rand_t state, slong rank, gr_ctx_t ctx); GR_MAT_INLINE truth_t -gr_mat_is_empty(const gr_mat_t mat, gr_ctx_t FLINT_UNUSED(ctx)) +gr_mat_is_empty(const gr_mat_t mat, gr_ctx_t ctx) { return ((mat->r == 0) || (mat->c == 0)) ? T_TRUE : T_FALSE; } GR_MAT_INLINE truth_t -gr_mat_is_square(const gr_mat_t mat, gr_ctx_t FLINT_UNUSED(ctx)) +gr_mat_is_square(const gr_mat_t mat, gr_ctx_t ctx) { return (mat->r == mat->c) ? T_TRUE : T_FALSE; } diff --git a/src/gr_poly.h b/src/gr_poly.h index 9ce700b3fd..3dea1d975c 100644 --- a/src/gr_poly.h +++ b/src/gr_poly.h @@ -41,13 +41,13 @@ gr_poly_entry_srcptr(const gr_poly_t poly, slong i, gr_ctx_t ctx) return GR_ENTRY(poly->coeffs, i, ctx->sizeof_elem); } -GR_POLY_INLINE slong gr_poly_length(const gr_poly_t poly, gr_ctx_t FLINT_UNUSED(ctx)) +GR_POLY_INLINE slong gr_poly_length(const gr_poly_t poly, gr_ctx_t ctx) { return poly->length; } GR_POLY_INLINE void -gr_poly_swap(gr_poly_t poly1, gr_poly_t poly2, gr_ctx_t FLINT_UNUSED(ctx)) +gr_poly_swap(gr_poly_t poly1, gr_poly_t poly2, gr_ctx_t ctx) { FLINT_SWAP(gr_poly_struct, *poly1, *poly2); } diff --git a/src/gr_vec.h b/src/gr_vec.h index 3709da1816..83c84b9e54 100644 --- a/src/gr_vec.h +++ b/src/gr_vec.h @@ -42,7 +42,7 @@ gr_vec_entry_srcptr(const gr_vec_t vec, slong i, gr_ctx_t ctx) } -GR_VEC_INLINE slong gr_vec_length(const gr_vec_t vec, gr_ctx_t FLINT_UNUSED(ctx)) +GR_VEC_INLINE slong gr_vec_length(const gr_vec_t vec, gr_ctx_t ctx) { return vec->length; } diff --git a/src/mpn_mod.h b/src/mpn_mod.h index 3c542195fe..1c1db547d4 100644 --- a/src/mpn_mod.h +++ b/src/mpn_mod.h @@ -85,7 +85,7 @@ mpn_mod_init(nn_ptr x, gr_ctx_t ctx) } MPN_MOD_INLINE void -mpn_mod_clear(nn_ptr FLINT_UNUSED(x), gr_ctx_t FLINT_UNUSED(ctx)) +mpn_mod_clear(nn_ptr x, gr_ctx_t ctx) { } @@ -187,7 +187,7 @@ int mpn_mod_div(nn_ptr res, nn_srcptr x, nn_srcptr y, gr_ctx_t ctx); /* Vector functions */ int _mpn_mod_vec_zero(nn_ptr res, slong len, gr_ctx_t ctx); -int _mpn_mod_vec_clear(nn_ptr FLINT_UNUSED(res), slong FLINT_UNUSED(len), gr_ctx_t FLINT_UNUSED(ctx)); +int _mpn_mod_vec_clear(nn_ptr res, slong len, gr_ctx_t ctx); int _mpn_mod_vec_set(nn_ptr res, nn_srcptr x, slong len, gr_ctx_t ctx); void _mpn_mod_vec_swap(nn_ptr vec1, nn_ptr vec2, slong len, gr_ctx_t ctx); int _mpn_mod_vec_neg(nn_ptr res, nn_srcptr x, slong len, gr_ctx_t ctx); diff --git a/src/mpoly.h b/src/mpoly.h index b50f273327..d4dbb48557 100644 --- a/src/mpoly.h +++ b/src/mpoly.h @@ -49,7 +49,7 @@ void mpoly_ctx_init_rand(mpoly_ctx_t mctx, flint_rand_t state, slong max_nvars); void mpoly_monomial_randbits_fmpz(fmpz * exp, flint_rand_t state, flint_bitcnt_t exp_bits, const mpoly_ctx_t mctx); -void mpoly_ctx_clear(mpoly_ctx_t FLINT_UNUSED(mctx)); +void mpoly_ctx_clear(mpoly_ctx_t mctx); /* number of words used by an exponent vector packed into "bits" bits: @@ -841,7 +841,7 @@ void mpoly_gen_fields_ui(ulong * exp, slong var, const mpoly_ctx_t mctx); void mpoly_gen_fields_fmpz(fmpz * exp, slong var, const mpoly_ctx_t mctx); -flint_bitcnt_t mpoly_gen_bits_required(slong FLINT_UNUSED(var), const mpoly_ctx_t FLINT_UNUSED(mctx)); +flint_bitcnt_t mpoly_gen_bits_required(slong var, const mpoly_ctx_t mctx); /* return the index in the fields where the generator of index v is stored */ FLINT_FORCE_INLINE slong mpoly_gen_index(slong v, const mpoly_ctx_t mctx) @@ -889,7 +889,7 @@ flint_bitcnt_t mpoly_exp_bits_required_ffmpz(const fmpz * user_exp, flint_bitcnt_t mpoly_exp_bits_required_pfmpz(fmpz * const * user_exp, const mpoly_ctx_t mctx); -flint_bitcnt_t mpoly_gen_pow_exp_bits_required(slong FLINT_UNUSED(v), ulong e, const mpoly_ctx_t FLINT_UNUSED(mctx)); +flint_bitcnt_t mpoly_gen_pow_exp_bits_required(slong v, ulong e, const mpoly_ctx_t mctx); int mpoly_is_poly(const ulong * Aexps, slong Alen, flint_bitcnt_t Abits, slong var, const mpoly_ctx_t mctx); @@ -1111,19 +1111,19 @@ slong mpoly_gcd_info_get_brown_upper_limit(const mpoly_gcd_info_t Iv, slong var, slong bound); void mpoly_gcd_info_measure_hensel(mpoly_gcd_info_t Iv, - slong Alength, slong Blength, const mpoly_ctx_t FLINT_UNUSED(mctx)); + slong Alength, slong Blength, const mpoly_ctx_t mctx); void mpoly_gcd_info_measure_brown(mpoly_gcd_info_t Iv, - slong Alength, slong Blength, const mpoly_ctx_t FLINT_UNUSED(mctx)); + slong Alength, slong Blength, const mpoly_ctx_t mctx); void mpoly_gcd_info_measure_bma(mpoly_gcd_info_t Iv, - slong Alength, slong Blength, const mpoly_ctx_t FLINT_UNUSED(mctx)); + slong Alength, slong Blength, const mpoly_ctx_t mctx); void mpoly_gcd_info_measure_zippel(mpoly_gcd_info_t Iv, - slong FLINT_UNUSED(Alength), slong FLINT_UNUSED(Blength), const mpoly_ctx_t FLINT_UNUSED(mctx)); + slong Alength, slong Blength, const mpoly_ctx_t mctx); void mpoly_gcd_info_measure_zippel2(mpoly_gcd_info_t Iv, - slong FLINT_UNUSED(Alength), slong FLINT_UNUSED(Blength), const mpoly_ctx_t FLINT_UNUSED(mctx)); + slong Alength, slong Blength, const mpoly_ctx_t mctx); int mpoly_monomial_cofactors(fmpz * Abarexps, fmpz * Bbarexps, const ulong * Aexps, flint_bitcnt_t Abits, @@ -1261,7 +1261,7 @@ int mpoly_parse_parse(mpoly_parse_t E, void * res, const char * s, slong len); Note this doesn't currently mask the relevant bits. */ void mpoly_main_variable_terms1(slong * i1, slong * n1, const ulong * exp1, - slong l1, slong len1, slong k, slong FLINT_UNUSED(num), slong bits); + slong l1, slong len1, slong k, slong num, slong bits); #ifdef __cplusplus } diff --git a/src/nmod_mpoly.h b/src/nmod_mpoly.h index 980dc34113..4358ccf08a 100644 --- a/src/nmod_mpoly.h +++ b/src/nmod_mpoly.h @@ -32,7 +32,7 @@ extern "C" { FLINT_FORCE_INLINE ulong * nmod_mpoly_term_coeff_ref(nmod_mpoly_t A, slong i, - const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const nmod_mpoly_ctx_t ctx) { FLINT_ASSERT(i < A->length); return A->coeffs + i; @@ -262,7 +262,7 @@ ulong nmod_mpoly_ctx_modulus(const nmod_mpoly_ctx_t ctx) /* Memory management ********************************************************/ NMOD_MPOLY_INLINE -void nmod_mpoly_init(nmod_mpoly_t A, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +void nmod_mpoly_init(nmod_mpoly_t A, const nmod_mpoly_ctx_t ctx) { A->coeffs = NULL; A->exps = NULL; @@ -278,7 +278,7 @@ void nmod_mpoly_init3(nmod_mpoly_t A, slong alloc, flint_bitcnt_t bits, const nm void nmod_mpoly_realloc(nmod_mpoly_t A, slong alloc, const nmod_mpoly_ctx_t ctx); NMOD_MPOLY_INLINE -void nmod_mpoly_clear(nmod_mpoly_t A, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +void nmod_mpoly_clear(nmod_mpoly_t A, const nmod_mpoly_ctx_t ctx) { if (A->coeffs_alloc > 0) flint_free(A->coeffs); @@ -316,7 +316,7 @@ void _nmod_mpoly_fit_length( } NMOD_MPOLY_INLINE -void _nmod_mpoly_set_length(nmod_mpoly_t A, slong newlen, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +void _nmod_mpoly_set_length(nmod_mpoly_t A, slong newlen, const nmod_mpoly_ctx_t ctx) { FLINT_ASSERT(newlen <= A->coeffs_alloc); FLINT_ASSERT(mpoly_words_per_exp(A->bits, ctx->minfo)*newlen <= A->exps_alloc); @@ -324,7 +324,7 @@ void _nmod_mpoly_set_length(nmod_mpoly_t A, slong newlen, const nmod_mpoly_ctx_t } NMOD_MPOLY_INLINE -void nmod_mpoly_truncate(nmod_mpoly_t A, slong newlen, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +void nmod_mpoly_truncate(nmod_mpoly_t A, slong newlen, const nmod_mpoly_ctx_t ctx) { if (A->length > newlen) { @@ -357,7 +357,7 @@ void nmod_mpoly_set(nmod_mpoly_t A, const nmod_mpoly_t B, const nmod_mpoly_ctx_t int nmod_mpoly_equal(const nmod_mpoly_t A, const nmod_mpoly_t B, const nmod_mpoly_ctx_t ctx); NMOD_MPOLY_INLINE -void nmod_mpoly_swap(nmod_mpoly_t A, nmod_mpoly_t B, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +void nmod_mpoly_swap(nmod_mpoly_t A, nmod_mpoly_t B, const nmod_mpoly_ctx_t ctx) { FLINT_SWAP(nmod_mpoly_struct, *A, *B); } @@ -386,7 +386,7 @@ void nmod_mpoly_one(nmod_mpoly_t A, const nmod_mpoly_ctx_t ctx) int nmod_mpoly_equal_ui(const nmod_mpoly_t A, ulong c, const nmod_mpoly_ctx_t ctx); NMOD_MPOLY_INLINE -int nmod_mpoly_is_zero(const nmod_mpoly_t A, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +int nmod_mpoly_is_zero(const nmod_mpoly_t A, const nmod_mpoly_ctx_t ctx) { return A->length == 0; } @@ -433,7 +433,7 @@ void nmod_mpoly_get_coeff_vars_ui(nmod_mpoly_t C, slong length, const nmod_mpoly_ctx_t ctx); NMOD_MPOLY_INLINE -ulong nmod_mpoly_leadcoeff(nmod_mpoly_t A, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +ulong nmod_mpoly_leadcoeff(nmod_mpoly_t A, const nmod_mpoly_ctx_t ctx) { FLINT_ASSERT(A->length > 0); return A->coeffs[0]; @@ -461,14 +461,14 @@ int nmod_mpoly_cmp(const nmod_mpoly_t A, const nmod_mpoly_t B, const nmod_mpoly_ int nmod_mpoly_is_canonical(const nmod_mpoly_t A, const nmod_mpoly_ctx_t ctx); NMOD_MPOLY_INLINE -slong nmod_mpoly_length(const nmod_mpoly_t A, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +slong nmod_mpoly_length(const nmod_mpoly_t A, const nmod_mpoly_ctx_t ctx) { return A->length; } void nmod_mpoly_resize(nmod_mpoly_t A, slong new_length, const nmod_mpoly_ctx_t ctx); -ulong nmod_mpoly_get_term_coeff_ui(const nmod_mpoly_t A, slong i, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); +ulong nmod_mpoly_get_term_coeff_ui(const nmod_mpoly_t A, slong i, const nmod_mpoly_ctx_t ctx); void nmod_mpoly_set_term_coeff_ui(nmod_mpoly_t A, slong i, ulong c, const nmod_mpoly_ctx_t ctx); @@ -840,7 +840,7 @@ void nmod_mpoly_univar_assert_canonical(nmod_mpoly_univar_t A, const nmod_mpoly_ctx_t ctx); NMOD_MPOLY_INLINE -void nmod_mpoly_univar_zero(nmod_mpoly_univar_t A, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +void nmod_mpoly_univar_zero(nmod_mpoly_univar_t A, const nmod_mpoly_ctx_t ctx) { A->length = 0; } @@ -858,7 +858,7 @@ void nmod_mpoly_from_univar(nmod_mpoly_t A, const nmod_mpoly_univar_t B, slong var, const nmod_mpoly_ctx_t ctx); NMOD_MPOLY_INLINE -void nmod_mpoly_univar_swap(nmod_mpoly_univar_t A, nmod_mpoly_univar_t B, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +void nmod_mpoly_univar_swap(nmod_mpoly_univar_t A, nmod_mpoly_univar_t B, const nmod_mpoly_ctx_t ctx) { FLINT_SWAP(nmod_mpoly_univar_struct, *A, *B); } @@ -867,7 +867,7 @@ int nmod_mpoly_univar_degree_fits_si(const nmod_mpoly_univar_t A, const nmod_mpo NMOD_MPOLY_INLINE slong nmod_mpoly_univar_length(const nmod_mpoly_univar_t A, - const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const nmod_mpoly_ctx_t ctx) { return A->length; } @@ -974,17 +974,17 @@ slong nmod_mpolyd_length(const nmod_mpolyd_t A); /* mpolyu ********************************************************************/ -void nmod_mpolyu_init(nmod_mpolyu_t A, flint_bitcnt_t bits, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); +void nmod_mpolyu_init(nmod_mpolyu_t A, flint_bitcnt_t bits, const nmod_mpoly_ctx_t ctx); void nmod_mpolyu_clear(nmod_mpolyu_t A, const nmod_mpoly_ctx_t uctx); FLINT_FORCE_INLINE -void nmod_mpolyu_swap(nmod_mpolyu_t A, nmod_mpolyu_t B, const nmod_mpoly_ctx_t FLINT_UNUSED(uctx)) +void nmod_mpolyu_swap(nmod_mpolyu_t A, nmod_mpolyu_t B, const nmod_mpoly_ctx_t uctx) { FLINT_SWAP(nmod_mpolyu_struct, *A, *B); } FLINT_FORCE_INLINE -void nmod_mpolyu_zero(nmod_mpolyu_t A, const nmod_mpoly_ctx_t FLINT_UNUSED(uctx)) +void nmod_mpolyu_zero(nmod_mpolyu_t A, const nmod_mpoly_ctx_t uctx) { A->length = 0; } @@ -1025,7 +1025,7 @@ void nmod_mpolyu_set(nmod_mpolyu_t A, const nmod_mpolyu_t B, const nmod_mpoly_ctx_t uctx); void nmod_mpolyu_cvtto_poly(nmod_poly_t a, nmod_mpolyu_t A, - const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); + const nmod_mpoly_ctx_t ctx); void nmod_mpolyu_cvtfrom_poly(nmod_mpolyu_t A, nmod_poly_t a, const nmod_mpoly_ctx_t ctx); @@ -1073,15 +1073,15 @@ NMOD_MPOLY_INLINE ulong nmod_mpolyu_leadcoeff( /* mpolyn ********************************************************************/ void nmod_mpolyn_init(nmod_mpolyn_t A, flint_bitcnt_t bits, - const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); + const nmod_mpoly_ctx_t ctx); -void nmod_mpolyn_clear(nmod_mpolyn_t A, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); +void nmod_mpolyn_clear(nmod_mpolyn_t A, const nmod_mpoly_ctx_t ctx); void nmod_mpolyn_swap(nmod_mpolyn_t A, nmod_mpolyn_t B); -void nmod_mpolyn_zero(nmod_mpolyn_t A, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); +void nmod_mpolyn_zero(nmod_mpolyn_t A, const nmod_mpoly_ctx_t ctx); -int nmod_mpolyn_is_zero(nmod_mpolyn_t A, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); +int nmod_mpolyn_is_zero(nmod_mpolyn_t A, const nmod_mpoly_ctx_t ctx); void nmod_mpolyn_print_pretty(const nmod_mpolyn_t A, const char ** x_in, const nmod_mpoly_ctx_t ctx); @@ -1090,7 +1090,7 @@ void nmod_mpolyn_fit_length(nmod_mpolyn_t A, slong length, const nmod_mpoly_ctx_t ctx); void nmod_mpolyn_set_length(nmod_mpolyn_t A, slong newlen, - const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); + const nmod_mpoly_ctx_t ctx); void nmod_mpolyn_fit_bits(nmod_mpolyn_t A, slong bits, const nmod_mpoly_ctx_t ctx); @@ -1114,7 +1114,7 @@ void nmod_mpoly_cvtto_mpolyn(nmod_mpolyn_t A, const nmod_mpoly_t B, slong var, const nmod_mpoly_ctx_t ctx); NMOD_MPOLY_INLINE ulong nmod_mpolyn_leadcoeff(nmod_mpolyn_t A, - const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const nmod_mpoly_ctx_t ctx) { n_poly_struct * leadpoly; @@ -1126,7 +1126,7 @@ NMOD_MPOLY_INLINE ulong nmod_mpolyn_leadcoeff(nmod_mpolyn_t A, } NMOD_MPOLY_INLINE n_poly_struct * nmod_mpolyn_leadcoeff_poly( - nmod_mpolyn_t A, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + nmod_mpolyn_t A, const nmod_mpoly_ctx_t ctx) { FLINT_ASSERT(A->length > 0); return A->coeffs + 0; @@ -1135,7 +1135,7 @@ NMOD_MPOLY_INLINE n_poly_struct * nmod_mpolyn_leadcoeff_poly( /* mpolyun *******************************************************************/ void nmod_mpolyun_init(nmod_mpolyun_t A, flint_bitcnt_t bits, - const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); + const nmod_mpoly_ctx_t ctx); void nmod_mpolyun_clear(nmod_mpolyun_t A, const nmod_mpoly_ctx_t ctx); @@ -1159,9 +1159,9 @@ void nmod_mpolyun_shift_right(nmod_mpolyun_t A, ulong s); void nmod_mpolyun_shift_left(nmod_mpolyun_t A, ulong s); -slong nmod_mpolyn_lastdeg(nmod_mpolyn_t A, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); +slong nmod_mpolyn_lastdeg(nmod_mpolyn_t A, const nmod_mpoly_ctx_t ctx); -slong nmod_mpolyun_lastdeg(nmod_mpolyun_t A, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); +slong nmod_mpolyun_lastdeg(nmod_mpolyun_t A, const nmod_mpoly_ctx_t ctx); void nmod_mpolyun_set(nmod_mpolyun_t A, const nmod_mpolyun_t B, const nmod_mpoly_ctx_t ctx); @@ -1171,9 +1171,9 @@ void nmod_mpolyun_one(nmod_mpolyun_t A, const nmod_mpoly_ctx_t ctx); ulong nmod_mpolyun_leadcoeff_last(nmod_mpolyun_t A, const nmod_mpoly_ctx_t ctx); -void nmod_mpolyn_set_mod(nmod_mpolyn_t FLINT_UNUSED(A), const nmod_t FLINT_UNUSED(mod)); +void nmod_mpolyn_set_mod(nmod_mpolyn_t A, const nmod_t mod); -void nmod_mpolyun_set_mod(nmod_mpolyun_t FLINT_UNUSED(A), const nmod_t FLINT_UNUSED(mod)); +void nmod_mpolyun_set_mod(nmod_mpolyun_t A, const nmod_t mod); int nmod_mpolyn_is_nonzero_nmod(const nmod_mpolyn_t A, const nmod_mpoly_ctx_t ctx); @@ -1242,7 +1242,7 @@ void nmod_mpoly_to_mpolyun_perm_deflate_threaded_pool( void nmod_mpoly_to_mpolyn_perm_deflate_threaded_pool(nmod_mpolyn_t A, const nmod_mpoly_ctx_t nctx, const nmod_mpoly_t B, const nmod_mpoly_ctx_t ctx, const slong * perm, const ulong * shift, const ulong * stride, - const thread_pool_handle * FLINT_UNUSED(handles), slong FLINT_UNUSED(num_handles)); + const thread_pool_handle * handles, slong num_handles); void nmod_mpoly_from_mpolyun_perm_inflate(nmod_mpoly_t A, flint_bitcnt_t Abits, const nmod_mpoly_ctx_t ctx, const nmod_mpolyun_t B, diff --git a/src/nmod_mpoly_factor.h b/src/nmod_mpoly_factor.h index 3f8a15f781..71c8962084 100644 --- a/src/nmod_mpoly_factor.h +++ b/src/nmod_mpoly_factor.h @@ -53,7 +53,7 @@ void nmod_mat_init_nullspace_tr(nmod_mat_t X, nmod_mat_t tmp); /*****************************************************************************/ NMOD_MPOLY_FACTOR_INLINE -void nmod_mpoly_factor_init(nmod_mpoly_factor_t f, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +void nmod_mpoly_factor_init(nmod_mpoly_factor_t f, const nmod_mpoly_ctx_t ctx) { f->constant = 1; f->poly = NULL; @@ -76,14 +76,14 @@ void nmod_mpoly_factor_clear(nmod_mpoly_factor_t f, NMOD_MPOLY_FACTOR_INLINE slong nmod_mpoly_factor_length(const nmod_mpoly_factor_t f, - const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const nmod_mpoly_ctx_t ctx) { return f->num; } NMOD_MPOLY_FACTOR_INLINE ulong nmod_mpoly_factor_get_constant_ui(const nmod_mpoly_factor_t f, - const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const nmod_mpoly_ctx_t ctx) { return f->constant; } @@ -104,7 +104,7 @@ void nmod_mpoly_factor_swap_base(nmod_mpoly_t p, nmod_mpoly_factor_t f, nmod_mpoly_swap(p, f->poly + i, ctx); } -slong nmod_mpoly_factor_get_exp_si(nmod_mpoly_factor_t f, slong i, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)); +slong nmod_mpoly_factor_get_exp_si(nmod_mpoly_factor_t f, slong i, const nmod_mpoly_ctx_t ctx); void nmod_mpoly_factor_append_ui(nmod_mpoly_factor_t f, const nmod_mpoly_t A, ulong e, const nmod_mpoly_ctx_t ctx); @@ -158,7 +158,7 @@ int nmod_mpoly_factor_fix_units(nmod_mpoly_factor_t f, NMOD_MPOLY_FACTOR_INLINE void nmod_mpoly_factor_swap(nmod_mpoly_factor_t f, nmod_mpoly_factor_t g, - const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const nmod_mpoly_ctx_t ctx) { nmod_mpoly_factor_struct t = *f; *f = *g; @@ -166,7 +166,7 @@ void nmod_mpoly_factor_swap(nmod_mpoly_factor_t f, nmod_mpoly_factor_t g, } NMOD_MPOLY_FACTOR_INLINE -void nmod_mpoly_factor_one(nmod_mpoly_factor_t f, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +void nmod_mpoly_factor_one(nmod_mpoly_factor_t f, const nmod_mpoly_ctx_t ctx) { f->constant = 1; f->num = 0; @@ -222,7 +222,7 @@ typedef struct typedef nmod_mpolyv_struct nmod_mpolyv_t[1]; NMOD_MPOLY_FACTOR_INLINE -void nmod_mpolyv_init(nmod_mpolyv_t A, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) +void nmod_mpolyv_init(nmod_mpolyv_t A, const nmod_mpoly_ctx_t ctx) { A->coeffs = NULL; A->alloc = 0; @@ -231,7 +231,7 @@ void nmod_mpolyv_init(nmod_mpolyv_t A, const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) NMOD_MPOLY_FACTOR_INLINE void nmod_mpolyv_swap(nmod_mpolyv_t A, nmod_mpolyv_t B, - const nmod_mpoly_ctx_t FLINT_UNUSED(ctx)) + const nmod_mpoly_ctx_t ctx) { nmod_mpolyv_struct t = *A; *A = *B; diff --git a/src/nmod_poly.h b/src/nmod_poly.h index 0ac7070bb2..61a13483eb 100644 --- a/src/nmod_poly.h +++ b/src/nmod_poly.h @@ -314,7 +314,7 @@ void _nmod_poly_KS2_reduce(nn_ptr res, slong s, nn_srcptr op, slong n, ulong w, void _nmod_poly_KS2_recover_reduce1(nn_ptr res, slong s, nn_srcptr op1, nn_srcptr op2, slong n, ulong b, nmod_t mod); void _nmod_poly_KS2_recover_reduce2(nn_ptr res, slong s, nn_srcptr op1, nn_srcptr op2, slong n, ulong b, nmod_t mod); -void _nmod_poly_KS2_recover_reduce2b(nn_ptr res, slong s, nn_srcptr op1, nn_srcptr op2, slong n, ulong FLINT_UNUSED(b), nmod_t mod); +void _nmod_poly_KS2_recover_reduce2b(nn_ptr res, slong s, nn_srcptr op1, nn_srcptr op2, slong n, ulong b, nmod_t mod); void _nmod_poly_KS2_recover_reduce3(nn_ptr res, slong s, nn_srcptr op1, nn_srcptr op2, slong n, ulong b, nmod_t mod); void _nmod_poly_KS2_recover_reduce(nn_ptr res, slong s, nn_srcptr op1, nn_srcptr op2, slong n, ulong b, nmod_t mod); @@ -451,7 +451,7 @@ void nmod_poly_div_series_basecase(nmod_poly_t Q, const nmod_poly_t A, const nmo void _nmod_poly_div_series(nn_ptr Q, nn_srcptr A, slong Alen, nn_srcptr B, slong Blen, slong n, nmod_t mod); void nmod_poly_div_series(nmod_poly_t Q, const nmod_poly_t A, const nmod_poly_t B, slong n); -void _nmod_poly_div_newton_n_preinv(nn_ptr Q, nn_srcptr A, slong lenA, nn_srcptr FLINT_UNUSED(B), slong lenB, nn_srcptr Binv, slong lenBinv, nmod_t mod); +void _nmod_poly_div_newton_n_preinv(nn_ptr Q, nn_srcptr A, slong lenA, nn_srcptr B, slong lenB, nn_srcptr Binv, slong lenBinv, nmod_t mod); void nmod_poly_div_newton_n_preinv (nmod_poly_t Q, const nmod_poly_t A, const nmod_poly_t B, const nmod_poly_t Binv); void _nmod_poly_divrem_newton_n_preinv (nn_ptr Q, nn_ptr R, nn_srcptr A, slong lenA, nn_srcptr B, slong lenB, nn_srcptr Binv, slong lenBinv, nmod_t mod); @@ -602,7 +602,7 @@ void nmod_poly_compose_mod_brent_kung_preinv(nmod_poly_t res, void _nmod_poly_compose_mod_brent_kung_vec_preinv(nmod_poly_struct * res, - const nmod_poly_struct * polys, slong FLINT_UNUSED(lenpolys), slong l, + const nmod_poly_struct * polys, slong lenpolys, slong l, nn_srcptr g, slong glen, nn_srcptr poly, slong len, nn_srcptr polyinv, slong leninv, nmod_t mod); @@ -623,7 +623,7 @@ nmod_poly_compose_mod_brent_kung_vec_preinv_threaded_pool(nmod_poly_struct * res void _nmod_poly_compose_mod_brent_kung_vec_preinv_threaded_pool( nmod_poly_struct * res, const nmod_poly_struct * polys, - slong FLINT_UNUSED(lenpolys), slong l, + slong lenpolys, slong l, nn_srcptr g, slong glen, nn_srcptr poly, slong len, nn_srcptr polyinv, slong leninv, diff --git a/src/padic.h b/src/padic.h index 7f8db223eb..af74efb875 100644 --- a/src/padic.h +++ b/src/padic.h @@ -229,7 +229,7 @@ slong _padic_log_bound(slong v, slong N, const fmpz_t p); void _padic_log(fmpz_t z, const fmpz_t y, slong v, const fmpz_t p, slong N); void _padic_log_rectangular(fmpz_t z, const fmpz_t y, slong v, const fmpz_t p, slong N); void _padic_log_satoh(fmpz_t z, const fmpz_t y, slong v, const fmpz_t p, slong N); -void _padic_log_balanced(fmpz_t z, const fmpz_t y, slong FLINT_UNUSED(v), const fmpz_t p, slong N); +void _padic_log_balanced(fmpz_t z, const fmpz_t y, slong v, const fmpz_t p, slong N); int padic_log(padic_t rop, const padic_t op, const padic_ctx_t ctx); int padic_log_rectangular(padic_t rop, const padic_t op, const padic_ctx_t ctx); diff --git a/src/padic_mat.h b/src/padic_mat.h index ce8e134072..f60b90fa35 100644 --- a/src/padic_mat.h +++ b/src/padic_mat.h @@ -177,7 +177,7 @@ void padic_mat_neg(padic_mat_t B, const padic_mat_t A, const padic_ctx_t ctx); void _padic_mat_scalar_mul_padic(padic_mat_t B, const padic_mat_t A, const padic_t c, - const padic_ctx_t FLINT_UNUSED(ctx)); + const padic_ctx_t ctx); void padic_mat_scalar_mul_padic(padic_mat_t B, const padic_mat_t A, const padic_t c, const padic_ctx_t ctx); diff --git a/src/padic_poly.h b/src/padic_poly.h index d552845444..723dbfa67f 100644 --- a/src/padic_poly.h +++ b/src/padic_poly.h @@ -218,8 +218,8 @@ PADIC_POLY_INLINE int padic_poly_is_one(const padic_poly_t poly) /* Addition and subtraction ************************************************/ void _padic_poly_add(fmpz *rop, slong *rval, slong N, - const fmpz *op1, slong val1, slong len1, slong FLINT_UNUSED(N1), - const fmpz *op2, slong val2, slong len2, slong FLINT_UNUSED(N2), + const fmpz *op1, slong val1, slong len1, slong N1, + const fmpz *op2, slong val2, slong len2, slong N2, const padic_ctx_t ctx); void padic_poly_add(padic_poly_t f, @@ -227,8 +227,8 @@ void padic_poly_add(padic_poly_t f, const padic_ctx_t ctx); void _padic_poly_sub(fmpz *rop, slong *rval, slong N, - const fmpz *op1, slong val1, slong len1, slong FLINT_UNUSED(N1), - const fmpz *op2, slong val2, slong len2, slong FLINT_UNUSED(N2), + const fmpz *op1, slong val1, slong len1, slong N1, + const fmpz *op2, slong val2, slong len2, slong N2, const padic_ctx_t ctx); void padic_poly_sub(padic_poly_t f, diff --git a/src/thread_pool.h b/src/thread_pool.h index b536ff86ef..762f41ba80 100644 --- a/src/thread_pool.h +++ b/src/thread_pool.h @@ -87,7 +87,7 @@ void thread_pool_clear(thread_pool_t T); void _thread_pool_distribute_work_2(slong start, slong stop, slong * Astart, slong * Astop, slong Alen, - slong * Bstart, slong * Bstop, slong FLINT_UNUSED(Blen)); + slong * Bstart, slong * Bstop, slong Blen); ulong _thread_pool_find_work_2(ulong a, ulong alpha, ulong b, ulong beta, ulong yn, ulong yd); diff --git a/src/ulong_extras.h b/src/ulong_extras.h index 86cf7453c0..0779509d45 100644 --- a/src/ulong_extras.h +++ b/src/ulong_extras.h @@ -400,7 +400,7 @@ void n_nth_prime_bounds(ulong *lo, ulong *hi, ulong n); ulong n_prime_pi(ulong n); void n_prime_pi_bounds(ulong *lo, ulong *hi, ulong n); -ulong n_nextprime(ulong n, int FLINT_UNUSED(proved)); +ulong n_nextprime(ulong n, int proved); /* Factorisation *************************************************************/ From cb23003ee27f8bf4228e0808c5e9633dd4915ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sat, 5 Oct 2024 18:57:59 +0200 Subject: [PATCH 004/114] Remove unused macros in flint.h --- src/flint.h.in | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/flint.h.in b/src/flint.h.in index a574fc8a26..dc579dc98b 100644 --- a/src/flint.h.in +++ b/src/flint.h.in @@ -120,12 +120,6 @@ typedef const ulong * nn_srcptr; # define FLINT_WARN_UNUSED __attribute__((warn_unused_result)) # define FLINT_UNLIKELY(x) __builtin_expect((x),0) # define FLINT_LIKELY(x) __builtin_expect((x),1) -# define FLINT_PUSH_OPTIONS _Pragma("GCC push_options") -# define FLINT_POP_OPTIONS _Pragma("GCC pop_options") -# define FLINT_OPTIMIZE_NESTED_3(part) _Pragma(#part) -# define FLINT_OPTIMIZE_NESTED_2(part) FLINT_OPTIMIZE_NESTED_3(GCC optimize part) -# define FLINT_OPTIMIZE_NESTED_1(part) FLINT_OPTIMIZE_NESTED_2(#part) -# define FLINT_OPTIMIZE(x) FLINT_OPTIMIZE_NESTED_1(x) # define FLINT_CONSTANT_P __builtin_constant_p # define FLINT_UNREACHABLE __builtin_unreachable() # define FLINT_RETURNS_NONNULL __attribute__((returns_nonnull)) @@ -147,9 +141,6 @@ typedef const ulong * nn_srcptr; # define FLINT_CONST # define FLINT_UNLIKELY(x) (x) # define FLINT_LIKELY(x) (x) -# define FLINT_PUSH_OPTIONS -# define FLINT_POP_OPTIONS -# define FLINT_OPTIMIZE(x) # define FLINT_CONSTANT_P(x) 0 # define FLINT_RETURNS_NONNULL # define FLINT_MALLOC From b79f50442c2e8f0d9d07ac698aa693b597bd3804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sat, 5 Oct 2024 19:16:06 +0200 Subject: [PATCH 005/114] Introduce FLINT header start and end macro --- src/flint.h.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/flint.h.in b/src/flint.h.in index dc579dc98b..2610c3d472 100644 --- a/src/flint.h.in +++ b/src/flint.h.in @@ -125,6 +125,8 @@ typedef const ulong * nn_srcptr; # define FLINT_RETURNS_NONNULL __attribute__((returns_nonnull)) # define FLINT_MALLOC __attribute__((malloc)) # define FLINT_DEPRECATED __attribute__((deprecated)) +# define FLINT_HEADER_START _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") +# define FLINT_HEADER_END _Pragma("GCC diagnostic pop") #else # define __attribute__(x) # if defined(_MSC_VER) @@ -145,6 +147,8 @@ typedef const ulong * nn_srcptr; # define FLINT_RETURNS_NONNULL # define FLINT_MALLOC # define FLINT_DEPRECATED +# define FLINT_HEADER_START +# define FLINT_HEADER_END #endif #if defined(__cplusplus) From 1840d9b7f09c0e744cdbac11c4ce8ac2ca624054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 06:49:18 +0200 Subject: [PATCH 006/114] Move FLINT_TLS_PREFIX to start of declaration --- src/arb_calc.h | 2 +- src/arb_calc/verbose.c | 2 +- src/arf.h | 8 ++++---- src/bernoulli.h | 4 ++-- src/ulong_extras.h | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/arb_calc.h b/src/arb_calc.h index 69fdf1c7b4..d854e22b75 100644 --- a/src/arb_calc.h +++ b/src/arb_calc.h @@ -18,7 +18,7 @@ extern "C" { #endif -extern FLINT_TLS_PREFIX int arb_calc_verbose; +FLINT_TLS_PREFIX extern int arb_calc_verbose; typedef int (*arb_calc_func_t)(arb_ptr out, const arb_t inp, void * param, slong order, slong prec); diff --git a/src/arb_calc/verbose.c b/src/arb_calc/verbose.c index 91588651df..39139ec96d 100644 --- a/src/arb_calc/verbose.c +++ b/src/arb_calc/verbose.c @@ -11,4 +11,4 @@ #include "arb_calc.h" -int FLINT_TLS_PREFIX arb_calc_verbose = 0; +FLINT_TLS_PREFIX int arb_calc_verbose = 0; diff --git a/src/arf.h b/src/arf.h index d44df5b9f4..93abd358bf 100644 --- a/src/arf.h +++ b/src/arf.h @@ -730,8 +730,8 @@ void arf_urandom(arf_t x, flint_rand_t state, slong bits, arf_rnd_t rnd); #define ARF_MUL_STACK_ALLOC 40 #define ARF_MUL_TLS_ALLOC 1000 -extern FLINT_TLS_PREFIX nn_ptr __arf_mul_tmp; -extern FLINT_TLS_PREFIX slong __arf_mul_alloc; +FLINT_TLS_PREFIX extern nn_ptr __arf_mul_tmp; +FLINT_TLS_PREFIX extern slong __arf_mul_alloc; extern void _arf_mul_tmp_cleanup(void); @@ -826,8 +826,8 @@ arf_mul_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, slong prec, arf_rnd_t rnd) #define ARF_ADD_STACK_ALLOC 40 #define ARF_ADD_TLS_ALLOC 1000 -extern FLINT_TLS_PREFIX nn_ptr __arf_add_tmp; -extern FLINT_TLS_PREFIX slong __arf_add_alloc; +FLINT_TLS_PREFIX extern nn_ptr __arf_add_tmp; +FLINT_TLS_PREFIX extern slong __arf_add_alloc; extern void _arf_add_tmp_cleanup(void); diff --git a/src/bernoulli.h b/src/bernoulli.h index 6a4448b223..744d4d1951 100644 --- a/src/bernoulli.h +++ b/src/bernoulli.h @@ -20,9 +20,9 @@ extern "C" { #endif -extern slong FLINT_TLS_PREFIX bernoulli_cache_num; +FLINT_TLS_PREFIX extern slong bernoulli_cache_num; -extern FLINT_TLS_PREFIX fmpq * bernoulli_cache; +FLINT_TLS_PREFIX extern fmpq * bernoulli_cache; void bernoulli_cache_compute(slong n); diff --git a/src/ulong_extras.h b/src/ulong_extras.h index 0779509d45..c6a3a69254 100644 --- a/src/ulong_extras.h +++ b/src/ulong_extras.h @@ -359,9 +359,9 @@ ulong n_euler_phi(ulong n); FLINT_DLL extern const unsigned int flint_primes_small[]; -extern FLINT_TLS_PREFIX ulong * _flint_primes[FLINT_BITS]; -extern FLINT_TLS_PREFIX double * _flint_prime_inverses[FLINT_BITS]; -extern FLINT_TLS_PREFIX slong _flint_primes_used; +FLINT_TLS_PREFIX extern ulong * _flint_primes[FLINT_BITS]; +FLINT_TLS_PREFIX extern double * _flint_prime_inverses[FLINT_BITS]; +FLINT_TLS_PREFIX extern slong _flint_primes_used; void n_primes_init(n_primes_t iter); void n_primes_clear(n_primes_t iter); From e3a2262179eeb6613b024ba2b62096f9bd40f04b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Wed, 9 Oct 2024 01:47:11 +0200 Subject: [PATCH 007/114] Set TESTCFLAGS for sanity check Removes -Wsign-compare, -Wmissing-prototypes and -Wmissing-declarations. --- configure.ac | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7290f67ab0..b90a4fe483 100644 --- a/configure.ac +++ b/configure.ac @@ -244,6 +244,9 @@ esac if test "$enableval" = "yes" && test "$cflags_set" = "yes"; then AC_MSG_ERROR([Cannot enable sanity check and push other CFLAGS at the same time.]) +elif test "$enableval" = "yes" && test "$testcflags_set" = "yes"; +then + AC_MSG_ERROR([Cannot enable sanity check and push other TESTCFLAGS at the same time.]) fi], enable_sanity_check="no") @@ -251,6 +254,9 @@ enable_sanity_check="no") # remove -Wcast-function-type for GR. sanity_check_CFLAGS="-Werror -Wall -Wextra -Wno-cast-function-type -Wcast-align -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -pedantic -std=c11 -O0" +# We take CFLAGS but ignore -Wsign-compare, -Wmissing-declarations and -Wmissing-prototypes. +sanity_check_TESTCFLAGS="-Werror -Wall -Wextra -Wno-cast-function-type -Wno-sign-compare -Wcast-align -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -pedantic -std=c11 -O0" + AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],[Compile FLINT with debug information [default=yes]])], [case $enableval in @@ -1266,6 +1272,7 @@ then else AX_CHECK_COMPILE_FLAG([$flag], [save_CFLAGS="$flag $save_CFLAGS" + sanity_check_TESTCFLAGS="$flag $sanity_check_TESTCFLAGS" found_single="yes"], [unset flint_cv_have_fft_small_x86_i unset flint_cv_have_fft_small_arm_i]) @@ -1322,7 +1329,12 @@ fi if test "$testcflags_set" = "no"; then - TESTCFLAGS="$CFLAGS" + if test "$enable_sanity_check" = "no"; + then + TESTCFLAGS="$CFLAGS" + else + TESTCFLAGS="$sanity_check_TESTCFLAGS" + fi else TESTCFLAGS="$TESTCFLAGS $save_CFLAGS" fi From bb4f76c28ce0d618123f077b036d04bdaa3a9106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 21:08:52 +0200 Subject: [PATCH 008/114] Use --enable-sanity-check in CI --- .github/workflows/CI.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 74261d0bd4..8026829f21 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -93,18 +93,15 @@ jobs: ############################################################################## - # gcc build check no regressions + # gcc sanity check ############################################################################## - gcc-build-regression-check: - name: GCC build regression check (no tests) + gcc-sanity-check: + name: GCC sanity check runs-on: ubuntu-24.04 env: CC: "gcc" - CFLAGS: "-march=native -std=c11 -Wall -Wextra -Werror" - MODULES: "build/thread_pool_merged.lo build/thread_support_merged.lo build/ulong_extras_merged.lo build/long_extras_merged.lo build/perm_merged.lo build/double_extras_merged.lo build/d_vec_merged.lo build/d_mat_merged.lo build/mpn_extras_merged.lo build/mpfr_vec_merged.lo build/mpfr_mat_merged.lo build/nmod_merged.lo build/nmod_vec_merged.lo build/nmod_mat_merged.lo build/nmod_poly_merged.lo build/mpn_mod_merged.lo build/fmpz_merged.lo build/fmpz_vec_merged.lo build/fmpz_mat_merged.lo build/fmpz_poly_merged.lo build/fmpz_mod_merged.lo build/fmpz_mod_vec_merged.lo build/fmpz_mod_mat_merged.lo build/fmpz_mod_poly_merged.lo build/fmpq_merged.lo build/fmpq_vec_merged.lo build/fmpq_mat_merged.lo build/fmpq_poly_merged.lo build/fq_merged.lo build/fq_vec_merged.lo build/fq_mat_merged.lo build/fq_poly_merged.lo build/fq_nmod_merged.lo build/fq_nmod_vec_merged.lo build/fq_nmod_mat_merged.lo build/fq_nmod_poly_merged.lo build/fq_zech_merged.lo build/fq_zech_mat_merged.lo build/fq_zech_poly_merged.lo build/fq_default_merged.lo build/fq_default_mat_merged.lo build/fq_default_poly_merged.lo build/fq_embed_merged.lo build/fq_nmod_embed_merged.lo build/fq_zech_embed_merged.lo build/padic_merged.lo build/padic_mat_merged.lo build/padic_poly_merged.lo build/qadic_merged.lo build/nmod_poly_factor_merged.lo build/fmpz_factor_merged.lo build/fmpz_poly_factor_merged.lo build/fmpz_mod_poly_factor_merged.lo build/fq_poly_factor_merged.lo build/fq_nmod_poly_factor_merged.lo build/fq_zech_poly_factor_merged.lo build/fq_default_poly_factor_merged.lo build/nmod_poly_mat_merged.lo build/fmpz_poly_mat_merged.lo build/mpoly_merged.lo build/nmod_mpoly_merged.lo build/fmpz_mpoly_merged.lo build/fmpz_mod_mpoly_merged.lo build/fmpq_mpoly_merged.lo build/fq_nmod_mpoly_merged.lo build/fq_zech_mpoly_merged.lo build/nmod_mpoly_factor_merged.lo build/fmpz_mpoly_factor_merged.lo build/fmpz_mod_mpoly_factor_merged.lo build/fmpq_mpoly_factor_merged.lo build/fq_nmod_mpoly_factor_merged.lo build/fq_zech_mpoly_factor_merged.lo build/fft_merged.lo build/fft_small_merged.lo" - # Everything until fmpz_poly_q steps: - uses: actions/checkout@v4 @@ -123,12 +120,15 @@ jobs: ./bootstrap.sh ./configure \ CC=${CC} \ - CFLAGS="${CFLAGS}" \ - --disable-debug + --enable-sanity-check - - name: "Check regression in a subset of modules" + - name: "Build with sanity" run: | - $MAKE $MODULES + $MAKE + + - name: "Build tests with sanity" + run: | + $MAKE From 7b213b3b825fcb19f38218663874da071ad6d864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 09:23:21 +0200 Subject: [PATCH 009/114] Fix symbol for arb_mat_entrywise_is_zero --- src/arb_mat/entrywise_is_zero.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arb_mat/entrywise_is_zero.c b/src/arb_mat/entrywise_is_zero.c index 44e4e2a7b8..5b7edfb586 100644 --- a/src/arb_mat/entrywise_is_zero.c +++ b/src/arb_mat/entrywise_is_zero.c @@ -14,7 +14,7 @@ #include "arb_mat.h" void -_arb_mat_entrywise_is_zero(fmpz_mat_t dest, const arb_mat_t src) +arb_mat_entrywise_is_zero(fmpz_mat_t dest, const arb_mat_t src) { slong i, j; fmpz_mat_zero(dest); From 8cee53475128f51407ccf24b6cf15fd369dae41f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Fri, 4 Oct 2024 23:31:00 +0200 Subject: [PATCH 010/114] generic_files --- src/generic_files/io.c | 2 +- src/generic_files/memory_manager.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/generic_files/io.c b/src/generic_files/io.c index 6a18333536..e36d24cab3 100644 --- a/src/generic_files/io.c +++ b/src/generic_files/io.c @@ -97,7 +97,7 @@ static int __acb_is_pm1(const void * ip) static int __ulong_is_zero(const void * ip) { - return *((ulong *) ip) == 0; + return *((const ulong *) ip) == 0; } /* is_neg */ diff --git a/src/generic_files/memory_manager.c b/src/generic_files/memory_manager.c index 6ee4b70432..f44bf0b500 100644 --- a/src/generic_files/memory_manager.c +++ b/src/generic_files/memory_manager.c @@ -369,7 +369,7 @@ void flint_register_cleanup_function(flint_cleanup_function_t cleanup_function) void _fmpz_cleanup(void); -void _flint_cleanup(void) +static void _flint_cleanup(void) { size_t i; From d868a7810609073f194a8fdbab5dc605a0a0a759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Fri, 4 Oct 2024 23:34:39 +0200 Subject: [PATCH 011/114] thread_support --- src/thread_support/get_num_available_threads.c | 3 ++- src/thread_support/test/t-parallel_binary_splitting.c | 4 ++-- src/thread_support/thread_support.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/thread_support/get_num_available_threads.c b/src/thread_support/get_num_available_threads.c index e1f6b00e8c..a37ebdba09 100644 --- a/src/thread_support/get_num_available_threads.c +++ b/src/thread_support/get_num_available_threads.c @@ -10,8 +10,9 @@ */ #include "thread_pool.h" +#include "thread_support.h" -slong flint_thread_pool_num_available(thread_pool_t T) +static slong flint_thread_pool_num_available(thread_pool_t T) { slong i, num = 0; thread_pool_entry_struct * D; diff --git a/src/thread_support/test/t-parallel_binary_splitting.c b/src/thread_support/test/t-parallel_binary_splitting.c index 55f9c60b3e..cc0369db9a 100644 --- a/src/thread_support/test/t-parallel_binary_splitting.c +++ b/src/thread_support/test/t-parallel_binary_splitting.c @@ -27,13 +27,13 @@ typedef struct product_args_t; static void -product_init(product_res_t * x, product_args_t * args) +product_init(product_res_t * x, product_args_t * FLINT_UNUSED(args)) { fmpz_init(&x->r); } static void -product_clear(product_res_t * x, product_args_t * args) +product_clear(product_res_t * x, product_args_t * FLINT_UNUSED(args)) { fmpz_clear(&x->r); } diff --git a/src/thread_support/thread_support.c b/src/thread_support/thread_support.c index c50f0879b5..d200ca596b 100644 --- a/src/thread_support/thread_support.c +++ b/src/thread_support/thread_support.c @@ -160,7 +160,7 @@ void flint_parallel_do(do_func_t f, void * args, slong n, int thread_limit, int } else { - slong i, num_threads, num_workers; + slong num_threads, num_workers; thread_pool_handle * handles; num_workers = flint_request_threads(&handles, thread_limit); From 850bc571431fa84412de04cfeb6b1e2dc5e8c426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Fri, 4 Oct 2024 23:47:35 +0200 Subject: [PATCH 012/114] ulong_extras --- src/ulong_extras.h | 17 ++++++++--------- src/ulong_extras/discrete_log_bsgs.c | 2 +- src/ulong_extras/factor_SQUFOF.c | 2 +- src/ulong_extras/factor_partial.c | 2 +- src/ulong_extras/factor_pollard_brent.c | 2 +- src/ulong_extras/factor_pp1.c | 14 +++++++------- src/ulong_extras/is_probabprime.c | 8 ++++---- src/ulong_extras/test/t-cbrtrem.c | 5 +++-- src/ulong_extras/test/t-sqrtmod_primepow.c | 9 +++++---- src/ulong_extras/test/t-sqrtmodn.c | 7 ++++--- 10 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/ulong_extras.h b/src/ulong_extras.h index c6a3a69254..4462bdf7f1 100644 --- a/src/ulong_extras.h +++ b/src/ulong_extras.h @@ -31,14 +31,11 @@ extern "C" { /* Randomisation *************************************************************/ -ulong n_randlimb(flint_rand_t state); ulong n_urandint(flint_rand_t state, ulong limit); ulong n_randbits(flint_rand_t state, unsigned int bits); ulong n_randprime(flint_rand_t state, ulong bits, int proved); ulong n_randtest_bits(flint_rand_t state, int bits); -ulong n_randtest(flint_rand_t state); -ulong n_randtest_not_zero(flint_rand_t state); ulong n_randtest_prime(flint_rand_t state, int proved); /* Basic arithmetic **********************************************************/ @@ -78,14 +75,16 @@ ulong n_flog(ulong n, ulong b); ulong n_clog(ulong n, ulong b); ulong n_clog_2exp(ulong n, ulong b); -#ifdef _MSC_VER -# define DECLSPEC_IMPORT __declspec(dllimport) -#else -# define DECLSPEC_IMPORT -#endif +#ifndef __GMP_H__ +# ifdef _MSC_VER +# define DECLSPEC_IMPORT __declspec(dllimport) +# else +# define DECLSPEC_IMPORT +# endif DECLSPEC_IMPORT ulong __gmpn_gcd_11(ulong, ulong); DECLSPEC_IMPORT ulong __gmpn_gcd_1(nn_srcptr, long int, ulong); -#undef DECLSPEC_IMPORT +# undef DECLSPEC_IMPORT +#endif ULONG_EXTRAS_INLINE ulong n_gcd(ulong x, ulong y) diff --git a/src/ulong_extras/discrete_log_bsgs.c b/src/ulong_extras/discrete_log_bsgs.c index 5d8f178ed0..7ff44138e9 100644 --- a/src/ulong_extras/discrete_log_bsgs.c +++ b/src/ulong_extras/discrete_log_bsgs.c @@ -64,7 +64,7 @@ bsgs_table_clear(bsgs_t t) flint_free(t->table); } -ulong +static ulong n_discrete_log_bsgs_table(const bsgs_t t, ulong b) { ulong i; diff --git a/src/ulong_extras/factor_SQUFOF.c b/src/ulong_extras/factor_SQUFOF.c index c847f5ab0b..ee929f3c68 100644 --- a/src/ulong_extras/factor_SQUFOF.c +++ b/src/ulong_extras/factor_SQUFOF.c @@ -14,7 +14,7 @@ #define r_shift(in, c) (((c) == FLINT_BITS) ? WORD(0) : ((in) >> (c))) -ulong _ll_factor_SQUFOF(ulong n_hi, ulong n_lo, ulong max_iters) +static ulong _ll_factor_SQUFOF(ulong n_hi, ulong n_lo, ulong max_iters) { ulong n[2]; ulong sqrt[2]; diff --git a/src/ulong_extras/factor_partial.c b/src/ulong_extras/factor_partial.c index fef4b0faa4..da2517b22c 100644 --- a/src/ulong_extras/factor_partial.c +++ b/src/ulong_extras/factor_partial.c @@ -11,7 +11,7 @@ #include "ulong_extras.h" -int is_prime2(ulong n, int proved) +static int is_prime2(ulong n, int proved) { if (proved) return n_is_prime(n); else return n_is_probabprime(n); diff --git a/src/ulong_extras/factor_pollard_brent.c b/src/ulong_extras/factor_pollard_brent.c index 5f2a787dc7..5ed2fdb94b 100644 --- a/src/ulong_extras/factor_pollard_brent.c +++ b/src/ulong_extras/factor_pollard_brent.c @@ -11,7 +11,7 @@ #include "ulong_extras.h" -ulong +static ulong n_sqr_and_add_a(ulong y, ulong a, ulong n, ulong ninv, ulong normbits) { diff --git a/src/ulong_extras/factor_pp1.c b/src/ulong_extras/factor_pp1.c index 776cfda5cc..e0ee05b54b 100644 --- a/src/ulong_extras/factor_pp1.c +++ b/src/ulong_extras/factor_pp1.c @@ -50,23 +50,23 @@ void n_pp1_print(ulong x, ulong y, ulong norm) #define n_pp1_2k(x, y, n, ninv, x0, norm) \ do { \ - const ulong two = (UWORD(2) << norm); \ + const ulong xxtwo = (UWORD(2) << norm); \ y = n_mulmod_preinv(y, x, n, ninv, norm); \ y = n_submod(y, x0, n); \ x = n_mulmod_preinv(x, x, n, ninv, norm); \ - x = n_submod(x, two, n); \ + x = n_submod(x, xxtwo, n); \ } while (0) #define n_pp1_2kp1(x, y, n, ninv, x0, norm) \ do { \ - const ulong two = (UWORD(2) << norm); \ + const ulong xxtwo = (UWORD(2) << norm); \ x = n_mulmod_preinv(x, y, n, ninv, norm); \ x = n_submod(x, x0, n); \ y = n_mulmod_preinv(y, y, n, ninv, norm); \ - y = n_submod(y, two, n); \ + y = n_submod(y, xxtwo, n); \ } while (0) -void n_pp1_pow_ui(ulong * x, ulong * y, ulong exp, +static void n_pp1_pow_ui(ulong * x, ulong * y, ulong exp, ulong n, ulong ninv, ulong norm) { const ulong x0 = *x; @@ -87,7 +87,7 @@ void n_pp1_pow_ui(ulong * x, ulong * y, ulong exp, } } -ulong n_pp1_factor(ulong n, ulong x, ulong norm) +static ulong n_pp1_factor(ulong n, ulong x, ulong norm) { if (norm) { @@ -102,7 +102,7 @@ ulong n_pp1_factor(ulong n, ulong x, ulong norm) return n_gcd(n, x); } -ulong n_pp1_find_power(ulong * x, ulong * y, +static ulong n_pp1_find_power(ulong * x, ulong * y, ulong p, ulong n, ulong ninv, ulong norm) { ulong factor; diff --git a/src/ulong_extras/is_probabprime.c b/src/ulong_extras/is_probabprime.c index bd4e7f9b61..0406dda11b 100644 --- a/src/ulong_extras/is_probabprime.c +++ b/src/ulong_extras/is_probabprime.c @@ -161,7 +161,7 @@ n_is_probabprime_fermat(ulong n, ulong i) return n_powmod2_ui_preinv(i, n - 1, n, n_preinvert_limb(n)) == UWORD(1); } -n_pair_t +static n_pair_t fchain_precomp(ulong m, ulong n, double npre) { n_pair_t current = {0, 0}, old; @@ -200,7 +200,7 @@ fchain_precomp(ulong m, ulong n, double npre) return current; } -n_pair_t +static n_pair_t fchain2_preinv(ulong m, ulong n, ulong ninv) { n_pair_t current = {0, 0}, old; @@ -273,7 +273,7 @@ n_is_probabprime_fibonacci(ulong n) } } -n_pair_t +static n_pair_t lchain_precomp(ulong m, ulong a, ulong n, double npre) { n_pair_t current = {0, 0}, old; @@ -310,7 +310,7 @@ lchain_precomp(ulong m, ulong a, ulong n, double npre) return current; } -n_pair_t +static n_pair_t lchain2_preinv(ulong m, ulong a, ulong n, ulong ninv) { n_pair_t current = {0, 0}, old; diff --git a/src/ulong_extras/test/t-cbrtrem.c b/src/ulong_extras/test/t-cbrtrem.c index dd1c726acd..a352f596c5 100644 --- a/src/ulong_extras/test/t-cbrtrem.c +++ b/src/ulong_extras/test/t-cbrtrem.c @@ -15,9 +15,10 @@ TEST_FUNCTION_START(n_cbrtrem, state) { - int i, result; + slong ix; + int result; - for (i = 0; i < 10000 * flint_test_multiplier(); i++) + for (ix = 0; ix < 10000 * flint_test_multiplier(); ix++) { ulong a, b, c, i, j; mpz_t e, f, g; diff --git a/src/ulong_extras/test/t-sqrtmod_primepow.c b/src/ulong_extras/test/t-sqrtmod_primepow.c index 5536657cc4..f9b1564b40 100644 --- a/src/ulong_extras/test/t-sqrtmod_primepow.c +++ b/src/ulong_extras/test/t-sqrtmod_primepow.c @@ -14,9 +14,10 @@ TEST_FUNCTION_START(n_sqrtmod_primepow, state) { - int i, result; + slong ix; + int result; - for (i = 0; i < 1000 * flint_test_multiplier(); i++) /* Test random squares mod a power of 2 */ + for (ix = 0; ix < 1000 * flint_test_multiplier(); ix++) /* Test random squares mod a power of 2 */ { ulong a, b, p, pow, pow2, pinv; slong exp, num, i; @@ -67,7 +68,7 @@ TEST_FUNCTION_START(n_sqrtmod_primepow, state) flint_free(sqrt); } - for (i = 0; i < 1000 * flint_test_multiplier(); i++) /* Test random squares mod other prime powers */ + for (ix = 0; ix < 1000 * flint_test_multiplier(); ix++) /* Test random squares mod other prime powers */ { ulong a, b, p, pow, pow2, pinv; slong exp, maxexp, num, i; @@ -123,7 +124,7 @@ TEST_FUNCTION_START(n_sqrtmod_primepow, state) flint_free(sqrt); } - for (i = 0; i < 500 * flint_test_multiplier(); i++) /* Test random nonsquares */ + for (ix = 0; ix < 500 * flint_test_multiplier(); ix++) /* Test random nonsquares */ { ulong a, b, p, pow, pinv; slong exp, maxexp; diff --git a/src/ulong_extras/test/t-sqrtmodn.c b/src/ulong_extras/test/t-sqrtmodn.c index c79d3507d4..0426613d7e 100644 --- a/src/ulong_extras/test/t-sqrtmodn.c +++ b/src/ulong_extras/test/t-sqrtmodn.c @@ -14,9 +14,10 @@ TEST_FUNCTION_START(n_sqrtmodn, state) { - int i, result; + slong ix; + int result; - for (i = 0; i < 1000 * flint_test_multiplier(); i++) /* Test random squares mod n */ + for (ix = 0; ix < 1000 * flint_test_multiplier(); ix++) /* Test random squares mod n */ { ulong a, b, n, ninv; slong num, i; @@ -60,7 +61,7 @@ TEST_FUNCTION_START(n_sqrtmodn, state) flint_free(sqrt); } - for (i = 0; i < 500 * flint_test_multiplier(); i++) /* test random nonsquares */ + for (ix = 0; ix < 500 * flint_test_multiplier(); ix++) /* test random nonsquares */ { ulong a, b, n, ninv; flint_bitcnt_t bits; From e4412c44219fbe3a0e33fa41fcb2c09f0eac3cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sat, 5 Oct 2024 20:21:14 +0200 Subject: [PATCH 013/114] nfloat --- src/gr_mat.h | 4 ++++ src/gr_vec.h | 4 ++++ src/nfloat.h | 4 ++++ src/nfloat/complex.c | 3 +-- src/nfloat/ctx.c | 1 + src/nfloat/dot.c | 10 +++++----- src/nfloat/mat_mul.c | 14 +++++++------- src/nfloat/nfixed.c | 10 +++++----- src/nfloat/nfloat.c | 32 ++++++++++++++++---------------- src/nfloat/test/t-nfixed_dot.c | 8 -------- 10 files changed, 47 insertions(+), 43 deletions(-) diff --git a/src/gr_mat.h b/src/gr_mat.h index 8a3d83c29c..74f77c459f 100644 --- a/src/gr_mat.h +++ b/src/gr_mat.h @@ -25,6 +25,8 @@ extern "C" { #endif +FLINT_HEADER_START + #define GR_MAT_ENTRY(mat,i,j,sz) GR_ENTRY((mat)->rows[i], j, sz) #define gr_mat_nrows(mat, ctx) ((mat)->r) #define gr_mat_ncols(mat, ctx) ((mat)->c) @@ -305,6 +307,8 @@ void gr_mat_test_nonsingular_solve_triu(gr_method_mat_binary_op_with_flag solve_ void gr_mat_test_approx_mul_max_norm(gr_method_mat_binary_op mul_impl, gr_srcptr rel_tol, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx); void gr_mat_test_approx_mul_pos_entrywise_accurate(gr_method_mat_binary_op mul_impl, gr_srcptr rel_tol, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/gr_vec.h b/src/gr_vec.h index 83c84b9e54..3d0565eb52 100644 --- a/src/gr_vec.h +++ b/src/gr_vec.h @@ -24,6 +24,8 @@ extern "C" { #endif +FLINT_HEADER_START + void gr_vec_init(gr_vec_t vec, slong len, gr_ctx_t ctx); void gr_vec_clear(gr_vec_t vec, gr_ctx_t ctx); @@ -200,6 +202,8 @@ WARN_UNUSED_RESULT int _gr_vec_product_generic(gr_ptr res, gr_srcptr vec, slong WARN_UNUSED_RESULT int _gr_vec_step(gr_ptr vec, gr_srcptr start, gr_srcptr step, slong len, gr_ctx_t ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/nfloat.h b/src/nfloat.h index d73c32bbc4..0a3d042cbb 100644 --- a/src/nfloat.h +++ b/src/nfloat.h @@ -25,6 +25,8 @@ extern "C" { #endif +FLINT_HEADER_START + /* The upper limit is so that temporary buffers are safe to allocate on the stack and so that simple operations like swapping are not too expensive compared to a pointer-and-size representation. */ @@ -595,6 +597,8 @@ void _nfixed_mat_mul_waksman(nn_ptr C, nn_srcptr A, nn_srcptr B, slong m, slong void _nfixed_mat_mul_strassen(nn_ptr C, nn_srcptr A, nn_srcptr B, slong m, slong n, slong p, slong cutoff, slong nlimbs); void _nfixed_mat_mul(nn_ptr C, nn_srcptr A, nn_srcptr B, slong m, slong n, slong p, slong nlimbs); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/nfloat/complex.c b/src/nfloat/complex.c index f925ed178e..7bd4a00767 100644 --- a/src/nfloat/complex.c +++ b/src/nfloat/complex.c @@ -163,7 +163,6 @@ nfloat_complex_set_other(nfloat_complex_ptr res, gr_srcptr x, gr_ctx_t x_ctx, gr default: { - int status; acf_t t; gr_ctx_t acf_ctx; @@ -1642,7 +1641,7 @@ _nfloat_complex_vec_init(nfloat_complex_ptr res, slong len, gr_ctx_t ctx) } void -_nfloat_complex_vec_clear(nfloat_complex_ptr res, slong len, gr_ctx_t ctx) +_nfloat_complex_vec_clear(nfloat_complex_ptr FLINT_UNUSED(res), slong FLINT_UNUSED(len), gr_ctx_t FLINT_UNUSED(ctx)) { return; } diff --git a/src/nfloat/ctx.c b/src/nfloat/ctx.c index c73f1a1a1e..7122b86c64 100644 --- a/src/nfloat/ctx.c +++ b/src/nfloat/ctx.c @@ -12,6 +12,7 @@ #include "nfloat.h" #include "gr.h" #include "gr_mat.h" +#include "gr_generic.h" int _nfloat_methods_initialized = 0; diff --git a/src/nfloat/dot.c b/src/nfloat/dot.c index db25936c7b..f8aa397da2 100644 --- a/src/nfloat/dot.c +++ b/src/nfloat/dot.c @@ -35,7 +35,7 @@ (r1) = __r1; (r2) = __r2; (r3) = __r3; \ } while (0) -void +static void _nfloat_vec_dot_set_initial(ulong * s, slong sexp, nfloat_srcptr x, int subtract, slong nlimbs) { slong xexp, delta; @@ -72,7 +72,7 @@ _nfloat_vec_dot_set_initial(ulong * s, slong sexp, nfloat_srcptr x, int subtract } /* n is the number of limbs of s and x */ -void +static void _nfloat_vec_dot_add_limbs(ulong * s, slong sexp, mp_srcptr x, slong xexp, int subtract, slong n) { slong delta, delta_limbs, delta_bits; @@ -123,7 +123,7 @@ _nfloat_vec_dot_add_limbs(ulong * s, slong sexp, mp_srcptr x, slong xexp, int su #include -void +static void _nfloat_vec_dot_addmul(ulong * s, slong sexp, nfloat_srcptr xi, nfloat_srcptr yi, int subtract, slong nlimbs) { slong xexp, delta; @@ -207,7 +207,7 @@ _nfloat_vec_dot_addmul(ulong * s, slong sexp, nfloat_srcptr xi, nfloat_srcptr yi } } -int +static int __nfloat_vec_dot(nfloat_ptr res, nfloat_srcptr initial, int subtract, nfloat_srcptr x, slong sizeof_xstep, nfloat_srcptr y, slong sizeof_ystep, slong len, gr_ctx_t ctx) { if (NFLOAT_CTX_NLIMBS(ctx) == 1 && !(NFLOAT_CTX_FLAGS(ctx) & (NFLOAT_ALLOW_INF | NFLOAT_ALLOW_NAN))) @@ -768,7 +768,7 @@ _flint_mpn_signed_add_n(nn_ptr res, nn_srcptr x, int xsgnbit, nn_srcptr y, int y return xsgnbit; } -int +static int __nfloat_complex_vec_dot(nfloat_complex_ptr res, nfloat_complex_srcptr initial, int subtract, nfloat_complex_srcptr x, slong xstep, nfloat_complex_srcptr y, slong ystep, slong len, gr_ctx_t ctx) { slong i, pad_bits; diff --git a/src/nfloat/mat_mul.c b/src/nfloat/mat_mul.c index 6643015a91..6574d930b2 100644 --- a/src/nfloat/mat_mul.c +++ b/src/nfloat/mat_mul.c @@ -429,7 +429,7 @@ _nfloat_mat_exp_range(slong * _Amin, slong * _Amax, const gr_mat_t A, gr_ctx_t c _Amax[0] = Amax; } -int +static int _nfloat_mat_mul_fixed_given_exp(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, slong Aexp, slong Bexp, slong fnlimbs, gr_ctx_t ctx) { nn_ptr T, TA, TB, TC; @@ -558,7 +558,7 @@ _nfloat_2exp_get_fmpz(fmpz_t res, nfloat_srcptr x, slong fixexp, gr_ctx_t ctx) _fmpz_demote_val(res); } -int +static int nfloat_mat_addmul_block_fallback(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, slong block_start, @@ -601,7 +601,7 @@ nfloat_mat_addmul_block_fallback(gr_mat_t C, return status; } -int +static int nfloat_mat_addmul_block_prescaled(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, slong block_start, @@ -718,7 +718,7 @@ _nfloat_nbits(nfloat_srcptr x, slong nlimbs) return bits; } -int +static int nfloat_complex_mat_addmul_block_fallback(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, slong block_start, @@ -768,7 +768,7 @@ _nfloat_complex_2exp_get_fmpz_fmpz(fmpz_t res1, fmpz_t res2, nfloat_complex_srcp _nfloat_2exp_get_fmpz(res2, NFLOAT_COMPLEX_IM(x, ctx), fixexp, ctx); } -int +static int nfloat_complex_mat_addmul_block_prescaled(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, slong block_start, @@ -1288,7 +1288,7 @@ _nfloat_complex_mat_exp_range(slong * _Amin, slong * _Amax, const gr_mat_t A, gr _Amax[0] = Amax; } -int +static int _nfloat_complex_mat_mul_fixed_given_exp(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, slong Aexp, slong Bexp, slong fnlimbs, gr_ctx_t ctx) { nn_ptr T, Aa, Ab, Ba, Bb, AaBa, AbBb, Cb; @@ -1543,7 +1543,7 @@ _set_imag_part(gr_mat_t res, const gr_mat_t A, gr_ctx_t ctx) flint_mpn_copyi(((nn_ptr) res->rows[i]) + (j * 2 + 1) * ndlimbs, ((nn_srcptr) A->rows[i]) + j * ndlimbs, ndlimbs); } -int +static int _nfloat_complex_mat_mul_reorder(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, int Areal, int Breal, gr_ctx_t ctx) { gr_mat_t X, Y, Z, W; diff --git a/src/nfloat/nfixed.c b/src/nfloat/nfixed.c index 2c8eaef16e..a0ef09123f 100644 --- a/src/nfloat/nfixed.c +++ b/src/nfloat/nfixed.c @@ -38,7 +38,7 @@ static int nfixed_mat_mul_use_waksman(slong n, slong nlimbs) return (n >= 2); } -static slong nfixed_mat_mul_strassen_cutoff(slong n, int parity, slong nlimbs) +static slong nfixed_mat_mul_strassen_cutoff(slong FLINT_UNUSED(n), int parity, slong nlimbs) { if (nlimbs <= 3) return parity ? 57 : 50; @@ -840,7 +840,7 @@ addmul_addadd_8(nn_ptr val0, nn_ptr val1, nn_ptr val2, nn_ptr c, nn_srcptr a1, n #endif -void +static void _nfixed_mat_mul_waksman2(nn_ptr C, nn_srcptr A, nn_srcptr B, slong m, slong n, slong p, slong nlimbs, slong Cstride, slong Astride, slong Bstride) { slong l, j, k; @@ -990,7 +990,7 @@ _nfixed_mat_init(_nfixed_mat_t A, slong r, slong c, slong nlimbs) } static void -_nfixed_mat_clear(_nfixed_mat_t A, slong nlimbs) +_nfixed_mat_clear(_nfixed_mat_t A, slong FLINT_UNUSED(nlimbs)) { flint_free(A->start); } @@ -1005,7 +1005,7 @@ _nfixed_mat_window_init(_nfixed_mat_t A, const _nfixed_mat_t mat, slong r1, slon } static void -_nfixed_mat_window_clear(_nfixed_mat_t A, slong nlimbs) +_nfixed_mat_window_clear(_nfixed_mat_t FLINT_UNUSED(A), slong FLINT_UNUSED(nlimbs)) { } @@ -1081,7 +1081,7 @@ _nfixed_mat_sub(_nfixed_mat_t C, const _nfixed_mat_t A, const _nfixed_mat_t B, s _nfixed_vec_sub(Cptr + i * Cstride, Aptr + i * Astride, Bptr + i * Bstride, c, nlimbs); } -void +static void _nfixed_mat_mul_waksman3(_nfixed_mat_t C, const _nfixed_mat_t A, const _nfixed_mat_t B, slong nlimbs) { nn_srcptr Aptr, Bptr; diff --git a/src/nfloat/nfloat.c b/src/nfloat/nfloat.c index 4a47995326..dd28c66471 100644 --- a/src/nfloat/nfloat.c +++ b/src/nfloat/nfloat.c @@ -76,7 +76,7 @@ _nfloat_vec_init(nfloat_ptr res, slong len, gr_ctx_t ctx) } void -_nfloat_vec_clear(nfloat_ptr res, slong len, gr_ctx_t ctx) +_nfloat_vec_clear(nfloat_ptr FLINT_UNUSED(res), slong FLINT_UNUSED(len), gr_ctx_t FLINT_UNUSED(ctx)) { } @@ -204,7 +204,7 @@ nfloat_nan(nfloat_ptr res, gr_ctx_t ctx) } int -_nfloat_underflow(nfloat_ptr res, int sgnbit, gr_ctx_t ctx) +_nfloat_underflow(nfloat_ptr res, int FLINT_UNUSED(sgnbit), gr_ctx_t ctx) { if (!(NFLOAT_CTX_FLAGS(ctx) & NFLOAT_ALLOW_UNDERFLOW)) return GR_UNABLE; @@ -639,7 +639,7 @@ nfloat_sgn(nfloat_ptr res, nfloat_srcptr x, gr_ctx_t ctx) } int -nfloat_im(nfloat_ptr res, nfloat_srcptr x, gr_ctx_t ctx) +nfloat_im(nfloat_ptr res, nfloat_srcptr FLINT_UNUSED(x), gr_ctx_t ctx) { return nfloat_zero(res, ctx); } @@ -1743,7 +1743,7 @@ nfloat_sub(nfloat_ptr res, nfloat_srcptr x, nfloat_srcptr y, gr_ctx_t ctx) } } -int +static int _nfloat_vec_aors_1(nfloat_ptr res, nfloat_srcptr x, nfloat_srcptr y, int subtract, slong len, gr_ctx_t ctx) { slong i, stride; @@ -1802,7 +1802,7 @@ _nfloat_vec_aors_1(nfloat_ptr res, nfloat_srcptr x, nfloat_srcptr y, int subtrac return status; } -int +static int _nfloat_vec_aors_2(nfloat_ptr res, nfloat_srcptr x, nfloat_srcptr y, int subtract, slong len, gr_ctx_t ctx) { slong i, stride; @@ -1861,7 +1861,7 @@ _nfloat_vec_aors_2(nfloat_ptr res, nfloat_srcptr x, nfloat_srcptr y, int subtrac return status; } -int +static int _nfloat_vec_aors_3(nfloat_ptr res, nfloat_srcptr x, nfloat_srcptr y, int subtract, slong len, gr_ctx_t ctx) { slong i, stride; @@ -1920,7 +1920,7 @@ _nfloat_vec_aors_3(nfloat_ptr res, nfloat_srcptr x, nfloat_srcptr y, int subtrac return status; } -int +static int _nfloat_vec_aors_4(nfloat_ptr res, nfloat_srcptr x, nfloat_srcptr y, int subtract, slong len, gr_ctx_t ctx) { slong i, stride; @@ -2186,7 +2186,7 @@ nfloat_sqr(nfloat_ptr res, nfloat_srcptr x, gr_ctx_t ctx) return GR_SUCCESS; } -int +static int _nfloat_vec_mul_1(nfloat_ptr res, nfloat_srcptr x, nfloat_srcptr y, slong len, gr_ctx_t ctx) { slong i, stride; @@ -2282,7 +2282,7 @@ _nfloat_vec_mul_1(nfloat_ptr res, nfloat_srcptr x, nfloat_srcptr y, slong len, g return status; } -int +static int _nfloat_vec_mul_2(nfloat_ptr res, nfloat_srcptr x, nfloat_srcptr y, slong len, gr_ctx_t ctx) { slong i, stride; @@ -2427,7 +2427,7 @@ _nfloat_vec_mul(nfloat_ptr res, nfloat_srcptr x, nfloat_srcptr y, slong len, gr_ return status; } -int +static int _nfloat_vec_mul_scalar_1(nfloat_ptr res, nfloat_srcptr x, slong len, nfloat_srcptr y, gr_ctx_t ctx) { slong i, stride; @@ -2487,7 +2487,7 @@ _nfloat_vec_mul_scalar_1(nfloat_ptr res, nfloat_srcptr x, slong len, nfloat_srcp return status; } -int +static int _nfloat_vec_mul_scalar_2(nfloat_ptr res, nfloat_srcptr x, slong len, nfloat_srcptr y, gr_ctx_t ctx) { slong i, stride; @@ -2624,7 +2624,7 @@ nfloat_submul(nfloat_ptr res, nfloat_srcptr x, nfloat_srcptr y, gr_ctx_t ctx) } /* No infs or nans allowed by context; y != 0 */ -int +static int _nfloat_vec_aorsmul_scalar_1(nfloat_ptr res, nfloat_srcptr x, slong len, nfloat_srcptr y, int subtract, gr_ctx_t ctx) { slong yexp, rexp, texp; @@ -2692,7 +2692,7 @@ _nfloat_vec_aorsmul_scalar_1(nfloat_ptr res, nfloat_srcptr x, slong len, nfloat_ } /* No infs or nans allowed by context; y != 0 */ -int +static int _nfloat_vec_aorsmul_scalar_2(nfloat_ptr res, nfloat_srcptr x, slong len, nfloat_srcptr y, int subtract, gr_ctx_t ctx) { slong yexp, rexp, texp; @@ -2764,7 +2764,7 @@ _nfloat_vec_aorsmul_scalar_2(nfloat_ptr res, nfloat_srcptr x, slong len, nfloat_ } /* No infs or nans allowed by context; y != 0 */ -int +static int _nfloat_vec_aorsmul_scalar_3(nfloat_ptr res, nfloat_srcptr x, slong len, nfloat_srcptr y, int subtract, gr_ctx_t ctx) { slong yexp, rexp, texp; @@ -2819,7 +2819,7 @@ _nfloat_vec_aorsmul_scalar_3(nfloat_ptr res, nfloat_srcptr x, slong len, nfloat_ return status; } -int +static int _nfloat_vec_aorsmul_scalar_4(nfloat_ptr res, nfloat_srcptr x, slong len, nfloat_srcptr y, int subtract, gr_ctx_t ctx) { slong yexp, rexp, texp; @@ -2874,7 +2874,7 @@ _nfloat_vec_aorsmul_scalar_4(nfloat_ptr res, nfloat_srcptr x, slong len, nfloat_ return status; } -int +static int _nfloat_vec_aorsmul_scalar_n(nfloat_ptr res, nfloat_srcptr x, slong len, nfloat_srcptr y, int subtract, slong nlimbs, gr_ctx_t ctx) { slong yexp, rexp, texp; diff --git a/src/nfloat/test/t-nfixed_dot.c b/src/nfloat/test/t-nfixed_dot.c index 9e29a0c86b..6cd5940227 100644 --- a/src/nfloat/test/t-nfixed_dot.c +++ b/src/nfloat/test/t-nfixed_dot.c @@ -66,14 +66,6 @@ void nfixed_mul(nn_ptr res, nn_srcptr a, nn_srcptr b, slong nlimbs) flint_mpn_mulhigh_n(res + 1, a + 1, b + 1, nlimbs); } -void _nfixed_dot_2(nn_ptr res, nn_srcptr x, slong xstride, nn_srcptr y, slong ystride, slong len); -void _nfixed_dot_3(nn_ptr res, nn_srcptr x, slong xstride, nn_srcptr y, slong ystride, slong len); -void _nfixed_dot_4(nn_ptr res, nn_srcptr x, slong xstride, nn_srcptr y, slong ystride, slong len); -void _nfixed_dot_5(nn_ptr res, nn_srcptr x, slong xstride, nn_srcptr y, slong ystride, slong len); -void _nfixed_dot_6(nn_ptr res, nn_srcptr x, slong xstride, nn_srcptr y, slong ystride, slong len); -void _nfixed_dot_7(nn_ptr res, nn_srcptr x, slong xstride, nn_srcptr y, slong ystride, slong len); -void _nfixed_dot_8(nn_ptr res, nn_srcptr x, slong xstride, nn_srcptr y, slong ystride, slong len); - TEST_FUNCTION_START(nfixed_dot, state) { slong iter, len, i, nlimbs; From 93c38ce6b9fa3c8812e9860f242b97c927cb3996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sat, 5 Oct 2024 20:25:19 +0200 Subject: [PATCH 014/114] mpn_extras --- src/fft_small.h | 2 - src/mpn_extras/factor_trial_tree.c | 5 +- src/mpn_extras/mul_basecase.c | 86 +++++++++++++++--------------- src/mpn_extras/sqr_basecase.c | 8 +-- 4 files changed, 49 insertions(+), 52 deletions(-) diff --git a/src/fft_small.h b/src/fft_small.h index 58c1036308..f9a94aa2ae 100644 --- a/src/fft_small.h +++ b/src/fft_small.h @@ -120,8 +120,6 @@ FLINT_FORCE_INLINE slong z_min(slong a, slong b) {return FLINT_MIN(a, b);} FLINT_FORCE_INLINE slong z_max(slong a, slong b) {return FLINT_MAX(a, b);} -int fft_small_mulmod_satisfies_bounds(ulong n); - /* The twiddle factors are split across SD_FFT_CTX_W2TAB_SIZE tables: diff --git a/src/mpn_extras/factor_trial_tree.c b/src/mpn_extras/factor_trial_tree.c index c2a4876f20..dfce0371f5 100644 --- a/src/mpn_extras/factor_trial_tree.c +++ b/src/mpn_extras/factor_trial_tree.c @@ -31,7 +31,7 @@ void _tree_mutex_init(void) } #endif -void _cleanup_trial_tree(void) +static void _cleanup_trial_tree(void) { slong i; @@ -41,8 +41,7 @@ void _cleanup_trial_tree(void) _factor_trial_tree_initialised = 0; } -void -_factor_trial_tree_init(void) +static void _factor_trial_tree_init(void) { slong i, j, k, m, n; const mp_limb_t * primes; diff --git a/src/mpn_extras/mul_basecase.c b/src/mpn_extras/mul_basecase.c index 016069e3cc..9f9791894a 100644 --- a/src/mpn_extras/mul_basecase.c +++ b/src/mpn_extras/mul_basecase.c @@ -187,47 +187,47 @@ static mp_limb_t _flint_mpn_mul_n_14(mp_ptr res, mp_srcptr u, mp_srcptr v, mp_si return res[n + 13]; } -mp_limb_t flint_mpn_mul_9_9(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_9(res, u, v, 9); } -mp_limb_t flint_mpn_mul_10_9(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_9(res, u, v, 10); } -mp_limb_t flint_mpn_mul_11_9(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_9(res, u, v, 11); } -mp_limb_t flint_mpn_mul_12_9(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_9(res, u, v, 12); } -mp_limb_t flint_mpn_mul_13_9(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_9(res, u, v, 13); } -mp_limb_t flint_mpn_mul_14_9(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_9(res, u, v, 14); } -mp_limb_t flint_mpn_mul_15_9(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_9(res, u, v, 15); } -mp_limb_t flint_mpn_mul_16_9(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_9(res, u, v, 16); } - -mp_limb_t flint_mpn_mul_10_10(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_10(res, u, v, 10); } -mp_limb_t flint_mpn_mul_11_10(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_10(res, u, v, 11); } -mp_limb_t flint_mpn_mul_12_10(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_10(res, u, v, 12); } -mp_limb_t flint_mpn_mul_13_10(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_10(res, u, v, 13); } -mp_limb_t flint_mpn_mul_14_10(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_10(res, u, v, 14); } -mp_limb_t flint_mpn_mul_15_10(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_10(res, u, v, 15); } -mp_limb_t flint_mpn_mul_16_10(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_10(res, u, v, 16); } - -mp_limb_t flint_mpn_mul_11_11(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_11(res, u, v, 11); } -mp_limb_t flint_mpn_mul_12_11(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_11(res, u, v, 12); } -mp_limb_t flint_mpn_mul_13_11(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_11(res, u, v, 13); } -mp_limb_t flint_mpn_mul_14_11(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_11(res, u, v, 14); } -mp_limb_t flint_mpn_mul_15_11(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_11(res, u, v, 15); } -mp_limb_t flint_mpn_mul_16_11(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_11(res, u, v, 16); } - -mp_limb_t flint_mpn_mul_12_12(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_12(res, u, v, 12); } -mp_limb_t flint_mpn_mul_13_12(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_12(res, u, v, 13); } -mp_limb_t flint_mpn_mul_14_12(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_12(res, u, v, 14); } -mp_limb_t flint_mpn_mul_15_12(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_12(res, u, v, 15); } -mp_limb_t flint_mpn_mul_16_12(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_12(res, u, v, 16); } - -mp_limb_t flint_mpn_mul_13_13(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_13(res, u, v, 13); } -mp_limb_t flint_mpn_mul_14_13(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_13(res, u, v, 14); } -mp_limb_t flint_mpn_mul_15_13(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_13(res, u, v, 15); } -mp_limb_t flint_mpn_mul_16_13(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_13(res, u, v, 16); } - -mp_limb_t flint_mpn_mul_14_14(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_14(res, u, v, 14); } -mp_limb_t flint_mpn_mul_15_14(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_14(res, u, v, 15); } -mp_limb_t flint_mpn_mul_16_14(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_14(res, u, v, 16); } - - -mp_limb_t flint_mpn_mul_15_15(mp_ptr res, mp_srcptr u, mp_srcptr v) +static mp_limb_t flint_mpn_mul_9_9(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_9(res, u, v, 9); } +static mp_limb_t flint_mpn_mul_10_9(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_9(res, u, v, 10); } +static mp_limb_t flint_mpn_mul_11_9(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_9(res, u, v, 11); } +static mp_limb_t flint_mpn_mul_12_9(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_9(res, u, v, 12); } +static mp_limb_t flint_mpn_mul_13_9(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_9(res, u, v, 13); } +static mp_limb_t flint_mpn_mul_14_9(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_9(res, u, v, 14); } +static mp_limb_t flint_mpn_mul_15_9(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_9(res, u, v, 15); } +static mp_limb_t flint_mpn_mul_16_9(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_9(res, u, v, 16); } + +static mp_limb_t flint_mpn_mul_10_10(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_10(res, u, v, 10); } +static mp_limb_t flint_mpn_mul_11_10(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_10(res, u, v, 11); } +static mp_limb_t flint_mpn_mul_12_10(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_10(res, u, v, 12); } +static mp_limb_t flint_mpn_mul_13_10(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_10(res, u, v, 13); } +static mp_limb_t flint_mpn_mul_14_10(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_10(res, u, v, 14); } +static mp_limb_t flint_mpn_mul_15_10(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_10(res, u, v, 15); } +static mp_limb_t flint_mpn_mul_16_10(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_10(res, u, v, 16); } + +static mp_limb_t flint_mpn_mul_11_11(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_11(res, u, v, 11); } +static mp_limb_t flint_mpn_mul_12_11(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_11(res, u, v, 12); } +static mp_limb_t flint_mpn_mul_13_11(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_11(res, u, v, 13); } +static mp_limb_t flint_mpn_mul_14_11(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_11(res, u, v, 14); } +static mp_limb_t flint_mpn_mul_15_11(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_11(res, u, v, 15); } +static mp_limb_t flint_mpn_mul_16_11(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_11(res, u, v, 16); } + +static mp_limb_t flint_mpn_mul_12_12(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_12(res, u, v, 12); } +static mp_limb_t flint_mpn_mul_13_12(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_12(res, u, v, 13); } +static mp_limb_t flint_mpn_mul_14_12(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_12(res, u, v, 14); } +static mp_limb_t flint_mpn_mul_15_12(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_12(res, u, v, 15); } +static mp_limb_t flint_mpn_mul_16_12(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_12(res, u, v, 16); } + +static mp_limb_t flint_mpn_mul_13_13(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_13(res, u, v, 13); } +static mp_limb_t flint_mpn_mul_14_13(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_13(res, u, v, 14); } +static mp_limb_t flint_mpn_mul_15_13(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_13(res, u, v, 15); } +static mp_limb_t flint_mpn_mul_16_13(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_13(res, u, v, 16); } + +static mp_limb_t flint_mpn_mul_14_14(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_14(res, u, v, 14); } +static mp_limb_t flint_mpn_mul_15_14(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_14(res, u, v, 15); } +static mp_limb_t flint_mpn_mul_16_14(mp_ptr res, mp_srcptr u, mp_srcptr v) { return _flint_mpn_mul_n_14(res, u, v, 16); } + + +static mp_limb_t flint_mpn_mul_15_15(mp_ptr res, mp_srcptr u, mp_srcptr v) { #if 1 mp_limb_t tmp[22], cy; @@ -242,7 +242,7 @@ mp_limb_t flint_mpn_mul_15_15(mp_ptr res, mp_srcptr u, mp_srcptr v) return res[29]; } -mp_limb_t flint_mpn_mul_16_15(mp_ptr res, mp_srcptr u, mp_srcptr v) +static mp_limb_t flint_mpn_mul_16_15(mp_ptr res, mp_srcptr u, mp_srcptr v) { #if 0 mp_limb_t tmp[23], cy; @@ -257,7 +257,7 @@ mp_limb_t flint_mpn_mul_16_15(mp_ptr res, mp_srcptr u, mp_srcptr v) return res[30]; } -mp_limb_t flint_mpn_mul_16_16(mp_ptr res, mp_srcptr u, mp_srcptr v) +static mp_limb_t flint_mpn_mul_16_16(mp_ptr res, mp_srcptr u, mp_srcptr v) { #if 0 mp_limb_t tmp[24], cy; diff --git a/src/mpn_extras/sqr_basecase.c b/src/mpn_extras/sqr_basecase.c index 5feab800a4..ba672863a0 100644 --- a/src/mpn_extras/sqr_basecase.c +++ b/src/mpn_extras/sqr_basecase.c @@ -32,7 +32,7 @@ mp_limb_t flint_mpn_mul_7_6(mp_ptr, mp_srcptr, mp_srcptr); mp_limb_t flint_mpn_mul_7_7(mp_ptr, mp_srcptr, mp_srcptr); mp_limb_t flint_mpn_mul_8_7(mp_ptr, mp_srcptr, mp_srcptr); -mp_limb_t flint_mpn_sqr_11(mp_ptr res, mp_srcptr x) +static mp_limb_t flint_mpn_sqr_11(mp_ptr res, mp_srcptr x) { mp_limb_t t[14]; flint_mpn_sqr_7(res, x); @@ -45,7 +45,7 @@ mp_limb_t flint_mpn_sqr_11(mp_ptr res, mp_srcptr x) return res[21]; } -mp_limb_t flint_mpn_sqr_12(mp_ptr res, mp_srcptr x) +static mp_limb_t flint_mpn_sqr_12(mp_ptr res, mp_srcptr x) { mp_limb_t t[12]; mp_limb_t cy; @@ -57,7 +57,7 @@ mp_limb_t flint_mpn_sqr_12(mp_ptr res, mp_srcptr x) return res[23]; } -mp_limb_t flint_mpn_sqr_13(mp_ptr res, mp_srcptr x) +static mp_limb_t flint_mpn_sqr_13(mp_ptr res, mp_srcptr x) { mp_limb_t t[13]; mp_limb_t cy; @@ -69,7 +69,7 @@ mp_limb_t flint_mpn_sqr_13(mp_ptr res, mp_srcptr x) return res[25]; } -mp_limb_t flint_mpn_sqr_14(mp_ptr res, mp_srcptr x) +static mp_limb_t flint_mpn_sqr_14(mp_ptr res, mp_srcptr x) { mp_limb_t t[14]; mp_limb_t cy; From 1bc100e4b72e3937df51bbdea87088eb160c9962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sat, 5 Oct 2024 20:33:11 +0200 Subject: [PATCH 015/114] nmod_vec --- src/nmod_vec/scalar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nmod_vec/scalar.c b/src/nmod_vec/scalar.c index 05068fefcb..e750878e9d 100644 --- a/src/nmod_vec/scalar.c +++ b/src/nmod_vec/scalar.c @@ -15,7 +15,7 @@ #include "flint-mparam.h" #include "nmod_vec.h" -void _nmod_vec_scalar_addmul_nmod_fullword(nn_ptr res, nn_srcptr vec, +static void _nmod_vec_scalar_addmul_nmod_fullword(nn_ptr res, nn_srcptr vec, slong len, ulong c, nmod_t mod) { slong i; @@ -70,7 +70,7 @@ void _nmod_vec_scalar_addmul_nmod(nn_ptr res, nn_srcptr vec, _nmod_vec_scalar_addmul_nmod_generic(res, vec, len, c, mod); } -void _nmod_vec_scalar_mul_nmod_fullword(nn_ptr res, nn_srcptr vec, +static void _nmod_vec_scalar_mul_nmod_fullword(nn_ptr res, nn_srcptr vec, slong len, ulong c, nmod_t mod) { slong i; From 3df7efa273ef99979a542d936c86e8bfeabc0b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sat, 5 Oct 2024 20:45:01 +0200 Subject: [PATCH 016/114] nmod_mat --- src/nmod_mat/lu_classical_delayed.c | 6 +++--- src/nmod_mat/mul_blas.c | 3 +-- src/nmod_mat/mul_classical_threaded.c | 6 +++--- src/nmod_mat/scalar.c | 8 ++++---- src/nmod_mat/test/t-rref.c | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/nmod_mat/lu_classical_delayed.c b/src/nmod_mat/lu_classical_delayed.c index 356a8305a4..9f67690f90 100644 --- a/src/nmod_mat/lu_classical_delayed.c +++ b/src/nmod_mat/lu_classical_delayed.c @@ -21,7 +21,7 @@ nmod_set_uiuiui(ulong s2, ulong s1, ulong s0, nmod_t mod) return s0; } -slong +static slong nmod_mat_lu_classical_delayed_1(slong * P, nmod_mat_t A, int rank_check) { ulong d, e, f, **a; @@ -121,7 +121,7 @@ nmod_mat_lu_classical_delayed_1(slong * P, nmod_mat_t A, int rank_check) return rank; } -slong +static slong nmod_mat_lu_classical_delayed_2(slong * P, nmod_mat_t A, int rank_check) { ulong d, e, f, **a; @@ -291,7 +291,7 @@ nmod_mat_lu_classical_delayed_2(slong * P, nmod_mat_t A, int rank_check) return rank; } -slong +static slong nmod_mat_lu_classical_delayed_3(slong * P, nmod_mat_t A, int rank_check) { ulong d, e, f, **a; diff --git a/src/nmod_mat/mul_blas.c b/src/nmod_mat/mul_blas.c index b55ae896b7..53d79ab7f5 100644 --- a/src/nmod_mat/mul_blas.c +++ b/src/nmod_mat/mul_blas.c @@ -9,7 +9,7 @@ (at your option) any later version. See . */ -#include "nmod_types.h" +#include "nmod_mat.h" #if FLINT_USES_BLAS && FLINT_BITS == 64 @@ -18,7 +18,6 @@ #include "thread_pool.h" #include "thread_support.h" #include "nmod.h" -#include "nmod_mat.h" #include "fmpz.h" /* diff --git a/src/nmod_mat/mul_classical_threaded.c b/src/nmod_mat/mul_classical_threaded.c index 4bd76b7adc..ce86729bdf 100644 --- a/src/nmod_mat/mul_classical_threaded.c +++ b/src/nmod_mat/mul_classical_threaded.c @@ -67,7 +67,7 @@ typedef struct int op; } nmod_mat_transpose_arg_t; -void +static void _nmod_mat_addmul_transpose_worker(void * arg_ptr) { nmod_mat_transpose_arg_t arg = *((nmod_mat_transpose_arg_t *) arg_ptr); @@ -225,7 +225,7 @@ typedef struct int op; } nmod_mat_packed_arg_t; -void +static void _nmod_mat_addmul_packed_worker(void * arg_ptr) { nmod_mat_packed_arg_t arg = *((nmod_mat_packed_arg_t *) arg_ptr); @@ -443,7 +443,7 @@ _nmod_mat_mul_classical_threaded_pool_op(nmod_mat_t D, const nmod_mat_t C, } } -void +static void _nmod_mat_mul_classical_threaded_op(nmod_mat_t D, const nmod_mat_t C, const nmod_mat_t A, const nmod_mat_t B, int op) { diff --git a/src/nmod_mat/scalar.c b/src/nmod_mat/scalar.c index b5848bb3b3..0148e1e63f 100644 --- a/src/nmod_mat/scalar.c +++ b/src/nmod_mat/scalar.c @@ -22,7 +22,7 @@ /* scalar_addmul */ /*******************/ -void +static void _nmod_mat_scalar_addmul_ui_generic(nmod_mat_t C, const nmod_mat_t A, const nmod_mat_t B, const ulong c) { @@ -38,7 +38,7 @@ _nmod_mat_scalar_addmul_ui_generic(nmod_mat_t C, const nmod_mat_t A, } } -void +static void _nmod_mat_scalar_addmul_ui_precomp(nmod_mat_t C, const nmod_mat_t A, const nmod_mat_t B, const ulong c, const ulong c_pr) { @@ -78,7 +78,7 @@ nmod_mat_scalar_addmul_ui(nmod_mat_t C, const nmod_mat_t A, const nmod_mat_t B, /* scalar_mul */ /****************/ -void +static void _nmod_mat_scalar_mul_generic(nmod_mat_t B, const nmod_mat_t A, ulong c) { for (slong i = 0; i < A->r; i++) @@ -86,7 +86,7 @@ _nmod_mat_scalar_mul_generic(nmod_mat_t B, const nmod_mat_t A, ulong c) nmod_mat_entry(B, i, j) = nmod_mul(nmod_mat_entry(A, i, j), c, A->mod); } -void +static void _nmod_mat_scalar_mul_precomp(nmod_mat_t B, const nmod_mat_t A, ulong c, ulong c_pr) { for (slong i = 0; i < A->r; i++) diff --git a/src/nmod_mat/test/t-rref.c b/src/nmod_mat/test/t-rref.c index ca4de2ed27..99ea989b1b 100644 --- a/src/nmod_mat/test/t-rref.c +++ b/src/nmod_mat/test/t-rref.c @@ -14,7 +14,7 @@ #include "nmod.h" #include "nmod_mat.h" -int check_rref_form(slong * perm, nmod_mat_t A, slong rank) +static int check_rref_form(slong * FLINT_UNUSED(perm), nmod_mat_t A, slong rank) { slong i, j, k, prev_pivot; From 9ad0dfb8425c4898e93814f31cb9bc58fe0c9d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sat, 5 Oct 2024 20:50:23 +0200 Subject: [PATCH 017/114] nmod_poly --- src/nmod_poly/div_series.c | 6 ++++++ src/nmod_poly/divrem_basecase.c | 10 +++++----- src/nmod_poly/evaluate_mat.c | 2 +- src/nmod_poly/inv_series.c | 6 ++++++ src/nmod_poly/mul_classical.c | 2 +- src/nmod_poly/mullow_classical.c | 2 +- src/nmod_poly/powers_mod.c | 2 +- src/nmod_poly/rem.c | 2 +- 8 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/nmod_poly/div_series.c b/src/nmod_poly/div_series.c index 8d3e844e28..c108bf7fbd 100644 --- a/src/nmod_poly/div_series.c +++ b/src/nmod_poly/div_series.c @@ -15,6 +15,12 @@ #include "nmod_poly.h" #include "gr_poly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void _nmod_poly_div_series_basecase_preinv1(nn_ptr Qinv, nn_srcptr P, slong Plen, nn_srcptr Q, slong Qlen, slong n, ulong q, nmod_t mod) diff --git a/src/nmod_poly/divrem_basecase.c b/src/nmod_poly/divrem_basecase.c index 1789d33099..5d5526dafe 100644 --- a/src/nmod_poly/divrem_basecase.c +++ b/src/nmod_poly/divrem_basecase.c @@ -31,7 +31,7 @@ slong NMOD_DIVREM_BC_ITCH(slong lenA, slong lenB, nmod_t mod) } -void _nmod_poly_divrem_q0_preinv1(nn_ptr Q, nn_ptr R, +static void _nmod_poly_divrem_q0_preinv1(nn_ptr Q, nn_ptr R, nn_srcptr A, nn_srcptr B, slong lenA, ulong invL, nmod_t mod) { if (lenA == 1) @@ -54,7 +54,7 @@ void _nmod_poly_divrem_q0_preinv1(nn_ptr Q, nn_ptr R, } } -void _nmod_poly_divrem_q1_preinv1(nn_ptr Q, nn_ptr R, +static void _nmod_poly_divrem_q1_preinv1(nn_ptr Q, nn_ptr R, nn_srcptr A, slong lenA, nn_srcptr B, slong lenB, ulong invL, nmod_t mod) { @@ -118,7 +118,7 @@ void _nmod_poly_divrem_q1_preinv1(nn_ptr Q, nn_ptr R, } } -void +static void _nmod_poly_divrem_basecase_preinv1_1(nn_ptr Q, nn_ptr R, nn_ptr W, nn_srcptr A, slong lenA, nn_srcptr B, slong lenB, ulong invL, @@ -152,7 +152,7 @@ _nmod_poly_divrem_basecase_preinv1_1(nn_ptr Q, nn_ptr R, nn_ptr W, _nmod_vec_reduce(R, R1, lenB - 1, mod); } -void +static void _nmod_poly_divrem_basecase_preinv1_2(nn_ptr Q, nn_ptr R, nn_ptr W, nn_srcptr A, slong lenA, nn_srcptr B, slong lenB, ulong invL, @@ -202,7 +202,7 @@ _nmod_poly_divrem_basecase_preinv1_2(nn_ptr Q, nn_ptr R, nn_ptr W, R[iR] = n_ll_mod_preinv(R2[2*iR+1], R2[2*iR], mod.n, mod.ninv); } -void +static void _nmod_poly_divrem_basecase_preinv1_3(nn_ptr Q, nn_ptr R, nn_ptr W, nn_srcptr A, slong lenA, nn_srcptr B, slong lenB, ulong invL, diff --git a/src/nmod_poly/evaluate_mat.c b/src/nmod_poly/evaluate_mat.c index 1b93acee74..fa013381b3 100644 --- a/src/nmod_poly/evaluate_mat.c +++ b/src/nmod_poly/evaluate_mat.c @@ -39,7 +39,7 @@ nmod_mat_one_addmul(nmod_mat_t dest, const nmod_mat_t mat, ulong c) } } -void +static void _nmod_poly_evaluate_mat_horner(nmod_mat_t dest, nn_srcptr poly, slong len, const nmod_mat_t c) { slong m = len-1; diff --git a/src/nmod_poly/inv_series.c b/src/nmod_poly/inv_series.c index 365835dc10..1d7d8e37ef 100644 --- a/src/nmod_poly/inv_series.c +++ b/src/nmod_poly/inv_series.c @@ -16,6 +16,12 @@ #include "nmod_poly.h" #include "gr_poly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void _nmod_poly_inv_series_basecase_preinv1(nn_ptr Qinv, nn_srcptr Q, slong Qlen, slong n, ulong q, nmod_t mod) { diff --git a/src/nmod_poly/mul_classical.c b/src/nmod_poly/mul_classical.c index 13ba36430e..6e0d968421 100644 --- a/src/nmod_poly/mul_classical.c +++ b/src/nmod_poly/mul_classical.c @@ -61,7 +61,7 @@ _nmod_poly_mul_classical(nn_ptr res, nn_srcptr poly1, { for (i = 0; i < len1; i++) { - ulong c = poly1[i]; + c = poly1[i]; for (j = 0; j < len2; j++) res[i + j] += c * poly2[j]; diff --git a/src/nmod_poly/mullow_classical.c b/src/nmod_poly/mullow_classical.c index fa24979ac9..92a62aefda 100644 --- a/src/nmod_poly/mullow_classical.c +++ b/src/nmod_poly/mullow_classical.c @@ -69,7 +69,7 @@ _nmod_poly_mullow_classical(nn_ptr res, nn_srcptr poly1, slong len1, { for (i = 0; i < len1; i++) { - ulong c = poly1[i]; + c = poly1[i]; for (j = 0; j < FLINT_MIN(len2, n - i); j++) res[i + j] += c * poly2[j]; diff --git a/src/nmod_poly/powers_mod.c b/src/nmod_poly/powers_mod.c index 2706da8dcb..db68661923 100644 --- a/src/nmod_poly/powers_mod.c +++ b/src/nmod_poly/powers_mod.c @@ -32,7 +32,7 @@ typedef struct #endif } powers_preinv_arg_t; -void +static void _nmod_poly_powers_mod_preinv_worker(void * arg_ptr) { powers_preinv_arg_t arg = *((powers_preinv_arg_t *) arg_ptr); diff --git a/src/nmod_poly/rem.c b/src/nmod_poly/rem.c index 395e82b06d..37e802b4b3 100644 --- a/src/nmod_poly/rem.c +++ b/src/nmod_poly/rem.c @@ -13,7 +13,7 @@ #include "nmod.h" #include "nmod_poly.h" -void _nmod_poly_rem_q1(nn_ptr R, +static void _nmod_poly_rem_q1(nn_ptr R, nn_srcptr A, slong lenA, nn_srcptr B, slong lenB, nmod_t mod) { From 90e57a14df247a74d2ddcab2869fb9c83f971b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sat, 5 Oct 2024 21:50:46 +0200 Subject: [PATCH 018/114] mpn_mod --- src/crt_helpers.h | 4 ++++ src/mpn_mod.h | 6 ++++++ src/mpn_mod/ctx.c | 8 +------- src/mpn_mod/poly_divrem_basecase.c | 2 -- src/mpn_mod/poly_mullow_fft_small.c | 2 +- src/mpn_mod/poly_mullow_karatsuba.c | 6 ++++++ 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/crt_helpers.h b/src/crt_helpers.h index 4380c0ea6c..9da2ed58f0 100644 --- a/src/crt_helpers.h +++ b/src/crt_helpers.h @@ -25,6 +25,8 @@ extern "C" { #endif +FLINT_HEADER_START + #if defined(__AVX2__) FLINT_FORCE_INLINE unsigned char _addcarry_ulong(unsigned char cf, ulong x, ulong y, ulong* s) @@ -458,6 +460,8 @@ DEFINE_IT(6, 5) DEFINE_IT(7, 6) #undef DEFINE_IT +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/mpn_mod.h b/src/mpn_mod.h index 1c1db547d4..7ee5fc5575 100644 --- a/src/mpn_mod.h +++ b/src/mpn_mod.h @@ -25,6 +25,8 @@ extern "C" { #endif +FLINT_HEADER_START + /* Single limbs are already dealt with well by nmod, and excluding them allows avoiding various special cases. */ #define MPN_MOD_MIN_LIMBS 2 @@ -65,7 +67,9 @@ mpn_mod_ctx_set_is_field(gr_ctx_t ctx, truth_t is_field) /* Basic operations and arithmetic */ +#ifndef GR_H int gr_ctx_init_mpn_mod(gr_ctx_t ctx, const fmpz_t n); +#endif int _gr_ctx_init_mpn_mod(gr_ctx_t ctx, nn_srcptr n, slong nlimbs); void gr_ctx_init_mpn_mod_randtest(gr_ctx_t ctx, flint_rand_t state); @@ -231,6 +235,8 @@ int _mpn_mod_poly_div(nn_ptr Q, nn_srcptr A, slong lenA, nn_srcptr B, slong lenB int _mpn_mod_poly_gcd(nn_ptr G, slong * lenG, nn_srcptr A, slong lenA, nn_srcptr B, slong lenB, gr_ctx_t ctx); int _mpn_mod_poly_xgcd(slong * lenG, nn_ptr G, nn_ptr S, nn_ptr T, nn_srcptr A, slong lenA, nn_srcptr B, slong lenB, gr_ctx_t ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/mpn_mod/ctx.c b/src/mpn_mod/ctx.c index f6771a1a41..967cc98c1d 100644 --- a/src/mpn_mod/ctx.c +++ b/src/mpn_mod/ctx.c @@ -12,15 +12,12 @@ #include "fmpz.h" #include "mpn_mod.h" #include "gr.h" +#include "gr_generic.h" int _mpn_mod_methods_initialized = 0; gr_static_method_table _mpn_mod_methods; -#if defined(__GNUC__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcast-function-type" -#endif gr_method_tab_input _mpn_mod_methods_input[] = { {GR_METHOD_CTX_WRITE, (gr_funcptr) mpn_mod_ctx_write}, @@ -135,9 +132,6 @@ gr_method_tab_input _mpn_mod_methods_input[] = {GR_METHOD_MAT_DET, (gr_funcptr) mpn_mod_mat_det}, {0, (gr_funcptr) NULL}, }; -#if defined(__GNUC__) -# pragma GCC diagnostic pop -#endif int _gr_ctx_init_mpn_mod(gr_ctx_t ctx, nn_srcptr n, slong nlimbs) diff --git a/src/mpn_mod/poly_divrem_basecase.c b/src/mpn_mod/poly_divrem_basecase.c index ce88958020..ba780b80b9 100644 --- a/src/mpn_mod/poly_divrem_basecase.c +++ b/src/mpn_mod/poly_divrem_basecase.c @@ -234,8 +234,6 @@ _mpn_mod_poly_divrem_basecase_preinv1(nn_ptr Q, nn_ptr R, if (nlimbs == 2) { - ulong t[4]; - if (slimbs == 5) { for (j = 0; j < lenB - 1; j++) diff --git a/src/mpn_mod/poly_mullow_fft_small.c b/src/mpn_mod/poly_mullow_fft_small.c index 99b46a6152..b37452cdcb 100644 --- a/src/mpn_mod/poly_mullow_fft_small.c +++ b/src/mpn_mod/poly_mullow_fft_small.c @@ -311,7 +311,7 @@ static void s2worker_func(void* varg) X->stride, X->crts + X->offset, X->nlimbs, X->mpn_mod_ctx); } -int _mpn_mod_poly_mulmid_fft_small_internal(nn_ptr z, ulong zl, ulong zh, +static int _mpn_mod_poly_mulmid_fft_small_internal(nn_ptr z, ulong zl, ulong zh, nn_srcptr a, ulong an, nn_srcptr b, ulong bn, mpn_ctx_t R, gr_ctx_t ctx) diff --git a/src/mpn_mod/poly_mullow_karatsuba.c b/src/mpn_mod/poly_mullow_karatsuba.c index afbe1388a6..5f9486f422 100644 --- a/src/mpn_mod/poly_mullow_karatsuba.c +++ b/src/mpn_mod/poly_mullow_karatsuba.c @@ -11,6 +11,12 @@ #include "mpn_mod.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void _mpn_dot_rev_2x2_3(nn_ptr s, nn_srcptr a, nn_srcptr b, slong len) { ulong A0, A1, B0, B1; From b4adc40a783451902cb7eb3a69e862d914969da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 00:30:04 +0200 Subject: [PATCH 019/114] fmpz --- src/fmpz/CRT.c | 2 +- src/fmpz/addmul.c | 15 +- src/fmpz/fdiv.c | 4 +- src/fmpz/fmma.c | 12 +- src/fmpz/fmms.c | 12 +- src/fmpz/get_str.c | 6 + src/fmpz/invmod.c | 2 +- src/fmpz/is_perfect_power.c | 452 +++++++++++++++---------------- src/fmpz/is_prime.c | 4 +- src/fmpz/is_prime_pseudosquare.c | 2 +- src/fmpz/link/fmpz_gc.c | 2 +- src/fmpz/link/fmpz_single.c | 2 +- src/fmpz/lucas_chain.c | 4 +- src/fmpz/multi_CRT.c | 18 +- src/fmpz/primorial.c | 6 +- src/fmpz/set_str.c | 2 +- src/fmpz/test/t-set_str.c | 6 +- 17 files changed, 280 insertions(+), 271 deletions(-) diff --git a/src/fmpz/CRT.c b/src/fmpz/CRT.c index 2aa972bb98..1573569157 100644 --- a/src/fmpz/CRT.c +++ b/src/fmpz/CRT.c @@ -14,7 +14,7 @@ #include "ulong_extras.h" #include "fmpz.h" -void +static void _fmpz_CRT(fmpz_t out, const fmpz_t r1, const fmpz_t m1, const fmpz_t r2, const fmpz_t m2, const fmpz_t m1m2, fmpz_t c, int sign) { diff --git a/src/fmpz/addmul.c b/src/fmpz/addmul.c index b2b031b71d..f873df6b89 100644 --- a/src/fmpz/addmul.c +++ b/src/fmpz/addmul.c @@ -15,6 +15,12 @@ #include "mpn_extras.h" #include "fmpz.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + /* Will not get called with x or y small. */ void _flint_mpz_addmul_large(mpz_ptr z, mpz_srcptr x, mpz_srcptr y, int negate) @@ -35,12 +41,9 @@ _flint_mpz_addmul_large(mpz_ptr z, mpz_srcptr x, mpz_srcptr y, int negate) if (xn < yn) { - mpz_srcptr t; - slong tn; - - t = x; x = y; y = t; - tn = xn; xn = yn; yn = tn; - tn = x_sgn; x_sgn = y_sgn; y_sgn = tn; + FLINT_SWAP(mpz_srcptr, x, y); + FLINT_SWAP(slong, xn, yn); + FLINT_SWAP(slong, x_sgn, y_sgn); } if (negate) diff --git a/src/fmpz/fdiv.c b/src/fmpz/fdiv.c index e03e828d63..5726eeefd6 100644 --- a/src/fmpz/fdiv.c +++ b/src/fmpz/fdiv.c @@ -190,7 +190,7 @@ fmpz_fdiv_qr(fmpz_t f, fmpz_t s, const fmpz_t g, const fmpz_t h) } /* these functions were adapted from similar functions in an old version of GMP */ -void _mpz_tdiv_qr_preinvn(mpz_ptr q, mpz_ptr r, +static void _mpz_tdiv_qr_preinvn(mpz_ptr q, mpz_ptr r, mpz_srcptr a, mpz_srcptr d, const fmpz_preinvn_t inv) { slong size1 = a->_mp_size, size2 = d->_mp_size; @@ -267,7 +267,7 @@ void _mpz_tdiv_qr_preinvn(mpz_ptr q, mpz_ptr r, TMP_END; } -void _mpz_fdiv_qr_preinvn(mpz_ptr q, mpz_ptr r, +static void _mpz_fdiv_qr_preinvn(mpz_ptr q, mpz_ptr r, mpz_srcptr a, mpz_srcptr d, const fmpz_preinvn_t inv) { slong size1 = a->_mp_size; diff --git a/src/fmpz/fmma.c b/src/fmpz/fmma.c index deb136cb38..20107f7892 100644 --- a/src/fmpz/fmma.c +++ b/src/fmpz/fmma.c @@ -51,12 +51,12 @@ void fmpz_fmma(fmpz_t f, const fmpz_t a, const fmpz_t b, { if (f == a || f == b) { - fmpz_t t; - fmpz_init(t); - fmpz_mul(t, a, b); - fmpz_addmul(t, c, d); - fmpz_swap(t, f); - fmpz_clear(t); + fmpz_t tmp; + fmpz_init(tmp); + fmpz_mul(tmp, a, b); + fmpz_addmul(tmp, c, d); + fmpz_swap(tmp, f); + fmpz_clear(tmp); } else { diff --git a/src/fmpz/fmms.c b/src/fmpz/fmms.c index c4abc8d3a6..f3d129d3e4 100644 --- a/src/fmpz/fmms.c +++ b/src/fmpz/fmms.c @@ -52,12 +52,12 @@ void fmpz_fmms(fmpz_t f, const fmpz_t a, const fmpz_t b, { if (f == a || f == b) { - fmpz_t t; - fmpz_init(t); - fmpz_mul(t, a, b); - fmpz_submul(t, c, d); - fmpz_swap(t, f); - fmpz_clear(t); + fmpz_t tmp; + fmpz_init(tmp); + fmpz_mul(tmp, a, b); + fmpz_submul(tmp, c, d); + fmpz_swap(tmp, f); + fmpz_clear(tmp); } else { diff --git a/src/fmpz/get_str.c b/src/fmpz/get_str.c index 72135abde9..a2d2465c8c 100644 --- a/src/fmpz/get_str.c +++ b/src/fmpz/get_str.c @@ -17,6 +17,12 @@ #include "thread_pool.h" #include "thread_support.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + /* Notes: diff --git a/src/fmpz/invmod.c b/src/fmpz/invmod.c index 956a6f66b1..6e9f3bf0a0 100644 --- a/src/fmpz/invmod.c +++ b/src/fmpz/invmod.c @@ -13,7 +13,7 @@ #include "ulong_extras.h" #include "fmpz.h" -ulong +static ulong z_gcdinv(ulong * inv, slong a, ulong b) { ulong g, ua = FLINT_ABS(a); diff --git a/src/fmpz/is_perfect_power.c b/src/fmpz/is_perfect_power.c index e6f6dfc824..85516a71d2 100644 --- a/src/fmpz/is_perfect_power.c +++ b/src/fmpz/is_perfect_power.c @@ -62,241 +62,241 @@ static const unsigned short primes[] = int fmpz_is_perfect_power(fmpz_t root, const fmpz_t f) { - ulong prime, n, n2, rem; - mpz_t u2, q; - int exact, exp2, sgn = fmpz_sgn(f); - slong i, uns, usize = fmpz_size(f); - mpz_ptr u, r; - - if (usize == 0) - { - fmpz_zero(root); - return 2; /* consider 0 a perfect square */ - } - - if (usize == 1) - { - ulong r = 0; - ulong r2; - ulong n = fmpz_get_ui(f); - - int exp = n_is_perfect_power(&r, n); - - /* get highest exponent */ - while (r > 1 && (exp2 = n_is_perfect_power(&r2, r)) != 0) - { - exp *= exp2; - r = r2; - } - - if (exp == 0) - return 0; - else if (sgn < 0 && (exp & 1) == 0) - { - while ((exp & 1) == 0) - { - r = r*r; - exp >>= 1; - } - if (exp == 1 && n != 1) + ulong prime, n, n2, rem; + mpz_t u2, q; + int exact, exp2, sgn = fmpz_sgn(f); + slong i, uns, usize = fmpz_size(f); + mpz_ptr u, r; + + if (usize == 0) + { + fmpz_zero(root); + return 2; /* consider 0 a perfect square */ + } + + if (usize == 1) + { + ulong r1 = 0, r2; + int exp; + + n = fmpz_get_ui(f); + exp = n_is_perfect_power(&r1, n); + + /* get highest exponent */ + while (r1 > 1 && (exp2 = n_is_perfect_power(&r2, r1)) != 0) + { + exp *= exp2; + r1 = r2; + } + + if (exp == 0) return 0; - else - { - fmpz_set_si(root, -r); + else if (sgn < 0 && (exp & 1) == 0) + { + while ((exp & 1) == 0) + { + r1 = r1*r1; + exp >>= 1; + } + if (exp == 1 && n != 1) + return 0; + else + { + fmpz_set_si(root, -r1); + return exp; + } + } else + { + fmpz_set_ui(root, r1); + if (sgn < 0) + fmpz_neg(root, root); return exp; - } - } else - { - fmpz_set_ui(root, r); - if (sgn < 0) - fmpz_neg(root, root); - return exp; - } - } - - u = COEFF_TO_PTR(*f); - usize = u->_mp_size; - - n2 = mpz_scan1(u, 0); - - if (n2 == 1) - return 0; /* 2 divides exactly once */ - - if (n2 > 1 && (n2 & (n2 - 1)) == 0 && usize < 0) - return 0; /* 2 has power of two multiplicity with negative u */ - - uns = FLINT_ABS(usize) - n2/FLINT_BITS; - mpz_init2(q, FLINT_BITS*uns); - mpz_init2(u2, FLINT_BITS*uns); - - mpz_tdiv_q_2exp(u2, u, n2); - - if (n_is_prime(n2)) - goto n2prime; - - for (i = 1; primes[i] != 0; i++) - { - prime = primes[i]; - - if (mpz_divisible_ui_p(u2, prime)) /* divisible by this prime? */ - { - rem = mpz_tdiv_q_ui(q, u2, prime*prime); - - if (rem != 0) - { - mpz_clear(q); - mpz_clear(u2); - return 0; /* prime divides exactly once, reject */ - } - - mpz_swap(q, u2); - for (n = 2; ; ) - { - rem = mpz_tdiv_q_ui(q, u2, prime); - if (rem != 0) - break; - mpz_swap (q, u2); - n++; - } - - if ((n & (n - 1)) == 0 && usize < 0) - { - mpz_clear(q); - mpz_clear(u2); - return 0; /* power of two multiplicity with negative U, reject */ - } - - n2 = n_gcd(n2, n); - if (n2 == 1) - { - mpz_clear(q); - mpz_clear(u2); - return 0; /* we have multiplicity 1 of some factor */ - } - - if (mpz_cmpabs_ui(u2, 1) == 0) - { - mpz_clear(q); - mpz_clear(u2); - - if (usize < 0) + } + } + + u = COEFF_TO_PTR(*f); + usize = u->_mp_size; + + n2 = mpz_scan1(u, 0); + + if (n2 == 1) + return 0; /* 2 divides exactly once */ + + if (n2 > 1 && (n2 & (n2 - 1)) == 0 && usize < 0) + return 0; /* 2 has power of two multiplicity with negative u */ + + uns = FLINT_ABS(usize) - n2/FLINT_BITS; + mpz_init2(q, FLINT_BITS*uns); + mpz_init2(u2, FLINT_BITS*uns); + + mpz_tdiv_q_2exp(u2, u, n2); + + if (n_is_prime(n2)) + goto n2prime; + + for (i = 1; primes[i] != 0; i++) + { + prime = primes[i]; + + if (mpz_divisible_ui_p(u2, prime)) /* divisible by this prime? */ + { + rem = mpz_tdiv_q_ui(q, u2, prime*prime); + + if (rem != 0) + { + mpz_clear(q); + mpz_clear(u2); + return 0; /* prime divides exactly once, reject */ + } + + mpz_swap(q, u2); + for (n = 2; ; ) + { + rem = mpz_tdiv_q_ui(q, u2, prime); + if (rem != 0) + break; + mpz_swap (q, u2); + n++; + } + + if ((n & (n - 1)) == 0 && usize < 0) + { + mpz_clear(q); + mpz_clear(u2); + return 0; /* power of two multiplicity with negative U, reject */ + } + + n2 = n_gcd(n2, n); + if (n2 == 1) { - if ((n2 & (n2 - 1)) == 0) - return 0; /* factoring completed; not consistent power */ + mpz_clear(q); + mpz_clear(u2); + return 0; /* we have multiplicity 1 of some factor */ + } - while ((n2 & 1) == 0) - n2 >>= 1; + if (mpz_cmpabs_ui(u2, 1) == 0) + { + mpz_clear(q); + mpz_clear(u2); + + if (usize < 0) + { + if ((n2 & (n2 - 1)) == 0) + return 0; /* factoring completed; not consistent power */ + + while ((n2 & 1) == 0) + n2 >>= 1; + } + + r = _fmpz_promote(root); + mpz_root(r, u, n2); + _fmpz_demote_val(root); + return n2; /* factoring completed; consistent power */ } - r = _fmpz_promote(root); - mpz_root(r, u, n2); - _fmpz_demote_val(root); - return n2; /* factoring completed; consistent power */ - } - - /* - as soon as n2 becomes a prime number, stop factoring - either we have u=x^n2 or u is not a perfect power - */ - if (n_is_prime(n2)) - goto n2prime; - } - } - - if (n2 == 0) - { - /* we found no factors above; have to check all values of n */ - ulong nth; - - for (nth = usize < 0 ? 3 : 2; ; nth++) - { - if (!n_is_prime(nth)) - continue; - - exact = mpz_root(q, u2, nth); - - if (exact) - { - r = _fmpz_promote(root); - mpz_set(r, q); - _fmpz_demote_val(root); - mpz_clear(q); - mpz_clear(u2); - return nth; - } - - if (mpz_cmpabs_ui(q, SMALLEST_OMITTED_PRIME) < 0) - { - mpz_clear(q); - mpz_clear(u2); - return 0; - } - } + /* + as soon as n2 becomes a prime number, stop factoring + either we have u=x^n2 or u is not a perfect power + */ + if (n_is_prime(n2)) + goto n2prime; + } + } + + if (n2 == 0) + { + /* we found no factors above; have to check all values of n */ + ulong nth; + + for (nth = usize < 0 ? 3 : 2; ; nth++) + { + if (!n_is_prime(nth)) + continue; + + exact = mpz_root(q, u2, nth); + + if (exact) + { + r = _fmpz_promote(root); + mpz_set(r, q); + _fmpz_demote_val(root); + mpz_clear(q); + mpz_clear(u2); + return nth; + } + + if (mpz_cmpabs_ui(q, SMALLEST_OMITTED_PRIME) < 0) + { + mpz_clear(q); + mpz_clear(u2); + return 0; + } + } } else { - ulong nth; - - /* - we found some factors above and we just need to consider values of n - that divide n2 - */ - - for (nth = usize < 0 ? 3 : 2; nth <= n2; nth++) - { - if (!n_is_prime(nth)) - continue; - - if (n2 % nth != 0) - continue; - - exact = mpz_root(q, u, nth); - - if (exact) - { - r = _fmpz_promote(root); - mpz_set(r, q); - _fmpz_demote_val(root); - mpz_clear(q); - mpz_clear(u2); - return nth; - } - - if (mpz_cmpabs_ui(q, SMALLEST_OMITTED_PRIME) < 0) - { - mpz_clear(q); - mpz_clear(u2); - return 0; - } - } - - mpz_clear(q); - mpz_clear(u2); - return 0; - } + ulong nth; + + /* + we found some factors above and we just need to consider values of n + that divide n2 + */ + + for (nth = usize < 0 ? 3 : 2; nth <= n2; nth++) + { + if (!n_is_prime(nth)) + continue; + + if (n2 % nth != 0) + continue; + + exact = mpz_root(q, u, nth); + + if (exact) + { + r = _fmpz_promote(root); + mpz_set(r, q); + _fmpz_demote_val(root); + mpz_clear(q); + mpz_clear(u2); + return nth; + } + + if (mpz_cmpabs_ui(q, SMALLEST_OMITTED_PRIME) < 0) + { + mpz_clear(q); + mpz_clear(u2); + return 0; + } + } + + mpz_clear(q); + mpz_clear(u2); + return 0; + } n2prime: - if (n2 == 2 && usize < 0) - { - mpz_clear(q); - mpz_clear(u2); - return 0; - } - - exact = mpz_root(q, u, n2); - - if (exact) - { - r = _fmpz_promote(root); - mpz_set(r, q); - _fmpz_demote_val(root); - mpz_clear(q); - mpz_clear(u2); - return n2; - } else - { - mpz_clear(q); - mpz_clear(u2); - return 0; - } + if (n2 == 2 && usize < 0) + { + mpz_clear(q); + mpz_clear(u2); + return 0; + } + + exact = mpz_root(q, u, n2); + + if (exact) + { + r = _fmpz_promote(root); + mpz_set(r, q); + _fmpz_demote_val(root); + mpz_clear(q); + mpz_clear(u2); + return n2; + } else + { + mpz_clear(q); + mpz_clear(u2); + return 0; + } } diff --git a/src/fmpz/is_prime.c b/src/fmpz/is_prime.c index fef98c1496..2165f527e3 100644 --- a/src/fmpz/is_prime.c +++ b/src/fmpz/is_prime.c @@ -16,7 +16,7 @@ #include "fmpz.h" #include "aprcl.h" -int _fmpz_is_prime(const fmpz_t n, int proved) +static int _fmpz_is_prime(const fmpz_t n, int proved) { double logd; ulong p, ppi, limit; @@ -202,7 +202,7 @@ int _fmpz_is_prime(const fmpz_t n, int proved) if (fmpz_cmp(Fcub, n) > 0) /* Improved n + 1 test */ { - fmpz_t r1, r0, b, r, t; + fmpz_t r1, r0, b, r; fmpz_init(r1); fmpz_init(r0); diff --git a/src/fmpz/is_prime_pseudosquare.c b/src/fmpz/is_prime_pseudosquare.c index 451a0a09db..056cc9b07c 100644 --- a/src/fmpz/is_prime_pseudosquare.c +++ b/src/fmpz/is_prime_pseudosquare.c @@ -172,7 +172,7 @@ ulong flint_fmpz_pseudosquares[][2] = #define FLINT_NUM_FMPZ_PSEUDOSQUARES 74 -void fmpz_set_pseudosquare(fmpz_t f, unsigned int i) +static void fmpz_set_pseudosquare(fmpz_t f, unsigned int i) { #ifndef FLINT64 if (i < 25) diff --git a/src/fmpz/link/fmpz_gc.c b/src/fmpz/link/fmpz_gc.c index 6591047542..693401a6da 100644 --- a/src/fmpz/link/fmpz_gc.c +++ b/src/fmpz/link/fmpz_gc.c @@ -38,7 +38,7 @@ ulong mpz_free_num = 0; ulong mpz_free_alloc = 0; #if FLINT_USES_PTHREAD -void fmpz_lock_init() +static void fmpz_lock_init() { pthread_mutex_init(&fmpz_lock, NULL); } diff --git a/src/fmpz/link/fmpz_single.c b/src/fmpz/link/fmpz_single.c index 4cfddbfb70..aa7dd7db15 100644 --- a/src/fmpz/link/fmpz_single.c +++ b/src/fmpz/link/fmpz_single.c @@ -61,7 +61,7 @@ static slong flint_page_size; static slong flint_mpz_structs_per_block; static slong flint_page_mask; -slong flint_get_page_size(void) +static slong flint_get_page_size(void) { #if defined(__unix__) return sysconf(_SC_PAGESIZE); diff --git a/src/fmpz/lucas_chain.c b/src/fmpz/lucas_chain.c index 422baa6483..3dcc6dd2df 100644 --- a/src/fmpz/lucas_chain.c +++ b/src/fmpz/lucas_chain.c @@ -15,10 +15,10 @@ #include "fmpz.h" #include "fmpz_vec.h" #include "fmpz_extras.h" -#include "gr.h" #include "mpn_mod.h" +#include "gr.h" -int _gr_lucas_chain(gr_ptr Vm, gr_ptr Vm1, gr_srcptr A, const fmpz_t m, gr_ctx_t ctx) +static int _gr_lucas_chain(gr_ptr Vm, gr_ptr Vm1, gr_srcptr A, const fmpz_t m, gr_ctx_t ctx) { gr_ptr t; slong i, B, mn; diff --git a/src/fmpz/multi_CRT.c b/src/fmpz/multi_CRT.c index 75eb7439de..cd2a3229c7 100644 --- a/src/fmpz/multi_CRT.c +++ b/src/fmpz/multi_CRT.c @@ -377,17 +377,17 @@ int fmpz_multi_CRT_precompute( for (i = r, j = 0; j < 2*r - 4; i++, j += 2) { - slong s, minp; + slong sx, minp; const fmpz * mind; minp = j; mind = v + j; - for (s = j + 1; s < i; s++) + for (sx = j + 1; sx < i; sx++) { - if (fmpz_cmp(v + s, mind) < 0) + if (fmpz_cmp(v + sx, mind) < 0) { - mind = v + s; - minp = s; + mind = v + sx; + minp = sx; } } fmpz_swap(v + j, v + minp); @@ -395,12 +395,12 @@ int fmpz_multi_CRT_precompute( minp = j + 1; mind = v + j + 1; - for (s = j + 2; s < i; s++) + for (sx = j + 2; sx < i; sx++) { - if (fmpz_cmp(v + s, mind) < 0) + if (fmpz_cmp(v + sx, mind) < 0) { - mind = v + s; - minp = s; + mind = v + sx; + minp = sx; } } fmpz_swap(v + j + 1, v + minp); diff --git a/src/fmpz/primorial.c b/src/fmpz/primorial.c index 0310928536..a7181f4e31 100644 --- a/src/fmpz/primorial.c +++ b/src/fmpz/primorial.c @@ -55,7 +55,7 @@ const ulong ULONG_PRIMORIALS[] = #define PROD_LIMBS_DIRECT_CUTOFF 50 -slong mpn_prod_limbs_direct(ulong * result, const ulong * factors, +static slong mpn_prod_limbs_direct(ulong * result, const ulong * factors, slong n) { slong k, len; @@ -79,7 +79,7 @@ slong mpn_prod_limbs_direct(ulong * result, const ulong * factors, return len; } -slong mpn_prod_limbs_balanced(ulong * result, ulong * scratch, +static slong mpn_prod_limbs_balanced(ulong * result, ulong * scratch, const ulong * factors, slong n, ulong bits) { slong an, bn, alen, blen, len; @@ -112,7 +112,7 @@ slong mpn_prod_limbs_balanced(ulong * result, ulong * scratch, bits must be set to some bound on the bit size of the entries in factors. If no bound is known, simply use FLINT_BITS. */ -slong mpn_prod_limbs(ulong * result, const ulong * factors, +static slong mpn_prod_limbs(ulong * result, const ulong * factors, slong n, ulong bits) { slong len, limbs; diff --git a/src/fmpz/set_str.c b/src/fmpz/set_str.c index 0271755ca9..3d4bf1dadb 100644 --- a/src/fmpz/set_str.c +++ b/src/fmpz/set_str.c @@ -154,7 +154,7 @@ _fmpz_get_str_recursive(fmpz_t res, const char * s, slong slen, const slong * ex } } -void +static void fmpz_set_str_bsplit_threaded(fmpz_t res, const char * s, slong slen) { slong k, depth; diff --git a/src/fmpz/test/t-set_str.c b/src/fmpz/test/t-set_str.c index f40cb8f184..910f821b0f 100644 --- a/src/fmpz/test/t-set_str.c +++ b/src/fmpz/test/t-set_str.c @@ -16,9 +16,9 @@ TEST_FUNCTION_START(fmpz_set_str, state) { - int i; + slong ix; - for (i = 0; i < 1000 * flint_test_multiplier(); i++) + for (ix = 0; ix < 1000 * flint_test_multiplier(); ix++) { fmpz_t a, c; mpz_t b; @@ -76,7 +76,7 @@ TEST_FUNCTION_START(fmpz_set_str, state) } /* test binary splitting code */ - for (i = 0; i < 10 * flint_test_multiplier(); i++) + for (ix = 0; ix < 10 * flint_test_multiplier(); ix++) { fmpz_t a, c; mpz_t b; From 2a6aad45f9574a17744b604890e8ad4f3cc41ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 00:49:41 +0200 Subject: [PATCH 020/114] fmpq_vec --- src/fmpq_vec.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/fmpq_vec.h b/src/fmpq_vec.h index 8eb688d865..415abbcdd3 100644 --- a/src/fmpq_vec.h +++ b/src/fmpq_vec.h @@ -45,9 +45,6 @@ void _fmpq_vec_sort(fmpq * vec, slong len); void _fmpq_vec_set_fmpz_vec(fmpq * res, const fmpz * vec, slong len); -void _fmpq_vec_get_fmpz_vec_fmpz(fmpz* num, fmpz_t den, - const fmpq * a, slong len); - void _fmpq_vec_get_fmpz_vec_fmpz(fmpz* num, fmpz_t den, const fmpq * a, slong len); From 442a106c48ce0e5838faaf6161f63bc6c1d4ce8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 00:59:24 +0200 Subject: [PATCH 021/114] fmpz_mat --- src/fmpq_mat/solve_multi_mod.c | 36 +++++++++++++++++++++++++---- src/fmpz_mat/can_solve_fflu.c | 4 ++-- src/fmpz_mat/charpoly.c | 2 +- src/fmpz_mat/col_partition.c | 4 ++-- src/fmpz_mat/det_bareiss.c | 2 +- src/fmpz_mat/hadamard.c | 2 +- src/fmpz_mat/hnf_transform.c | 2 +- src/fmpz_mat/minpoly_modular.c | 4 ++-- src/fmpz_mat/mul_fft.c | 2 +- src/fmpz_mat/next_col_van_hoeij.c | 2 +- src/fmpz_mat/rank_small_inplace.c | 2 +- src/fmpz_mat/solve_cramer.c | 2 +- src/fmpz_mat/solve_fflu_precomp.c | 2 +- src/fmpz_mat/solve_multi_mod_den.c | 33 -------------------------- src/fmpz_mat/test/t-inv.c | 1 - src/fmpz_mat/test/t-mul.c | 3 ++- src/fmpz_mat/test/t-mul_classical.c | 6 +++-- src/fmpz_mat/test/t-pow.c | 4 ++-- 18 files changed, 55 insertions(+), 58 deletions(-) diff --git a/src/fmpq_mat/solve_multi_mod.c b/src/fmpq_mat/solve_multi_mod.c index cac1b0c53e..77069657ff 100644 --- a/src/fmpq_mat/solve_multi_mod.c +++ b/src/fmpq_mat/solve_multi_mod.c @@ -17,12 +17,40 @@ #include "fmpz_mat.h" #include "fmpq_mat.h" -ulong fmpz_mat_find_good_prime_and_solve(nmod_mat_t Xmod, +static ulong fmpz_mat_find_good_prime_and_solve(nmod_mat_t Xmod, nmod_mat_t Amod, nmod_mat_t Bmod, - const fmpz_mat_t A, const fmpz_mat_t B, const fmpz_t det_bound); + const fmpz_mat_t A, const fmpz_mat_t B, const fmpz_t det_bound) +{ + ulong p; + fmpz_t tested; + p = UWORD(1) << NMOD_MAT_OPTIMAL_MODULUS_BITS; + fmpz_init(tested); + fmpz_one(tested); -int + while (1) + { + p = n_nextprime(p, 0); + nmod_mat_set_mod(Xmod, p); + nmod_mat_set_mod(Amod, p); + nmod_mat_set_mod(Bmod, p); + fmpz_mat_get_nmod_mat(Amod, A); + fmpz_mat_get_nmod_mat(Bmod, B); + if (nmod_mat_solve(Xmod, Amod, Bmod)) + break; + fmpz_mul_ui(tested, tested, p); + if (fmpz_cmp(tested, det_bound) > 0) + { + p = 0; + break; + } + } + + fmpz_clear(tested); + return p; +} + +static int _fmpq_mat_check_solution_fmpz_mat(const fmpq_mat_t X, const fmpz_mat_t A, const fmpz_mat_t B) { slong i, j; @@ -60,7 +88,7 @@ _fmpq_mat_check_solution_fmpz_mat(const fmpq_mat_t X, const fmpz_mat_t A, const return ok; } -void +static void _fmpq_mat_solve_multi_mod(fmpq_mat_t X, const fmpz_mat_t A, const fmpz_mat_t B, nmod_mat_t Xmod, nmod_mat_t Amod, nmod_mat_t Bmod, diff --git a/src/fmpz_mat/can_solve_fflu.c b/src/fmpz_mat/can_solve_fflu.c index 3f3e840112..d0ac741335 100644 --- a/src/fmpz_mat/can_solve_fflu.c +++ b/src/fmpz_mat/can_solve_fflu.c @@ -14,7 +14,7 @@ #include "fmpz.h" #include "fmpz_mat.h" -void _fmpz_mat_window_with_perm_init(fmpz_mat_t Ap, slong * perm, +static void _fmpz_mat_window_with_perm_init(fmpz_mat_t Ap, slong * perm, const fmpz_mat_t A, slong start) { slong i, n = A->r; @@ -32,7 +32,7 @@ void _fmpz_mat_window_with_perm_init(fmpz_mat_t Ap, slong * perm, Ap->c = A->c; } -void _fmpz_mat_window_with_perm_clear(fmpz_mat_t Ap) +static void _fmpz_mat_window_with_perm_clear(fmpz_mat_t Ap) { if (Ap->r != 0) flint_free(Ap->rows); diff --git a/src/fmpz_mat/charpoly.c b/src/fmpz_mat/charpoly.c index 9a9994cb3c..5de1a0df64 100644 --- a/src/fmpz_mat/charpoly.c +++ b/src/fmpz_mat/charpoly.c @@ -91,7 +91,7 @@ static void _fmpz_mat_charpoly_small_3x3(fmpz *rop, fmpz ** const x) fmpz_clear(a + 1); } -void _fmpz_mat_charpoly_small(fmpz * rop, const fmpz_mat_t op) +static void _fmpz_mat_charpoly_small(fmpz * rop, const fmpz_mat_t op) { if (op->r == 0) { diff --git a/src/fmpz_mat/col_partition.c b/src/fmpz_mat/col_partition.c index 1c723f84ed..b01ca0d53b 100644 --- a/src/fmpz_mat/col_partition.c +++ b/src/fmpz_mat/col_partition.c @@ -24,7 +24,7 @@ typedef col_hash_struct * col_hash_ptr; typedef const col_hash_struct * col_hash_srcptr; /* cheap hash of all columns of M */ -void +static void fmpz_mat_col_hash(col_hash_ptr col_h, fmpz_mat_t M) { slong i, j; @@ -45,7 +45,7 @@ fmpz_mat_col_hash(col_hash_ptr col_h, fmpz_mat_t M) } } -int +static int fmpz_mat_col_hash_compare(const void * a, const void * b) { col_hash_srcptr col_a = a; diff --git a/src/fmpz_mat/det_bareiss.c b/src/fmpz_mat/det_bareiss.c index dde864d7b2..25de6edb81 100644 --- a/src/fmpz_mat/det_bareiss.c +++ b/src/fmpz_mat/det_bareiss.c @@ -13,7 +13,7 @@ #include "fmpz_mat.h" #include "perm.h" -void +static void _fmpz_mat_det_bareiss(fmpz_t det, fmpz_mat_t tmp) { slong *perm, n = fmpz_mat_nrows(tmp); diff --git a/src/fmpz_mat/hadamard.c b/src/fmpz_mat/hadamard.c index 6b0101d6f1..1fd5c7bc68 100644 --- a/src/fmpz_mat/hadamard.c +++ b/src/fmpz_mat/hadamard.c @@ -67,7 +67,7 @@ n_is_prime_power(ulong * p, ulong n) /* Jacobsthal matrix of order q = p^d */ /* Could speed up greatly for d = 1. */ -void +static void fmpz_mat_jacobsthal(fmpz_mat_t Q) { int * quadratic; diff --git a/src/fmpz_mat/hnf_transform.c b/src/fmpz_mat/hnf_transform.c index e02140e877..f9724edf49 100644 --- a/src/fmpz_mat/hnf_transform.c +++ b/src/fmpz_mat/hnf_transform.c @@ -15,7 +15,7 @@ #include "fmpz.h" #include "fmpz_mat.h" -void +static void _fmpz_mat_hnf_transform_naive(fmpz_mat_t H, fmpz_mat_t U, const fmpz_mat_t A) { slong i, j, m, n; diff --git a/src/fmpz_mat/minpoly_modular.c b/src/fmpz_mat/minpoly_modular.c index ce11eabc4e..e32f4e0a39 100644 --- a/src/fmpz_mat/minpoly_modular.c +++ b/src/fmpz_mat/minpoly_modular.c @@ -27,7 +27,7 @@ static inline long double _log2(const long double x) return log(x) * MINPOLY_M_LOG2E; } -slong _fmpz_mat_minpoly_small(fmpz * rop, const fmpz_mat_t op) +static slong _fmpz_mat_minpoly_small(fmpz * rop, const fmpz_mat_t op) { slong len = 0; @@ -46,7 +46,7 @@ slong _fmpz_mat_minpoly_small(fmpz * rop, const fmpz_mat_t op) return len; } -void _fmpz_mat_bound_ovals_of_cassini(fmpz_t b, const fmpz_mat_t op) +static void _fmpz_mat_bound_ovals_of_cassini(fmpz_t b, const fmpz_mat_t op) { slong n = op->r, i, j; fmpz * v1; diff --git a/src/fmpz_mat/mul_fft.c b/src/fmpz_mat/mul_fft.c index aeec15e216..4e3692ec36 100644 --- a/src/fmpz_mat/mul_fft.c +++ b/src/fmpz_mat/mul_fft.c @@ -263,7 +263,7 @@ static void _dot( } -void _fmpz_mat_mul_truncate_sqrt2( +static void _fmpz_mat_mul_truncate_sqrt2( fmpz_mat_t C, const fmpz_mat_t A, slong Abits, const fmpz_mat_t B, slong Bbits, diff --git a/src/fmpz_mat/next_col_van_hoeij.c b/src/fmpz_mat/next_col_van_hoeij.c index 92e27c473e..d35f7a310d 100644 --- a/src/fmpz_mat/next_col_van_hoeij.c +++ b/src/fmpz_mat/next_col_van_hoeij.c @@ -15,7 +15,7 @@ #include "fmpz.h" #include "fmpz_mat.h" -void _fmpz_mat_resize_van_hoeij(fmpz_mat_t M, slong r, slong c) +static void _fmpz_mat_resize_van_hoeij(fmpz_mat_t M, slong r, slong c) { slong i, j; fmpz * old_entries = M->entries; diff --git a/src/fmpz_mat/rank_small_inplace.c b/src/fmpz_mat/rank_small_inplace.c index 89c141fb8e..27746c070b 100644 --- a/src/fmpz_mat/rank_small_inplace.c +++ b/src/fmpz_mat/rank_small_inplace.c @@ -15,7 +15,7 @@ #define E(j,k) fmpz_mat_entry(B,j,k) -slong _fmpz_mat_rank_overflow(fmpz_mat_t B, slong pivot_row, slong pivot_col) +static slong _fmpz_mat_rank_overflow(fmpz_mat_t B, slong pivot_row, slong pivot_col) { fmpz_t den; fmpz_mat_t window; diff --git a/src/fmpz_mat/solve_cramer.c b/src/fmpz_mat/solve_cramer.c index 7b22552be0..8123a2ed53 100644 --- a/src/fmpz_mat/solve_cramer.c +++ b/src/fmpz_mat/solve_cramer.c @@ -17,7 +17,7 @@ #define BB(i,j) fmpz_mat_entry(B, i, j) #define XX(i,j) fmpz_mat_entry(X, i, j) -int +static int _fmpz_mat_solve_cramer_3x3(fmpz_mat_t X, fmpz_t den, const fmpz_mat_t A, const fmpz_mat_t B) { diff --git a/src/fmpz_mat/solve_fflu_precomp.c b/src/fmpz_mat/solve_fflu_precomp.c index bc7a623369..0477d66dc2 100644 --- a/src/fmpz_mat/solve_fflu_precomp.c +++ b/src/fmpz_mat/solve_fflu_precomp.c @@ -22,7 +22,7 @@ #define r_shift(in, c) (((c) == FLINT_BITS) ? WORD(0) : ((in) >> (c))) -void +static void fmpz_mat_set_perm(fmpz_mat_t X, const slong * perm, const fmpz_mat_t B) { if (X == B) diff --git a/src/fmpz_mat/solve_multi_mod_den.c b/src/fmpz_mat/solve_multi_mod_den.c index 3e40347dd5..3e14a90db0 100644 --- a/src/fmpz_mat/solve_multi_mod_den.c +++ b/src/fmpz_mat/solve_multi_mod_den.c @@ -15,39 +15,6 @@ #include "fmpz_mat.h" #include "fmpq_mat.h" -ulong fmpz_mat_find_good_prime_and_solve(nmod_mat_t Xmod, - nmod_mat_t Amod, nmod_mat_t Bmod, - const fmpz_mat_t A, const fmpz_mat_t B, const fmpz_t det_bound) -{ - ulong p; - fmpz_t tested; - - p = UWORD(1) << NMOD_MAT_OPTIMAL_MODULUS_BITS; - fmpz_init(tested); - fmpz_one(tested); - - while (1) - { - p = n_nextprime(p, 0); - nmod_mat_set_mod(Xmod, p); - nmod_mat_set_mod(Amod, p); - nmod_mat_set_mod(Bmod, p); - fmpz_mat_get_nmod_mat(Amod, A); - fmpz_mat_get_nmod_mat(Bmod, B); - if (nmod_mat_solve(Xmod, Amod, Bmod)) - break; - fmpz_mul_ui(tested, tested, p); - if (fmpz_cmp(tested, det_bound) > 0) - { - p = 0; - break; - } - } - - fmpz_clear(tested); - return p; -} - int fmpz_mat_solve_multi_mod_den(fmpz_mat_t X, fmpz_t den, const fmpz_mat_t A, const fmpz_mat_t B) diff --git a/src/fmpz_mat/test/t-inv.c b/src/fmpz_mat/test/t-inv.c index 4f4eacc2e2..0201bbd013 100644 --- a/src/fmpz_mat/test/t-inv.c +++ b/src/fmpz_mat/test/t-inv.c @@ -22,7 +22,6 @@ TEST_FUNCTION_START(fmpz_mat_inv, state) { fmpz_t d; - fmpz_mat_t A, B, C; fmpz_mat_init(A, 1, 1); fmpz_one(fmpz_mat_entry(A, 0, 0)); diff --git a/src/fmpz_mat/test/t-mul.c b/src/fmpz_mat/test/t-mul.c index 2c09658f54..80f76aa62e 100644 --- a/src/fmpz_mat/test/t-mul.c +++ b/src/fmpz_mat/test/t-mul.c @@ -11,6 +11,7 @@ */ #include "test_helpers.h" +#include "longlong.h" #include "fmpz.h" #include "fmpz_mat.h" @@ -152,7 +153,7 @@ TEST_FUNCTION_START(fmpz_mat_mul, state) /* Test aliasing with windows */ { - fmpz_mat_t A, B, A_window; + fmpz_mat_t A_window; fmpz_mat_init(A, 2, 2); fmpz_mat_init(B, 2, 2); diff --git a/src/fmpz_mat/test/t-mul_classical.c b/src/fmpz_mat/test/t-mul_classical.c index e58e791d8d..79859bbe72 100644 --- a/src/fmpz_mat/test/t-mul_classical.c +++ b/src/fmpz_mat/test/t-mul_classical.c @@ -10,13 +10,15 @@ */ #include "test_helpers.h" +#include "fmpz.h" #include "fmpz_mat.h" + TEST_FUNCTION_START(fmpz_mat_mul_classical, state) { fmpz_mat_t A, B, C, D; - slong i; + slong ix; - for (i = 0; i < 100 * flint_test_multiplier(); i++) + for (ix = 0; ix < 100 * flint_test_multiplier(); ix++) { slong m, n, k; slong i, j, h; diff --git a/src/fmpz_mat/test/t-pow.c b/src/fmpz_mat/test/t-pow.c index 8c1b488740..642e05326c 100644 --- a/src/fmpz_mat/test/t-pow.c +++ b/src/fmpz_mat/test/t-pow.c @@ -14,9 +14,9 @@ TEST_FUNCTION_START(fmpz_mat_pow, state) { - slong i; + slong ix; - for (i = 0; i < 100 * flint_test_multiplier(); i++) + for (ix = 0; ix < 100 * flint_test_multiplier(); ix++) { fmpz_mat_t A, B, C; slong i, n; From 36cf1e012d7a4fd9aa54a81e4139ac90b65a0905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 01:59:14 +0200 Subject: [PATCH 022/114] fmpz_poly --- src/fmpz_poly/eta_qexp.c | 2 +- src/fmpz_poly/eulerian_polynomial.c | 6 +++--- src/fmpz_poly/evaluate_horner_d_2exp.c | 6 ++++++ src/fmpz_poly/gcd_heuristic.c | 4 ++-- src/fmpz_poly/hensel_lift.c | 2 +- src/fmpz_poly/mul.c | 4 ++-- src/fmpz_poly/mul_karatsuba.c | 6 ++++++ src/fmpz_poly/mullow.c | 4 ++-- src/fmpz_poly/num_real_roots_sturm.c | 7 ++----- src/fmpz_poly/randtest_no_real_root.c | 4 ++-- src/fmpz_poly/sqr.c | 4 ++-- src/fmpz_poly/sqr_karatsuba.c | 17 ++++++----------- src/fmpz_poly/sqrlow.c | 4 ++-- src/fmpz_poly/sqrlow_karatsuba_n.c | 2 +- src/fmpz_poly/taylor_shift_horner.c | 1 - src/fmpz_poly/taylor_shift_multi_mod_threaded.c | 8 ++++---- src/fmpz_poly/test/t-evaluate_horner_d_2exp.c | 6 +++--- 17 files changed, 45 insertions(+), 42 deletions(-) diff --git a/src/fmpz_poly/eta_qexp.c b/src/fmpz_poly/eta_qexp.c index 4422656d9b..a3eded3bdb 100644 --- a/src/fmpz_poly/eta_qexp.c +++ b/src/fmpz_poly/eta_qexp.c @@ -34,7 +34,7 @@ _eta_one(fmpz * c, slong N) } } -void +static void _eta_two(fmpz * c, slong N) { slong k1, n1, k2, n2; diff --git a/src/fmpz_poly/eulerian_polynomial.c b/src/fmpz_poly/eulerian_polynomial.c index b5f208ffc2..3eff702d74 100644 --- a/src/fmpz_poly/eulerian_polynomial.c +++ b/src/fmpz_poly/eulerian_polynomial.c @@ -51,7 +51,7 @@ _fmpz_vec_binomials(fmpz * res, ulong n, slong len) } } -void +static void _fmpz_poly_eulerian_polynomial_series(fmpz * res, ulong n) { slong ix, m; @@ -67,7 +67,7 @@ _fmpz_poly_eulerian_polynomial_series(fmpz * res, ulong n) _fmpz_vec_clear(tmp, 2 * m + 1); } -void +static void _fmpz_poly_eulerian_polynomial_rec(fmpz * res, ulong n) { slong jx; @@ -99,7 +99,7 @@ _fmpz_poly_eulerian_polynomial_rec(fmpz * res, ulong n) } } -void +static void _fmpz_poly_eulerian_polynomial(fmpz * res, ulong n) { ulong ix; diff --git a/src/fmpz_poly/evaluate_horner_d_2exp.c b/src/fmpz_poly/evaluate_horner_d_2exp.c index d061eedf9e..629e21c859 100644 --- a/src/fmpz_poly/evaluate_horner_d_2exp.c +++ b/src/fmpz_poly/evaluate_horner_d_2exp.c @@ -15,6 +15,12 @@ #include "fmpz.h" #include "fmpz_poly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + /* Naive double+exponent arithmetic; not designed to deal with underflow/overflow. */ typedef struct diff --git a/src/fmpz_poly/gcd_heuristic.c b/src/fmpz_poly/gcd_heuristic.c index 507219acf9..97f76d208d 100644 --- a/src/fmpz_poly/gcd_heuristic.c +++ b/src/fmpz_poly/gcd_heuristic.c @@ -18,7 +18,7 @@ Divide (arrayg, limbsg) by the positive value gc in-place and return the number of limbs written */ -slong flint_mpn_tdiv_q_fmpz_inplace(nn_ptr arrayg, slong limbsg, fmpz_t gc) +static slong flint_mpn_tdiv_q_fmpz_inplace(nn_ptr arrayg, slong limbsg, fmpz_t gc) { if (fmpz_size(gc) == 1) { @@ -46,7 +46,7 @@ slong flint_mpn_tdiv_q_fmpz_inplace(nn_ptr arrayg, slong limbsg, fmpz_t gc) Returns 1 if sign * (G, glen) * (Q, qlen) = (P, len), else returns 0. Temp requires space for glen + qlen - 1 coefficients */ -int multiplies_out(fmpz * P, slong len, const fmpz * Q, slong qlen, +static int multiplies_out(fmpz * P, slong len, const fmpz * Q, slong qlen, const fmpz * G, slong glen, slong sign, fmpz * temp) { int divides = 0; diff --git a/src/fmpz_poly/hensel_lift.c b/src/fmpz_poly/hensel_lift.c index 40cc4a461e..31cb08b0b9 100644 --- a/src/fmpz_poly/hensel_lift.c +++ b/src/fmpz_poly/hensel_lift.c @@ -12,7 +12,7 @@ #include "fmpz_poly.h" -void _fmpz_poly_hensel_lift(fmpz *G, fmpz *H, fmpz *A, fmpz *B, +static void _fmpz_poly_hensel_lift(fmpz *G, fmpz *H, fmpz *A, fmpz *B, const fmpz *f, slong lenF, const fmpz *g, slong lenG, const fmpz *h, slong lenH, const fmpz *a, slong lenA, const fmpz *b, slong lenB, diff --git a/src/fmpz_poly/mul.c b/src/fmpz_poly/mul.c index 21512dede7..3610a7d16e 100644 --- a/src/fmpz_poly/mul.c +++ b/src/fmpz_poly/mul.c @@ -19,7 +19,7 @@ # include "fft_small.h" #endif -void +static void _fmpz_poly_mul_tiny1(fmpz * res, const fmpz * poly1, slong len1, const fmpz * poly2, slong len2) { @@ -39,7 +39,7 @@ _fmpz_poly_mul_tiny1(fmpz * res, const fmpz * poly1, } } -void +static void _fmpz_poly_mul_tiny2(fmpz * res, const fmpz * poly1, slong len1, const fmpz * poly2, slong len2) { diff --git a/src/fmpz_poly/mul_karatsuba.c b/src/fmpz_poly/mul_karatsuba.c index d0a92376f1..4d62c406bb 100644 --- a/src/fmpz_poly/mul_karatsuba.c +++ b/src/fmpz_poly/mul_karatsuba.c @@ -14,6 +14,12 @@ #include "fmpz_vec.h" #include "fmpz_poly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + /* Implements karatsuba multiplication. There is no basecase crossover, so this is only efficient when the coefficients are large (the main usage diff --git a/src/fmpz_poly/mullow.c b/src/fmpz_poly/mullow.c index dc93d087a8..3de5efd0a8 100644 --- a/src/fmpz_poly/mullow.c +++ b/src/fmpz_poly/mullow.c @@ -19,7 +19,7 @@ #include "fft_small.h" #endif -void +static void _fmpz_poly_mullow_tiny1(fmpz * res, const fmpz * poly1, slong len1, const fmpz * poly2, slong len2, slong n) { @@ -39,7 +39,7 @@ _fmpz_poly_mullow_tiny1(fmpz * res, const fmpz * poly1, } } -void +static void _fmpz_poly_mullow_tiny2(fmpz * res, const fmpz * poly1, slong len1, const fmpz * poly2, slong len2, slong n) { diff --git a/src/fmpz_poly/num_real_roots_sturm.c b/src/fmpz_poly/num_real_roots_sturm.c index 80e0869ac0..7267daa409 100644 --- a/src/fmpz_poly/num_real_roots_sturm.c +++ b/src/fmpz_poly/num_real_roots_sturm.c @@ -82,11 +82,8 @@ void _fmpz_poly_num_real_roots_sturm(slong * n_neg, slong * n_pos, const fmpz * if (lenA <= 1) break; - { - fmpz *T; - slong len; - T = A, A = B, B = T, len = lenA, lenA = lenB, lenB = len; - } + FLINT_SWAP(fmpz *, A, B); + FLINT_SWAP(slong, lenA, lenB); if (delta == 1) { diff --git a/src/fmpz_poly/randtest_no_real_root.c b/src/fmpz_poly/randtest_no_real_root.c index b360665572..8e36af7b91 100644 --- a/src/fmpz_poly/randtest_no_real_root.c +++ b/src/fmpz_poly/randtest_no_real_root.c @@ -13,7 +13,7 @@ #include "fmpz_vec.h" #include "fmpz_poly.h" -void _quadratic(fmpz_poly_t p, flint_rand_t state, flint_bitcnt_t bits) +static void _quadratic(fmpz_poly_t p, flint_rand_t state, flint_bitcnt_t bits) { fmpz *a, *b, *c; @@ -35,7 +35,7 @@ void _quadratic(fmpz_poly_t p, flint_rand_t state, flint_bitcnt_t bits) _fmpz_poly_set_length(p, 3); } -void _even(fmpz_poly_t p, flint_rand_t state, slong len, flint_bitcnt_t bits) +static void _even(fmpz_poly_t p, flint_rand_t state, slong len, flint_bitcnt_t bits) { slong n, i; diff --git a/src/fmpz_poly/sqr.c b/src/fmpz_poly/sqr.c index 80fbc473e5..d0b6ffe370 100644 --- a/src/fmpz_poly/sqr.c +++ b/src/fmpz_poly/sqr.c @@ -19,7 +19,7 @@ # include "fft_small.h" #endif -void _fmpz_poly_sqr_tiny1(fmpz * res, const fmpz * poly, slong len) +static void _fmpz_poly_sqr_tiny1(fmpz * res, const fmpz * poly, slong len) { slong i, j, c; @@ -41,7 +41,7 @@ void _fmpz_poly_sqr_tiny1(fmpz * res, const fmpz * poly, slong len) } } -void _fmpz_poly_sqr_tiny2(fmpz * res, const fmpz * poly, slong len) +static void _fmpz_poly_sqr_tiny2(fmpz * res, const fmpz * poly, slong len) { slong i, j, k, c, d; ulong hi, lo; diff --git a/src/fmpz_poly/sqr_karatsuba.c b/src/fmpz_poly/sqr_karatsuba.c index 371f928c50..115b36269f 100644 --- a/src/fmpz_poly/sqr_karatsuba.c +++ b/src/fmpz_poly/sqr_karatsuba.c @@ -14,18 +14,13 @@ #include "fmpz_vec.h" #include "fmpz_poly.h" -/* - For documentation, see fmpz_poly/mul_karatsuba.c - */ - -extern void revbin1(fmpz * out, const fmpz * in, slong len, slong bits); - -extern void revbin2(fmpz * out, const fmpz * in, slong len, slong bits); - -extern void _fmpz_vec_add_rev(fmpz * in1, fmpz * in2, slong bits); +/* For documentation, see fmpz_poly/mul_karatsuba.c */ +void revbin1(fmpz * out, const fmpz * in, slong len, slong bits); +void revbin2(fmpz * out, const fmpz * in, slong len, slong bits); +void _fmpz_vec_add_rev(fmpz * in1, fmpz * in2, slong bits); -void _fmpz_poly_sqr_kara_recursive(fmpz * out, fmpz * rev, - fmpz * temp, slong bits) +static void +_fmpz_poly_sqr_kara_recursive(fmpz * out, fmpz * rev, fmpz * temp, slong bits) { slong len = (WORD(1) << bits); slong m = len / 2; diff --git a/src/fmpz_poly/sqrlow.c b/src/fmpz_poly/sqrlow.c index 2472c60367..1a06100f0d 100644 --- a/src/fmpz_poly/sqrlow.c +++ b/src/fmpz_poly/sqrlow.c @@ -20,7 +20,7 @@ # include "fft_small.h" #endif -void _fmpz_poly_sqrlow_tiny1(fmpz * res, const fmpz * poly, slong len, slong n) +static void _fmpz_poly_sqrlow_tiny1(fmpz * res, const fmpz * poly, slong len, slong n) { slong i, j, c; @@ -43,7 +43,7 @@ void _fmpz_poly_sqrlow_tiny1(fmpz * res, const fmpz * poly, slong len, slong n) } } -void _fmpz_poly_sqrlow_tiny2(fmpz * res, const fmpz * poly, slong len, slong n) +static void _fmpz_poly_sqrlow_tiny2(fmpz * res, const fmpz * poly, slong len, slong n) { slong i, j, k, c, d; ulong hi, lo; diff --git a/src/fmpz_poly/sqrlow_karatsuba_n.c b/src/fmpz_poly/sqrlow_karatsuba_n.c index 98aa620d25..4af855d53d 100644 --- a/src/fmpz_poly/sqrlow_karatsuba_n.c +++ b/src/fmpz_poly/sqrlow_karatsuba_n.c @@ -19,7 +19,7 @@ For documentation, see fmpz_poly/mullow_karatsuba_n.c */ -void _fmpz_poly_sqrlow_kara_recursive(fmpz * out, +static void _fmpz_poly_sqrlow_kara_recursive(fmpz * out, const fmpz * pol, fmpz * temp, slong len) { slong m1 = len / 2; diff --git a/src/fmpz_poly/taylor_shift_horner.c b/src/fmpz_poly/taylor_shift_horner.c index d7d786d0c6..01d3ee27d2 100644 --- a/src/fmpz_poly/taylor_shift_horner.c +++ b/src/fmpz_poly/taylor_shift_horner.c @@ -45,7 +45,6 @@ _fmpz_poly_taylor_shift_horner(fmpz * poly, const fmpz_t c, slong n) } else { - slong i; fmpz_t d, one; *one = 1; diff --git a/src/fmpz_poly/taylor_shift_multi_mod_threaded.c b/src/fmpz_poly/taylor_shift_multi_mod_threaded.c index d8e6f96225..8eadee1f47 100644 --- a/src/fmpz_poly/taylor_shift_multi_mod_threaded.c +++ b/src/fmpz_poly/taylor_shift_multi_mod_threaded.c @@ -30,7 +30,7 @@ typedef struct } mod_ui_arg_t; -void +static void _fmpz_vec_multi_mod_ui_worker(void * arg_ptr) { mod_ui_arg_t arg = *((mod_ui_arg_t *) arg_ptr); @@ -65,7 +65,7 @@ _fmpz_vec_multi_mod_ui_worker(void * arg_ptr) fmpz_comb_temp_clear(comb_temp); } -void +static void _fmpz_vec_multi_mod_ui_threaded(nn_ptr * residues, fmpz * vec, slong len, nn_srcptr primes, slong num_primes, int crt) { @@ -115,7 +115,7 @@ typedef struct } taylor_shift_arg_t; -void +static void _fmpz_poly_multi_taylor_shift_worker(void * arg_ptr) { taylor_shift_arg_t arg = *((taylor_shift_arg_t *) arg_ptr); @@ -133,7 +133,7 @@ _fmpz_poly_multi_taylor_shift_worker(void * arg_ptr) } } -void +static void _fmpz_poly_multi_taylor_shift_threaded(nn_ptr * residues, slong len, const fmpz_t c, nn_srcptr primes, slong num_primes) { diff --git a/src/fmpz_poly/test/t-evaluate_horner_d_2exp.c b/src/fmpz_poly/test/t-evaluate_horner_d_2exp.c index 7865d0683c..ac0475d9f1 100644 --- a/src/fmpz_poly/test/t-evaluate_horner_d_2exp.c +++ b/src/fmpz_poly/test/t-evaluate_horner_d_2exp.c @@ -18,9 +18,9 @@ TEST_FUNCTION_START(fmpz_poly_evaluate_horner_d_2exp, state) { - int i; + slong ix; - for (i = 0; i < 1000 * flint_test_multiplier(); i++) + for (ix = 0; ix < 1000 * flint_test_multiplier(); ix++) { fmpz_poly_t f; double x, y, z, t; @@ -52,7 +52,7 @@ TEST_FUNCTION_START(fmpz_poly_evaluate_horner_d_2exp, state) fmpz_poly_clear(f); } - for (i = 0; i < 1000 * flint_test_multiplier(); i++) + for (ix = 0; ix < 1000 * flint_test_multiplier(); ix++) { fmpz_poly_t f; double x, y; From 2d4ad4f49eff4d42dbe0ff88c64268c1ed6bca21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 02:15:22 +0200 Subject: [PATCH 023/114] fmpz_mod --- src/fmpz_mod/pow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fmpz_mod/pow.c b/src/fmpz_mod/pow.c index aa1e92f960..91174fdd27 100644 --- a/src/fmpz_mod/pow.c +++ b/src/fmpz_mod/pow.c @@ -18,7 +18,7 @@ #if FLINT_HAVE_FFT_SMALL -void +static void _fmpz_mod_pow_fmpz(fmpz_t res, const fmpz_t x, const fmpz_t e, const fmpz_mod_ctx_t ctx) { if (*e <= 2) @@ -93,7 +93,7 @@ int fmpz_mod_pow_fmpz(fmpz_t a, const fmpz_t b, const fmpz_t pow, #if FLINT_HAVE_FFT_SMALL -void +static void _fmpz_mod_pow_ui(fmpz_t res, const fmpz_t x, ulong e, const fmpz_mod_ctx_t ctx) { if (e <= 2) From c0703c658c7832b95d9de137c9089739336831e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 02:17:40 +0200 Subject: [PATCH 024/114] fmpz_mod_vec --- src/fmpz_mod_vec/set_fmpz_vec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fmpz_mod_vec/set_fmpz_vec.c b/src/fmpz_mod_vec/set_fmpz_vec.c index 8092a61612..c3019f8d38 100644 --- a/src/fmpz_mod_vec/set_fmpz_vec.c +++ b/src/fmpz_mod_vec/set_fmpz_vec.c @@ -32,7 +32,7 @@ worker(slong i, void * args) fmpz_mod_set_fmpz(w->res + i, w->vec + i, w->ctx); } -void +static void _fmpz_mod_vec_set_fmpz_vec_threaded(fmpz * A, const fmpz * B, slong len, const fmpz_mod_ctx_t ctx) { From d46cc5c06d9da5de17dfcf20789bd24609ea6f73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 02:17:49 +0200 Subject: [PATCH 025/114] fmpz_mod_mat --- src/fmpz_mod_mat.h | 6 +++++- src/fmpz_mod_mat/charpoly_berkowitz.c | 2 +- src/fmpz_mod_mat/mul_classical_threaded.c | 4 ++-- src/fmpz_mod_mat/test/t-mul.c | 3 ++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/fmpz_mod_mat.h b/src/fmpz_mod_mat.h index f76ffb1b9f..78fb3caeb5 100644 --- a/src/fmpz_mod_mat.h +++ b/src/fmpz_mod_mat.h @@ -23,9 +23,11 @@ #include "fmpz_mod_types.h" #ifdef __cplusplus - extern "C" { +extern "C" { #endif +FLINT_HEADER_START + #define FMPZ_MOD_MAT_MUL_TRANSPOSE_CUTOFF 10 /* Element access ********************************************************/ @@ -285,6 +287,8 @@ void fmpz_mod_mat_invert_cols(fmpz_mod_mat_t mat, slong * perm, const fmpz_mod_c fmpz_mat_invert_cols(mat, perm); } +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/fmpz_mod_mat/charpoly_berkowitz.c b/src/fmpz_mod_mat/charpoly_berkowitz.c index 183f54b1aa..041d805d86 100644 --- a/src/fmpz_mod_mat/charpoly_berkowitz.c +++ b/src/fmpz_mod_mat/charpoly_berkowitz.c @@ -18,7 +18,7 @@ #include "gr.h" #include "gr_mat.h" -void _fmpz_mod_mat_charpoly_berkowitz(fmpz* cp, const fmpz_mod_mat_t mat, +static void _fmpz_mod_mat_charpoly_berkowitz(fmpz* cp, const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx) { gr_ctx_t gr_ctx; diff --git a/src/fmpz_mod_mat/mul_classical_threaded.c b/src/fmpz_mod_mat/mul_classical_threaded.c index 46bff054e6..d5c182b8f3 100644 --- a/src/fmpz_mod_mat/mul_classical_threaded.c +++ b/src/fmpz_mod_mat/mul_classical_threaded.c @@ -82,7 +82,7 @@ typedef struct const fmpz_mod_ctx_struct * ctx; } fmpz_mod_mat_transpose_arg_t; -void +static void _fmpz_mod_mat_addmul_transpose_worker(void * arg_ptr) { fmpz_mod_mat_transpose_arg_t arg = *((fmpz_mod_mat_transpose_arg_t *) arg_ptr); @@ -239,7 +239,7 @@ _fmpz_mod_mat_mul_classical_threaded_pool_op(fmpz_mod_mat_t D, const fmpz_mod_ma m, k, n, op, threads, num_threads, ctx); } -void +static void fmpz_mod_mat_mul_classical_threaded_op(fmpz_mod_mat_t D, const fmpz_mod_mat_t C, const fmpz_mod_mat_t A, const fmpz_mod_mat_t B, int op, const fmpz_mod_ctx_t ctx) { diff --git a/src/fmpz_mod_mat/test/t-mul.c b/src/fmpz_mod_mat/test/t-mul.c index ebe41b922f..b6298298e5 100644 --- a/src/fmpz_mod_mat/test/t-mul.c +++ b/src/fmpz_mod_mat/test/t-mul.c @@ -11,6 +11,7 @@ #include "test_helpers.h" #include "fmpz.h" +#include "fmpz_mod.h" #include "fmpz_mod_mat.h" TEST_FUNCTION_START(fmpz_mod_mat_mul, state) @@ -109,7 +110,7 @@ TEST_FUNCTION_START(fmpz_mod_mat_mul, state) /* Test aliasing with windows */ { - fmpz_mod_mat_t A, B, A_window; + fmpz_mod_mat_t A_window; fmpz_mod_ctx_t ctx; fmpz_mod_ctx_init_ui(ctx, 3); From c10ee221073b6c07bcc2965e3a44a6d85c1755df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 01:59:08 +0200 Subject: [PATCH 026/114] fmpz_mod_poly --- src/fmpz_mod_poly.h | 4 ++++ .../compose_mod_brent_kung_vec_preinv_threaded.c | 2 +- src/fmpz_mod_poly/powers_mod_bsgs_threaded.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/fmpz_mod_poly.h b/src/fmpz_mod_poly.h index c12530f76e..c110129cdb 100644 --- a/src/fmpz_mod_poly.h +++ b/src/fmpz_mod_poly.h @@ -26,6 +26,8 @@ extern "C" { #endif +FLINT_HEADER_START + #define FMPZ_MOD_POLY_HGCD_CUTOFF 128 /* HGCD: Basecase -> Recursion */ #define FMPZ_MOD_POLY_GCD_CUTOFF 256 /* GCD: Euclidean -> HGCD */ @@ -971,6 +973,8 @@ void fmpz_mod_poly_fmpz_sub(fmpz_mod_poly_t res, const fmpz_t c, #define fmpz_mod_poly_set_coeff_mpz _Pragma("GCC error \"'fmpz_mod_poly_set_coeff_mpz' is deprecated. Use 'fmpz_mod_poly_set_coeff_fmpz' instead.\"") #define fmpz_mod_poly_get_coeff_mpz _Pragma("GCC error \"'fmpz_mod_poly_get_coeff_mpz' is deprecated. Use 'fmpz_mod_poly_get_coeff_fmpz' instead.\"") +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/fmpz_mod_poly/compose_mod_brent_kung_vec_preinv_threaded.c b/src/fmpz_mod_poly/compose_mod_brent_kung_vec_preinv_threaded.c index 46711070b2..a7db20e4c9 100644 --- a/src/fmpz_mod_poly/compose_mod_brent_kung_vec_preinv_threaded.c +++ b/src/fmpz_mod_poly/compose_mod_brent_kung_vec_preinv_threaded.c @@ -42,7 +42,7 @@ typedef struct } compose_vec_arg_t; -void +static void _fmpz_mod_poly_compose_mod_brent_kung_vec_preinv_worker(void * arg_ptr) { compose_vec_arg_t arg = *((compose_vec_arg_t *) arg_ptr); diff --git a/src/fmpz_mod_poly/powers_mod_bsgs_threaded.c b/src/fmpz_mod_poly/powers_mod_bsgs_threaded.c index a43c5a1785..60b6962317 100644 --- a/src/fmpz_mod_poly/powers_mod_bsgs_threaded.c +++ b/src/fmpz_mod_poly/powers_mod_bsgs_threaded.c @@ -32,7 +32,7 @@ typedef struct #endif } fmpz_powers_preinv_arg_t; -void +static void _fmpz_mod_poly_powers_mod_preinv_worker(void * arg_ptr) { fmpz_powers_preinv_arg_t arg = *((fmpz_powers_preinv_arg_t *) arg_ptr); From 95900ae7e407c1fd817718a5598e5174ceb4301f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 10:53:54 +0200 Subject: [PATCH 027/114] fmpq --- src/fmpq.h | 2 +- src/fmpq/reconstruct_fmpz_2.c | 6 +++--- src/fmpq/set_cfrac.c | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/fmpq.h b/src/fmpq.h index 5ccb02f708..98a37d269d 100644 --- a/src/fmpq.h +++ b/src/fmpq.h @@ -78,8 +78,8 @@ void flint_mpq_init_set_readonly(mpq_t z, const fmpq_t f); void flint_mpq_clear_readonly(mpq_t z); void fmpq_init_set_readonly(fmpq_t f, const mpq_t z); -void fmpq_clear_readonly(fmpq_t f); #endif +void fmpq_clear_readonly(fmpq_t f); /* conversions ***************************************************************/ diff --git a/src/fmpq/reconstruct_fmpz_2.c b/src/fmpq/reconstruct_fmpz_2.c index def61ccd95..5ff5cc9c36 100644 --- a/src/fmpq/reconstruct_fmpz_2.c +++ b/src/fmpq/reconstruct_fmpz_2.c @@ -255,7 +255,7 @@ static int coprime_uiui(ulong u1, ulong u0, ulong v1, ulong v0) } -int _fmpq_reconstruct_fmpz_2_ui(fmpz_t n, fmpz_t d, +static int _fmpq_reconstruct_fmpz_2_ui(fmpz_t n, fmpz_t d, const fmpz_t a, const fmpz_t m, const fmpz_t NN, const fmpz_t DD) { ulong Q, R, A, B, N; @@ -307,7 +307,7 @@ int _fmpq_reconstruct_fmpz_2_ui(fmpz_t n, fmpz_t d, return 0; } -int _fmpq_reconstruct_fmpz_2_uiui(fmpz_t n, fmpz_t d, +static int _fmpq_reconstruct_fmpz_2_uiui(fmpz_t n, fmpz_t d, const fmpz_t a, const fmpz_t m, const fmpz_t NN, const fmpz_t DD) { ulong extra; @@ -379,7 +379,7 @@ int _fmpq_reconstruct_fmpz_2_uiui(fmpz_t n, fmpz_t d, return 0; } -int _fmpq_reconstruct_fmpz_2_ui_array(fmpz_t n, fmpz_t d, +static int _fmpq_reconstruct_fmpz_2_ui_array(fmpz_t n, fmpz_t d, const fmpz_t a, const fmpz_t m, const fmpz_t N, const fmpz_t D) { ulong ex0, ex1, ex2, ex3, A1, A0, B1, B0; diff --git a/src/fmpq/set_cfrac.c b/src/fmpq/set_cfrac.c index bb986aafd2..546b618089 100644 --- a/src/fmpq/set_cfrac.c +++ b/src/fmpq/set_cfrac.c @@ -11,8 +11,7 @@ #include "fmpq.h" - -void _fmpq_set_cfrac_divconquer(_fmpz_mat22_t M, const fmpz * c, slong n) +static void _fmpq_set_cfrac_divconquer(_fmpz_mat22_t M, const fmpz * c, slong n) { _fmpz_mat22_one(M); if (n < 32) @@ -33,7 +32,6 @@ void _fmpq_set_cfrac_divconquer(_fmpz_mat22_t M, const fmpz * c, slong n) } } - void fmpq_set_cfrac(fmpq_t x, const fmpz * c, slong n) { _fmpz_mat22_t M; From 4bc69e32cf19116b77d3db4e4959211ef889f759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 10:57:29 +0200 Subject: [PATCH 028/114] fmpq_mat --- src/fmpq_mat/can_solve_multi_mod.c | 10 ++++++-- src/fmpq_mat/get_fmpz_mat_rowwise.c | 2 +- src/fmpq_mat/solve_dixon.c | 2 +- src/fmpq_mat/solve_multi_mod.c | 40 ++--------------------------- src/fmpq_mat/test/t-is_integral.c | 4 +-- 5 files changed, 14 insertions(+), 44 deletions(-) diff --git a/src/fmpq_mat/can_solve_multi_mod.c b/src/fmpq_mat/can_solve_multi_mod.c index e55308a1cb..015061adf8 100644 --- a/src/fmpq_mat/can_solve_multi_mod.c +++ b/src/fmpq_mat/can_solve_multi_mod.c @@ -17,7 +17,13 @@ #include "fmpz_mat.h" #include "fmpq_mat.h" -static int +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + +int _fmpq_mat_check_solution_fmpz_mat(const fmpq_mat_t X, const fmpz_mat_t A, const fmpz_mat_t B) { slong i, j; @@ -84,7 +90,7 @@ _permpiv_copy(slong * perm, slong * prm, slong * pivots, slong * piv, slong n) } } -int +static int _fmpq_mat_can_solve_multi_mod(fmpq_mat_t X, const fmpz_mat_t A, const fmpz_mat_t B, const fmpz_t D) { diff --git a/src/fmpq_mat/get_fmpz_mat_rowwise.c b/src/fmpq_mat/get_fmpz_mat_rowwise.c index 3b787a99d7..e3a57b93ae 100644 --- a/src/fmpq_mat/get_fmpz_mat_rowwise.c +++ b/src/fmpq_mat/get_fmpz_mat_rowwise.c @@ -13,7 +13,7 @@ #include "fmpz_mat.h" #include "fmpq_mat.h" -void +static void _fmpq_mat_get_fmpz_mat_rowwise(fmpz_mat_struct ** num, fmpz * den, const fmpq_mat_struct ** mat, slong n) { diff --git a/src/fmpq_mat/solve_dixon.c b/src/fmpq_mat/solve_dixon.c index a42f7a6c68..cb0b9fb6fc 100644 --- a/src/fmpq_mat/solve_dixon.c +++ b/src/fmpq_mat/solve_dixon.c @@ -21,7 +21,7 @@ int _fmpq_mat_check_solution_fmpz_mat(const fmpq_mat_t X, const fmpz_mat_t A, const fmpz_mat_t B); -void +static void _fmpq_mat_solve_dixon(fmpq_mat_t X, const fmpz_mat_t A, const fmpz_mat_t B, const nmod_mat_t Ainv, ulong p, diff --git a/src/fmpq_mat/solve_multi_mod.c b/src/fmpq_mat/solve_multi_mod.c index 77069657ff..5d1a991f32 100644 --- a/src/fmpq_mat/solve_multi_mod.c +++ b/src/fmpq_mat/solve_multi_mod.c @@ -17,6 +17,8 @@ #include "fmpz_mat.h" #include "fmpq_mat.h" +int _fmpq_mat_check_solution_fmpz_mat(const fmpq_mat_t X, const fmpz_mat_t A, const fmpz_mat_t B); + static ulong fmpz_mat_find_good_prime_and_solve(nmod_mat_t Xmod, nmod_mat_t Amod, nmod_mat_t Bmod, const fmpz_mat_t A, const fmpz_mat_t B, const fmpz_t det_bound) @@ -50,44 +52,6 @@ static ulong fmpz_mat_find_good_prime_and_solve(nmod_mat_t Xmod, return p; } -static int -_fmpq_mat_check_solution_fmpz_mat(const fmpq_mat_t X, const fmpz_mat_t A, const fmpz_mat_t B) -{ - slong i, j; - fmpz_mat_t Xclear, AXclear; - fmpz_t t; - fmpz * Xden; - int ok; - - Xden = _fmpz_vec_init(X->c); - fmpz_mat_init(Xclear, X->r, X->c); - fmpz_mat_init(AXclear, B->r, B->c); - fmpz_init(t); - - fmpq_mat_get_fmpz_mat_colwise(Xclear, Xden, X); - fmpz_mat_mul(AXclear, A, Xclear); - - ok = 1; - for (i = 0; i < B->r && ok; i++) - { - for (j = 0; j < B->c && ok; j++) - { - /* AXclear[i,j] / Xden[j] = B[i,j] */ - fmpz_mul(t, fmpz_mat_entry(B, i, j), Xden + j); - - if (!fmpz_equal(t, fmpz_mat_entry(AXclear, i, j))) - ok = 0; - } - } - - _fmpz_vec_clear(Xden, X->c); - fmpz_mat_clear(Xclear); - fmpz_mat_clear(AXclear); - fmpz_clear(t); - - return ok; -} - static void _fmpq_mat_solve_multi_mod(fmpq_mat_t X, const fmpz_mat_t A, const fmpz_mat_t B, diff --git a/src/fmpq_mat/test/t-is_integral.c b/src/fmpq_mat/test/t-is_integral.c index 303b9836a5..fd0d429d52 100644 --- a/src/fmpq_mat/test/t-is_integral.c +++ b/src/fmpq_mat/test/t-is_integral.c @@ -16,9 +16,9 @@ TEST_FUNCTION_START(fmpq_mat_is_integral, state) { - int i; + slong ix; - for (i = 0; i < 100 * flint_test_multiplier(); i++) + for (ix = 0; ix < 100 * flint_test_multiplier(); ix++) { fmpq_mat_t A; fmpz_mat_t B; From b9256d9835f86ab3c6720bda03e742c9280bfb13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 11:20:37 +0200 Subject: [PATCH 029/114] fmpq_poly --- src/fmpq_poly/cos_series.c | 4 ++-- src/fmpq_poly/exp_series.c | 8 ++++---- src/fmpq_poly/inv_series_newton.c | 22 +++++++++++----------- src/fmpq_poly/sin_cos_series.c | 8 +++++++- src/fmpq_poly/sin_series.c | 4 ++-- src/fmpq_poly/test/t-resultant.c | 1 - 6 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/fmpq_poly/cos_series.c b/src/fmpq_poly/cos_series.c index fad026fbca..bd12e0ba6f 100644 --- a/src/fmpq_poly/cos_series.c +++ b/src/fmpq_poly/cos_series.c @@ -17,7 +17,7 @@ void _fmpq_poly_sin_cos_series_basecase_can(fmpz * S, fmpz_t Sden, fmpz * C, fmpz_t Cden, const fmpz * A, const fmpz_t Aden, slong Alen, slong n, int can); -void +static void _fmpq_poly_cos_series_basecase(fmpz * g, fmpz_t gden, const fmpz * h, const fmpz_t hden, slong hlen, slong n) { @@ -36,7 +36,7 @@ _fmpq_poly_cos_series_basecase(fmpz * g, fmpz_t gden, _fmpz_vec_clear(tmp, n + 1); } -void +static void _fmpq_poly_cos_series_tangent(fmpz * g, fmpz_t gden, const fmpz * h, const fmpz_t hden, slong hlen, slong n) { diff --git a/src/fmpq_poly/exp_series.c b/src/fmpq_poly/exp_series.c index 827d6b23f8..c76cb45fb4 100644 --- a/src/fmpq_poly/exp_series.c +++ b/src/fmpq_poly/exp_series.c @@ -36,7 +36,7 @@ static ulong _fmpz_gcd_small(const fmpz_t g, ulong h) /* Basecase algorithm, given a precomputed derivative of of the input series (Alen still refers to the length of the original series). */ -void +static void _fmpq_poly_exp_series_basecase_deriv(fmpz * B, fmpz_t Bden, const fmpz * Aprime, const fmpz_t Aden, slong Alen, slong n) { @@ -69,7 +69,7 @@ _fmpq_poly_exp_series_basecase_deriv(fmpz * B, fmpz_t Bden, } /* Basecase algorithm; supports aliasing and guarantees canonical output. */ -void +static void _fmpq_poly_exp_series_basecase(fmpz * B, fmpz_t Bden, const fmpz * A, const fmpz_t Aden, slong Alen, slong n) { @@ -99,7 +99,7 @@ _fmpq_poly_exp_series_basecase(fmpz * B, fmpz_t Bden, } /* c_k x^k -> c_k x^k / (m+k) */ -void _fmpq_poly_integral_offset(fmpz * rpoly, fmpz_t rden, +static void _fmpq_poly_integral_offset(fmpz * rpoly, fmpz_t rden, const fmpz * poly, const fmpz_t den, slong len, slong m) { slong k; @@ -235,7 +235,7 @@ CONCATENATE(fmpz * poly, fmpz_t den, const fmpz_t high_den, slong m, slong n) /* Newton iteration. If g == NULL, computes {f, fden, n} = exp({h, hden, hlen}). If g != NULL, simultaneously computes {g, gden, n} = exp(-{h, hden, hlen}). Allows aliasing between (f, fden) and (h, hden) but not with (g, gden). */ -void +static void _fmpq_poly_exp_series_newton(fmpz * f, fmpz_t fden, fmpz * g, fmpz * gden, const fmpz * h, const fmpz_t hden, diff --git a/src/fmpq_poly/inv_series_newton.c b/src/fmpq_poly/inv_series_newton.c index b87c3a6aed..158dcb3dfd 100644 --- a/src/fmpq_poly/inv_series_newton.c +++ b/src/fmpq_poly/inv_series_newton.c @@ -105,25 +105,25 @@ _fmpq_poly_inv_series_newton(fmpz * Qinv, fmpz_t Qinvden, FLINT_NEWTON_INIT(FMPQ_POLY_INV_NEWTON_CUTOFF, n) - FLINT_NEWTON_BASECASE(n) - _fmpq_poly_inv_series_basecase_rev(Qinv, Qinvden, W, Wden, Q, Qden, Qlen, n); + FLINT_NEWTON_BASECASE(nx) + _fmpq_poly_inv_series_basecase_rev(Qinv, Qinvden, W, Wden, Q, Qden, Qlen, nx); FLINT_NEWTON_END_BASECASE - FLINT_NEWTON_LOOP(m, n) + FLINT_NEWTON_LOOP(mx, nx) - Qnlen = FLINT_MIN(Qlen, n); - Wlen = FLINT_MIN(Qnlen + m - 1, n); - W2len = Wlen - m; + Qnlen = FLINT_MIN(Qlen, nx); + Wlen = FLINT_MIN(Qnlen + mx - 1, nx); + W2len = Wlen - mx; - MULLOW(W, Q, Qnlen, Qinv, m, Wlen); + MULLOW(W, Q, Qnlen, Qinv, mx, Wlen); fmpz_mul(Wden, Qden, Qinvden); - MULLOW(Qinv + m, Qinv, m, W + m, W2len, n - m); + MULLOW(Qinv + mx, Qinv, mx, W + mx, W2len, nx - mx); fmpz_mul(Qinvden, Qinvden, Wden); - _fmpz_vec_scalar_mul_fmpz(Qinv, Qinv, m, Wden); - _fmpz_vec_neg(Qinv + m, Qinv + m, n - m); - _fmpq_poly_canonicalise(Qinv, Qinvden, n); + _fmpz_vec_scalar_mul_fmpz(Qinv, Qinv, mx, Wden); + _fmpz_vec_neg(Qinv + mx, Qinv + mx, nx - mx); + _fmpq_poly_canonicalise(Qinv, Qinvden, nx); FLINT_NEWTON_END_LOOP diff --git a/src/fmpq_poly/sin_cos_series.c b/src/fmpq_poly/sin_cos_series.c index 3ba1b30b5b..4bdaaca7ec 100644 --- a/src/fmpq_poly/sin_cos_series.c +++ b/src/fmpq_poly/sin_cos_series.c @@ -13,6 +13,12 @@ #include "fmpz_vec.h" #include "fmpq_poly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void _fmpq_poly_sin_cos_series_basecase_can(fmpz * S, fmpz_t Sden, fmpz * C, fmpz_t Cden, const fmpz * A, const fmpz_t Aden, slong Alen, slong n, int can) @@ -89,7 +95,7 @@ _fmpq_poly_sin_cos_series_basecase(fmpz * S, fmpz_t Sden, _fmpq_poly_sin_cos_series_basecase_can(S, Sden, C, Cden, A, Aden, Alen, n, 3); } -void +static void _fmpq_poly_sin_cos_series_tangent(fmpz * S, fmpz_t Sden, fmpz * C, fmpz_t Cden, const fmpz * A, const fmpz_t Aden, slong Alen, slong n) diff --git a/src/fmpq_poly/sin_series.c b/src/fmpq_poly/sin_series.c index 9b0b42f878..7dba35efe0 100644 --- a/src/fmpq_poly/sin_series.c +++ b/src/fmpq_poly/sin_series.c @@ -17,7 +17,7 @@ void _fmpq_poly_sin_cos_series_basecase_can(fmpz * S, fmpz_t Sden, fmpz * C, fmpz_t Cden, const fmpz * A, const fmpz_t Aden, slong Alen, slong n, int can); -void +static void _fmpq_poly_sin_series_basecase(fmpz * g, fmpz_t gden, const fmpz * h, const fmpz_t hden, slong hlen, slong n) { @@ -36,7 +36,7 @@ _fmpq_poly_sin_series_basecase(fmpz * g, fmpz_t gden, _fmpz_vec_clear(tmp, n + 1); } -void +static void _fmpq_poly_sin_series_tangent(fmpz * g, fmpz_t gden, const fmpz * h, const fmpz_t hden, slong hlen, slong n) { diff --git a/src/fmpq_poly/test/t-resultant.c b/src/fmpq_poly/test/t-resultant.c index 63d3edccb6..320b570a96 100644 --- a/src/fmpq_poly/test/t-resultant.c +++ b/src/fmpq_poly/test/t-resultant.c @@ -107,7 +107,6 @@ TEST_FUNCTION_START(fmpq_poly_resultant, state) { fmpq_poly_t f, g; fmpq_t x, y; - int result; fmpq_poly_init(f); fmpq_poly_init(g); From 27c9e7ee260189f6281c914160f0f4e04d5b9859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 11:23:45 +0200 Subject: [PATCH 030/114] fq_mat_templates --- src/fq_mat_templates.h | 6 +++++- src/fq_mat_templates/rref.c | 1 - src/fq_mat_templates/test/t-rref.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fq_mat_templates.h b/src/fq_mat_templates.h index 895316af04..c97fb96b6d 100644 --- a/src/fq_mat_templates.h +++ b/src/fq_mat_templates.h @@ -17,9 +17,11 @@ #include "templates.h" #ifdef __cplusplus - extern "C" { +extern "C" { #endif +FLINT_HEADER_START + /* Memory management ********************************************************/ void TEMPLATE(T, mat_init)(TEMPLATE(T, mat_t) mat, slong rows, slong cols, @@ -344,6 +346,8 @@ void TEMPLATE(T, mat_similarity) (TEMPLATE(T, mat_t) A, slong r, * const TEMPLATE(T, mat_t) X, const TEMPLATE(T, ctx_t) ctx); */ +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/fq_mat_templates/rref.c b/src/fq_mat_templates/rref.c index 1d0363ddd9..21dfc1f796 100644 --- a/src/fq_mat_templates/rref.c +++ b/src/fq_mat_templates/rref.c @@ -34,7 +34,6 @@ TEMPLATE(T, mat_rref) (TEMPLATE(T, mat_t) B, const TEMPLATE(T, mat_t) A, const T if (B->r == 1) { TEMPLATE(T, struct) * c; - slong i, j; slong r = 0; for (i = 0; i < B->c; i++) diff --git a/src/fq_mat_templates/test/t-rref.c b/src/fq_mat_templates/test/t-rref.c index 29085cfdb6..ce8ea9f16b 100644 --- a/src/fq_mat_templates/test/t-rref.c +++ b/src/fq_mat_templates/test/t-rref.c @@ -17,7 +17,7 @@ #include "perm.h" int -check_rref_form(slong * perm, TEMPLATE(T, mat_t) A, slong rank, +check_rref_form(slong * FLINT_UNUSED(perm), TEMPLATE(T, mat_t) A, slong rank, const TEMPLATE(T, ctx_t) ctx) { slong i, j, k, prev_pivot; From 6d726dd8cfca1c913633099871450ebc6e70faf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 11:23:54 +0200 Subject: [PATCH 031/114] fq_poly_templates --- src/fq_poly_templates.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/fq_poly_templates.h b/src/fq_poly_templates.h index fe9a291dbe..137e0a7e63 100644 --- a/src/fq_poly_templates.h +++ b/src/fq_poly_templates.h @@ -21,6 +21,8 @@ extern "C" { #endif +FLINT_HEADER_START + /* Memory management ********************************************************/ void TEMPLATE(T, poly_init)(TEMPLATE(T, poly_t) poly, const TEMPLATE(T, ctx_t) ctx); @@ -1041,6 +1043,8 @@ void TEMPLATE(T, mat_charpoly)(TEMPLATE(T, poly_t) p, void TEMPLATE(T, mat_minpoly) (TEMPLATE(T, poly_t) p, const TEMPLATE(T, mat_t) X, const TEMPLATE(T, ctx_t) ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif From 91d91245fc6ec26b8da2ea3d8d0deeea5051a26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 11:26:08 +0200 Subject: [PATCH 032/114] fq_poly_factor_templates --- src/fq_poly_factor_templates/factor.c | 4 ++-- src/fq_poly_factor_templates/roots.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fq_poly_factor_templates/factor.c b/src/fq_poly_factor_templates/factor.c index b6aba62970..6d3e602083 100644 --- a/src/fq_poly_factor_templates/factor.c +++ b/src/fq_poly_factor_templates/factor.c @@ -35,7 +35,7 @@ __TEMPLATE(T, poly_factor1) (TEMPLATE(T, poly_factor_t) res, TEMPLATE(T, poly_factor_berlekamp) (res, f, ctx); } -void +static void __TEMPLATE(T, poly_factor) (TEMPLATE(T, poly_factor_t) result, TEMPLATE(T, t) leading_coeff, const TEMPLATE(T, poly_t) input, @@ -94,7 +94,7 @@ __TEMPLATE(T, poly_factor) (TEMPLATE(T, poly_factor_t) result, return; } -void +static void __TEMPLATE(T, poly_factor_deflation) (TEMPLATE(T, poly_factor_t) result, TEMPLATE(T, t) leading_coeff, const TEMPLATE(T, poly_t) input, diff --git a/src/fq_poly_factor_templates/roots.c b/src/fq_poly_factor_templates/roots.c index fcd98b98cb..e75d77e005 100644 --- a/src/fq_poly_factor_templates/roots.c +++ b/src/fq_poly_factor_templates/roots.c @@ -15,7 +15,7 @@ /* split f assuming that f has degree(f) distinct nonzero roots in Fq */ -void _TEMPLATE(T, poly_split_rabin)( +static void _TEMPLATE(T, poly_split_rabin)( TEMPLATE(T, poly_t) a, TEMPLATE(T, poly_t) b, const TEMPLATE(T, poly_t) f, From 3617997dc3289cf0a5d13ea44406d0aa9ed6a59b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 11:28:00 +0200 Subject: [PATCH 033/114] fq_nmod --- src/fq_nmod/inv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fq_nmod/inv.c b/src/fq_nmod/inv.c index c61beff802..67e1eaad3f 100644 --- a/src/fq_nmod/inv.c +++ b/src/fq_nmod/inv.c @@ -16,7 +16,7 @@ #include "nmod_poly.h" #include "fq_nmod.h" -void _fq_nmod_inv(ulong *rop, const ulong *op, slong len, +static void _fq_nmod_inv(ulong *rop, const ulong *op, slong len, const fq_nmod_ctx_t ctx) { const slong d = fq_nmod_ctx_degree(ctx); From 0508c4baa72f3aacc17a5cfe2d8ce999f3d8e7a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 11:29:58 +0200 Subject: [PATCH 034/114] fq --- src/fq/ctx_init.c | 2 +- src/fq/inv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fq/ctx_init.c b/src/fq/ctx_init.c index be15e57bdd..aa82ff38e2 100644 --- a/src/fq/ctx_init.c +++ b/src/fq/ctx_init.c @@ -19,7 +19,7 @@ #include "fq.h" /* Assumes that everything fits inside a small fmpz */ -void +static void fq_ctx_init_set_clear_small_fq_nmod_ctx(fq_ctx_t c1, fq_nmod_ctx_t c2) { fmpz_mod_ctx_struct * ctxp = c1->ctxp; diff --git a/src/fq/inv.c b/src/fq/inv.c index 6d0f845dd4..d8ea772b28 100644 --- a/src/fq/inv.c +++ b/src/fq/inv.c @@ -17,7 +17,7 @@ #include "fmpz_mod_poly.h" #include "fq.h" -void +static void _fq_inv(fmpz * rop, const fmpz * op, slong len, const fq_ctx_t ctx) { const slong d = fq_ctx_degree(ctx); From dc073038479bf72dcec9aac0160bbc3043afca1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 11:30:05 +0200 Subject: [PATCH 035/114] fq_nmod_mat --- src/fq_nmod_mat/reduce_row.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fq_nmod_mat/reduce_row.c b/src/fq_nmod_mat/reduce_row.c index 57a3d6bddd..a3fca39c1f 100644 --- a/src/fq_nmod_mat/reduce_row.c +++ b/src/fq_nmod_mat/reduce_row.c @@ -17,7 +17,7 @@ #include "fq_nmod.h" #include "fq_nmod_mat.h" -slong fq_nmod_mat_reduce_row_KS(fq_nmod_mat_t A, slong * P, slong * L, +static slong fq_nmod_mat_reduce_row_KS(fq_nmod_mat_t A, slong * P, slong * L, slong m, const fq_nmod_ctx_t ctx) { slong n = A->c, i, j, r, bits, res = -WORD(1); From 09408ee75405bf14f6c55b8405f8b60a849f10f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 11:30:37 +0200 Subject: [PATCH 036/114] fq_nmod_poly --- src/fq_nmod_poly/mul_univariate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fq_nmod_poly/mul_univariate.c b/src/fq_nmod_poly/mul_univariate.c index ef02057459..9d86ae4658 100644 --- a/src/fq_nmod_poly/mul_univariate.c +++ b/src/fq_nmod_poly/mul_univariate.c @@ -15,7 +15,7 @@ #include "fq_nmod_vec.h" #include "fq_nmod_poly.h" -void +static void _fq_nmod_poly_mul_univariate_no_pad (fq_nmod_struct * rop, const fq_nmod_struct * op1, slong len1, const fq_nmod_struct * op2, slong len2, From 8b06100c7ff5615401c28b94252b11c214b55621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 11:42:26 +0200 Subject: [PATCH 037/114] fq_zech --- src/fq_zech.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/fq_zech.h b/src/fq_zech.h index 60ab1e3478..5f22e9c816 100644 --- a/src/fq_zech.h +++ b/src/fq_zech.h @@ -26,11 +26,14 @@ #include "fq_zech_types.h" -/* Data types and context ****************************************************/ #ifdef __cplusplus extern "C" { #endif +FLINT_HEADER_START + +/* Data types and context ****************************************************/ + void fq_zech_ctx_init_ui(fq_zech_ctx_t ctx, ulong p, slong d, const char * var); int _fq_zech_ctx_init_conway_ui(fq_zech_ctx_t ctx, ulong p, slong d, const char * var); void fq_zech_ctx_init_conway_ui(fq_zech_ctx_t ctx, ulong p, slong d, const char * var); @@ -285,6 +288,8 @@ void fq_zech_ctx_init_random(fq_zech_ctx_t, fmpz_t, slong, const char *); void fq_zech_ctx_order(fmpz_t, const fq_zech_ctx_t); +FLINT_HEADER_END + #ifdef T #undef T #endif From 8d6901e323f879a0803a42849c546544c4b0a447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 11:45:40 +0200 Subject: [PATCH 038/114] padic --- src/padic/exp_balanced.c | 4 ++-- src/padic/lifts.c | 2 +- src/padic/sqrt.c | 2 +- src/padic/test/t-log_balanced.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/padic/exp_balanced.c b/src/padic/exp_balanced.c index 8ac7f728c1..a0ba14d8e3 100644 --- a/src/padic/exp_balanced.c +++ b/src/padic/exp_balanced.c @@ -118,7 +118,7 @@ _padic_exp_bsplit(fmpz_t y, const fmpz_t x, slong v, const fmpz_t p, slong N) } } -void _padic_exp_balanced_2(fmpz_t rop, const fmpz_t xu, slong xv, slong N) +static void _padic_exp_balanced_2(fmpz_t rop, const fmpz_t xu, slong xv, slong N) { const fmpz_t p = {WORD(2)}; @@ -154,7 +154,7 @@ void _padic_exp_balanced_2(fmpz_t rop, const fmpz_t xu, slong xv, slong N) fmpz_clear(t); } -void _padic_exp_balanced_p(fmpz_t rop, const fmpz_t xu, slong xv, +static void _padic_exp_balanced_p(fmpz_t rop, const fmpz_t xu, slong xv, const fmpz_t p, slong N) { fmpz_t r, t, pw, pN; diff --git a/src/padic/lifts.c b/src/padic/lifts.c index d1b2f18f03..231b35496d 100644 --- a/src/padic/lifts.c +++ b/src/padic/lifts.c @@ -10,7 +10,7 @@ */ #include "longlong.h" -#include "fmpz.h" +#include "padic.h" slong * _padic_lifts_exps(slong *n, slong N) { diff --git a/src/padic/sqrt.c b/src/padic/sqrt.c index d308b7f1dd..4a0fe874c7 100644 --- a/src/padic/sqrt.c +++ b/src/padic/sqrt.c @@ -176,7 +176,7 @@ static int _padic_sqrt_2(fmpz_t rop, const fmpz_t op, slong N) return 1; } -int _padic_sqrt(fmpz_t rop, const fmpz_t op, const fmpz_t p, slong N) +static int _padic_sqrt(fmpz_t rop, const fmpz_t op, const fmpz_t p, slong N) { if (fmpz_equal_ui(p, 2)) { diff --git a/src/padic/test/t-log_balanced.c b/src/padic/test/t-log_balanced.c index b4dfb8814c..baa2b218f1 100644 --- a/src/padic/test/t-log_balanced.c +++ b/src/padic/test/t-log_balanced.c @@ -21,7 +21,7 @@ This is important as for negative N, exp(0) is 1, which is 0 mod p^N, and then log(0) does not converge. */ -static slong __rand_prec(flint_rand_t state, slong i) { return n_randint(state, PADIC_TEST_PREC_MAX) + 1; } +static slong __rand_prec(flint_rand_t state, slong FLINT_UNUSED(i)) { return n_randint(state, PADIC_TEST_PREC_MAX) + 1; } #endif TEST_FUNCTION_START(padic_log_balanced, state) From 4ee27cbc20b5028e03089c66354f881188438a2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 11:50:53 +0200 Subject: [PATCH 039/114] qadic --- src/qadic/frobenius.c | 2 +- src/qadic/io.c | 2 +- src/qadic/sqrt.c | 8 +++++++- src/qadic/test/t-sqrt.c | 24 ++++++++++++------------ 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/qadic/frobenius.c b/src/qadic/frobenius.c index db76b43907..50ce3518e8 100644 --- a/src/qadic/frobenius.c +++ b/src/qadic/frobenius.c @@ -194,7 +194,7 @@ _fmpz_mod_poly_compose_smod_horner(fmpz *rop, Does not support aliasing. */ -void +static void _fmpz_mod_poly_compose_smod(fmpz *rop, const fmpz *op1, slong len1, const fmpz *op2, slong len2, diff --git a/src/qadic/io.c b/src/qadic/io.c index a589a7bc75..65284c1523 100644 --- a/src/qadic/io.c +++ b/src/qadic/io.c @@ -16,7 +16,7 @@ /* printing *******************************************************************/ -int _qadic_fprint_pretty(FILE * file, const fmpz * u, slong len, slong v, const qadic_ctx_t ctx) +static int _qadic_fprint_pretty(FILE * file, const fmpz * u, slong len, slong v, const qadic_ctx_t ctx) { const fmpz *p = (&ctx->pctx)->p; diff --git a/src/qadic/sqrt.c b/src/qadic/sqrt.c index 30460e2368..7f9885487b 100644 --- a/src/qadic/sqrt.c +++ b/src/qadic/sqrt.c @@ -16,6 +16,12 @@ #include "fmpz_mod_poly.h" #include "qadic.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + static int __fmpz_mod_poly_invmod(fmpz *A, const fmpz *B, slong lenB, const fmpz *P, slong lenP, const fmpz_t p) @@ -795,7 +801,7 @@ _qadic_sqrt_2(fmpz *rop, const fmpz *op, slong len, Assumes that \code{(op, len)} has valuation $0$. */ -int _qadic_sqrt(fmpz *rop, const fmpz *op, slong len, +static int _qadic_sqrt(fmpz *rop, const fmpz *op, slong len, const fmpz *a, const slong *j, slong lena, const fmpz_t p, slong N) { diff --git a/src/qadic/test/t-sqrt.c b/src/qadic/test/t-sqrt.c index a9c96aa26d..eb6c579268 100644 --- a/src/qadic/test/t-sqrt.c +++ b/src/qadic/test/t-sqrt.c @@ -207,16 +207,16 @@ TEST_FUNCTION_START(qadic_sqrt, state) for (i = 0; i < 200 * flint_test_multiplier(); i++) { fmpz_t p = {WORD(2)}; - slong d, N; + slong dx, N; qadic_ctx_t ctx; int ans, ans2; qadic_t a, b, b2; - d = n_randint(state, 10) + 1; + dx = n_randint(state, 10) + 1; N = 1; - qadic_ctx_init_conway(ctx, p, d, FLINT_MAX(0,N-10), FLINT_MAX(0,N+10), "X", PADIC_SERIES); + qadic_ctx_init_conway(ctx, p, dx, FLINT_MAX(0,N-10), FLINT_MAX(0,N+10), "X", PADIC_SERIES); qadic_init2(a, N); qadic_init2(b, N); @@ -371,17 +371,17 @@ TEST_FUNCTION_START(qadic_sqrt, state) for (i = 0; i < 200 * flint_test_multiplier(); i++) { fmpz_t p = {WORD(2)}; - slong d, N, N2; + slong dx, N, N2; qadic_ctx_t ctx; int ans, ans2; qadic_t a, b, b2; - d = n_randint(state, 10) + 1; + dx = n_randint(state, 10) + 1; N = z_randint(state, 50) + 1; N2 = N - n_randint(state, 10); - qadic_ctx_init_conway(ctx, p, d, FLINT_MAX(0,N-10), FLINT_MAX(0,N+10), "X", PADIC_SERIES); + qadic_ctx_init_conway(ctx, p, dx, FLINT_MAX(0,N-10), FLINT_MAX(0,N+10), "X", PADIC_SERIES); qadic_init2(a, N); qadic_init2(b, N); @@ -578,7 +578,7 @@ TEST_FUNCTION_START(qadic_sqrt, state) for (i = 0; i < 200 * flint_test_multiplier(); i++) { fmpz_t p; - slong d, N, q; + slong dx, N, q; qadic_ctx_t ctx; int ans, ans2; @@ -588,10 +588,10 @@ TEST_FUNCTION_START(qadic_sqrt, state) while (q == 2) q = n_randprime(state, 2 + n_randint(state, 3), 1); fmpz_init_set_ui(p, q); - d = n_randint(state, 10) + 1; + dx = n_randint(state, 10) + 1; N = 1; - qadic_ctx_init_conway(ctx, p, d, FLINT_MAX(0,N-10), FLINT_MAX(0,N+10), "X", PADIC_SERIES); + qadic_ctx_init_conway(ctx, p, dx, FLINT_MAX(0,N-10), FLINT_MAX(0,N+10), "X", PADIC_SERIES); qadic_init2(a, N); qadic_init2(b, N); @@ -738,7 +738,7 @@ TEST_FUNCTION_START(qadic_sqrt, state) for (i = 0; i < 200 * flint_test_multiplier(); i++) { fmpz_t p; - slong d, N, N2, q; + slong dx, N, N2, q; qadic_ctx_t ctx; int ans, ans2; @@ -748,11 +748,11 @@ TEST_FUNCTION_START(qadic_sqrt, state) while (q == 2) q = n_randprime(state, 2 + n_randint(state, 3), 1); fmpz_init_set_ui(p, q); - d = n_randint(state, 10) + 1; + dx = n_randint(state, 10) + 1; N = z_randint(state, 50) + 1; N2 = N - n_randint(state, 10); - qadic_ctx_init_conway(ctx, p, d, FLINT_MAX(0,N-10), FLINT_MAX(0,N+10), "X", PADIC_SERIES); + qadic_ctx_init_conway(ctx, p, dx, FLINT_MAX(0,N-10), FLINT_MAX(0,N+10), "X", PADIC_SERIES); qadic_init2(a, N); qadic_init2(b, N); From ff6c5aebe988247b0fccf4da70e9073e0b3520cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 11:50:59 +0200 Subject: [PATCH 040/114] nmod_poly_factor --- src/nmod_poly_factor/factor.c | 4 ++-- src/nmod_poly_factor/is_irreducible.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nmod_poly_factor/factor.c b/src/nmod_poly_factor/factor.c index 927829bae8..52cd3d27a0 100644 --- a/src/nmod_poly_factor/factor.c +++ b/src/nmod_poly_factor/factor.c @@ -32,7 +32,7 @@ __nmod_poly_factor1(nmod_poly_factor_t res, const nmod_poly_t f, int algorithm) nmod_poly_factor_berlekamp(res, f); } -ulong +static ulong __nmod_poly_factor(nmod_poly_factor_t result, const nmod_poly_t input, int algorithm) { @@ -83,7 +83,7 @@ __nmod_poly_factor(nmod_poly_factor_t result, return leading_coeff; } -ulong +static ulong __nmod_poly_factor_deflation(nmod_poly_factor_t result, const nmod_poly_t input, int algorithm) { diff --git a/src/nmod_poly_factor/is_irreducible.c b/src/nmod_poly_factor/is_irreducible.c index 37ae6ddeca..04ca35373b 100644 --- a/src/nmod_poly_factor/is_irreducible.c +++ b/src/nmod_poly_factor/is_irreducible.c @@ -148,7 +148,7 @@ nmod_poly_is_irreducible(const nmod_poly_t f) return 1; } -void +static void nmod_poly_powpowmod(nmod_poly_t res, const nmod_poly_t pol, ulong exp, ulong exp2, const nmod_poly_t f) { From ec124bbe1a461ede27ed6e917ecc97f75342e112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 11:54:40 +0200 Subject: [PATCH 041/114] fmpz_factor --- src/fmpz_factor/expand_multiexp.c | 2 +- src/fmpz_factor/factor_pp1.c | 14 +++++++------- src/fmpz_factor/factor_smooth.c | 7 +++---- src/fmpz_factor/test/t-refine.c | 14 +++++++------- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/fmpz_factor/expand_multiexp.c b/src/fmpz_factor/expand_multiexp.c index 7b6c3df970..bab424790c 100644 --- a/src/fmpz_factor/expand_multiexp.c +++ b/src/fmpz_factor/expand_multiexp.c @@ -14,7 +14,7 @@ #include "fmpz_vec.h" #include "fmpz_factor.h" -void +static void _fmpz_factor_eval_multiexp(fmpz_t res, const fmpz * p, const ulong * e, slong len) { slong i, j; diff --git a/src/fmpz_factor/factor_pp1.c b/src/fmpz_factor/factor_pp1.c index 3e756fad8e..f7f35cf2ba 100644 --- a/src/fmpz_factor/factor_pp1.c +++ b/src/fmpz_factor/factor_pp1.c @@ -43,14 +43,14 @@ ulong pp1_primorial[9] = #define num_primorials 9 #endif -void pp1_set(nn_ptr x1, nn_ptr y1, +static void pp1_set(nn_ptr x1, nn_ptr y1, nn_srcptr x2, nn_srcptr y2, slong nn) { flint_mpn_copyi(x1, x2, nn); flint_mpn_copyi(y1, y2, nn); } -void pp1_set_ui(nn_ptr x, slong nn, ulong norm, ulong c) +static void pp1_set_ui(nn_ptr x, slong nn, ulong norm, ulong c) { mpn_zero(x, nn); x[0] = (c << norm); @@ -58,7 +58,7 @@ void pp1_set_ui(nn_ptr x, slong nn, ulong norm, ulong c) x[1] = (c >> (FLINT_BITS - norm)); } -void pp1_2k(nn_ptr x, nn_ptr y, slong nn, nn_srcptr n, +static void pp1_2k(nn_ptr x, nn_ptr y, slong nn, nn_srcptr n, nn_srcptr ninv, nn_srcptr x0, ulong norm) { pp1_mulmod(y, y, x, nn, n, ninv, norm); @@ -70,7 +70,7 @@ void pp1_2k(nn_ptr x, nn_ptr y, slong nn, nn_srcptr n, mpn_add_n(x, x, n, nn); } -void pp1_2kp1(nn_ptr x, nn_ptr y, slong nn, nn_srcptr n, +static void pp1_2kp1(nn_ptr x, nn_ptr y, slong nn, nn_srcptr n, nn_srcptr ninv, nn_srcptr x0, ulong norm) { pp1_mulmod(x, x, y, nn, n, ninv, norm); @@ -82,7 +82,7 @@ void pp1_2kp1(nn_ptr x, nn_ptr y, slong nn, nn_srcptr n, mpn_add_n(y, y, n, nn); } -void pp1_pow_ui(nn_ptr x, nn_ptr y, slong nn, +static void pp1_pow_ui(nn_ptr x, nn_ptr y, slong nn, ulong exp, nn_srcptr n, nn_srcptr ninv, ulong norm) { ulong t[30]; @@ -111,7 +111,7 @@ void pp1_pow_ui(nn_ptr x, nn_ptr y, slong nn, flint_free(x0); } -slong pp1_factor(nn_ptr factor, nn_srcptr n, +static slong pp1_factor(nn_ptr factor, nn_srcptr n, nn_srcptr x, slong nn, ulong norm) { slong ret = 0, xn = nn; @@ -147,7 +147,7 @@ slong pp1_factor(nn_ptr factor, nn_srcptr n, return ret; } -slong pp1_find_power(nn_ptr factor, nn_ptr x, nn_ptr y, slong nn, +static slong pp1_find_power(nn_ptr factor, nn_ptr x, nn_ptr y, slong nn, ulong p, nn_srcptr n, nn_srcptr ninv, ulong norm) { slong ret; diff --git a/src/fmpz_factor/factor_smooth.c b/src/fmpz_factor/factor_smooth.c index c62a4d045b..90ca8fc6bf 100644 --- a/src/fmpz_factor/factor_smooth.c +++ b/src/fmpz_factor/factor_smooth.c @@ -36,7 +36,7 @@ static slong ecm_tuning[][3] = {100, 470000, 430} }; -int _is_prime(const fmpz_t n, int proved) +static int _is_prime(const fmpz_t n, int proved) { if (proved) return fmpz_is_prime(n); @@ -44,7 +44,7 @@ int _is_prime(const fmpz_t n, int proved) return fmpz_is_probabprime(n); } -void remove_found_factors(fmpz_factor_t factor, fmpz_t n, fmpz_t f) +static void remove_found_factors(fmpz_factor_t factor, fmpz_t n, fmpz_t f) { slong i; fmpz_factor_t fac; @@ -70,7 +70,7 @@ int fmpz_factor_smooth(fmpz_factor_t factor, const fmpz_t n, mpz_ptr xsrc; nn_ptr xd; slong xsize; - slong found; + int found; slong trial_stop; slong * idx; slong i, b, bits2, istride; @@ -215,7 +215,6 @@ int fmpz_factor_smooth(fmpz_factor_t factor, const fmpz_t n, } else if (bits >= 16) /* trial factored already up to 15 bits */ { - int found; flint_rand_t state; fmpz_init(f); diff --git a/src/fmpz_factor/test/t-refine.c b/src/fmpz_factor/test/t-refine.c index 3b0380ae30..c5b157e964 100644 --- a/src/fmpz_factor/test/t-refine.c +++ b/src/fmpz_factor/test/t-refine.c @@ -221,19 +221,19 @@ TEST_FUNCTION_START(fmpz_factor_refine, state) */ if (g->sign) { - slong i, j; + slong ix, jx; fmpz_t x; fmpz_init(x); - for (i = 0; i < f->num; i++) + for (ix = 0; ix < f->num; ix++) { - if (f->exp[i] != WORD(0)) + if (f->exp[ix] != WORD(0)) { - fmpz_abs(x, f->p+i); - for (j = 0; j < g->num; j++) + fmpz_abs(x, f->p + ix); + for (jx = 0; jx < g->num; jx++) { - while (fmpz_divisible(x, g->p+j)) + while (fmpz_divisible(x, g->p + jx)) { - fmpz_divexact(x, x, g->p+j); + fmpz_divexact(x, x, g->p + jx); } } if (!fmpz_is_one(x)) From f9fb156ff8a9d9af835508163c0725f28ba44540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 12:01:24 +0200 Subject: [PATCH 042/114] fmpz_poly_factor --- src/fmpz_poly_factor/factor.c | 2 +- src/fmpz_poly_factor/factor_van_hoeij.c | 4 ++-- src/fmpz_poly_factor/factor_zassenhaus.c | 2 +- src/fmpz_poly_factor/van_hoeij_check_if_solved.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/fmpz_poly_factor/factor.c b/src/fmpz_poly_factor/factor.c index 56d2be572d..52e59d8470 100644 --- a/src/fmpz_poly_factor/factor.c +++ b/src/fmpz_poly_factor/factor.c @@ -14,7 +14,7 @@ #include "fmpz_poly.h" #include "fmpz_poly_factor.h" -void fmpz_poly_factor_deflation(fmpz_poly_factor_t fac, const fmpz_poly_t G, int deflation) +static void fmpz_poly_factor_deflation(fmpz_poly_factor_t fac, const fmpz_poly_t G, int deflation) { const slong lenG = G->length; fmpz_poly_t g; diff --git a/src/fmpz_poly_factor/factor_van_hoeij.c b/src/fmpz_poly_factor/factor_van_hoeij.c index c6e8c3b078..6660c0b54b 100644 --- a/src/fmpz_poly_factor/factor_van_hoeij.c +++ b/src/fmpz_poly_factor/factor_van_hoeij.c @@ -25,7 +25,7 @@ # include #endif -slong _heuristic_van_hoeij_starting_precision(const fmpz_poly_t f, +static slong _heuristic_van_hoeij_starting_precision(const fmpz_poly_t f, slong r, ulong p) { fmpz_t lead_b, trail_b; @@ -51,7 +51,7 @@ slong _heuristic_van_hoeij_starting_precision(const fmpz_poly_t f, resize the matrix M to num_rows, where num_rows <= M->r the algorithm assumes rows have been permuted in memory by LLL */ -void fmpz_mat_van_hoeij_resize_matrix(fmpz_mat_t M, slong num_rows) +static void fmpz_mat_van_hoeij_resize_matrix(fmpz_mat_t M, slong num_rows) { slong i, j; fmpz ** empty_rows; diff --git a/src/fmpz_poly_factor/factor_zassenhaus.c b/src/fmpz_poly_factor/factor_zassenhaus.c index f30be998e7..c98b596188 100644 --- a/src/fmpz_poly_factor/factor_zassenhaus.c +++ b/src/fmpz_poly_factor/factor_zassenhaus.c @@ -42,7 +42,7 @@ [Coh1996] Cohen, Henri : A course in computational algebraic number theory, Springer, 1996 */ -void _fmpz_poly_factor_mignotte(fmpz_t B, const fmpz *f, slong m) +static void _fmpz_poly_factor_mignotte(fmpz_t B, const fmpz *f, slong m) { slong j; fmpz_t b, f2, lc, s, t; diff --git a/src/fmpz_poly_factor/van_hoeij_check_if_solved.c b/src/fmpz_poly_factor/van_hoeij_check_if_solved.c index 8f5e93fe45..c82ffa98c7 100644 --- a/src/fmpz_poly_factor/van_hoeij_check_if_solved.c +++ b/src/fmpz_poly_factor/van_hoeij_check_if_solved.c @@ -17,7 +17,7 @@ #include "fmpz_poly.h" #include "fmpz_poly_factor.h" -int _compare_poly_lengths(const void * a, const void * b) +static int _compare_poly_lengths(const void * a, const void * b) { const fmpz_poly_struct * p = (fmpz_poly_struct *) a; const fmpz_poly_struct * q = (fmpz_poly_struct *) b; From b648337fd37acb4a7737d990848edc3381e988a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 02:20:06 +0200 Subject: [PATCH 043/114] fmpz_mod_poly_factor --- src/fmpz_mod_poly_factor.h | 4 ++++ src/fmpz_mod_poly_factor/factor_equal_deg.c | 2 +- src/fmpz_mod_poly_factor/init.c | 2 +- .../is_irreducible_rabin.c | 19 ------------------- 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/src/fmpz_mod_poly_factor.h b/src/fmpz_mod_poly_factor.h index bbcfffdb2f..64014e4589 100644 --- a/src/fmpz_mod_poly_factor.h +++ b/src/fmpz_mod_poly_factor.h @@ -25,6 +25,8 @@ extern "C" { #endif +FLINT_HEADER_START + /* Factoring ****************************************************************/ void fmpz_mod_poly_factor_init(fmpz_mod_poly_factor_t fac, @@ -170,6 +172,8 @@ int fmpz_mod_poly_roots_factored_with_length_limit(fmpz_mod_poly_factor_t x0, void fmpz_mod_poly_factor_get_fmpz_mod_poly(fmpz_mod_poly_t z, fmpz_mod_poly_factor_t fac, slong i, const fmpz_mod_ctx_t ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/fmpz_mod_poly_factor/factor_equal_deg.c b/src/fmpz_mod_poly_factor/factor_equal_deg.c index daea89359b..3e67a798bf 100644 --- a/src/fmpz_mod_poly_factor/factor_equal_deg.c +++ b/src/fmpz_mod_poly_factor/factor_equal_deg.c @@ -48,7 +48,7 @@ static void _queue_vec_fit_length(queue_struct ** Q, slong * Qalloc, } /* given g|f, update Q and res with g and f/g */ -void _add_split( +static void _add_split( fmpz_mod_poly_factor_t res, queue_struct ** Q_, slong * Qlen_, slong * Qalloc_, fmpz_mod_poly_t f, diff --git a/src/fmpz_mod_poly_factor/init.c b/src/fmpz_mod_poly_factor/init.c index d89454f5dd..b326792a4b 100644 --- a/src/fmpz_mod_poly_factor/init.c +++ b/src/fmpz_mod_poly_factor/init.c @@ -14,7 +14,7 @@ (at your option) any later version. See . */ -#include "fmpz_mod_poly.h" +#include "fmpz_mod_poly_factor.h" void fmpz_mod_poly_factor_init(fmpz_mod_poly_factor_t fac, const fmpz_mod_ctx_t FLINT_UNUSED(ctx)) diff --git a/src/fmpz_mod_poly_factor/is_irreducible_rabin.c b/src/fmpz_mod_poly_factor/is_irreducible_rabin.c index 5d21cca104..59d69c5006 100644 --- a/src/fmpz_mod_poly_factor/is_irreducible_rabin.c +++ b/src/fmpz_mod_poly_factor/is_irreducible_rabin.c @@ -17,25 +17,6 @@ #include "fmpz_mod_poly.h" #include "fmpz_mod_poly_factor.h" -void -fmpz_mod_poly_powpowmod(fmpz_mod_poly_t res, const fmpz_mod_poly_t pol, - const fmpz_t exp, ulong exp2, const fmpz_mod_poly_t f, - const fmpz_mod_ctx_t ctx) -{ - fmpz_mod_poly_t pow; - ulong i; - - fmpz_mod_poly_init(pow, ctx); - fmpz_mod_poly_powmod_fmpz_binexp(pow, pol, exp, f, ctx); - fmpz_mod_poly_set(res, pow, ctx); - - if (!fmpz_mod_poly_equal(pow, pol, ctx)) - for (i = 1; i < exp2; i++) - fmpz_mod_poly_powmod_fmpz_binexp(res, res, exp, f, ctx); - - fmpz_mod_poly_clear(pow, ctx); -} - int fmpz_mod_poly_is_irreducible_rabin(const fmpz_mod_poly_t f, const fmpz_mod_ctx_t ctx) { From 1423e65208f17e4f0228d2993fc78de550dcb009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 12:08:38 +0200 Subject: [PATCH 044/114] nmod_poly_mat --- src/nmod_poly_mat/solve_fflu_precomp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nmod_poly_mat/solve_fflu_precomp.c b/src/nmod_poly_mat/solve_fflu_precomp.c index d8dbb8d1a1..d07d2dfb5c 100644 --- a/src/nmod_poly_mat/solve_fflu_precomp.c +++ b/src/nmod_poly_mat/solve_fflu_precomp.c @@ -17,7 +17,7 @@ #define BB(ii,jj) nmod_poly_mat_entry(B,(ii),(jj)) #define LU(ii,jj) nmod_poly_mat_entry(FFLU,(ii),(jj)) -void +static void nmod_poly_mat_set_perm(nmod_poly_mat_t X, const slong * perm, const nmod_poly_mat_t B) { From b0c9f2d8867a1f9ddb1fc67516ff7ccdb86aca36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 12:08:45 +0200 Subject: [PATCH 045/114] fmpz_poly_mat --- src/fmpz_poly_mat/solve_fflu_precomp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fmpz_poly_mat/solve_fflu_precomp.c b/src/fmpz_poly_mat/solve_fflu_precomp.c index 71e693e4a2..14f9e27772 100644 --- a/src/fmpz_poly_mat/solve_fflu_precomp.c +++ b/src/fmpz_poly_mat/solve_fflu_precomp.c @@ -18,7 +18,7 @@ #define BB(ii,jj) fmpz_poly_mat_entry(B,(ii),(jj)) #define LU(ii,jj) fmpz_poly_mat_entry(FFLU,(ii),(jj)) -void +static void fmpz_poly_mat_set_perm(fmpz_poly_mat_t X, const slong * perm, const fmpz_poly_mat_t B) { From 7425f80594f49ec13a73d070157fa8a0bdc7b983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 12:54:14 +0200 Subject: [PATCH 046/114] mpoly --- src/mpoly.h | 14 ++++++++------ src/mpoly/compression.c | 6 +++--- src/mpoly/gcd_info.c | 2 +- src/mpoly/monomial_exists.c | 2 +- src/mpoly/test_irreducible.c | 12 ++++++------ src/mpoly/univar.c | 4 ++-- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/mpoly.h b/src/mpoly.h index d4dbb48557..6faddaee53 100644 --- a/src/mpoly.h +++ b/src/mpoly.h @@ -28,18 +28,20 @@ extern "C" { /* choose m so that (m + 1)/(n - m) ~= la/lb, i.e. m = (n*la - lb)/(la + lb) */ slong mpoly_divide_threads(slong n, double la, double lb); -#ifdef _MSC_VER -# define DECLSPEC_IMPORT __declspec(dllimport) -#else -# define DECLSPEC_IMPORT -#endif +#ifndef __GMP_H__ +# ifdef _MSC_VER +# define DECLSPEC_IMPORT __declspec(dllimport) +# else +# define DECLSPEC_IMPORT +# endif DECLSPEC_IMPORT ulong __gmpn_add_n(nn_ptr, nn_srcptr, nn_srcptr, long int); DECLSPEC_IMPORT ulong __gmpn_sub_n(nn_ptr, nn_srcptr, nn_srcptr, long int); DECLSPEC_IMPORT ulong __gmpn_addmul_1(nn_ptr, nn_srcptr, long int, ulong); DECLSPEC_IMPORT ulong __gmpn_submul_1(nn_ptr, nn_srcptr, long int, ulong); DECLSPEC_IMPORT ulong __gmpn_rshift(nn_ptr, nn_srcptr, long int, unsigned int); DECLSPEC_IMPORT ulong __gmpn_mul_1(nn_ptr, nn_srcptr, long int, ulong); -#undef DECLSPEC_IMPORT +# undef DECLSPEC_IMPORT +#endif /* context *******************************************************************/ diff --git a/src/mpoly/compression.c b/src/mpoly/compression.c index 45bafc46c2..d863c5ad96 100644 --- a/src/mpoly/compression.c +++ b/src/mpoly/compression.c @@ -190,10 +190,10 @@ slong _mpoly_compress_exps( { for (k = 0; k < l; k++) { - slong tot = 0; + slong tot2 = 0; for (j = 0; j < n; j++) - tot += S[k*n + j]; - S[k*n + i] = tot - best_min; + tot2 += S[k*n + j]; + S[k*n + i] = tot2 - best_min; } for (k = 0; k < n; k++) { diff --git a/src/mpoly/gcd_info.c b/src/mpoly/gcd_info.c index 784e300a8c..27e21976ab 100644 --- a/src/mpoly/gcd_info.c +++ b/src/mpoly/gcd_info.c @@ -366,10 +366,10 @@ void mpoly_gcd_info_measure_brown( eblend = 1; if (I->Gdeflate_deg_bounds_are_nice) { - slong k = perm[m - 1]; slong limit = mpoly_gcd_info_get_brown_upper_limit(I, m - 1, 0); slong expected_stab; + k = perm[m - 1]; expected_stab = FLINT_MIN(I->Adeflate_deg[k], I->Bdeflate_deg[k]); expected_stab = expected_stab - I->Gdeflate_deg_bound[k]; expected_stab = FLINT_MIN(expected_stab, I->Gdeflate_deg_bound[k]); diff --git a/src/mpoly/monomial_exists.c b/src/mpoly/monomial_exists.c index c24ebe6731..c6276c26a8 100644 --- a/src/mpoly/monomial_exists.c +++ b/src/mpoly/monomial_exists.c @@ -11,7 +11,7 @@ #include "mpoly.h" -int mpoly_monomial_exists1(slong * index, const ulong * poly_exps, +static int mpoly_monomial_exists1(slong * index, const ulong * poly_exps, const ulong exp, slong len, ulong maskhi) { slong n = len; diff --git a/src/mpoly/test_irreducible.c b/src/mpoly/test_irreducible.c index d2dbebff4e..559cf02ce1 100644 --- a/src/mpoly/test_irreducible.c +++ b/src/mpoly/test_irreducible.c @@ -409,7 +409,7 @@ static int point2d_set_contains(const point2d_set_t A, slong x, slong y) #endif /* is A intersect B empty? */ -int point2d_set_disjoint( +static int point2d_set_disjoint( const point2d_set_t A, const point2d_set_t B) { @@ -544,11 +544,11 @@ static int convex_hull_is_indecomposable( if (nV == 3) { - ulong g = FLINT_ABS(V[2].x - V[0].x); - g = n_gcd(g, FLINT_ABS(V[2].y - V[0].y)); - g = n_gcd(g, FLINT_ABS(V[1].x - V[0].x)); - g = n_gcd(g, FLINT_ABS(V[1].y - V[0].y)); - return g == 1; + ulong h = FLINT_ABS(V[2].x - V[0].x); + h = n_gcd(h, FLINT_ABS(V[2].y - V[0].y)); + h = n_gcd(h, FLINT_ABS(V[1].x - V[0].x)); + h = n_gcd(h, FLINT_ABS(V[1].y - V[0].y)); + return h == 1; } /* diff --git a/src/mpoly/univar.c b/src/mpoly/univar.c index d75adc3748..366c5afbbb 100644 --- a/src/mpoly/univar.c +++ b/src/mpoly/univar.c @@ -106,7 +106,7 @@ void mpoly_univar_init2(mpoly_univar_t A, slong len, mpoly_void_ring_t R) A = prem(A, -B) C is used for working space */ -void mpoly_univar_prem( +static void mpoly_univar_prem( mpoly_univar_t A, const mpoly_univar_t B, mpoly_univar_t C, @@ -758,7 +758,7 @@ int mpoly_univar_pseudo_gcd_ducos( -void mpoly_univar_derivative( +static void mpoly_univar_derivative( mpoly_univar_t A, const mpoly_univar_t B, mpoly_void_ring_t R) From d5ad46e4889e239dd88238d84371ec5d91ce49de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 13:15:29 +0200 Subject: [PATCH 047/114] nmod_mpoly --- src/nmod_mpoly.h | 4 ++++ src/nmod_mpoly/add.c | 2 +- src/nmod_mpoly/compose_nmod_poly.c | 4 ++-- src/nmod_mpoly/divides_dense.c | 2 +- src/nmod_mpoly/divrem_ideal_monagan_pearce.c | 4 ++-- src/nmod_mpoly/equal.c | 2 +- src/nmod_mpoly/evaluate_one.c | 2 +- src/nmod_mpoly/gcd.c | 2 +- src/nmod_mpoly/gcd_zippel2.c | 2 +- src/nmod_mpoly/geobuckets.c | 2 +- src/nmod_mpoly/interp.c | 2 +- src/nmod_mpoly/mpolyn_gcd_brown.c | 2 +- src/nmod_mpoly/mpolyu.c | 6 +++--- src/nmod_mpoly/mpolyu_divides.c | 4 ++-- src/nmod_mpoly/mpolyu_gcdp_zippel.c | 13 ++++++------- src/nmod_mpoly/mpolyun.c | 15 ++++++++------- src/nmod_mpoly/mpolyun_divides.c | 6 +++--- src/nmod_mpoly/mul_array_threaded.c | 4 ++-- src/nmod_mpoly/mul_johnson.c | 2 +- src/nmod_mpoly/scalar.c | 4 ++-- src/nmod_mpoly/setform.c | 4 ++-- src/nmod_mpoly/sub.c | 2 +- 22 files changed, 47 insertions(+), 43 deletions(-) diff --git a/src/nmod_mpoly.h b/src/nmod_mpoly.h index 4358ccf08a..ed9f65ad65 100644 --- a/src/nmod_mpoly.h +++ b/src/nmod_mpoly.h @@ -30,6 +30,8 @@ extern "C" { #endif +FLINT_HEADER_START + FLINT_FORCE_INLINE ulong * nmod_mpoly_term_coeff_ref(nmod_mpoly_t A, slong i, const nmod_mpoly_ctx_t ctx) @@ -1463,6 +1465,8 @@ void nmod_mpoly_geobucket_sub(nmod_mpoly_geobucket_t B, nmod_mpoly_t p, const nm void nmod_mpoly_remainder_strongtest(const nmod_mpoly_t r, const nmod_mpoly_t g, const nmod_mpoly_ctx_t ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/nmod_mpoly/add.c b/src/nmod_mpoly/add.c index 468f01ca83..7dd72ce85e 100644 --- a/src/nmod_mpoly/add.c +++ b/src/nmod_mpoly/add.c @@ -13,7 +13,7 @@ #include "mpoly.h" #include "nmod_mpoly.h" -slong _nmod_mpoly_add1( +static slong _nmod_mpoly_add1( ulong * Acoeffs, ulong * Aexps, const ulong * Bcoeffs, const ulong * Bexps, slong Blen, const ulong * Ccoeffs, const ulong * Cexps, slong Clen, diff --git a/src/nmod_mpoly/compose_nmod_poly.c b/src/nmod_mpoly/compose_nmod_poly.c index 6515c304b1..5e3f1fd207 100644 --- a/src/nmod_mpoly/compose_nmod_poly.c +++ b/src/nmod_mpoly/compose_nmod_poly.c @@ -41,7 +41,7 @@ int _ff_poly_pow_ui_is_not_feasible(slong length, ulong e) } } -int _nmod_mpoly_compose_nmod_poly_sp(nmod_poly_t A, const nmod_mpoly_t B, +static int _nmod_mpoly_compose_nmod_poly_sp(nmod_poly_t A, const nmod_mpoly_t B, nmod_poly_struct * const * C, const nmod_mpoly_ctx_t ctx) { int success = 1; @@ -138,7 +138,7 @@ int _nmod_mpoly_compose_nmod_poly_sp(nmod_poly_t A, const nmod_mpoly_t B, } -int _nmod_mpoly_compose_nmod_poly_mp(nmod_poly_t A, const nmod_mpoly_t B, +static int _nmod_mpoly_compose_nmod_poly_mp(nmod_poly_t A, const nmod_mpoly_t B, nmod_poly_struct * const * C, const nmod_mpoly_ctx_t ctx) { int success = 1; diff --git a/src/nmod_mpoly/divides_dense.c b/src/nmod_mpoly/divides_dense.c index d470492de0..e14724ad6a 100644 --- a/src/nmod_mpoly/divides_dense.c +++ b/src/nmod_mpoly/divides_dense.c @@ -18,7 +18,7 @@ Convert B to A if the degrees of A are <= expected_deg If not, return 0 and set A to 0. */ -int nmod_mpoly_convert_from_nmod_mpolyd_degbound( +static int nmod_mpoly_convert_from_nmod_mpolyd_degbound( nmod_mpoly_t A, const nmod_mpoly_ctx_t ctx, const nmod_mpolyd_t B, const nmod_mpolyd_ctx_t dctx, slong * expect_deg) diff --git a/src/nmod_mpoly/divrem_ideal_monagan_pearce.c b/src/nmod_mpoly/divrem_ideal_monagan_pearce.c index e323575fb6..8a5acb781e 100644 --- a/src/nmod_mpoly/divrem_ideal_monagan_pearce.c +++ b/src/nmod_mpoly/divrem_ideal_monagan_pearce.c @@ -18,7 +18,7 @@ passed and an array of quotient polynomials is returned. These are not in low level format. */ -int _nmod_mpoly_divrem_ideal_monagan_pearce1( +static int _nmod_mpoly_divrem_ideal_monagan_pearce1( nmod_mpoly_struct ** Q, nmod_mpoly_t R, const ulong * Acoeffs, const ulong * Aexps, slong Alen, @@ -247,7 +247,7 @@ break_continue:; passed and an array of quotient polynomials is returned. These are not in low level format. */ -int _nmod_mpoly_divrem_ideal_monagan_pearce( +static int _nmod_mpoly_divrem_ideal_monagan_pearce( nmod_mpoly_struct ** Q, nmod_mpoly_t R, const ulong * Acoeffs, const ulong * Aexps, slong Alen, diff --git a/src/nmod_mpoly/equal.c b/src/nmod_mpoly/equal.c index 365cc711f2..6add53b6b9 100644 --- a/src/nmod_mpoly/equal.c +++ b/src/nmod_mpoly/equal.c @@ -13,7 +13,7 @@ #include "mpoly.h" #include "nmod_mpoly.h" -int _nmod_mpoly_equal(const ulong * coeff1, const ulong * exp1, +static int _nmod_mpoly_equal(const ulong * coeff1, const ulong * exp1, const ulong * coeff2, const ulong * exp2, slong len, slong N) { diff --git a/src/nmod_mpoly/evaluate_one.c b/src/nmod_mpoly/evaluate_one.c index 1f167d23d2..cf96aa3f50 100644 --- a/src/nmod_mpoly/evaluate_one.c +++ b/src/nmod_mpoly/evaluate_one.c @@ -16,7 +16,7 @@ #include "nmod_mpoly.h" /* exponents of B are not multiprecision */ -void _nmod_mpoly_evaluate_one_ui_sp( +static void _nmod_mpoly_evaluate_one_ui_sp( nmod_mpoly_t A, const nmod_mpoly_t B, slong var, diff --git a/src/nmod_mpoly/gcd.c b/src/nmod_mpoly/gcd.c index 8104e3f6e1..644e5f3015 100644 --- a/src/nmod_mpoly/gcd.c +++ b/src/nmod_mpoly/gcd.c @@ -936,7 +936,7 @@ static int _try_monomial_cofactors( /*** ess(A) and ess(B) depend on only one variable v_in_both ****************/ -int _do_univar( +static int _do_univar( nmod_mpoly_t G, nmod_mpoly_t Abar, nmod_mpoly_t Bbar, diff --git a/src/nmod_mpoly/gcd_zippel2.c b/src/nmod_mpoly/gcd_zippel2.c index 791bdf90a4..5579ae1443 100644 --- a/src/nmod_mpoly/gcd_zippel2.c +++ b/src/nmod_mpoly/gcd_zippel2.c @@ -351,7 +351,7 @@ int nmod_mpoly_gcd_get_use_new( return use; } -ulong n_poly_mod_eval_step_sep( +static ulong n_poly_mod_eval_step_sep( n_poly_t cur, const n_poly_t inc, const nmod_mpoly_t A, diff --git a/src/nmod_mpoly/geobuckets.c b/src/nmod_mpoly/geobuckets.c index e5d3e89c1a..952f37755f 100644 --- a/src/nmod_mpoly/geobuckets.c +++ b/src/nmod_mpoly/geobuckets.c @@ -90,7 +90,7 @@ void nmod_mpoly_geobucket_set(nmod_mpoly_geobucket_t B, nmod_mpoly_t p, } /* internal function for fixing overflows */ -void _nmod_mpoly_geobucket_fix(nmod_mpoly_geobucket_t B, slong i, +static void _nmod_mpoly_geobucket_fix(nmod_mpoly_geobucket_t B, slong i, const nmod_mpoly_ctx_t ctx) { while (clog4((B->polys + i)->length) > i) diff --git a/src/nmod_mpoly/interp.c b/src/nmod_mpoly/interp.c index 90807a5d51..0766875155 100644 --- a/src/nmod_mpoly/interp.c +++ b/src/nmod_mpoly/interp.c @@ -1242,7 +1242,7 @@ int nmod_mpolyn_interp_crt_2sm_mpolyn( /*****************************************************************************/ /* evaluate A at lastvar = alpha */ -void nmod_mpolyn_interp_reduce_sm_mpoly( +static void nmod_mpolyn_interp_reduce_sm_mpoly( nmod_mpoly_t B, nmod_mpolyn_t A, ulong alpha, diff --git a/src/nmod_mpoly/mpolyn_gcd_brown.c b/src/nmod_mpoly/mpolyn_gcd_brown.c index 78d9f2fd64..073af66889 100644 --- a/src/nmod_mpoly/mpolyn_gcd_brown.c +++ b/src/nmod_mpoly/mpolyn_gcd_brown.c @@ -694,7 +694,7 @@ int nmod_mpolyn_gcd_brown_smprime( -int nmod_mpolyn_gcd_brown_lgprime_bivar( +static int nmod_mpolyn_gcd_brown_lgprime_bivar( nmod_mpolyn_t G, nmod_mpolyn_t Abar, nmod_mpolyn_t Bbar, diff --git a/src/nmod_mpoly/mpolyu.c b/src/nmod_mpoly/mpolyu.c index ee67f05d62..e187a3300f 100644 --- a/src/nmod_mpoly/mpolyu.c +++ b/src/nmod_mpoly/mpolyu.c @@ -807,7 +807,7 @@ void nmod_mpolyu_set(nmod_mpolyu_t A, const nmod_mpolyu_t B, -void nmod_mpoly_cvtfrom_poly_notmain(nmod_mpoly_t A, nmod_poly_t a, +static void nmod_mpoly_cvtfrom_poly_notmain(nmod_mpoly_t A, nmod_poly_t a, slong var, const nmod_mpoly_ctx_t ctx) { slong i; @@ -901,7 +901,7 @@ void nmod_mpolyu_cvtfrom_poly(nmod_mpolyu_t A, nmod_poly_t a, A->length = k; } - +#if 0 void nmod_mpolyu_msub(nmod_mpolyu_t R, nmod_mpolyu_t A, nmod_mpolyu_t B, nmod_mpoly_t c, slong e, const nmod_mpoly_ctx_t ctx) { @@ -949,7 +949,7 @@ void nmod_mpolyu_msub(nmod_mpolyu_t R, nmod_mpolyu_t A, nmod_mpolyu_t B, nmod_mpoly_clear(T, ctx); R->length = k; } - +#endif void nmod_mpolyu_divexact_mpoly_inplace(nmod_mpolyu_t A, nmod_mpoly_t c, const nmod_mpoly_ctx_t ctx) diff --git a/src/nmod_mpoly/mpolyu_divides.c b/src/nmod_mpoly/mpolyu_divides.c index 8382fab252..77024c3c90 100644 --- a/src/nmod_mpoly/mpolyu_divides.c +++ b/src/nmod_mpoly/mpolyu_divides.c @@ -15,7 +15,7 @@ #include "nmod_mpoly.h" /* A = D - B*C */ -slong _nmod_mpoly_mulsub1(nmod_mpoly_t A, +static slong _nmod_mpoly_mulsub1(nmod_mpoly_t A, const ulong * Dcoeff, const ulong * Dexp, slong Dlen, const ulong * Bcoeff, const ulong * Bexp, slong Blen, const ulong * Ccoeff, const ulong * Cexp, slong Clen, @@ -174,7 +174,7 @@ slong _nmod_mpoly_mulsub1(nmod_mpoly_t A, } /* A = D - B*C */ -void _nmod_mpoly_mulsub(nmod_mpoly_t A, +static void _nmod_mpoly_mulsub(nmod_mpoly_t A, const ulong * Dcoeff, const ulong * Dexp, slong Dlen, const ulong * Bcoeff, const ulong * Bexp, slong Blen, const ulong * Ccoeff, const ulong * Cexp, slong Clen, diff --git a/src/nmod_mpoly/mpolyu_gcdp_zippel.c b/src/nmod_mpoly/mpolyu_gcdp_zippel.c index 9e9d84e8c0..b871cee603 100644 --- a/src/nmod_mpoly/mpolyu_gcdp_zippel.c +++ b/src/nmod_mpoly/mpolyu_gcdp_zippel.c @@ -17,7 +17,7 @@ #include "nmod_mpoly.h" /* store in each coefficient the evaluation of the corresponding monomial */ -void nmod_mpoly_evalsk(nmod_mpoly_t A, nmod_mpoly_t B, +static void nmod_mpoly_evalsk(nmod_mpoly_t A, nmod_mpoly_t B, slong entries, slong * offs, ulong * masks, ulong * powers, const nmod_mpoly_ctx_t ctx) { @@ -45,7 +45,7 @@ void nmod_mpoly_evalsk(nmod_mpoly_t A, nmod_mpoly_t B, A->length = B->length; } -void nmod_mpolyu_evalsk(nmod_mpolyu_t A, nmod_mpolyu_t B, +static void nmod_mpolyu_evalsk(nmod_mpolyu_t A, nmod_mpolyu_t B, slong entries, slong * offs, ulong * masks, ulong * powers, const nmod_mpoly_ctx_t ctx) { @@ -62,7 +62,7 @@ void nmod_mpolyu_evalsk(nmod_mpolyu_t A, nmod_mpolyu_t B, } /* multiply the coefficients of A pointwise by those of B */ -void nmod_mpolyu_mulsk(nmod_mpolyu_t A, nmod_mpolyu_t B, +static void nmod_mpolyu_mulsk(nmod_mpolyu_t A, nmod_mpolyu_t B, const nmod_mpoly_ctx_t ctx) { slong i, j; @@ -87,7 +87,7 @@ void nmod_mpolyu_mulsk(nmod_mpolyu_t A, nmod_mpolyu_t B, return 0 if the leading coeff of A vanishes else return 1 */ -int nmod_mpolyu_evalfromsk(nmod_poly_t e, nmod_mpolyu_t A, +static int nmod_mpolyu_evalfromsk(nmod_poly_t e, nmod_mpolyu_t A, nmod_mpolyu_t SK, const nmod_mpoly_ctx_t ctx) { slong i, j; @@ -129,8 +129,7 @@ int nmod_mpolyu_evalfromsk(nmod_poly_t e, nmod_mpolyu_t A, for x */ -int nmod_vandsolve(ulong * x, ulong * a, ulong * b, - slong n, nmod_t mod) +static int nmod_vandsolve(ulong * x, ulong * a, ulong * b, slong n, nmod_t mod) { int success = 0; slong i, j; @@ -662,7 +661,7 @@ static int nmod_mpolyu_gcdp_zippel_univar_no_cofactors( } -int nmod_mpolyu_gcdp_zippel_bivar( +static int nmod_mpolyu_gcdp_zippel_bivar( nmod_mpolyu_t G, nmod_mpolyu_t Abar, nmod_mpolyu_t Bbar, diff --git a/src/nmod_mpoly/mpolyun.c b/src/nmod_mpoly/mpolyun.c index bae8c64b37..1d7aef8b43 100644 --- a/src/nmod_mpoly/mpolyun.c +++ b/src/nmod_mpoly/mpolyun.c @@ -405,7 +405,7 @@ int nmod_mpolyun_equal( } - +#if 0 /* if the coefficient doesn't exist, a new one is created (and set to zero) */ n_poly_struct * _nmod_mpolyn_get_coeff(nmod_mpolyn_t A, ulong * pow, const nmod_mpoly_ctx_t uctx) @@ -478,9 +478,9 @@ n_poly_struct * _nmod_mpolyn_get_coeff(nmod_mpolyn_t A, return xk; } +#endif - - +#if 0 /* if the coefficient doesn't exist, a new one is created (and set to zero) */ nmod_mpolyn_struct * _nmod_mpolyun_get_coeff(nmod_mpolyun_t A, ulong pow, const nmod_mpoly_ctx_t uctx) @@ -551,9 +551,9 @@ nmod_mpolyn_struct * _nmod_mpolyun_get_coeff(nmod_mpolyun_t A, return xk; } +#endif - - +#if 0 void nmod_mpoly_to_mpolyun_perm_deflate_bivar( nmod_mpolyun_t A, const nmod_mpoly_t B, @@ -605,8 +605,9 @@ void nmod_mpoly_to_mpolyun_perm_deflate_bivar( mpoly_monomial_zero(Ac->exps + NA*0, NA); } } +#endif - +#if 0 /* Convert B to A using the variable permutation perm. The uctx should be the context of the coefficients of A. @@ -697,7 +698,7 @@ void nmod_mpoly_to_mpolyun_perm_deflate( TMP_END; } - +#endif void nmod_mpoly_to_mpolyn_perm_deflate_threaded_pool( nmod_mpolyn_t A, diff --git a/src/nmod_mpoly/mpolyun_divides.c b/src/nmod_mpoly/mpolyun_divides.c index f906730737..3c9195b2ca 100644 --- a/src/nmod_mpoly/mpolyun_divides.c +++ b/src/nmod_mpoly/mpolyun_divides.c @@ -13,7 +13,7 @@ #include "mpoly.h" #include "nmod_mpoly.h" -int _nmod_mpolyn_divides( +static int _nmod_mpolyn_divides( nmod_mpolyn_t Q, const nmod_mpolyn_t A, const nmod_mpolyn_t B, @@ -258,7 +258,7 @@ int nmod_mpolyn_divides( /* The following functions are currently untested and unused. */ -void _nmod_mpolyn_add( +static void _nmod_mpolyn_add( nmod_mpolyn_t A, const nmod_mpolyn_t B, const nmod_mpolyn_t C, @@ -322,7 +322,7 @@ void _nmod_mpolyn_add( /* A = D - B*C, D may be modified if saveD == 0 */ -void _nmod_mpolyn_mulsub( +static void _nmod_mpolyn_mulsub( nmod_mpolyn_t A, const nmod_mpolyn_t D, int saveD, const nmod_mpolyn_t B, diff --git a/src/nmod_mpoly/mul_array_threaded.c b/src/nmod_mpoly/mul_array_threaded.c index ac152299bb..99c5bdfdd3 100644 --- a/src/nmod_mpoly/mul_array_threaded.c +++ b/src/nmod_mpoly/mul_array_threaded.c @@ -209,7 +209,7 @@ static void _nmod_mpoly_mul_array_threaded_worker_LEX(void * varg) TMP_END; } -void _nmod_mpoly_mul_array_chunked_threaded_LEX( +static void _nmod_mpoly_mul_array_chunked_threaded_LEX( nmod_mpoly_t P, const nmod_mpoly_t A, const nmod_mpoly_t B, @@ -590,7 +590,7 @@ static void _nmod_mpoly_mul_array_threaded_worker_DEG(void * varg) -void _nmod_mpoly_mul_array_chunked_threaded_DEG( +static void _nmod_mpoly_mul_array_chunked_threaded_DEG( nmod_mpoly_t P, const nmod_mpoly_t A, const nmod_mpoly_t B, diff --git a/src/nmod_mpoly/mul_johnson.c b/src/nmod_mpoly/mul_johnson.c index 1160c327ec..ec1e67bd3f 100644 --- a/src/nmod_mpoly/mul_johnson.c +++ b/src/nmod_mpoly/mul_johnson.c @@ -15,7 +15,7 @@ #include "mpoly.h" #include "nmod_mpoly.h" -slong _nmod_mpoly_mul_johnson1( +static slong _nmod_mpoly_mul_johnson1( nmod_mpoly_t A, const ulong * coeff2, const ulong * exp2, slong len2, const ulong * coeff3, const ulong * exp3, slong len3, diff --git a/src/nmod_mpoly/scalar.c b/src/nmod_mpoly/scalar.c index 142252058a..80fbc5b97a 100644 --- a/src/nmod_mpoly/scalar.c +++ b/src/nmod_mpoly/scalar.c @@ -15,7 +15,7 @@ #include "mpoly.h" #include "nmod_mpoly.h" -slong _nmod_mpoly_scalar_addmul_ui1( +static slong _nmod_mpoly_scalar_addmul_ui1( ulong * Acoeffs, ulong * Aexps, const ulong * Bcoeffs, const ulong * Bexps, slong Blen, const ulong * Ccoeffs, const ulong * Cexps, slong Clen, @@ -255,7 +255,7 @@ void nmod_mpoly_scalar_mul_nmod_invertible( /* c is assumed to be reduced mod n */ -void nmod_mpoly_scalar_mul_nmod_general( +static void nmod_mpoly_scalar_mul_nmod_general( nmod_mpoly_t A, const nmod_mpoly_t B, ulong c, diff --git a/src/nmod_mpoly/setform.c b/src/nmod_mpoly/setform.c index 6cadd00d2e..8c5bc5fefc 100644 --- a/src/nmod_mpoly/setform.c +++ b/src/nmod_mpoly/setform.c @@ -14,7 +14,7 @@ #include "nmod_mpoly.h" /* setform copies the exponents and zeros the coefficients */ -void nmod_mpoly_setform(nmod_mpoly_t A, nmod_mpoly_t B, +static void nmod_mpoly_setform(nmod_mpoly_t A, nmod_mpoly_t B, const nmod_mpoly_ctx_t ctx) { flint_bitcnt_t bits = B->bits; @@ -40,7 +40,7 @@ void nmod_mpolyu_setform(nmod_mpolyu_t A, nmod_mpolyu_t B, A->length = B->length; } -void nmod_mpoly_setform_mpolyn(nmod_mpoly_t A, nmod_mpolyn_t B, +static void nmod_mpoly_setform_mpolyn(nmod_mpoly_t A, nmod_mpolyn_t B, const nmod_mpoly_ctx_t ctx) { slong i; diff --git a/src/nmod_mpoly/sub.c b/src/nmod_mpoly/sub.c index 235027a9ee..b05069d6f8 100644 --- a/src/nmod_mpoly/sub.c +++ b/src/nmod_mpoly/sub.c @@ -13,7 +13,7 @@ #include "mpoly.h" #include "nmod_mpoly.h" -slong _nmod_mpoly_sub1(ulong * coeff1, ulong * exp1, +static slong _nmod_mpoly_sub1(ulong * coeff1, ulong * exp1, const ulong * coeff2, const ulong * exp2, slong len2, const ulong * coeff3, const ulong * exp3, slong len3, ulong maskhi, nmod_t fctx) From 5ec812e11654d8c07526f352467c62dbab7d26d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 13:21:15 +0200 Subject: [PATCH 048/114] fmpz_mpoly --- src/fmpz_mpoly.h | 4 +++ src/fmpz_mpoly/add.c | 4 +-- src/fmpz_mpoly/compose_fmpz_poly.c | 4 +-- src/fmpz_mpoly/derivative.c | 4 +-- src/fmpz_mpoly/div_monagan_pearce.c | 2 +- src/fmpz_mpoly/divides_array.c | 14 ++++---- src/fmpz_mpoly/divides_monagan_pearce.c | 2 +- src/fmpz_mpoly/divrem.c | 2 +- src/fmpz_mpoly/divrem_array.c | 22 ++++++------- src/fmpz_mpoly/divrem_ideal.c | 2 +- src/fmpz_mpoly/evaluate_all.c | 4 +-- src/fmpz_mpoly/integral.c | 2 +- src/fmpz_mpoly/mul_array_threaded.c | 8 ++--- src/fmpz_mpoly/mul_heap_threaded.c | 2 +- src/fmpz_mpoly/mul_johnson.c | 2 +- src/fmpz_mpoly/quasidiv_heap.c | 4 +-- src/fmpz_mpoly/quasidivrem_heap.c | 4 +-- src/fmpz_mpoly/quasidivrem_ideal_heap.c | 36 ++++++++++----------- src/fmpz_mpoly/scalar_divides_fmpz.c | 2 +- src/fmpz_mpoly/scalar_fmma.c | 2 +- src/fmpz_mpoly/sqrt_heap.c | 2 +- src/fmpz_mpoly/sub.c | 4 +-- src/fmpz_mpoly/to_from_fmpz_poly.c | 5 ++- src/fmpz_mpoly/vec_autoreduction_groebner.c | 2 +- 24 files changed, 73 insertions(+), 66 deletions(-) diff --git a/src/fmpz_mpoly.h b/src/fmpz_mpoly.h index 34756c7339..c3fbc2d1ce 100644 --- a/src/fmpz_mpoly.h +++ b/src/fmpz_mpoly.h @@ -26,6 +26,8 @@ extern "C" { #endif +FLINT_HEADER_START + FMPZ_MPOLY_INLINE fmpz * fmpz_mpoly_term_coeff_ref(fmpz_mpoly_t A, slong i, const fmpz_mpoly_ctx_t ctx) @@ -933,6 +935,8 @@ void _fmpz_mpoly_addmul_uiuiui_fmpz(ulong * c, slong d1, slong d2) void fmpz_mpoly_remainder_test(const fmpz_mpoly_t r, const fmpz_mpoly_t g, const fmpz_mpoly_ctx_t ctx); void fmpz_mpoly_remainder_strongtest(const fmpz_mpoly_t r, const fmpz_mpoly_t g, const fmpz_mpoly_ctx_t ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/fmpz_mpoly/add.c b/src/fmpz_mpoly/add.c index 4cdd395dbd..710acb241e 100644 --- a/src/fmpz_mpoly/add.c +++ b/src/fmpz_mpoly/add.c @@ -15,7 +15,7 @@ #include "mpoly.h" #include "fmpz_mpoly.h" -slong _fmpz_mpoly_add1( +static slong _fmpz_mpoly_add1( fmpz * Acoeffs, ulong * Aexps, const fmpz * Bcoeffs, const ulong * Bexps, slong Blen, const fmpz * Ccoeffs, const ulong * Cexps, slong Clen, @@ -130,7 +130,7 @@ slong _fmpz_mpoly_add( return k; } -void fmpz_mpoly_add_inplace(fmpz_mpoly_t A, const fmpz_mpoly_t B, +static void fmpz_mpoly_add_inplace(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) { slong i, s, new_len, N; diff --git a/src/fmpz_mpoly/compose_fmpz_poly.c b/src/fmpz_mpoly/compose_fmpz_poly.c index 1f22a6a3a3..19ae12c711 100644 --- a/src/fmpz_mpoly/compose_fmpz_poly.c +++ b/src/fmpz_mpoly/compose_fmpz_poly.c @@ -55,7 +55,7 @@ static int _fmpz_poly_pow_ui_is_not_feasible(const fmpz_poly_t b, ulong e) } } -int _fmpz_mpoly_compose_fmpz_poly_sp(fmpz_poly_t A, const fmpz_mpoly_t B, +static int _fmpz_mpoly_compose_fmpz_poly_sp(fmpz_poly_t A, const fmpz_mpoly_t B, fmpz_poly_struct * const * C, const fmpz_mpoly_ctx_t ctx) { int success = 1; @@ -150,7 +150,7 @@ int _fmpz_mpoly_compose_fmpz_poly_sp(fmpz_poly_t A, const fmpz_mpoly_t B, } -int _fmpz_mpoly_compose_fmpz_poly_mp(fmpz_poly_t A, const fmpz_mpoly_t B, +static int _fmpz_mpoly_compose_fmpz_poly_mp(fmpz_poly_t A, const fmpz_mpoly_t B, fmpz_poly_struct * const * C, const fmpz_mpoly_ctx_t ctx) { int success = 1; diff --git a/src/fmpz_mpoly/derivative.c b/src/fmpz_mpoly/derivative.c index ba03926f9a..79a9f93cb9 100644 --- a/src/fmpz_mpoly/derivative.c +++ b/src/fmpz_mpoly/derivative.c @@ -13,7 +13,7 @@ #include "mpoly.h" #include "fmpz_mpoly.h" -slong _fmpz_mpoly_derivative(fmpz * coeff1, ulong * exp1, +static slong _fmpz_mpoly_derivative(fmpz * coeff1, ulong * exp1, const fmpz * coeff2, const ulong * exp2, slong len2, flint_bitcnt_t bits, slong N, slong offset, slong shift, ulong * oneexp) { @@ -37,7 +37,7 @@ slong _fmpz_mpoly_derivative(fmpz * coeff1, ulong * exp1, } -slong _fmpz_mpoly_derivative_mp(fmpz * coeff1, ulong * exp1, +static slong _fmpz_mpoly_derivative_mp(fmpz * coeff1, ulong * exp1, const fmpz * coeff2, const ulong * exp2, slong len2, flint_bitcnt_t bits, slong N, slong offset, ulong * oneexp) { diff --git a/src/fmpz_mpoly/div_monagan_pearce.c b/src/fmpz_mpoly/div_monagan_pearce.c index 2f33f8cd0b..29c84ec5c8 100644 --- a/src/fmpz_mpoly/div_monagan_pearce.c +++ b/src/fmpz_mpoly/div_monagan_pearce.c @@ -30,7 +30,7 @@ exponent at the head. Quotient poly is written in order. [1] http://www.cecm.sfu.ca/~rpearcea/sdmp/sdmp_paper.pdf */ -slong _fmpz_mpoly_div_monagan_pearce1(fmpz ** polyq, ulong ** expq, +static slong _fmpz_mpoly_div_monagan_pearce1(fmpz ** polyq, ulong ** expq, slong * allocq, const fmpz * poly2, const ulong * exp2, slong len2, const fmpz * poly3, const ulong * exp3, slong len3, slong bits, ulong maskhi) diff --git a/src/fmpz_mpoly/divides_array.c b/src/fmpz_mpoly/divides_array.c index c48e3aadca..0474c39ed6 100644 --- a/src/fmpz_mpoly/divides_array.c +++ b/src/fmpz_mpoly/divides_array.c @@ -1108,19 +1108,19 @@ static slong _fmpz_mpoly_divides_array_chunked(fmpz ** poly1, ulong ** exp1, /* if not done, use multiprecision coeffs instead */ if (len == 0) { - fmpz * p2 = (fmpz *) TMP_ALLOC(prod*sizeof(fmpz)); + fmpz * p2f = (fmpz *) TMP_ALLOC(prod*sizeof(fmpz)); for (j = 0; j < prod; j++) - fmpz_init(p2 + j); + fmpz_init(p2f + j); /* for each chunk of poly2 */ for (i = 0; i < l2 - skip; i++) { for (j = 0; j < prod; j++) - fmpz_zero(p2 + j); + fmpz_zero(p2f + j); /* convert relevant coeff/chunk of poly2 to array format */ - _fmpz_mpoly_to_fmpz_array(p2, poly2 + i2[i], e2 + i2[i], n2[i]); + _fmpz_mpoly_to_fmpz_array(p2f, poly2 + i2[i], e2 + i2[i], n2[i]); /* submuls */ @@ -1140,14 +1140,14 @@ static slong _fmpz_mpoly_divides_array_chunked(fmpz ** poly1, ulong ** exp1, goto cleanup; } - _fmpz_mpoly_submul_array1_fmpz(p2, (*poly1) + i1[j], + _fmpz_mpoly_submul_array1_fmpz(p2f, (*poly1) + i1[j], (*exp1) + i1[j], n1[j], poly3 + i3[k], e3 + i3[k], n3[k]); } } /* convert chunk from array format */ tlen = _fmpz_mpoly_from_fmpz_array(&temp, &texp, &talloc, - p2, mults, num, bits, 0); + p2f, mults, num, bits, 0); /* for terms where there may be a nonzero quotient if exact */ if (i < l1) @@ -1211,7 +1211,7 @@ static slong _fmpz_mpoly_divides_array_chunked(fmpz ** poly1, ulong ** exp1, cleanup2: for (j = 0; j < prod; j++) - fmpz_clear(p2 + j); + fmpz_clear(p2f + j); } /* if quotient was exact */ diff --git a/src/fmpz_mpoly/divides_monagan_pearce.c b/src/fmpz_mpoly/divides_monagan_pearce.c index 14ab7ee8d2..7dbdc6c9cf 100644 --- a/src/fmpz_mpoly/divides_monagan_pearce.c +++ b/src/fmpz_mpoly/divides_monagan_pearce.c @@ -26,7 +26,7 @@ we divide from right to left and use a heap with smallest exponent at head. [1] http://www.cecm.sfu.ca/~rpearcea/sdmp/sdmp_paper.pdf */ -slong _fmpz_mpoly_divides_monagan_pearce1(fmpz ** poly1, ulong ** exp1, +static slong _fmpz_mpoly_divides_monagan_pearce1(fmpz ** poly1, ulong ** exp1, slong * alloc, const fmpz * poly2, const ulong * exp2, slong len2, const fmpz * poly3, const ulong * exp3, slong len3, slong bits, ulong maskhi) diff --git a/src/fmpz_mpoly/divrem.c b/src/fmpz_mpoly/divrem.c index 885922ac01..3ab5fe8004 100644 --- a/src/fmpz_mpoly/divrem.c +++ b/src/fmpz_mpoly/divrem.c @@ -40,7 +40,7 @@ void fmpz_mpoly_divrem(fmpz_mpoly_t Q, fmpz_mpoly_t R, const fmpz_mpoly_t A, [1] http://www.cecm.sfu.ca/~rpearcea/sdmp/sdmp_paper.pdf */ -slong _fmpz_mpoly_divrem_monagan_pearce1(slong * lenr, +static slong _fmpz_mpoly_divrem_monagan_pearce1(slong * lenr, fmpz ** polyq, ulong ** expq, slong * allocq, fmpz ** polyr, ulong ** expr, slong * allocr, const fmpz * poly2, const ulong * exp2, slong len2, const fmpz * poly3, const ulong * exp3, slong len3, diff --git a/src/fmpz_mpoly/divrem_array.c b/src/fmpz_mpoly/divrem_array.c index da66652411..eba8b8e95e 100644 --- a/src/fmpz_mpoly/divrem_array.c +++ b/src/fmpz_mpoly/divrem_array.c @@ -34,7 +34,7 @@ The quotient and remainder terms are appended to the existing terms in those polys. */ -slong _fmpz_mpoly_divrem_array_tight(slong * lenr, +static slong _fmpz_mpoly_divrem_array_tight(slong * lenr, fmpz ** polyq, ulong ** expq, slong * allocq, slong len0, fmpz ** polyr, ulong ** expr, slong * allocr, slong len1, const fmpz * poly2, const ulong * exp2, slong len2, @@ -432,7 +432,7 @@ slong _fmpz_mpoly_divrem_array_tight(slong * lenr, of the quotient poly. It is assumed that poly2 is not zero. The quotient and remainder are written in reverse order. */ -slong _fmpz_mpoly_divrem_array_chunked(slong * lenr, +static slong _fmpz_mpoly_divrem_array_chunked(slong * lenr, fmpz ** polyq, ulong ** expq, slong * allocq, fmpz ** polyr, ulong ** expr, slong * allocr, const fmpz * poly2, const ulong * exp2, slong len2, @@ -740,19 +740,19 @@ slong _fmpz_mpoly_divrem_array_chunked(slong * lenr, /* if not done, use multiprecision coeffs instead */ if (len == 0 && l == 0) { - fmpz * p2 = (fmpz *) TMP_ALLOC(prod*sizeof(fmpz)); + fmpz * p2f = (fmpz *) TMP_ALLOC(prod*sizeof(fmpz)); for (j = 0; j < prod; j++) - fmpz_init(p2 + j); + fmpz_init(p2f + j); /* for each chunk of poly2 */ for (i = 0; i < l2; i++) { for (j = 0; j < prod; j++) - fmpz_zero(p2 + j); + fmpz_zero(p2f + j); /* convert relevant coeff/chunk of poly2 to array format */ - _fmpz_mpoly_to_fmpz_array(p2, poly2 + i2[i], e2 + i2[i], n2[i]); + _fmpz_mpoly_to_fmpz_array(p2f, poly2 + i2[i], e2 + i2[i], n2[i]); /* submuls */ @@ -774,19 +774,19 @@ slong _fmpz_mpoly_divrem_array_chunked(slong * lenr, l = 0; for (j = 0; j < prod; j++) - fmpz_clear(p2 + j); + fmpz_clear(p2f + j); goto cleanup3; } } - _fmpz_mpoly_submul_array1_fmpz(p2, (*polyq) + i1[j], + _fmpz_mpoly_submul_array1_fmpz(p2f, (*polyq) + i1[j], (*expq) + i1[j], n1[j], poly3 + i3[k], e3 + i3[k], n3[k]); } } /* convert chunk from array format */ tlen = _fmpz_mpoly_from_fmpz_array(&temp, &texp, &talloc, - p2, mults, num, bits, 0); + p2f, mults, num, bits, 0); if (tlen != 0) /* nonzero coeff/chunk */ { @@ -828,7 +828,7 @@ slong _fmpz_mpoly_divrem_array_chunked(slong * lenr, l = 0; for (j = 0; j < prod; j++) - fmpz_clear(p2 + j); + fmpz_clear(p2f + j); goto cleanup3; } } @@ -870,7 +870,7 @@ slong _fmpz_mpoly_divrem_array_chunked(slong * lenr, } for (j = 0; j < prod; j++) - fmpz_clear(p2 + j); + fmpz_clear(p2f + j); } /* if there were quotient terms */ diff --git a/src/fmpz_mpoly/divrem_ideal.c b/src/fmpz_mpoly/divrem_ideal.c index e13999f64f..a535c098c9 100644 --- a/src/fmpz_mpoly/divrem_ideal.c +++ b/src/fmpz_mpoly/divrem_ideal.c @@ -42,7 +42,7 @@ void fmpz_mpoly_divrem_ideal(fmpz_mpoly_struct ** Q, passed and an array of quotient polynomials is returned. These are not in low level format. */ -slong _fmpz_mpoly_divrem_ideal_monagan_pearce1(fmpz_mpoly_struct ** polyq, +static slong _fmpz_mpoly_divrem_ideal_monagan_pearce1(fmpz_mpoly_struct ** polyq, fmpz ** polyr, ulong ** expr, slong * allocr, const fmpz * poly2, const ulong * exp2, slong len2, fmpz_mpoly_struct * const * poly3, ulong * const * exp3, slong len, slong bits, const fmpz_mpoly_ctx_t ctx, diff --git a/src/fmpz_mpoly/evaluate_all.c b/src/fmpz_mpoly/evaluate_all.c index fd3606ad4e..88475dfb8d 100644 --- a/src/fmpz_mpoly/evaluate_all.c +++ b/src/fmpz_mpoly/evaluate_all.c @@ -28,7 +28,7 @@ int _fmpz_pow_ui_is_not_feasible(flint_bitcnt_t bbits, ulong e) return bbits > 1 && e >= limit/bbits; } -int _fmpz_mpoly_evaluate_all_fmpz_sp(fmpz_t ev, const fmpz_mpoly_t A, +static int _fmpz_mpoly_evaluate_all_fmpz_sp(fmpz_t ev, const fmpz_mpoly_t A, fmpz * const * val, const fmpz_mpoly_ctx_t ctx) { int success = 1; @@ -119,7 +119,7 @@ int _fmpz_mpoly_evaluate_all_fmpz_sp(fmpz_t ev, const fmpz_mpoly_t A, return success; } -int _fmpz_mpoly_evaluate_all_fmpz_mp(fmpz_t ev, const fmpz_mpoly_t A, +static int _fmpz_mpoly_evaluate_all_fmpz_mp(fmpz_t ev, const fmpz_mpoly_t A, fmpz * const * vals, const fmpz_mpoly_ctx_t ctx) { int success = 1; diff --git a/src/fmpz_mpoly/integral.c b/src/fmpz_mpoly/integral.c index cab033e576..043d13796b 100644 --- a/src/fmpz_mpoly/integral.c +++ b/src/fmpz_mpoly/integral.c @@ -14,7 +14,7 @@ #include "mpoly.h" #include "fmpz_mpoly.h" -slong _fmpz_mpoly_integral(fmpz_t s, fmpz * coeff1, ulong * exp1, +static slong _fmpz_mpoly_integral(fmpz_t s, fmpz * coeff1, ulong * exp1, const fmpz * coeff2, const ulong * exp2, slong len2, slong var, slong bits, const mpoly_ctx_t mctx) { diff --git a/src/fmpz_mpoly/mul_array_threaded.c b/src/fmpz_mpoly/mul_array_threaded.c index b8ab98dc9f..5383b3c853 100644 --- a/src/fmpz_mpoly/mul_array_threaded.c +++ b/src/fmpz_mpoly/mul_array_threaded.c @@ -76,7 +76,7 @@ _worker_arg_struct; LEX ******************/ -void _fmpz_mpoly_mul_array_threaded_worker_LEX(void * varg) +static void _fmpz_mpoly_mul_array_threaded_worker_LEX(void * varg) { slong i, j, Pi; _worker_arg_struct * arg = (_worker_arg_struct *) varg; @@ -219,7 +219,7 @@ void _fmpz_mpoly_mul_array_threaded_worker_LEX(void * varg) } -void _fmpz_mpoly_mul_array_chunked_threaded_LEX( +static void _fmpz_mpoly_mul_array_chunked_threaded_LEX( fmpz_mpoly_t P, const fmpz_mpoly_t A, const fmpz_mpoly_t B, @@ -478,7 +478,7 @@ int _fmpz_mpoly_mul_array_threaded_pool_LEX( *****************************/ -void _fmpz_mpoly_mul_array_threaded_worker_DEG(void * varg) +static void _fmpz_mpoly_mul_array_threaded_worker_DEG(void * varg) { slong i, j, Pi; _worker_arg_struct * arg = (_worker_arg_struct *) varg; @@ -634,7 +634,7 @@ void _fmpz_mpoly_mul_array_threaded_worker_DEG(void * varg) -void _fmpz_mpoly_mul_array_chunked_threaded_DEG( +static void _fmpz_mpoly_mul_array_chunked_threaded_DEG( fmpz_mpoly_t P, const fmpz_mpoly_t A, const fmpz_mpoly_t B, diff --git a/src/fmpz_mpoly/mul_heap_threaded.c b/src/fmpz_mpoly/mul_heap_threaded.c index 5f53ca655d..012c01d38a 100644 --- a/src/fmpz_mpoly/mul_heap_threaded.c +++ b/src/fmpz_mpoly/mul_heap_threaded.c @@ -637,7 +637,7 @@ static void _join_worker(void * varg) } } -void _fmpz_mpoly_mul_heap_threaded( +static void _fmpz_mpoly_mul_heap_threaded( fmpz_mpoly_t A, const fmpz * Bcoeff, const ulong * Bexp, slong Blen, const fmpz * Ccoeff, const ulong * Cexp, slong Clen, diff --git a/src/fmpz_mpoly/mul_johnson.c b/src/fmpz_mpoly/mul_johnson.c index 173d06d0d2..7501864e31 100644 --- a/src/fmpz_mpoly/mul_johnson.c +++ b/src/fmpz_mpoly/mul_johnson.c @@ -20,7 +20,7 @@ version of the function assumes the exponent vectors all fit in a single word. Assumes input polys are nonzero. */ -slong _fmpz_mpoly_mul_johnson1(fmpz ** poly1, ulong ** exp1, slong * alloc, +static slong _fmpz_mpoly_mul_johnson1(fmpz ** poly1, ulong ** exp1, slong * alloc, const fmpz * poly2, const ulong * exp2, slong len2, const fmpz * poly3, const ulong * exp3, slong len3, ulong maskhi) { diff --git a/src/fmpz_mpoly/quasidiv_heap.c b/src/fmpz_mpoly/quasidiv_heap.c index 888aac51b2..2880bac453 100644 --- a/src/fmpz_mpoly/quasidiv_heap.c +++ b/src/fmpz_mpoly/quasidiv_heap.c @@ -16,7 +16,7 @@ #include "mpoly.h" #include "fmpz_mpoly.h" -slong _fmpz_mpoly_quasidiv_heap1(fmpz_t scale, +static slong _fmpz_mpoly_quasidiv_heap1(fmpz_t scale, fmpz ** polyq, ulong ** expq, slong * allocq, const fmpz * poly2, const ulong * exp2, slong len2, const fmpz * poly3, const ulong * exp3, slong len3, @@ -370,7 +370,7 @@ slong _fmpz_mpoly_quasidiv_heap1(fmpz_t scale, } -slong _fmpz_mpoly_quasidiv_heap(fmpz_t scale, +static slong _fmpz_mpoly_quasidiv_heap(fmpz_t scale, fmpz ** polyq, ulong ** expq, slong * allocq, const fmpz * poly2, const ulong * exp2, slong len2, const fmpz * poly3, const ulong * exp3, slong len3, diff --git a/src/fmpz_mpoly/quasidivrem_heap.c b/src/fmpz_mpoly/quasidivrem_heap.c index 91ce5a652a..e809523623 100644 --- a/src/fmpz_mpoly/quasidivrem_heap.c +++ b/src/fmpz_mpoly/quasidivrem_heap.c @@ -16,7 +16,7 @@ #include "mpoly.h" #include "fmpz_mpoly.h" -slong _fmpz_mpoly_quasidivrem_heap1(fmpz_t scale, slong * lenr, +static slong _fmpz_mpoly_quasidivrem_heap1(fmpz_t scale, slong * lenr, fmpz ** polyq, ulong ** expq, slong * allocq, fmpz ** polyr, ulong ** expr, slong * allocr, const fmpz * poly2, const ulong * exp2, slong len2, const fmpz * poly3, const ulong * exp3, @@ -353,7 +353,7 @@ slong _fmpz_mpoly_quasidivrem_heap1(fmpz_t scale, slong * lenr, } -slong _fmpz_mpoly_quasidivrem_heap(fmpz_t scale, slong * lenr, +static slong _fmpz_mpoly_quasidivrem_heap(fmpz_t scale, slong * lenr, fmpz ** polyq, ulong ** expq, slong * allocq, fmpz ** polyr, ulong ** expr, slong * allocr, const fmpz * poly2, const ulong * exp2, slong len2, const fmpz * poly3, const ulong * exp3, diff --git a/src/fmpz_mpoly/quasidivrem_ideal_heap.c b/src/fmpz_mpoly/quasidivrem_ideal_heap.c index b053de4bdd..33f64ddd9f 100644 --- a/src/fmpz_mpoly/quasidivrem_ideal_heap.c +++ b/src/fmpz_mpoly/quasidivrem_ideal_heap.c @@ -14,7 +14,7 @@ #include "mpoly.h" #include "fmpz_mpoly.h" -slong _fmpz_mpoly_quasidivrem_ideal_heap1(fmpz_t scale, fmpz_mpoly_struct ** polyq, +static slong _fmpz_mpoly_quasidivrem_ideal_heap1(fmpz_t scale, fmpz_mpoly_struct ** polyq, fmpz ** polyr, ulong ** expr, slong * allocr, const fmpz * poly2, const ulong * exp2, slong len2, fmpz_mpoly_struct * const * poly3, ulong * const * exp3, slong len, slong bits, @@ -188,10 +188,10 @@ slong _fmpz_mpoly_quasidivrem_ideal_heap1(fmpz_t scale, fmpz_mpoly_struct ** pol fmpz_mpoly_fit_length(polyq[w], q_len[w] + 1, ctx); if (q_len[w] + 1 > qs_alloc[w]) { - slong len = FLINT_MAX(q_len[w] + 1, 2*qs_alloc[w]); - qs[w] = (fmpz *) flint_realloc(qs[w], len*sizeof(fmpz)); - flint_mpn_zero((nn_ptr) (qs[w] + qs_alloc[w]), len - qs_alloc[w]); - qs_alloc[w] = len; + slong len0 = FLINT_MAX(q_len[w] + 1, 2*qs_alloc[w]); + qs[w] = (fmpz *) flint_realloc(qs[w], len0*sizeof(fmpz)); + flint_mpn_zero((nn_ptr) (qs[w] + qs_alloc[w]), len0 - qs_alloc[w]); + qs_alloc[w] = len0; } fmpz_gcd(gcd, acc_lg, poly3[w]->coeffs + 0); @@ -230,10 +230,10 @@ slong _fmpz_mpoly_quasidivrem_ideal_heap1(fmpz_t scale, fmpz_mpoly_struct ** pol _fmpz_mpoly_fit_length(&r_coeff, &r_exp, allocr, r_len + 1, 1); if (r_len + 1 > rs_alloc) { - slong len = FLINT_MAX(r_len + 1, 2*rs_alloc); - rs = (fmpz *) flint_realloc(rs, len*sizeof(fmpz)); - flint_mpn_zero((nn_ptr) (rs + rs_alloc), len - rs_alloc); - rs_alloc = len; + slong len0 = FLINT_MAX(r_len + 1, 2*rs_alloc); + rs = (fmpz *) flint_realloc(rs, len0*sizeof(fmpz)); + flint_mpn_zero((nn_ptr) (rs + rs_alloc), len0 - rs_alloc); + rs_alloc = len0; } fmpz_set(r_coeff + r_len, acc_lg); fmpz_set(rs + r_len, scale); @@ -298,7 +298,7 @@ slong _fmpz_mpoly_quasidivrem_ideal_heap1(fmpz_t scale, fmpz_mpoly_struct ** pol -slong _fmpz_mpoly_quasidivrem_ideal_heap(fmpz_t scale, fmpz_mpoly_struct ** polyq, +static slong _fmpz_mpoly_quasidivrem_ideal_heap(fmpz_t scale, fmpz_mpoly_struct ** polyq, fmpz ** polyr, ulong ** expr, slong * allocr, const fmpz * poly2, const ulong * exp2, slong len2, fmpz_mpoly_struct * const * poly3, ulong * const * exp3, slong len, slong N, slong bits, @@ -507,10 +507,10 @@ slong _fmpz_mpoly_quasidivrem_ideal_heap(fmpz_t scale, fmpz_mpoly_struct ** poly fmpz_mpoly_fit_length(polyq[w], q_len[w] + 1, ctx); if (q_len[w] + 1 > qs_alloc[w]) { - slong len = FLINT_MAX(q_len[w] + 1, 2*qs_alloc[w]); - qs[w] = (fmpz *) flint_realloc(qs[w], len*sizeof(fmpz)); - flint_mpn_zero((nn_ptr) (qs[w] + qs_alloc[w]), len - qs_alloc[w]); - qs_alloc[w] = len; + slong len0 = FLINT_MAX(q_len[w] + 1, 2*qs_alloc[w]); + qs[w] = (fmpz *) flint_realloc(qs[w], len0*sizeof(fmpz)); + flint_mpn_zero((nn_ptr) (qs[w] + qs_alloc[w]), len0 - qs_alloc[w]); + qs_alloc[w] = len0; } fmpz_gcd(gcd, acc_lg, poly3[w]->coeffs + 0); @@ -551,10 +551,10 @@ slong _fmpz_mpoly_quasidivrem_ideal_heap(fmpz_t scale, fmpz_mpoly_struct ** poly _fmpz_mpoly_fit_length(&r_coeff, &r_exp, allocr, r_len + 1, N); if (r_len + 1 > rs_alloc) { - slong len = FLINT_MAX(r_len + 1, 2*rs_alloc); - rs = (fmpz *) flint_realloc(rs, len*sizeof(fmpz)); - flint_mpn_zero((nn_ptr) (rs + rs_alloc), len - rs_alloc); - rs_alloc = len; + slong len0 = FLINT_MAX(r_len + 1, 2*rs_alloc); + rs = (fmpz *) flint_realloc(rs, len0*sizeof(fmpz)); + flint_mpn_zero((nn_ptr) (rs + rs_alloc), len0 - rs_alloc); + rs_alloc = len0; } fmpz_set(r_coeff + r_len, acc_lg); fmpz_set(rs + r_len, scale); diff --git a/src/fmpz_mpoly/scalar_divides_fmpz.c b/src/fmpz_mpoly/scalar_divides_fmpz.c index 0c2164bd21..e02b9284a1 100644 --- a/src/fmpz_mpoly/scalar_divides_fmpz.c +++ b/src/fmpz_mpoly/scalar_divides_fmpz.c @@ -15,7 +15,7 @@ #include "fmpz_mpoly.h" /* leave vec1 undefined but valid if division is not exact */ -int _fmpz_vec_scalar_divides_fmpz(fmpz * vec1, const fmpz * vec2, +static int _fmpz_vec_scalar_divides_fmpz(fmpz * vec1, const fmpz * vec2, slong len2, const fmpz_t x) { slong i; diff --git a/src/fmpz_mpoly/scalar_fmma.c b/src/fmpz_mpoly/scalar_fmma.c index 2c2cd14de6..a90683fcfb 100644 --- a/src/fmpz_mpoly/scalar_fmma.c +++ b/src/fmpz_mpoly/scalar_fmma.c @@ -135,7 +135,7 @@ static slong _fmpz_mpoly_scalar_fmma( } /* A = A*a + B*b */ -void fmpz_mpoly_scalar_fmma_inplace( +static void fmpz_mpoly_scalar_fmma_inplace( fmpz_mpoly_t A, const fmpz_t a, const fmpz_mpoly_t B, diff --git a/src/fmpz_mpoly/sqrt_heap.c b/src/fmpz_mpoly/sqrt_heap.c index 53c088f60b..0f34210b8f 100644 --- a/src/fmpz_mpoly/sqrt_heap.c +++ b/src/fmpz_mpoly/sqrt_heap.c @@ -139,7 +139,7 @@ static int _is_proved_not_square( TODO: copy this strategy for the "small" case (i.e. no fmpz arithmetic) to the other fmpz mpoly mul/div functions. */ -slong _fmpz_mpoly_sqrt_heap1( +static slong _fmpz_mpoly_sqrt_heap1( fmpz ** polyq, ulong ** expq, slong * allocq, const fmpz * Acoeffs, const ulong * Aexps, slong Alen, flint_bitcnt_t bits, diff --git a/src/fmpz_mpoly/sub.c b/src/fmpz_mpoly/sub.c index 5e547edce2..cbf73be2a6 100644 --- a/src/fmpz_mpoly/sub.c +++ b/src/fmpz_mpoly/sub.c @@ -15,7 +15,7 @@ #include "mpoly.h" #include "fmpz_mpoly.h" -slong _fmpz_mpoly_sub1( +static slong _fmpz_mpoly_sub1( fmpz * Acoeffs, ulong * Aexps, const fmpz * Bcoeffs, const ulong * Bexps, slong Blen, const fmpz * Ccoeffs, const ulong * Cexps, slong Clen, @@ -130,7 +130,7 @@ slong _fmpz_mpoly_sub( return k; } -void fmpz_mpoly_sub_inplace(fmpz_mpoly_t A, const fmpz_mpoly_t B, +static void fmpz_mpoly_sub_inplace(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) { slong i, s, new_len, N; diff --git a/src/fmpz_mpoly/to_from_fmpz_poly.c b/src/fmpz_mpoly/to_from_fmpz_poly.c index d4253e9e51..9657f267d8 100644 --- a/src/fmpz_mpoly/to_from_fmpz_poly.c +++ b/src/fmpz_mpoly/to_from_fmpz_poly.c @@ -14,6 +14,7 @@ #include "mpoly.h" #include "fmpz_mpoly.h" +#if 0 /* assuming that the conversion can be done, set poly1 and poly1_shift so that poly2 is poly1 * X^poly1_shift @@ -51,7 +52,9 @@ void fmpz_mpoly_to_fmpz_poly(fmpz_poly_t poly1, slong * poly1_shift, *poly1_shift = _shift; } +#endif +#if 0 /* set poly1 to poly2 * X^shift2 in the variable var */ @@ -102,7 +105,7 @@ void fmpz_mpoly_from_fmpz_poly(fmpz_mpoly_t poly1, const fmpz_poly_t poly2, TMP_END; } - +#endif /* set A(x_var^Bstride[var]) to B/xbar^Bshifts diff --git a/src/fmpz_mpoly/vec_autoreduction_groebner.c b/src/fmpz_mpoly/vec_autoreduction_groebner.c index 4f6bd177d3..bd9c5f413f 100644 --- a/src/fmpz_mpoly/vec_autoreduction_groebner.c +++ b/src/fmpz_mpoly/vec_autoreduction_groebner.c @@ -93,7 +93,7 @@ fmpz_mpoly_vec_autoreduction_groebner(fmpz_mpoly_vec_t G, const fmpz_mpoly_vec_t { fmpz_t scale; fmpz_mpoly_struct ** Q, ** B; - slong i, j, alloc; + slong alloc; alloc = G->length - 1; From 75dbb2e45bda801f6e95a89db224b700812e264a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 13:21:24 +0200 Subject: [PATCH 049/114] fmpz_mod_mpoly --- src/fmpz_mod_mpoly.h | 4 ++++ src/fmpz_mod_mpoly/add.c | 2 +- src/fmpz_mod_mpoly/divides_monagan_pearce.c | 2 +- src/fmpz_mod_mpoly/divrem_ideal_monagan_pearce.c | 2 +- src/fmpz_mod_mpoly/evaluate_one.c | 2 +- src/fmpz_mod_mpoly/geobuckets.c | 2 +- src/fmpz_mod_mpoly/mul_johnson.c | 2 +- src/fmpz_mod_mpoly/scalar_mul_fmpz.c | 2 +- src/fmpz_mod_mpoly/sub.c | 2 +- src/fmpz_mod_mpoly/univar.c | 2 ++ 10 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/fmpz_mod_mpoly.h b/src/fmpz_mod_mpoly.h index cc6040c076..3262b273f6 100644 --- a/src/fmpz_mod_mpoly.h +++ b/src/fmpz_mod_mpoly.h @@ -29,6 +29,8 @@ extern "C" { #endif +FLINT_HEADER_START + /* type definitions **********************************************************/ /* @@ -955,6 +957,8 @@ void fmpz_mod_mpoly_from_mpolyl_perm_inflate(fmpz_mod_mpoly_t A, void fmpz_mod_mpoly_remainder_strongtest(const fmpz_mod_mpoly_t r, const fmpz_mod_mpoly_t g, const fmpz_mod_mpoly_ctx_t ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/fmpz_mod_mpoly/add.c b/src/fmpz_mod_mpoly/add.c index 290a28334c..446c8be1ab 100644 --- a/src/fmpz_mod_mpoly/add.c +++ b/src/fmpz_mod_mpoly/add.c @@ -13,7 +13,7 @@ #include "mpoly.h" #include "fmpz_mod_mpoly.h" -slong _fmpz_mod_mpoly_add( +static slong _fmpz_mod_mpoly_add( fmpz * Acoeffs, ulong * Aexps, const fmpz * Bcoeffs, const ulong * Bexps, slong Blen, const fmpz * Ccoeffs, const ulong * Cexps, slong Clen, diff --git a/src/fmpz_mod_mpoly/divides_monagan_pearce.c b/src/fmpz_mod_mpoly/divides_monagan_pearce.c index 35022b4a12..bd7f06743c 100644 --- a/src/fmpz_mod_mpoly/divides_monagan_pearce.c +++ b/src/fmpz_mod_mpoly/divides_monagan_pearce.c @@ -240,7 +240,7 @@ static int _fmpz_mod_mpoly_divides_monagan_pearce1( } -int _fmpz_mod_mpoly_divides_monagan_pearce( +static int _fmpz_mod_mpoly_divides_monagan_pearce( fmpz_mod_mpoly_t Q, const fmpz * Acoeffs, const ulong * Aexps, slong Alen, const fmpz * Bcoeffs, const ulong * Bexps, slong Blen, diff --git a/src/fmpz_mod_mpoly/divrem_ideal_monagan_pearce.c b/src/fmpz_mod_mpoly/divrem_ideal_monagan_pearce.c index 7dd31a85f7..c12063fdbe 100644 --- a/src/fmpz_mod_mpoly/divrem_ideal_monagan_pearce.c +++ b/src/fmpz_mod_mpoly/divrem_ideal_monagan_pearce.c @@ -13,7 +13,7 @@ #include "mpoly.h" #include "fmpz_mod_mpoly.h" -int _fmpz_mod_mpoly_divrem_ideal_monagan_pearce( +static int _fmpz_mod_mpoly_divrem_ideal_monagan_pearce( fmpz_mod_mpoly_struct ** Q, fmpz_mod_mpoly_t R, const fmpz * Acoeffs, const ulong * Aexps, slong Alen, diff --git a/src/fmpz_mod_mpoly/evaluate_one.c b/src/fmpz_mod_mpoly/evaluate_one.c index 9f37608b25..36f973eeac 100644 --- a/src/fmpz_mod_mpoly/evaluate_one.c +++ b/src/fmpz_mod_mpoly/evaluate_one.c @@ -14,7 +14,7 @@ #include "fmpz_mod_mpoly.h" /* exponents of B are not multiprecision */ -void _fmpz_mod_mpoly_evaluate_one_fmpz_mod_sp( +static void _fmpz_mod_mpoly_evaluate_one_fmpz_mod_sp( fmpz_mod_mpoly_t A, const fmpz_mod_mpoly_t B, slong var, diff --git a/src/fmpz_mod_mpoly/geobuckets.c b/src/fmpz_mod_mpoly/geobuckets.c index 06d60a101a..2f41e6f79c 100644 --- a/src/fmpz_mod_mpoly/geobuckets.c +++ b/src/fmpz_mod_mpoly/geobuckets.c @@ -97,7 +97,7 @@ void fmpz_mod_mpoly_geobucket_set( } /* internal function for fixing overflows */ -void _fmpz_mod_mpoly_geobucket_fix( +static void _fmpz_mod_mpoly_geobucket_fix( fmpz_mod_mpoly_geobucket_t B, slong i, const fmpz_mod_mpoly_ctx_t ctx) diff --git a/src/fmpz_mod_mpoly/mul_johnson.c b/src/fmpz_mod_mpoly/mul_johnson.c index 7c89d96525..8c62af603e 100644 --- a/src/fmpz_mod_mpoly/mul_johnson.c +++ b/src/fmpz_mod_mpoly/mul_johnson.c @@ -36,7 +36,7 @@ fmpz_mod_ctx_get_modulus_mpz_read_only(mpz_t m, const fmpz_mod_ctx_t ctx) } } -void _fmpz_mod_mpoly_mul_johnson1( +static void _fmpz_mod_mpoly_mul_johnson1( fmpz_mod_mpoly_t A, const fmpz * Bcoeffs, const ulong * Bexps, slong Blen, const fmpz * Ccoeffs, const ulong * Cexps, slong Clen, diff --git a/src/fmpz_mod_mpoly/scalar_mul_fmpz.c b/src/fmpz_mod_mpoly/scalar_mul_fmpz.c index 968faf5192..d6f782fd43 100644 --- a/src/fmpz_mod_mpoly/scalar_mul_fmpz.c +++ b/src/fmpz_mod_mpoly/scalar_mul_fmpz.c @@ -38,7 +38,7 @@ void fmpz_mod_mpoly_scalar_mul_fmpz_mod_invertible( } /* c is assumed to be reduced mod n */ -void fmpz_mod_mpoly_scalar_mul_fmpz_mod( +static void fmpz_mod_mpoly_scalar_mul_fmpz_mod( fmpz_mod_mpoly_t A, const fmpz_mod_mpoly_t B, const fmpz_t c, diff --git a/src/fmpz_mod_mpoly/sub.c b/src/fmpz_mod_mpoly/sub.c index 5fde0f60ed..97d7830e56 100644 --- a/src/fmpz_mod_mpoly/sub.c +++ b/src/fmpz_mod_mpoly/sub.c @@ -13,7 +13,7 @@ #include "mpoly.h" #include "fmpz_mod_mpoly.h" -slong _fmpz_mod_mpoly_sub( +static slong _fmpz_mod_mpoly_sub( fmpz * Acoeffs, ulong * Aexps, const fmpz * Bcoeffs, const ulong * Bexps, slong Blen, const fmpz * Ccoeffs, const ulong * Cexps, slong Clen, diff --git a/src/fmpz_mod_mpoly/univar.c b/src/fmpz_mod_mpoly/univar.c index 9f2da9446d..b55b568487 100644 --- a/src/fmpz_mod_mpoly/univar.c +++ b/src/fmpz_mod_mpoly/univar.c @@ -548,6 +548,7 @@ void fmpz_mod_mpoly_from_univar( _fmpz_mod_mpoly_from_univar(A, bits, B, var, ctx); } +#if 0 void fmpz_mod_mpoly_univar_set( fmpz_mod_mpoly_univar_t A, const fmpz_mod_mpoly_univar_t B, @@ -565,6 +566,7 @@ void fmpz_mod_mpoly_univar_set( A->length = B->length; } +#endif #define COEFF(A, i) ((void*)(A->coeffs + (i)*R->elem_size)) From 57a12405abd8207ded589fe4cab515eaff67678f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 13:21:35 +0200 Subject: [PATCH 050/114] fq_nmod_mpoly --- src/fq_nmod_mpoly.h | 6 +++++- src/fq_nmod_mpoly/compose_fq_nmod_poly.c | 4 ++-- src/fq_nmod_mpoly/divrem_ideal_monagan_pearce.c | 2 +- src/fq_nmod_mpoly/evaluate_one.c | 2 +- src/fq_nmod_mpoly/gcd.c | 8 ++++---- src/fq_nmod_mpoly/gcd_zippel.c | 2 +- src/fq_nmod_mpoly/geobuckets.c | 2 +- src/fq_nmod_mpoly/get_str_pretty.c | 2 +- src/fq_nmod_mpoly/interp.c | 10 +++++----- src/fq_nmod_mpoly/mpolyn_gcd_brown.c | 4 ++-- src/fq_nmod_mpoly/mpolyu.c | 7 ++++--- src/fq_nmod_mpoly/mpolyu_gcdp_zippel.c | 14 ++++++++++---- src/fq_nmod_mpoly/mul_johnson.c | 2 +- src/fq_nmod_mpoly/setform.c | 2 +- src/fq_nmod_mpoly/sub.c | 2 +- 15 files changed, 40 insertions(+), 29 deletions(-) diff --git a/src/fq_nmod_mpoly.h b/src/fq_nmod_mpoly.h index e26055cd25..0e489e2111 100644 --- a/src/fq_nmod_mpoly.h +++ b/src/fq_nmod_mpoly.h @@ -27,9 +27,11 @@ #endif #ifdef __cplusplus - extern "C" { +extern "C" { #endif +FLINT_HEADER_START + /* Internal type definitions *************************************************/ /* @@ -1513,6 +1515,8 @@ void fq_nmod_mpoly_geobucket_sub(fq_nmod_mpoly_geobucket_t B, void fq_nmod_mpoly_remainder_strongtest(const fq_nmod_mpoly_t r, const fq_nmod_mpoly_t g, const fq_nmod_mpoly_ctx_t ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/fq_nmod_mpoly/compose_fq_nmod_poly.c b/src/fq_nmod_mpoly/compose_fq_nmod_poly.c index 83a48c49cc..5e168f7808 100644 --- a/src/fq_nmod_mpoly/compose_fq_nmod_poly.c +++ b/src/fq_nmod_mpoly/compose_fq_nmod_poly.c @@ -18,7 +18,7 @@ #include "nmod_mpoly.h" #include "fq_nmod_mpoly.h" -int _fq_nmod_mpoly_compose_fq_nmod_poly_sp(fq_nmod_poly_t A, const fq_nmod_mpoly_t B, +static int _fq_nmod_mpoly_compose_fq_nmod_poly_sp(fq_nmod_poly_t A, const fq_nmod_mpoly_t B, fq_nmod_poly_struct * const * C, const fq_nmod_mpoly_ctx_t ctx) { slong d = fq_nmod_ctx_degree(ctx->fqctx); @@ -118,7 +118,7 @@ int _fq_nmod_mpoly_compose_fq_nmod_poly_sp(fq_nmod_poly_t A, const fq_nmod_mpoly return success; } -int _fq_nmod_mpoly_compose_fq_nmod_poly_mp(fq_nmod_poly_t A, const fq_nmod_mpoly_t B, +static int _fq_nmod_mpoly_compose_fq_nmod_poly_mp(fq_nmod_poly_t A, const fq_nmod_mpoly_t B, fq_nmod_poly_struct * const * C, const fq_nmod_mpoly_ctx_t ctx) { slong d = fq_nmod_ctx_degree(ctx->fqctx); diff --git a/src/fq_nmod_mpoly/divrem_ideal_monagan_pearce.c b/src/fq_nmod_mpoly/divrem_ideal_monagan_pearce.c index d236cf9fa9..23329733d8 100644 --- a/src/fq_nmod_mpoly/divrem_ideal_monagan_pearce.c +++ b/src/fq_nmod_mpoly/divrem_ideal_monagan_pearce.c @@ -19,7 +19,7 @@ passed and an array of quotient polynomials is returned. These are not in low level format. */ -int _fq_nmod_mpoly_divrem_ideal_monagan_pearce( +static int _fq_nmod_mpoly_divrem_ideal_monagan_pearce( fq_nmod_mpoly_struct ** Q, fq_nmod_mpoly_t R, const ulong * poly2, const ulong * exp2, slong len2, diff --git a/src/fq_nmod_mpoly/evaluate_one.c b/src/fq_nmod_mpoly/evaluate_one.c index 18ae448f0b..02bef3e41e 100644 --- a/src/fq_nmod_mpoly/evaluate_one.c +++ b/src/fq_nmod_mpoly/evaluate_one.c @@ -15,7 +15,7 @@ #include "mpoly.h" #include "fq_nmod_mpoly.h" -void _fq_nmod_mpoly_evaluate_one_fq_nmod_sp( +static void _fq_nmod_mpoly_evaluate_one_fq_nmod_sp( fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, slong var, diff --git a/src/fq_nmod_mpoly/gcd.c b/src/fq_nmod_mpoly/gcd.c index 281a06a30e..e26590bd18 100644 --- a/src/fq_nmod_mpoly/gcd.c +++ b/src/fq_nmod_mpoly/gcd.c @@ -29,7 +29,7 @@ If ignore[j] is nonzero, then out[j] need not be calculated, probably because we shouldn't calculate it in dense form. */ -void fq_nmod_mpoly_evals( +static void fq_nmod_mpoly_evals( slong * Atdeg, /* total degree of deflated A, or -1 for overflow */ n_fq_poly_struct * out, const int * ignore, @@ -134,7 +134,7 @@ void fq_nmod_mpoly_evals( flint_free(t); } -void fq_nmod_mpoly_evals_lgprime( +static void fq_nmod_mpoly_evals_lgprime( slong * Atdeg, /* total degree of deflated A, or -1 for overflow */ n_fq_poly_struct * out, const int * ignore, @@ -241,7 +241,7 @@ void fq_nmod_mpoly_evals_lgprime( } -void mpoly_gcd_info_set_estimates_fq_nmod_mpoly( +static void mpoly_gcd_info_set_estimates_fq_nmod_mpoly( mpoly_gcd_info_t I, const fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, @@ -361,7 +361,7 @@ void mpoly_gcd_info_set_estimates_fq_nmod_mpoly( } -void mpoly_gcd_info_set_estimates_fq_nmod_mpoly_lgprime( +static void mpoly_gcd_info_set_estimates_fq_nmod_mpoly_lgprime( mpoly_gcd_info_t I, const fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, diff --git a/src/fq_nmod_mpoly/gcd_zippel.c b/src/fq_nmod_mpoly/gcd_zippel.c index 48a15d7e91..77c20582e4 100644 --- a/src/fq_nmod_mpoly/gcd_zippel.c +++ b/src/fq_nmod_mpoly/gcd_zippel.c @@ -15,7 +15,7 @@ #include "mpoly.h" #include "fq_nmod_mpoly.h" -int fq_nmod_mpolyu_gcdm_zippel_bivar( +static int fq_nmod_mpolyu_gcdm_zippel_bivar( fq_nmod_mpolyu_t G, fq_nmod_mpolyu_t Abar, fq_nmod_mpolyu_t Bbar, diff --git a/src/fq_nmod_mpoly/geobuckets.c b/src/fq_nmod_mpoly/geobuckets.c index af9dbd03a3..085030eeeb 100644 --- a/src/fq_nmod_mpoly/geobuckets.c +++ b/src/fq_nmod_mpoly/geobuckets.c @@ -90,7 +90,7 @@ void fq_nmod_mpoly_geobucket_set(fq_nmod_mpoly_geobucket_t B, fq_nmod_mpoly_t p, } /* internal function for fixing overflows */ -void _fq_nmod_mpoly_geobucket_fix(fq_nmod_mpoly_geobucket_t B, slong i, +static void _fq_nmod_mpoly_geobucket_fix(fq_nmod_mpoly_geobucket_t B, slong i, const fq_nmod_mpoly_ctx_t ctx) { while (clog4((B->polys + i)->length) > i) diff --git a/src/fq_nmod_mpoly/get_str_pretty.c b/src/fq_nmod_mpoly/get_str_pretty.c index a73dd314c9..84640fa0b1 100644 --- a/src/fq_nmod_mpoly/get_str_pretty.c +++ b/src/fq_nmod_mpoly/get_str_pretty.c @@ -19,7 +19,7 @@ #define ALLOC_PER_VAR ((FLINT_BITS+4)/3) -char * _fq_nmod_mpoly_get_str_pretty( +static char * _fq_nmod_mpoly_get_str_pretty( const ulong * coeff, const ulong * exp, slong len, diff --git a/src/fq_nmod_mpoly/interp.c b/src/fq_nmod_mpoly/interp.c index 682f0b61d6..53fc70e308 100644 --- a/src/fq_nmod_mpoly/interp.c +++ b/src/fq_nmod_mpoly/interp.c @@ -1226,7 +1226,7 @@ int nmod_mpolyn_interp_mcrt_lg_mpoly( Update H so that it does not change mod m, and is now A mod p It is asserted that the monomials in H and A match */ -int nmod_mpolyn_CRT_fq_nmod_mpoly( +static int nmod_mpolyn_CRT_fq_nmod_mpoly( slong * lastdeg, nmod_mpolyn_t H, const nmod_mpoly_ctx_t ctx, @@ -2864,7 +2864,7 @@ int fq_nmod_mpolyn_interp_crt_lg_mpolyn( /*****************************************************************************/ /* evaluate A at lastvar = alpha */ -void fq_nmod_mpolyn_interp_reduce_sm_mpoly( +static void fq_nmod_mpolyn_interp_reduce_sm_mpoly( fq_nmod_mpoly_t B, fq_nmod_mpolyn_t A, fq_nmod_t alpha, @@ -2969,7 +2969,7 @@ void fq_nmod_mpolyun_interp_lift_sm_mpolyu( /* F = F + modulus*(A - F(alpha)) */ -int fq_nmod_mpolyn_interp_crt_sm_mpoly( +static int fq_nmod_mpolyn_interp_crt_sm_mpoly( slong * lastdeg, fq_nmod_mpolyn_t F, fq_nmod_mpolyn_t T, @@ -3312,7 +3312,7 @@ void fq_nmod_mpolyun_interp_lift_lg_mpolyu( no assumptions about matching monomials */ -int fq_nmod_mpolyn_interp_crt_lg_mpoly( +static int fq_nmod_mpolyn_interp_crt_lg_mpoly( slong * lastdeg, fq_nmod_mpolyn_t F, fq_nmod_mpolyn_t T, @@ -3573,7 +3573,7 @@ int fq_nmod_mpolyun_interp_crt_lg_mpolyu( Update H so that it does not change mod m, and is now A mod p It is asserted that the monomials in H and A match */ -int fq_nmod_mpolyn_interp_mcrt_lg_mpoly( +static int fq_nmod_mpolyn_interp_mcrt_lg_mpoly( slong * lastdeg, fq_nmod_mpolyn_t H, const fq_nmod_mpoly_ctx_t ctx, diff --git a/src/fq_nmod_mpoly/mpolyn_gcd_brown.c b/src/fq_nmod_mpoly/mpolyn_gcd_brown.c index 44296c267a..ca7d181ffa 100644 --- a/src/fq_nmod_mpoly/mpolyn_gcd_brown.c +++ b/src/fq_nmod_mpoly/mpolyn_gcd_brown.c @@ -15,7 +15,7 @@ #include "mpoly.h" #include "fq_nmod_mpoly.h" -int fq_nmod_mpolyn_gcd_brown_smprime_bivar( +static int fq_nmod_mpolyn_gcd_brown_smprime_bivar( fq_nmod_mpolyn_t G, fq_nmod_mpolyn_t Abar, fq_nmod_mpolyn_t Bbar, @@ -521,7 +521,7 @@ int fq_nmod_mpolyn_gcd_brown_smprime( } -int fq_nmod_mpolyn_gcd_brown_lgprime_bivar( +static int fq_nmod_mpolyn_gcd_brown_lgprime_bivar( fq_nmod_mpolyn_t G, fq_nmod_mpolyn_t Abar, fq_nmod_mpolyn_t Bbar, diff --git a/src/fq_nmod_mpoly/mpolyu.c b/src/fq_nmod_mpoly/mpolyu.c index fcac3fba61..e7d7fe3b84 100644 --- a/src/fq_nmod_mpoly/mpolyu.c +++ b/src/fq_nmod_mpoly/mpolyu.c @@ -387,7 +387,7 @@ void fq_nmod_mpoly_from_mpolyu_perm_inflate( fq_nmod_mpoly_sort_terms(A, ctx); } - +#if 0 /* Convert B to A using the variable permutation perm. The uctx should be the context of the coefficients of A. @@ -469,8 +469,9 @@ void fq_nmod_mpoly_to_mpolyuu_perm_deflate( TMP_END; } +#endif - +#if 0 /* Convert B to A using the variable permutation vector perm. A must be constructed with bits = Abits. @@ -557,7 +558,7 @@ void fq_nmod_mpoly_from_mpolyuu_perm_inflate( /* only for 2 main vars */ fq_nmod_mpoly_sort_terms(A, ctx); TMP_END; } - +#endif diff --git a/src/fq_nmod_mpoly/mpolyu_gcdp_zippel.c b/src/fq_nmod_mpoly/mpolyu_gcdp_zippel.c index ab0724960d..d4b83da023 100644 --- a/src/fq_nmod_mpoly/mpolyu_gcdp_zippel.c +++ b/src/fq_nmod_mpoly/mpolyu_gcdp_zippel.c @@ -19,6 +19,12 @@ #include "mpoly.h" #include "fq_nmod_mpoly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + int fq_nmod_next(fq_nmod_t alpha, const fq_nmod_ctx_t fqctx) { slong i; @@ -281,7 +287,7 @@ void fq_nmod_poly_product_roots(fq_nmod_poly_t P, fq_nmod_struct * r, for x */ -int fq_nmod_vandsolve(ulong * X, ulong * A, fq_nmod_struct * b, +static int fq_nmod_vandsolve(ulong * X, ulong * A, fq_nmod_struct * b, slong n, const fq_nmod_ctx_t fqctx) { slong d = fq_nmod_ctx_degree(fqctx); @@ -846,7 +852,7 @@ nmod_gcds_ret_t fq_nmod_mpolyu_gcds_zippel( /* setform copies the exponents and zeros the coefficients */ -void fq_nmod_mpoly_setform_mpolyn( +static void fq_nmod_mpoly_setform_mpolyn( fq_nmod_mpoly_t A, fq_nmod_mpolyn_t B, const fq_nmod_mpoly_ctx_t ctx) @@ -867,7 +873,7 @@ void fq_nmod_mpoly_setform_mpolyn( A->length = B->length; } -void fq_nmod_mpolyu_setform_mpolyun(fq_nmod_mpolyu_t A, fq_nmod_mpolyun_t B, +static void fq_nmod_mpolyu_setform_mpolyun(fq_nmod_mpolyu_t A, fq_nmod_mpolyun_t B, const fq_nmod_mpoly_ctx_t ctx) { slong i; @@ -942,7 +948,7 @@ int fq_nmod_mpolyu_gcdp_zippel_univar_no_cofactors( } -int fq_nmod_mpolyu_gcdp_zippel_bivar( +static int fq_nmod_mpolyu_gcdp_zippel_bivar( fq_nmod_mpolyu_t G, fq_nmod_mpolyu_t Abar, fq_nmod_mpolyu_t Bbar, diff --git a/src/fq_nmod_mpoly/mul_johnson.c b/src/fq_nmod_mpoly/mul_johnson.c index 590ba702c9..2614ef7f5d 100644 --- a/src/fq_nmod_mpoly/mul_johnson.c +++ b/src/fq_nmod_mpoly/mul_johnson.c @@ -16,7 +16,7 @@ #include "mpoly.h" #include "fq_nmod_mpoly.h" -void _fq_nmod_mpoly_mul_johnson1( +static void _fq_nmod_mpoly_mul_johnson1( fq_nmod_mpoly_t A, const ulong * Bcoeffs, const ulong * Bexps, slong Blen, const ulong * Ccoeffs, const ulong * Cexps, slong Clen, diff --git a/src/fq_nmod_mpoly/setform.c b/src/fq_nmod_mpoly/setform.c index d88c5ee3da..1c5ea9070d 100644 --- a/src/fq_nmod_mpoly/setform.c +++ b/src/fq_nmod_mpoly/setform.c @@ -15,7 +15,7 @@ #include "fq_nmod_mpoly.h" /* setform copies the exponents and zeros the coefficients */ -void fq_nmod_mpoly_setform(fq_nmod_mpoly_t A, fq_nmod_mpoly_t B, +static void fq_nmod_mpoly_setform(fq_nmod_mpoly_t A, fq_nmod_mpoly_t B, const fq_nmod_mpoly_ctx_t ctx) { slong d = fq_nmod_ctx_degree(ctx->fqctx); diff --git a/src/fq_nmod_mpoly/sub.c b/src/fq_nmod_mpoly/sub.c index 84aeb640c4..50136833b1 100644 --- a/src/fq_nmod_mpoly/sub.c +++ b/src/fq_nmod_mpoly/sub.c @@ -14,7 +14,7 @@ #include "mpoly.h" #include "fq_nmod_mpoly.h" -slong _fq_nmod_mpoly_sub( +static slong _fq_nmod_mpoly_sub( ulong * Acoeffs, ulong * Aexps, ulong * Bcoeffs, const ulong * Bexps, slong Blen, ulong * Ccoeffs, const ulong * Cexps, slong Clen, From b48774da3d5dd56eb218d7956d6044faa3770f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 13:22:16 +0200 Subject: [PATCH 051/114] nmod_mpoly_factor --- src/nmod_mpoly_factor.h | 5 ++++- src/nmod_mpoly_factor/factor.c | 2 +- src/nmod_mpoly_factor/n_bpoly_mod.c | 2 +- src/nmod_mpoly_factor/n_bpoly_mod_factor_smprime.c | 2 +- src/nmod_mpoly_factor/n_bpoly_mod_pfrac.c | 2 +- src/nmod_mpoly_factor/polyu3_mod_hlift.c | 10 +++++----- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/nmod_mpoly_factor.h b/src/nmod_mpoly_factor.h index 71c8962084..9be44834f1 100644 --- a/src/nmod_mpoly_factor.h +++ b/src/nmod_mpoly_factor.h @@ -21,9 +21,10 @@ #include "nmod_mpoly.h" #ifdef __cplusplus - extern "C" { +extern "C" { #endif +FLINT_HEADER_START void nmod_mpoly_get_bpoly(n_bpoly_t A, const nmod_mpoly_t B, slong var0, slong var1, const nmod_mpoly_ctx_t ctx); @@ -456,6 +457,8 @@ int n_polyu2n_add_zip_must_match(n_polyun_t Z, const n_bpoly_t A, int n_polyun_zip_solve(nmod_mpoly_t A, n_polyun_t Z, n_polyun_t H, n_polyun_t M, const nmod_mpoly_ctx_t ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/nmod_mpoly_factor/factor.c b/src/nmod_mpoly_factor/factor.c index 8f0e4f6d7f..d5d7f0db09 100644 --- a/src/nmod_mpoly_factor/factor.c +++ b/src/nmod_mpoly_factor/factor.c @@ -815,7 +815,7 @@ static int _factor_irred( Assume each factor in f is sep. Replace f by an irreducible factorization. */ -int nmod_mpoly_factor_irred( +static int nmod_mpoly_factor_irred( nmod_mpoly_factor_t f, const nmod_mpoly_ctx_t ctx, unsigned int algo) diff --git a/src/nmod_mpoly_factor/n_bpoly_mod.c b/src/nmod_mpoly_factor/n_bpoly_mod.c index ca3dfc8a55..7b55031810 100644 --- a/src/nmod_mpoly_factor/n_bpoly_mod.c +++ b/src/nmod_mpoly_factor/n_bpoly_mod.c @@ -486,7 +486,7 @@ int n_bpoly_mod_divides( /* ksub not faster :( */ if (0 && A->length > B->length && B->length > 2) { - n_poly_t a, b, q, r; + n_poly_t a, b, r; slong j; slong Adeg = n_bpoly_degree1(A); slong Bdeg = n_bpoly_degree1(B); diff --git a/src/nmod_mpoly_factor/n_bpoly_mod_factor_smprime.c b/src/nmod_mpoly_factor/n_bpoly_mod_factor_smprime.c index f0e219394e..f56bc59504 100644 --- a/src/nmod_mpoly_factor/n_bpoly_mod_factor_smprime.c +++ b/src/nmod_mpoly_factor/n_bpoly_mod_factor_smprime.c @@ -600,7 +600,7 @@ static void n_bpoly_mod_lift_start( combine the factors in L according to the rows of N and then replace N by an identity matrix */ -void n_bpoly_mod_lift_combine( +static void n_bpoly_mod_lift_combine( n_bpoly_mod_lift_t L, nmod_mat_t N, const n_bpoly_t monicA, diff --git a/src/nmod_mpoly_factor/n_bpoly_mod_pfrac.c b/src/nmod_mpoly_factor/n_bpoly_mod_pfrac.c index f48691fc6e..83016420f5 100644 --- a/src/nmod_mpoly_factor/n_bpoly_mod_pfrac.c +++ b/src/nmod_mpoly_factor/n_bpoly_mod_pfrac.c @@ -13,7 +13,7 @@ #include "n_poly.h" #include "nmod_mpoly_factor.h" -int n_bpoly_mod_pfrac2( +static int n_bpoly_mod_pfrac2( n_bpoly_t C1, n_bpoly_t C2, slong C1_deg1_bound, slong C2_deg1_bound, n_bpoly_t A, diff --git a/src/nmod_mpoly_factor/polyu3_mod_hlift.c b/src/nmod_mpoly_factor/polyu3_mod_hlift.c index ba5694390f..01e990968d 100644 --- a/src/nmod_mpoly_factor/polyu3_mod_hlift.c +++ b/src/nmod_mpoly_factor/polyu3_mod_hlift.c @@ -142,7 +142,7 @@ static void n_polyu_mod_mul( #endif -void n_poly_fill_powers( +static void n_poly_fill_powers( n_poly_t alphapow, slong target, nmod_t mod) @@ -163,7 +163,7 @@ void n_poly_fill_powers( } -void n_polyu3_mod_interp_reduce_2sm_bpoly( +static void n_polyu3_mod_interp_reduce_2sm_bpoly( n_bpoly_t Ap, n_bpoly_t Am, const n_polyu_t A, @@ -247,7 +247,7 @@ void n_polyu3_mod_interp_reduce_2sm_bpoly( T(x0, x1, x2) == B(x0, x1) mod (x2 + alpha) */ -void n_polyu3n_mod_interp_lift_2sm_bpoly( +static void n_polyu3n_mod_interp_lift_2sm_bpoly( slong * lastdeg, n_polyun_t T, const n_bpoly_t A, @@ -376,7 +376,7 @@ void n_polyu3n_mod_interp_lift_2sm_bpoly( } -int n_polyu3n_mod_interp_crt_2sm_bpoly( +static int n_polyu3n_mod_interp_crt_2sm_bpoly( slong * lastdeg, n_polyun_t F, n_polyun_t T, @@ -574,7 +574,7 @@ int n_polyu3n_mod_interp_crt_2sm_bpoly( 0: lift of B0*B1 to true factors is impossible 1: successfully lifted B0*B1 to true factors BB0*BB1 without changing lc_x */ -int n_polyu3_mod_hlift2( +static int n_polyu3_mod_hlift2( n_polyun_t BB0, n_polyun_t BB1, n_polyu_t A, From 6a70c6569cafb530dac4a760a61b9d8892d35502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 13:22:02 +0200 Subject: [PATCH 052/114] fmpz_mpoly_factor --- src/fmpz_mpoly_factor.h | 6 +++- src/fmpz_mpoly_factor/add.c | 7 +++++ src/fmpz_mpoly_factor/bpoly_factor.c | 34 +++++++++++------------ src/fmpz_mpoly_factor/gcd_algo.c | 6 ++-- src/fmpz_mpoly_factor/gcd_zippel2.c | 41 ++++++++++++++-------------- src/fmpz_mpoly_factor/lcc_kaltofen.c | 7 +++-- 6 files changed, 57 insertions(+), 44 deletions(-) diff --git a/src/fmpz_mpoly_factor.h b/src/fmpz_mpoly_factor.h index 98d79fc980..6f24cfef31 100644 --- a/src/fmpz_mpoly_factor.h +++ b/src/fmpz_mpoly_factor.h @@ -22,9 +22,11 @@ #include "fmpz_mpoly.h" #ifdef __cplusplus - extern "C" { +extern "C" { #endif +FLINT_HEADER_START + /*****************************************************************************/ void tuple_print(fmpz * alpha, slong n); @@ -536,6 +538,8 @@ void fmpz_mpoly_compression_undo(fmpz_mpoly_t A, flint_bitcnt_t Abits, const fmpz_mpoly_ctx_t Actx, fmpz_mpoly_t L, const fmpz_mpoly_ctx_t Lctx, mpoly_compression_t M); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/fmpz_mpoly_factor/add.c b/src/fmpz_mpoly_factor/add.c index a861961d2b..3cd22592c3 100644 --- a/src/fmpz_mpoly_factor/add.c +++ b/src/fmpz_mpoly_factor/add.c @@ -12,6 +12,13 @@ #include "fmpz.h" #include "fmpz_mpoly_factor.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma message "fmpz_mpoly_factor_add is currently unused/untested/undocumented!" +#endif + int fmpz_mpoly_factor_add( fmpz_mpoly_factor_t A, const fmpz_mpoly_factor_t B, diff --git a/src/fmpz_mpoly_factor/bpoly_factor.c b/src/fmpz_mpoly_factor/bpoly_factor.c index ab5f0ae5f2..c642b33d65 100644 --- a/src/fmpz_mpoly_factor/bpoly_factor.c +++ b/src/fmpz_mpoly_factor/bpoly_factor.c @@ -15,7 +15,8 @@ #include "fmpz_mpoly_factor.h" #include "fmpz_mod_mpoly_factor.h" -void fmpz_tpoly_print(fmpz_tpoly_t A, const char * xvar, const char * yvar, const char * zvar) +#if 0 +static void fmpz_tpoly_print(fmpz_tpoly_t A, const char * xvar, const char * yvar, const char * zvar) { slong i; int first; @@ -36,10 +37,9 @@ void fmpz_tpoly_print(fmpz_tpoly_t A, const char * xvar, const char * yvar, cons if (first) flint_printf("0"); } +#endif - - -void fmpz_mod_bpoly_set_fmpz_bpoly( +static void fmpz_mod_bpoly_set_fmpz_bpoly( fmpz_mod_bpoly_t A, const fmpz_bpoly_t B, const fmpz_mod_ctx_t ctx) @@ -54,7 +54,7 @@ void fmpz_mod_bpoly_set_fmpz_bpoly( } } -void fmpz_mod_bpoly_set_polyx( +static void fmpz_mod_bpoly_set_polyx( fmpz_mod_bpoly_t A, const fmpz_mod_poly_t B, const fmpz_mod_ctx_t ctx) @@ -70,7 +70,7 @@ void fmpz_mod_bpoly_set_polyx( } } -void fmpz_mod_bpoly_set_polyy( +static void fmpz_mod_bpoly_set_polyy( fmpz_mod_bpoly_t A, const fmpz_mod_poly_t B, const fmpz_mod_ctx_t ctx) @@ -81,7 +81,7 @@ void fmpz_mod_bpoly_set_polyy( } -void fmpz_mod_bpoly_add_poly_shift( +static void fmpz_mod_bpoly_add_poly_shift( fmpz_mod_bpoly_t A, const fmpz_mod_poly_t B, slong yshift, @@ -106,7 +106,7 @@ void fmpz_mod_bpoly_add_poly_shift( -void fmpz_bpoly_set(fmpz_bpoly_t A, const fmpz_bpoly_t B) +static void fmpz_bpoly_set(fmpz_bpoly_t A, const fmpz_bpoly_t B) { slong i; @@ -119,7 +119,7 @@ void fmpz_bpoly_set(fmpz_bpoly_t A, const fmpz_bpoly_t B) fmpz_poly_set(A->coeffs + i, B->coeffs + i); } -void fmpz_bpoly_make_primitive(fmpz_poly_t g, fmpz_bpoly_t A) +static void fmpz_bpoly_make_primitive(fmpz_poly_t g, fmpz_bpoly_t A) { slong Alen = A->length; slong i; @@ -146,7 +146,7 @@ void fmpz_bpoly_make_primitive(fmpz_poly_t g, fmpz_bpoly_t A) fmpz_poly_clear(q); } -int fmpz_bpoly_divides(fmpz_bpoly_t Q, fmpz_bpoly_t A, fmpz_bpoly_t B) +static int fmpz_bpoly_divides(fmpz_bpoly_t Q, fmpz_bpoly_t A, fmpz_bpoly_t B) { slong i, qoff; int divides; @@ -204,7 +204,7 @@ int fmpz_bpoly_divides(fmpz_bpoly_t Q, fmpz_bpoly_t A, fmpz_bpoly_t B) return divides; } -void fmpz_bpoly_set_fmpz_mod_bpoly( +static void fmpz_bpoly_set_fmpz_mod_bpoly( fmpz_bpoly_t A, const fmpz_mod_bpoly_t B, const fmpz_mod_ctx_t ctx) @@ -224,7 +224,7 @@ void fmpz_bpoly_set_fmpz_mod_bpoly( } } -void fmpz_bpoly_eval(fmpz_poly_t E, const fmpz_bpoly_t A, const fmpz_t alpha) +static void fmpz_bpoly_eval(fmpz_poly_t E, const fmpz_bpoly_t A, const fmpz_t alpha) { slong i; fmpz_t t; @@ -241,7 +241,7 @@ void fmpz_bpoly_eval(fmpz_poly_t E, const fmpz_bpoly_t A, const fmpz_t alpha) fmpz_clear(t); } -void fmpz_bpoly_taylor_shift(fmpz_bpoly_t A, const fmpz_t alpha) +static void fmpz_bpoly_taylor_shift(fmpz_bpoly_t A, const fmpz_t alpha) { slong i; for (i = A->length - 1; i >= 0; i--) @@ -267,7 +267,7 @@ typedef struct { typedef bpoly_info_struct bpoly_info_t[1]; -void bpoly_info_init(bpoly_info_t I, slong r, const fmpz_t p, ulong k) +static void bpoly_info_init(bpoly_info_t I, slong r, const fmpz_t p, ulong k) { slong i; @@ -305,7 +305,7 @@ void bpoly_info_init(bpoly_info_t I, slong r, const fmpz_t p, ulong k) } } -void bpoly_info_clear(bpoly_info_t I) +static void bpoly_info_clear(bpoly_info_t I) { slong i; @@ -339,7 +339,7 @@ void bpoly_info_clear(bpoly_info_t I) set out[i] so that 1/(f[0]*f[1]*...*f[n-1]) = out[0]/f[0] + ... + out[n-1]/f[n-1] */ -int partial_fraction_coeffs( +static int partial_fraction_coeffs( fmpz_mod_poly_struct * out, const fmpz_mod_poly_struct * f, slong n, @@ -386,7 +386,7 @@ int partial_fraction_coeffs( } -int bpoly_info_disolve(bpoly_info_t I) +static int bpoly_info_disolve(bpoly_info_t I) { slong i, j; fmpz_t pj, t1; diff --git a/src/fmpz_mpoly_factor/gcd_algo.c b/src/fmpz_mpoly_factor/gcd_algo.c index 2f0e106035..29a7807c1f 100644 --- a/src/fmpz_mpoly_factor/gcd_algo.c +++ b/src/fmpz_mpoly_factor/gcd_algo.c @@ -27,7 +27,7 @@ If ignore[j] is nonzero, then out[j] need not be calculated, probably because we shouldn't calculate it in dense form. */ -void fmpz_mpoly_evals( +static void fmpz_mpoly_evals( nmod_poly_struct * out, const int * ignore, const fmpz_mpoly_t A, @@ -156,7 +156,7 @@ void fmpz_mpoly_evals( slong * LUToffset, * LUTvar; ulong * LUTvalue, * LUTvalueinv; ulong * vieval; - ulong t, xpoweval, xinvpoweval; + ulong xpoweval, xinvpoweval; LUToffset = (slong *) flint_malloc(N*FLINT_BITS*sizeof(slong)); LUTmask = (ulong *) flint_malloc(N*FLINT_BITS*sizeof(ulong)); @@ -234,7 +234,7 @@ void fmpz_mpoly_evals( } -void _set_estimates( +static void _set_estimates( mpoly_gcd_info_t I, const fmpz_mpoly_t A, const fmpz_mpoly_t B, diff --git a/src/fmpz_mpoly_factor/gcd_zippel2.c b/src/fmpz_mpoly_factor/gcd_zippel2.c index 36d1b6b18e..9560caf95f 100644 --- a/src/fmpz_mpoly_factor/gcd_zippel2.c +++ b/src/fmpz_mpoly_factor/gcd_zippel2.c @@ -17,6 +17,7 @@ #include "mpoly.h" #include "fmpz_mpoly.h" #include "nmod_mpoly_factor.h" +#include "fmpz_mpoly_factor.h" #include "fmpz_mod_mpoly_factor.h" typedef struct { @@ -250,7 +251,7 @@ static void fmpz_mpoly_fmpz_mod_coeffs( _fmpz_mod_vec_set_fmpz_vec(EH->coeffs, Acoeffs, Alen, fpctx); } -ulong n_poly_mod_zip_eval_cur_inc_coeff( +static ulong n_poly_mod_zip_eval_cur_inc_coeff( n_poly_t Acur, n_poly_t Ainc, n_poly_t Acoeff, @@ -260,7 +261,7 @@ ulong n_poly_mod_zip_eval_cur_inc_coeff( Acur->length, ctx); } -void fmpz_mod_poly_zip_eval_cur_inc_coeff( +static void fmpz_mod_poly_zip_eval_cur_inc_coeff( fmpz_t e, fmpz_mod_poly_t Acur, fmpz_mod_poly_t Ainc, @@ -375,7 +376,7 @@ static void fmpz_mpoly2_eval_fmpz_mod( secret: subdegs[0] is not used */ -void nmod_mpoly_bma_interpolate_alpha_powers( +static void nmod_mpoly_bma_interpolate_alpha_powers( ulong * out, ulong w, slong m, @@ -389,7 +390,7 @@ void nmod_mpoly_bma_interpolate_alpha_powers( out[j - 1] = nmod_pow_ui(out[j], Ictx->subdegs[j], fpctx); } -void fmpz_mod_mpoly_bma_interpolate_alpha_powers( +static void fmpz_mod_mpoly_bma_interpolate_alpha_powers( fmpz * out, const fmpz_t w, slong m, @@ -404,7 +405,7 @@ void fmpz_mod_mpoly_bma_interpolate_alpha_powers( } -void nmod_bma_mpoly_init(nmod_bma_mpoly_t A) +static void nmod_bma_mpoly_init(nmod_bma_mpoly_t A) { A->length = 0; A->alloc = 0; @@ -413,7 +414,7 @@ void nmod_bma_mpoly_init(nmod_bma_mpoly_t A) A->pointcount = 0; } -void nmod_bma_mpoly_reset_prime( +static void nmod_bma_mpoly_reset_prime( nmod_bma_mpoly_t A, nmod_t fpctx) { @@ -423,7 +424,7 @@ void nmod_bma_mpoly_reset_prime( } -void nmod_bma_mpoly_clear(nmod_bma_mpoly_t A) +static void nmod_bma_mpoly_clear(nmod_bma_mpoly_t A) { slong i; for (i = 0; i < A->alloc; i++) @@ -438,7 +439,7 @@ void nmod_bma_mpoly_clear(nmod_bma_mpoly_t A) } -void nmod_bma_mpoly_fit_length( +static void nmod_bma_mpoly_fit_length( nmod_bma_mpoly_t A, slong length, nmod_t fpctx) @@ -459,14 +460,14 @@ void nmod_bma_mpoly_fit_length( } } -void nmod_bma_mpoly_zero(nmod_bma_mpoly_t L) +static void nmod_bma_mpoly_zero(nmod_bma_mpoly_t L) { L->length = 0; L->pointcount = 0; } -int nmod_bma_mpoly_reduce(nmod_bma_mpoly_t L) +static int nmod_bma_mpoly_reduce(nmod_bma_mpoly_t L) { slong i; int changed; @@ -483,7 +484,7 @@ int nmod_bma_mpoly_reduce(nmod_bma_mpoly_t L) } -void nmod_bma_mpoly_add_point( +static void nmod_bma_mpoly_add_point( nmod_bma_mpoly_t L, const n_polyun_t A, nmod_t fpctx) @@ -858,7 +859,7 @@ static int _fmpz_mod_bma_get_fmpz_mpoly2( -int nmod_bma_mpoly_get_fmpz_mpoly2( +static int nmod_bma_mpoly_get_fmpz_mpoly2( fmpz_mpoly_t A, n_poly_t Amarks, const fmpz_mpoly_ctx_t ctx, @@ -924,7 +925,7 @@ int nmod_bma_mpoly_get_fmpz_mpoly2( } -int fmpz_mod_bma_mpoly_get_fmpz_mpoly2( +static int fmpz_mod_bma_mpoly_get_fmpz_mpoly2( fmpz_mpoly_t A, n_poly_t Amarks, const fmpz_mpoly_ctx_t ctx, @@ -992,7 +993,7 @@ int fmpz_mod_bma_mpoly_get_fmpz_mpoly2( -void fmpz_mod_bma_mpoly_init(fmpz_mod_bma_mpoly_t A) +static void fmpz_mod_bma_mpoly_init(fmpz_mod_bma_mpoly_t A) { A->length = 0; A->alloc = 0; @@ -1002,7 +1003,7 @@ void fmpz_mod_bma_mpoly_init(fmpz_mod_bma_mpoly_t A) } -void fmpz_mod_bma_mpoly_clear( +static void fmpz_mod_bma_mpoly_clear( fmpz_mod_bma_mpoly_t A, const fmpz_mod_ctx_t fpctx) { @@ -1016,7 +1017,7 @@ void fmpz_mod_bma_mpoly_clear( } -void fmpz_mod_bma_mpoly_fit_length( +static void fmpz_mod_bma_mpoly_fit_length( fmpz_mod_bma_mpoly_t A, slong length, const fmpz_mod_ctx_t fpctx) @@ -1038,13 +1039,13 @@ void fmpz_mod_bma_mpoly_fit_length( } } -void fmpz_mod_bma_mpoly_zero(fmpz_mod_bma_mpoly_t L) +static void fmpz_mod_bma_mpoly_zero(fmpz_mod_bma_mpoly_t L) { L->length = 0; L->pointcount = 0; } -int fmpz_mod_bma_mpoly_reduce(fmpz_mod_bma_mpoly_t L, const fmpz_mod_ctx_t fpctx) +static int fmpz_mod_bma_mpoly_reduce(fmpz_mod_bma_mpoly_t L, const fmpz_mod_ctx_t fpctx) { slong i; int changed; @@ -1176,7 +1177,7 @@ static void fmpz_mod_bma_mpoly_add_point( x_(n-1) = x ^ (1) a univariate in ZZ[x] remains. Return the content of this poly. */ -void _fmpz_mpoly_ksub_content( +static void _fmpz_mpoly_ksub_content( fmpz_t content, const fmpz * Acoeffs, const ulong * Aexps, @@ -1461,7 +1462,7 @@ static int zip_solve( } -int _fmpz_vec_crt_nmod( +static int _fmpz_vec_crt_nmod( flint_bitcnt_t * maxbits_, fmpz * a, fmpz_t am, diff --git a/src/fmpz_mpoly_factor/lcc_kaltofen.c b/src/fmpz_mpoly_factor/lcc_kaltofen.c index d548402057..788a4a7875 100644 --- a/src/fmpz_mpoly_factor/lcc_kaltofen.c +++ b/src/fmpz_mpoly_factor/lcc_kaltofen.c @@ -187,7 +187,7 @@ static void _make_bases_coprime( fmpz_poly_clear(g); } -void fmpz_poly_vector_insert_poly(fmpz_bpoly_t v, const fmpz_poly_t a) +static void fmpz_poly_vector_insert_poly(fmpz_bpoly_t v, const fmpz_poly_t a) { slong i; @@ -200,7 +200,7 @@ void fmpz_poly_vector_insert_poly(fmpz_bpoly_t v, const fmpz_poly_t a) v->length++; } - +#if 0 void fmpz_poly_factor_print_pretty(fmpz_poly_factor_t f, const char * x) { slong i; @@ -212,6 +212,7 @@ void fmpz_poly_factor_print_pretty(fmpz_poly_factor_t f, const char * x) flint_printf(")^%wd", f->exp[i]); } } +#endif static int _try_lift( fmpz_mpoly_struct * lifts, /* length r */ @@ -405,7 +406,7 @@ static int _try_lift( } /* assume content(b) = 1 for now */ -void fmpz_mpoly_factor_divexact_mpoly_pow_ui( +static void fmpz_mpoly_factor_divexact_mpoly_pow_ui( fmpz_mpoly_factor_t A, const fmpz_mpoly_t b_in, ulong e, From 3784cbf31decf5ef320ca58d17640a4da01ae6b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 13:22:26 +0200 Subject: [PATCH 053/114] fq_zech_mpoly --- src/fq_zech_mpoly.h | 6 +++++- src/fq_zech_mpoly/derivative.c | 4 ++-- src/fq_zech_mpoly/equal.c | 2 +- src/fq_zech_mpoly/evaluate_all.c | 3 ++- src/fq_zech_mpoly/mpolyu.c | 5 +++++ src/fq_zech_mpoly/neg.c | 2 +- src/fq_zech_mpoly/repack_bits.c | 2 ++ src/fq_zech_mpoly/set.c | 2 +- src/fq_zech_mpoly/sub.c | 2 +- 9 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/fq_zech_mpoly.h b/src/fq_zech_mpoly.h index 22bf796a51..b9fc15c486 100644 --- a/src/fq_zech_mpoly.h +++ b/src/fq_zech_mpoly.h @@ -23,9 +23,11 @@ #include "mpoly_types.h" #ifdef __cplusplus - extern "C" { +extern "C" { #endif +FLINT_HEADER_START + FQ_ZECH_MPOLY_INLINE nmod_t fq_zech_ctx_mod(const fq_zech_ctx_t ctx) { @@ -760,6 +762,8 @@ void fq_zech_mpolyu_fit_length(fq_zech_mpolyu_t A, slong length, void fq_zech_mpolyu_one(fq_zech_mpolyu_t A, const fq_zech_mpoly_ctx_t uctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/fq_zech_mpoly/derivative.c b/src/fq_zech_mpoly/derivative.c index f4ba112d94..c7b6952a61 100644 --- a/src/fq_zech_mpoly/derivative.c +++ b/src/fq_zech_mpoly/derivative.c @@ -15,7 +15,7 @@ #include "mpoly.h" #include "fq_zech_mpoly.h" -slong _fq_zech_mpoly_derivative(fq_zech_struct * Acoeff, ulong * Aexp, +static slong _fq_zech_mpoly_derivative(fq_zech_struct * Acoeff, ulong * Aexp, const fq_zech_struct * Bcoeff, const ulong * Bexp, slong Blen, flint_bitcnt_t bits, slong N, slong offset, slong shift, ulong * oneexp, const fq_zech_ctx_t fqctx) @@ -43,7 +43,7 @@ slong _fq_zech_mpoly_derivative(fq_zech_struct * Acoeff, ulong * Aexp, } -slong _fq_zech_mpoly_derivative_mp(fq_zech_struct * Acoeff, ulong * Aexp, +static slong _fq_zech_mpoly_derivative_mp(fq_zech_struct * Acoeff, ulong * Aexp, const fq_zech_struct * Bcoeff, const ulong * Bexp, slong Blen, flint_bitcnt_t bits, slong N, slong offset, ulong * oneexp, const fq_zech_ctx_t fqctx) diff --git a/src/fq_zech_mpoly/equal.c b/src/fq_zech_mpoly/equal.c index cab1a0c577..78f055ea17 100644 --- a/src/fq_zech_mpoly/equal.c +++ b/src/fq_zech_mpoly/equal.c @@ -13,7 +13,7 @@ #include "mpoly.h" #include "fq_zech_mpoly.h" -int _fq_zech_mpoly_equal(const fq_zech_struct * coeff1, const ulong * exp1, +static int _fq_zech_mpoly_equal(const fq_zech_struct * coeff1, const ulong * exp1, const fq_zech_struct * coeff2, const ulong * exp2, slong len, slong N, const fq_zech_mpoly_ctx_t ctx) { diff --git a/src/fq_zech_mpoly/evaluate_all.c b/src/fq_zech_mpoly/evaluate_all.c index b9724f0b7e..b38d1d8680 100644 --- a/src/fq_zech_mpoly/evaluate_all.c +++ b/src/fq_zech_mpoly/evaluate_all.c @@ -84,7 +84,7 @@ void _fq_zech_mpoly_eval_all_fq_zech( TMP_END; } - +#if 0 void fq_zech_mpoly_evaluate_all_ui(fq_zech_t eval, const fq_zech_mpoly_t A, fq_zech_struct * const * vals, const fq_zech_mpoly_ctx_t ctx) { @@ -97,3 +97,4 @@ void fq_zech_mpoly_evaluate_all_ui(fq_zech_t eval, const fq_zech_mpoly_t A, _fq_zech_mpoly_eval_all_fq_zech(eval, A->coeffs, A->exps, A->length, A->bits, vals, ctx->minfo, ctx->fqctx); } +#endif diff --git a/src/fq_zech_mpoly/mpolyu.c b/src/fq_zech_mpoly/mpolyu.c index 81f791b9db..897b49649b 100644 --- a/src/fq_zech_mpoly/mpolyu.c +++ b/src/fq_zech_mpoly/mpolyu.c @@ -11,6 +11,11 @@ #include "fq_zech_mpoly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif int fq_zech_mpolyu_is_canonical(const fq_zech_mpolyu_t A, const fq_zech_mpoly_ctx_t ctx) diff --git a/src/fq_zech_mpoly/neg.c b/src/fq_zech_mpoly/neg.c index 75accf0de0..7275e4a687 100644 --- a/src/fq_zech_mpoly/neg.c +++ b/src/fq_zech_mpoly/neg.c @@ -13,7 +13,7 @@ #include "mpoly.h" #include "fq_zech_mpoly.h" -void _fq_zech_mpoly_neg(fq_zech_struct * Acoeff, ulong * Aexp, +static void _fq_zech_mpoly_neg(fq_zech_struct * Acoeff, ulong * Aexp, const fq_zech_struct * Bcoeff, const ulong * Bexp, slong Blen, slong N, const fq_zech_ctx_t fqctx) { diff --git a/src/fq_zech_mpoly/repack_bits.c b/src/fq_zech_mpoly/repack_bits.c index 65c7d9ecb4..7ed0052767 100644 --- a/src/fq_zech_mpoly/repack_bits.c +++ b/src/fq_zech_mpoly/repack_bits.c @@ -13,6 +13,7 @@ #include "mpoly.h" #include "fq_zech_mpoly.h" +#if 0 int fq_zech_mpoly_repack_bits(fq_zech_mpoly_t A, const fq_zech_mpoly_t B, flint_bitcnt_t Abits, const fq_zech_mpoly_ctx_t ctx) { @@ -55,6 +56,7 @@ int fq_zech_mpoly_repack_bits(fq_zech_mpoly_t A, const fq_zech_mpoly_t B, return success; } +#endif int fq_zech_mpoly_repack_bits_inplace( fq_zech_mpoly_t A, diff --git a/src/fq_zech_mpoly/set.c b/src/fq_zech_mpoly/set.c index 3df4183380..524a0d2dff 100644 --- a/src/fq_zech_mpoly/set.c +++ b/src/fq_zech_mpoly/set.c @@ -13,7 +13,7 @@ #include "mpoly.h" #include "fq_zech_mpoly.h" -void _fq_zech_mpoly_set(fq_zech_struct * coeff1, ulong * exps1, +static void _fq_zech_mpoly_set(fq_zech_struct * coeff1, ulong * exps1, const fq_zech_struct * coeff2, const ulong * exps2, slong len2, slong N, const fq_zech_ctx_t fqctx) { diff --git a/src/fq_zech_mpoly/sub.c b/src/fq_zech_mpoly/sub.c index 45ba05fded..c3ac0d02a5 100644 --- a/src/fq_zech_mpoly/sub.c +++ b/src/fq_zech_mpoly/sub.c @@ -13,7 +13,7 @@ #include "mpoly.h" #include "fq_zech_mpoly.h" -slong _fq_zech_mpoly_sub(fq_zech_struct * coeff1, ulong * exp1, +static slong _fq_zech_mpoly_sub(fq_zech_struct * coeff1, ulong * exp1, fq_zech_struct * coeff2, const ulong * exp2, slong len2, fq_zech_struct * coeff3, const ulong * exp3, slong len3, slong N, const ulong * cmpmask, const fq_zech_ctx_t fqctx) From 43a604de2099ccce4b54995a657aabd68165feae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 13:22:35 +0200 Subject: [PATCH 054/114] fq_zech_mpoly_factor --- src/fq_zech_mpoly_factor.h | 6 +++++- src/fq_zech_mpoly_factor/bpoly.c | 2 +- src/fq_zech_mpoly_factor/bpoly_factor_smprime.c | 4 ++-- src/fq_zech_mpoly_factor/irred_smprime_zippel.c | 12 ++++++------ src/fq_zech_mpoly_factor/polyu3_hlift.c | 8 ++++---- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/fq_zech_mpoly_factor.h b/src/fq_zech_mpoly_factor.h index 825df1a74a..c752f527b3 100644 --- a/src/fq_zech_mpoly_factor.h +++ b/src/fq_zech_mpoly_factor.h @@ -21,9 +21,11 @@ #include "fq_zech_mpoly.h" #ifdef __cplusplus - extern "C" { +extern "C" { #endif +FLINT_HEADER_START + typedef struct { fq_zech_poly_struct * coeffs; @@ -747,6 +749,8 @@ void _fq_zech_mpoly_set_fq_zech_bpoly_var1_zero( int fq_zech_next(fq_zech_t x, const fq_zech_ctx_t ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/fq_zech_mpoly_factor/bpoly.c b/src/fq_zech_mpoly_factor/bpoly.c index 756e3f3a87..b56cc8836b 100644 --- a/src/fq_zech_mpoly_factor/bpoly.c +++ b/src/fq_zech_mpoly_factor/bpoly.c @@ -549,7 +549,7 @@ void fq_zech_bpoly_make_primitive( } -void _fq_zech_poly_taylor_shift_horner( +static void _fq_zech_poly_taylor_shift_horner( fq_zech_struct * poly, const fq_zech_t c, slong n, diff --git a/src/fq_zech_mpoly_factor/bpoly_factor_smprime.c b/src/fq_zech_mpoly_factor/bpoly_factor_smprime.c index 6979ed9719..1a0b290d76 100644 --- a/src/fq_zech_mpoly_factor/bpoly_factor_smprime.c +++ b/src/fq_zech_mpoly_factor/bpoly_factor_smprime.c @@ -27,7 +27,7 @@ int fq_zech_next(fq_zech_t x, const fq_zech_ctx_t FLINT_UNUSED(ctx)) return 1; } -void fq_zech_bpoly_eval_var1( +static void fq_zech_bpoly_eval_var1( fq_zech_poly_t E, const fq_zech_bpoly_t A, const fq_zech_t alpha, @@ -41,7 +41,7 @@ void fq_zech_bpoly_eval_var1( _fq_zech_poly_normalise(E, ctx); } -void fq_zech_bpoly_make_monic_series( +static void fq_zech_bpoly_make_monic_series( fq_zech_bpoly_t A, const fq_zech_bpoly_t B, slong order, diff --git a/src/fq_zech_mpoly_factor/irred_smprime_zippel.c b/src/fq_zech_mpoly_factor/irred_smprime_zippel.c index 13938d875b..776dc959bd 100644 --- a/src/fq_zech_mpoly_factor/irred_smprime_zippel.c +++ b/src/fq_zech_mpoly_factor/irred_smprime_zippel.c @@ -40,7 +40,7 @@ static void fq_zech_mpoly_delete_duplicate_terms( } -slong fq_zech_mpolyu_find_term(const fq_zech_mpolyu_t A, ulong e) +static slong fq_zech_mpolyu_find_term(const fq_zech_mpolyu_t A, ulong e) { slong i; for (i = 0; i < A->length; i++) @@ -50,7 +50,7 @@ slong fq_zech_mpolyu_find_term(const fq_zech_mpolyu_t A, ulong e) } -void fq_zech_poly_product_roots(fq_zech_poly_t P, fq_zech_struct * r, +static void fq_zech_poly_product_roots(fq_zech_poly_t P, fq_zech_struct * r, slong n, const fq_zech_ctx_t fqctx) { slong i; @@ -230,7 +230,7 @@ static void _fq_zech_mpoly_monomial_evals_indirect( } -int fq_zech_zip_find_coeffs_new( +static int fq_zech_zip_find_coeffs_new( fq_zech_struct * coeffs, /* length mlength */ const fq_zech_struct * monomials, /* length mlength */ slong mlength, @@ -611,7 +611,7 @@ static void fq_zech_poly_eval_step( } -void fq_zech_polyu_eval_step( +static void fq_zech_polyu_eval_step( fq_zech_polyu_t E, fq_zech_polyun_t A, const fq_zech_ctx_t ctx) @@ -632,7 +632,7 @@ void fq_zech_polyu_eval_step( } -void fq_zech_polyu3_add_zip_limit1( +static void fq_zech_polyu3_add_zip_limit1( fq_zech_polyun_t Z, const fq_zech_polyun_t A, const ulong deg1, @@ -870,7 +870,7 @@ static int fq_zech_mpoly_from_zip( } /* bit counts of all degrees should be < FLINT_BITS/3 */ -int fq_zech_mpoly_hlift_zippel( +static int fq_zech_mpoly_hlift_zippel( slong m, fq_zech_mpoly_struct * B, slong r, diff --git a/src/fq_zech_mpoly_factor/polyu3_hlift.c b/src/fq_zech_mpoly_factor/polyu3_hlift.c index 8fb5f6658d..1f089d2568 100644 --- a/src/fq_zech_mpoly_factor/polyu3_hlift.c +++ b/src/fq_zech_mpoly_factor/polyu3_hlift.c @@ -133,7 +133,7 @@ static void fq_zech_polyu_mul( -void fq_zech_polyu3_interp_reduce_bpoly( +static void fq_zech_polyu3_interp_reduce_bpoly( fq_zech_bpoly_t Ap, const fq_zech_polyu_t A, const fq_zech_t alpha, @@ -204,7 +204,7 @@ void fq_zech_polyu3_interp_reduce_bpoly( T(x0, x1, x2) == B(x0, x1) mod (x2 + alpha) */ -void fq_zech_polyu3n_interp_lift_sm_bpoly( +static void fq_zech_polyu3n_interp_lift_sm_bpoly( slong * lastdeg, fq_zech_polyun_t T, const fq_zech_bpoly_t A, @@ -240,7 +240,7 @@ void fq_zech_polyu3n_interp_lift_sm_bpoly( F is in Fq[x2][x0, x1] A is in Fq[x0, x1] */ -int fq_zech_polyu3n_interp_crt_sm_bpoly( +static int fq_zech_polyu3n_interp_crt_sm_bpoly( slong * lastdeg, fq_zech_polyun_t F, fq_zech_polyun_t T, @@ -380,7 +380,7 @@ int fq_zech_polyu3n_interp_crt_sm_bpoly( return changed; } -void fq_zech_poly_shift_left_scalar_submul( +static void fq_zech_poly_shift_left_scalar_submul( fq_zech_poly_t modulus, slong k, const fq_zech_t alpha, From e1043cd7c0839e4e0f7dccfd15ae1b8d79ce507e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 15:49:30 +0200 Subject: [PATCH 055/114] fmpq_mpoly --- src/fmpq_mpoly.h | 4 ++++ src/fmpq_mpoly/evaluate_one.c | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fmpq_mpoly.h b/src/fmpq_mpoly.h index d0836cbb25..35261048c4 100644 --- a/src/fmpq_mpoly.h +++ b/src/fmpq_mpoly.h @@ -26,6 +26,8 @@ extern "C" { #endif +FLINT_HEADER_START + /* Context object ************************************************************/ FMPQ_MPOLY_INLINE @@ -804,6 +806,8 @@ void fmpq_mpoly_univar_swap_term_coeff(fmpq_mpoly_t c, void fmpq_mpoly_remainder_test(const fmpq_mpoly_t r, const fmpq_mpoly_t g, const fmpq_mpoly_ctx_t ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/fmpq_mpoly/evaluate_one.c b/src/fmpq_mpoly/evaluate_one.c index 1de7f78381..5d2489bdce 100644 --- a/src/fmpq_mpoly/evaluate_one.c +++ b/src/fmpq_mpoly/evaluate_one.c @@ -246,7 +246,6 @@ int fmpq_mpoly_evaluate_one_fmpq(fmpq_mpoly_t A, if (A == B) { - int success; fmpq_mpoly_t T; fmpq_mpoly_init(T, ctx); success = fmpq_mpoly_evaluate_one_fmpq(T, B, var, val, ctx); From 7483f30c504bbe4d8cc7ecabf3007d37c4155a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 15:47:36 +0200 Subject: [PATCH 056/114] fmpz_mod_mpoly_factor --- src/fmpz_mod_mpoly_factor.h | 4 ++++ src/fmpz_mod_mpoly_factor/bpoly_factor_smprime.c | 2 +- src/fmpz_mod_mpoly_factor/factor.c | 2 +- src/fmpz_mod_mpoly_factor/fmpz_mod_bpoly.c | 2 +- src/fmpz_mod_mpoly_factor/gcd_zippel.c | 2 +- src/fmpz_mod_mpoly_factor/gcd_zippel2.c | 6 +++--- src/fmpz_mod_mpoly_factor/interp.c | 7 ++++++- src/fmpz_mod_mpoly_factor/io.c | 2 ++ src/fmpz_mod_mpoly_factor/mpoly_hlift_zippel.c | 6 +++++- src/fmpz_mod_mpoly_factor/polyu3_mod_hlift.c | 8 ++++---- 10 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/fmpz_mod_mpoly_factor.h b/src/fmpz_mod_mpoly_factor.h index 9f6c02039b..3ff6473d00 100644 --- a/src/fmpz_mod_mpoly_factor.h +++ b/src/fmpz_mod_mpoly_factor.h @@ -25,6 +25,8 @@ extern "C" { #endif +FLINT_HEADER_START + FMPZ_MOD_MPOLY_FACTOR_INLINE void fmpz_mod_mpoly_factor_init(fmpz_mod_mpoly_factor_t f, const fmpz_mod_mpoly_ctx_t ctx) @@ -1386,6 +1388,8 @@ int fmpz_mod_polyun_zip_solve( fmpz_mod_polyun_t M, const fmpz_mod_mpoly_ctx_t ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/fmpz_mod_mpoly_factor/bpoly_factor_smprime.c b/src/fmpz_mod_mpoly_factor/bpoly_factor_smprime.c index 26647293c2..cd76f70d2d 100644 --- a/src/fmpz_mod_mpoly_factor/bpoly_factor_smprime.c +++ b/src/fmpz_mod_mpoly_factor/bpoly_factor_smprime.c @@ -592,7 +592,7 @@ static void fmpz_mod_bpoly_lift_start( combine the factors in L according to the rows of N and then replace N by an identity matrix */ -void fmpz_mod_bpoly_lift_combine( +static void fmpz_mod_bpoly_lift_combine( fmpz_mod_bpoly_lift_t L, fmpz_mod_mat_t N, const fmpz_mod_bpoly_t monicA, diff --git a/src/fmpz_mod_mpoly_factor/factor.c b/src/fmpz_mod_mpoly_factor/factor.c index 8652bc07ad..a21b8366da 100644 --- a/src/fmpz_mod_mpoly_factor/factor.c +++ b/src/fmpz_mod_mpoly_factor/factor.c @@ -485,7 +485,7 @@ static int _factor_irred( Assume each factor in f is sep. Replace f by an irreducible factorization. */ -int fmpz_mod_mpoly_factor_irred( +static int fmpz_mod_mpoly_factor_irred( fmpz_mod_mpoly_factor_t f, const fmpz_mod_mpoly_ctx_t ctx, unsigned int algo) diff --git a/src/fmpz_mod_mpoly_factor/fmpz_mod_bpoly.c b/src/fmpz_mod_mpoly_factor/fmpz_mod_bpoly.c index cdf4a56e49..508f1795be 100644 --- a/src/fmpz_mod_mpoly_factor/fmpz_mod_bpoly.c +++ b/src/fmpz_mod_mpoly_factor/fmpz_mod_bpoly.c @@ -166,7 +166,7 @@ void fmpz_mod_bpoly_set( fmpz_mod_poly_set(A->coeffs + i, B->coeffs + i, ctx); } -void _fmpz_mod_poly_taylor_shift_horner( +static void _fmpz_mod_poly_taylor_shift_horner( fmpz * a, const fmpz_t c, slong n, diff --git a/src/fmpz_mod_mpoly_factor/gcd_zippel.c b/src/fmpz_mod_mpoly_factor/gcd_zippel.c index 1a303a9df3..e0ba92f319 100644 --- a/src/fmpz_mod_mpoly_factor/gcd_zippel.c +++ b/src/fmpz_mod_mpoly_factor/gcd_zippel.c @@ -123,7 +123,7 @@ static fmpz * fmpz_mod_mat_row_ref(fmpz_mod_mat_t M, slong i) sum_j c_ij alpha^((k+1)e_j) = s_k g_ik for 0 <= i <= degree(gcd) */ -int fmpz_mod_mpolyl_gcds_zippel( +static int fmpz_mod_mpolyl_gcds_zippel( fmpz_mod_mpoly_t G, const ulong * Gmarks, slong Gmarkslen, fmpz_mod_mpoly_t A, fmpz_mod_mpoly_t B, diff --git a/src/fmpz_mod_mpoly_factor/gcd_zippel2.c b/src/fmpz_mod_mpoly_factor/gcd_zippel2.c index 8516014084..98649b2967 100644 --- a/src/fmpz_mod_mpoly_factor/gcd_zippel2.c +++ b/src/fmpz_mod_mpoly_factor/gcd_zippel2.c @@ -16,7 +16,7 @@ #include "mpoly.h" #include "fmpz_mod_mpoly_factor.h" -void fmpz_mod_mpolyn_interp_lift_sm_polyu1n( +static void fmpz_mod_mpolyn_interp_lift_sm_polyu1n( fmpz_mod_mpolyn_t F, fmpz_mod_polyun_t A, const fmpz_mod_mpoly_ctx_t ctx) @@ -51,7 +51,7 @@ void fmpz_mod_mpolyn_interp_lift_sm_polyu1n( F->length = Fi; } -int fmpz_mod_mpolyn_interp_crt_sm_polyu1n( +static int fmpz_mod_mpolyn_interp_crt_sm_polyu1n( slong * lastdeg, fmpz_mod_mpolyn_t F, fmpz_mod_mpolyn_t T, @@ -252,7 +252,7 @@ static double interp_cost( numABgamma + totnumci + (degxAB*degyAB)*(degxAB*degyAB))); } -int fmpz_mod_mpoly_gcd_get_use_new( +static int fmpz_mod_mpoly_gcd_get_use_new( slong rGdeg, slong Adeg, slong Bdeg, diff --git a/src/fmpz_mod_mpoly_factor/interp.c b/src/fmpz_mod_mpoly_factor/interp.c index a7e9a04cbf..55f4b96631 100644 --- a/src/fmpz_mod_mpoly_factor/interp.c +++ b/src/fmpz_mod_mpoly_factor/interp.c @@ -13,6 +13,7 @@ #include "mpoly.h" #include "fmpz_mod_mpoly_factor.h" +#if 0 /* E = A(v = alpha) A is in R[v][x] @@ -36,7 +37,9 @@ void fmpz_mod_polyu1n_intp_reduce_sm_poly( } fmpz_clear(v); } +#endif +#if 0 /* A = B A, B are in R[X] @@ -67,8 +70,9 @@ void fmpz_mod_polyu1n_intp_lift_sm_poly( } A->length = Ai; } +#endif - +#if 0 /* F = F + modulus*(A - F(v = alpha)) no assumptions about matching monomials @@ -176,6 +180,7 @@ int fmpz_mod_polyu1n_intp_crt_sm_poly( *lastdeg = lastlen - 1; return changed; } +#endif void fmpz_mod_polyu1n_interp_reduce_2sm_poly( diff --git a/src/fmpz_mod_mpoly_factor/io.c b/src/fmpz_mod_mpoly_factor/io.c index 5460cb39c6..34fc9eeb35 100644 --- a/src/fmpz_mod_mpoly_factor/io.c +++ b/src/fmpz_mod_mpoly_factor/io.c @@ -109,6 +109,7 @@ void fmpz_mod_mpoly_factor_print_pretty( } } +#if 0 void fmpz_mod_mpolyu_print_pretty( const fmpz_mod_mpolyu_t poly, const char ** x, @@ -126,6 +127,7 @@ void fmpz_mod_mpolyu_print_pretty( flint_printf(")*X^%wd",poly->exps[i]); } } +#endif void fmpz_mod_bpoly_print_pretty( const fmpz_mod_bpoly_t A, diff --git a/src/fmpz_mod_mpoly_factor/mpoly_hlift_zippel.c b/src/fmpz_mod_mpoly_factor/mpoly_hlift_zippel.c index c5e618e5a0..494d823519 100644 --- a/src/fmpz_mod_mpoly_factor/mpoly_hlift_zippel.c +++ b/src/fmpz_mod_mpoly_factor/mpoly_hlift_zippel.c @@ -158,6 +158,7 @@ static void fmpz_mod_mpolyu_fit_length( } } +#if 0 void fmpz_mod_mpolyu_one(fmpz_mod_mpolyu_t A, const fmpz_mod_mpoly_ctx_t uctx) { fmpz_mod_mpolyu_fit_length(A, WORD(1), uctx); @@ -165,7 +166,9 @@ void fmpz_mod_mpolyu_one(fmpz_mod_mpolyu_t A, const fmpz_mod_mpoly_ctx_t uctx) fmpz_mod_mpoly_one(A->coeffs + 0, uctx); A->length = WORD(1); } +#endif +#if 0 void fmpz_mod_mpolyu_repack_bits_inplace( fmpz_mod_mpolyu_t A, flint_bitcnt_t bits, @@ -181,10 +184,11 @@ void fmpz_mod_mpolyu_repack_bits_inplace( for (i = 0; i < A->alloc; i++) fmpz_mod_mpoly_repack_bits_inplace(A->coeffs + i, bits, ctx); } +#endif /* if the coefficient doesn't exist, a new one is created (and set to zero) */ -fmpz_mod_mpoly_struct * _fmpz_mod_mpolyu_get_coeff( +static fmpz_mod_mpoly_struct * _fmpz_mod_mpolyu_get_coeff( fmpz_mod_mpolyu_t A, ulong pow, const fmpz_mod_mpoly_ctx_t uctx) diff --git a/src/fmpz_mod_mpoly_factor/polyu3_mod_hlift.c b/src/fmpz_mod_mpoly_factor/polyu3_mod_hlift.c index eaa3bd7dc1..19458b8c0f 100644 --- a/src/fmpz_mod_mpoly_factor/polyu3_mod_hlift.c +++ b/src/fmpz_mod_mpoly_factor/polyu3_mod_hlift.c @@ -150,7 +150,7 @@ static void fmpz_mod_polyu_mul( #endif -void fmpz_mod_poly_fill_powers( +static void fmpz_mod_poly_fill_powers( fmpz_mod_poly_t alphapow, slong target, const fmpz_mod_ctx_t ctx) @@ -171,7 +171,7 @@ void fmpz_mod_poly_fill_powers( } -void fmpz_mod_polyu3_interp_reduce_2sm_bpoly( +static void fmpz_mod_polyu3_interp_reduce_2sm_bpoly( fmpz_mod_bpoly_t Ap, fmpz_mod_bpoly_t Am, const fmpz_mod_polyu_t A, @@ -265,7 +265,7 @@ void fmpz_mod_polyu3_interp_reduce_2sm_bpoly( T(x0, x1, x2) == B(x0, x1) mod (x2 + alpha) */ -void fmpz_mod_polyu3n_interp_lift_2sm_bpoly( +static void fmpz_mod_polyu3n_interp_lift_2sm_bpoly( slong * lastdeg, fmpz_mod_polyun_t T, const fmpz_mod_bpoly_t A, @@ -406,7 +406,7 @@ void fmpz_mod_polyu3n_interp_lift_2sm_bpoly( } -int fmpz_mod_polyu3n_interp_crt_2sm_bpoly( +static int fmpz_mod_polyu3n_interp_crt_2sm_bpoly( slong * lastdeg, fmpz_mod_polyun_t F, fmpz_mod_polyun_t T, From 6c48701ec01cee80c85cfc6e8909495d4aecccc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 19:11:59 +0200 Subject: [PATCH 057/114] fmpq_mpoly_factor --- src/fmpq_mpoly_factor.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/fmpq_mpoly_factor.h b/src/fmpq_mpoly_factor.h index 6009329787..ec7834fc77 100644 --- a/src/fmpq_mpoly_factor.h +++ b/src/fmpq_mpoly_factor.h @@ -24,6 +24,8 @@ extern "C" { #endif +FLINT_HEADER_START + void fmpq_mpoly_factor_init(fmpq_mpoly_factor_t f, const fmpq_mpoly_ctx_t ctx); @@ -96,6 +98,8 @@ void _fmpq_mpoly_factor_swap_fmpz_mpoly_factor(fmpq_mpoly_factor_t f, int fmpq_mpoly_factor_expand(fmpq_mpoly_t A, const fmpq_mpoly_factor_t f, const fmpq_mpoly_ctx_t ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif From ed9f778128295a8bff07c72804edcee9f97ccc84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 13:21:53 +0200 Subject: [PATCH 058/114] fq_nmod_mpoly_factor --- src/fq_nmod_mpoly_factor.h | 6 +++++- src/fq_nmod_mpoly_factor/factor.c | 2 +- src/fq_nmod_mpoly_factor/irred_smprime_zippel.c | 2 +- src/fq_nmod_mpoly_factor/polyu3_hlift.c | 8 ++++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/fq_nmod_mpoly_factor.h b/src/fq_nmod_mpoly_factor.h index ef05aa6cb6..2b058c2846 100644 --- a/src/fq_nmod_mpoly_factor.h +++ b/src/fq_nmod_mpoly_factor.h @@ -21,9 +21,11 @@ #include "fq_nmod_mpoly.h" #ifdef __cplusplus - extern "C" { +extern "C" { #endif +FLINT_HEADER_START + /*****************************************************************************/ typedef struct { @@ -510,6 +512,8 @@ void _fq_nmod_mpoly_set_n_fq_bpoly_gen1_zero(fq_nmod_mpoly_t A, flint_bitcnt_t Abits, const n_bpoly_t B, slong var, const fq_nmod_mpoly_ctx_t ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/fq_nmod_mpoly_factor/factor.c b/src/fq_nmod_mpoly_factor/factor.c index 7934ae7867..5ea145b13f 100644 --- a/src/fq_nmod_mpoly_factor/factor.c +++ b/src/fq_nmod_mpoly_factor/factor.c @@ -801,7 +801,7 @@ static int _factor_irred( Assume each factor in f is sep. Replace f by an irreducible factorization. */ -int fq_nmod_mpoly_factor_irred( +static int fq_nmod_mpoly_factor_irred( fq_nmod_mpoly_factor_t f, const fq_nmod_mpoly_ctx_t ctx, unsigned int algo) diff --git a/src/fq_nmod_mpoly_factor/irred_smprime_zippel.c b/src/fq_nmod_mpoly_factor/irred_smprime_zippel.c index 058a9aedd1..5b696402e7 100644 --- a/src/fq_nmod_mpoly_factor/irred_smprime_zippel.c +++ b/src/fq_nmod_mpoly_factor/irred_smprime_zippel.c @@ -1016,7 +1016,7 @@ static int fq_nmod_mpoly_from_zipp( } /* bit counts of all degrees should be < FLINT_BITS/3 */ -int fq_nmod_mpoly_hlift_zippel( +static int fq_nmod_mpoly_hlift_zippel( slong m, fq_nmod_mpoly_struct * B, slong r, diff --git a/src/fq_nmod_mpoly_factor/polyu3_hlift.c b/src/fq_nmod_mpoly_factor/polyu3_hlift.c index 4223441952..7c4557dab9 100644 --- a/src/fq_nmod_mpoly_factor/polyu3_hlift.c +++ b/src/fq_nmod_mpoly_factor/polyu3_hlift.c @@ -138,7 +138,7 @@ static void fq_nmod_polyu_mul( #endif -void n_fq_poly_fill_power( +static void n_fq_poly_fill_power( n_fq_poly_t alphapow, slong e, const fq_nmod_ctx_t ctx, @@ -161,7 +161,7 @@ void n_fq_poly_fill_power( } -void fq_nmod_polyu3_interp_reduce_bpoly( +static void fq_nmod_polyu3_interp_reduce_bpoly( n_bpoly_t Ap, const n_polyu_t A, n_fq_poly_t alphapow, @@ -230,7 +230,7 @@ void fq_nmod_polyu3_interp_reduce_bpoly( T(x0, x1, x2) == B(x0, x1) mod (x2 + alpha) */ -void fq_nmod_polyu3n_interp_lift_sm_bpoly( +static void fq_nmod_polyu3n_interp_lift_sm_bpoly( slong * lastdeg, n_polyun_t T, const n_bpoly_t A, @@ -271,7 +271,7 @@ void fq_nmod_polyu3n_interp_lift_sm_bpoly( T = F + modulus*(A - F(alpha)) */ -int fq_nmod_polyu3n_interp_crt_sm_bpoly( +static int fq_nmod_polyu3n_interp_crt_sm_bpoly( slong * lastdeg, n_polyun_t F, n_polyun_t T, From db5f8c3814692ffc26531c53744d2113f64e84d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 00:53:27 +0200 Subject: [PATCH 059/114] fft --- src/fft.h | 3 --- src/fft/butterfly_lshB.c | 1 + src/fft/butterfly_rshB.c | 1 + src/fft/fft_mfa_truncate_sqrt2.c | 8 ++++---- src/fft/fft_mfa_truncate_sqrt2_inner.c | 4 ++-- src/fft/ifft_mfa_truncate_sqrt2.c | 10 +++++----- src/fft/split_bits.c | 4 ++-- src/fft/test/t-butterfly_twiddle.c | 4 ++-- 8 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/fft.h b/src/fft.h index 031cb4dc77..e352ad4f7e 100644 --- a/src/fft.h +++ b/src/fft.h @@ -25,9 +25,6 @@ extern "C" { #endif -/* defined in mpn_extras.h */ -mp_limb_t flint_mpn_sumdiff_n(mp_ptr s, mp_ptr d, mp_srcptr x, mp_srcptr y, mp_size_t n); - #define fft_sumdiff(t, u, r, s, n) \ (n == 0 ? 0 : flint_mpn_sumdiff_n(t, u, r, s, n)) diff --git a/src/fft/butterfly_lshB.c b/src/fft/butterfly_lshB.c index 9adc45a26e..972da259f0 100644 --- a/src/fft/butterfly_lshB.c +++ b/src/fft/butterfly_lshB.c @@ -9,6 +9,7 @@ (at your option) any later version. See . */ +#include "mpn_extras.h" #include "fft.h" void butterfly_lshB(mp_limb_t * t, mp_limb_t * u, mp_limb_t * i1, diff --git a/src/fft/butterfly_rshB.c b/src/fft/butterfly_rshB.c index 427726b2da..f3f9dc1585 100644 --- a/src/fft/butterfly_rshB.c +++ b/src/fft/butterfly_rshB.c @@ -9,6 +9,7 @@ (at your option) any later version. See . */ +#include "mpn_extras.h" #include "fft.h" void butterfly_rshB(mp_limb_t * t, mp_limb_t * u, mp_limb_t * i1, diff --git a/src/fft/fft_mfa_truncate_sqrt2.c b/src/fft/fft_mfa_truncate_sqrt2.c index 2cacf19e34..0953379534 100644 --- a/src/fft/fft_mfa_truncate_sqrt2.c +++ b/src/fft/fft_mfa_truncate_sqrt2.c @@ -169,7 +169,7 @@ void fft_mfa_truncate_sqrt2(mp_limb_t ** ii, mp_size_t n, fft_radix2_twiddle(ii + i, n1, n2/2, w*n1, t1, t2, w, 0, i, 1); for (j = 0; j < n2; j++) { - mp_size_t s = n_revbin(j, depth); + s = n_revbin(j, depth); if (j < s) SWAP_PTRS(ii[i+j*n1], ii[i+s*n1]); } } @@ -199,7 +199,7 @@ void fft_mfa_truncate_sqrt2(mp_limb_t ** ii, mp_size_t n, fft_truncate1_twiddle(ii + i, n1, n2/2, w*n1, t1, t2, w, 0, i, 1, trunc2); for (j = 0; j < n2; j++) { - mp_size_t s = n_revbin(j, depth); + s = n_revbin(j, depth); if (j < s) SWAP_PTRS(ii[i+j*n1], ii[i+s*n1]); } } @@ -238,7 +238,7 @@ typedef struct } fft_outer_arg_t; -void +static void _fft_outer1_worker(void * arg_ptr) { fft_outer_arg_t arg = *((fft_outer_arg_t *) arg_ptr); @@ -322,7 +322,7 @@ _fft_outer1_worker(void * arg_ptr) } } -void +static void _fft_outer2_worker(void * arg_ptr) { fft_outer_arg_t arg = *((fft_outer_arg_t *) arg_ptr); diff --git a/src/fft/fft_mfa_truncate_sqrt2_inner.c b/src/fft/fft_mfa_truncate_sqrt2_inner.c index e96339cccd..32e8dca5f9 100644 --- a/src/fft/fft_mfa_truncate_sqrt2_inner.c +++ b/src/fft/fft_mfa_truncate_sqrt2_inner.c @@ -35,7 +35,7 @@ typedef struct } fft_inner_arg_t; -void +static void _fft_inner1_worker(void * arg_ptr) { fft_inner_arg_t arg = *((fft_inner_arg_t *) arg_ptr); @@ -86,7 +86,7 @@ _fft_inner1_worker(void * arg_ptr) } } -void +static void _fft_inner2_worker(void * arg_ptr) { fft_inner_arg_t arg = *((fft_inner_arg_t *) arg_ptr); diff --git a/src/fft/ifft_mfa_truncate_sqrt2.c b/src/fft/ifft_mfa_truncate_sqrt2.c index aa0498d26c..ed7e202848 100644 --- a/src/fft/ifft_mfa_truncate_sqrt2.c +++ b/src/fft/ifft_mfa_truncate_sqrt2.c @@ -149,7 +149,7 @@ void ifft_mfa_truncate_sqrt2(mp_limb_t ** ii, mp_size_t n, flint_bitcnt_t w, { for (j = 0; j < n1; j++) { - mp_size_t s = n_revbin(j, depth2); + s = n_revbin(j, depth2); if (j < s) SWAP_PTRS(ii[i*n1+j], ii[i*n1+s]); } @@ -161,7 +161,7 @@ void ifft_mfa_truncate_sqrt2(mp_limb_t ** ii, mp_size_t n, flint_bitcnt_t w, { for (j = 0; j < n2; j++) { - mp_size_t s = n_revbin(j, depth); + s = n_revbin(j, depth); if (j < s) SWAP_PTRS(ii[i+j*n1], ii[i+s*n1]); } @@ -193,7 +193,7 @@ void ifft_mfa_truncate_sqrt2(mp_limb_t ** ii, mp_size_t n, flint_bitcnt_t w, { for (j = 0; j < trunc2; j++) { - mp_size_t s = n_revbin(j, depth); + s = n_revbin(j, depth); if (j < s) SWAP_PTRS(ii[i+j*n1], ii[i+s*n1]); } @@ -267,7 +267,7 @@ typedef struct } ifft_outer_arg_t; -void +static void _ifft_outer1_worker(void * arg_ptr) { ifft_outer_arg_t arg = *((ifft_outer_arg_t *) arg_ptr); @@ -311,7 +311,7 @@ _ifft_outer1_worker(void * arg_ptr) } } -void +static void _ifft_outer2_worker(void * arg_ptr) { ifft_outer_arg_t arg = *((ifft_outer_arg_t *) arg_ptr); diff --git a/src/fft/split_bits.c b/src/fft/split_bits.c index b674feaf19..00a63e0ace 100644 --- a/src/fft/split_bits.c +++ b/src/fft/split_bits.c @@ -28,7 +28,7 @@ typedef struct } split_limbs_arg_t; -void +static void _split_limbs_worker(void * arg_ptr) { split_limbs_arg_t arg = *((split_limbs_arg_t *) arg_ptr); @@ -144,7 +144,7 @@ typedef struct } split_bits_arg_t; -void +static void _split_bits_worker(void * arg_ptr) { split_bits_arg_t arg = *((split_bits_arg_t *) arg_ptr); diff --git a/src/fft/test/t-butterfly_twiddle.c b/src/fft/test/t-butterfly_twiddle.c index 36fac94d2a..af9f8b0e41 100644 --- a/src/fft/test/t-butterfly_twiddle.c +++ b/src/fft/test/t-butterfly_twiddle.c @@ -30,7 +30,7 @@ void set_p(mpz_t p, mp_size_t n, flint_bitcnt_t w) #endif void ref_fft_butterfly_twiddle(mpz_t s, mpz_t t, mpz_t i1, mpz_t i2, - mpz_t p, mp_size_t i, mp_size_t w, flint_bitcnt_t b1, flint_bitcnt_t b2) + mpz_t p, mp_size_t FLINT_UNUSED(i), mp_size_t FLINT_UNUSED(w), flint_bitcnt_t b1, flint_bitcnt_t b2) { mpz_add(s, i1, i2); mpz_sub(t, i1, i2); @@ -41,7 +41,7 @@ void ref_fft_butterfly_twiddle(mpz_t s, mpz_t t, mpz_t i1, mpz_t i2, } void ref_ifft_butterfly_twiddle(mpz_t s, mpz_t t, mpz_t i1, mpz_t i2, - mpz_t p, mp_size_t i, mp_size_t n, mp_size_t w, flint_bitcnt_t b1, flint_bitcnt_t b2) + mpz_t p, mp_size_t FLINT_UNUSED(i), mp_size_t n, mp_size_t w, flint_bitcnt_t b1, flint_bitcnt_t b2) { mpz_mul_2exp(i1, i1, 2*n*w - b1); mpz_mul_2exp(i2, i2, 2*n*w - b2); From 3e4c10bbe39a0e993e3decf6ad9304160bd5414a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 19:29:08 +0200 Subject: [PATCH 060/114] fft_small --- src/fft_small/default_ctx.c | 2 +- src/fft_small/fmpz_poly_mul.c | 2 +- src/fft_small/mpn_mul.c | 16 ++++++++-------- src/fft_small/nmod_poly_mul.c | 14 +++++++------- src/fft_small/sd_fft.c | 2 +- src/fft_small/sd_ifft.c | 10 +++++----- src/fft_small/test/t-sd_fft.c | 4 ++-- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/fft_small/default_ctx.c b/src/fft_small/default_ctx.c index 34cdf6bbe4..7eadd396c1 100644 --- a/src/fft_small/default_ctx.c +++ b/src/fft_small/default_ctx.c @@ -16,7 +16,7 @@ FLINT_TLS_PREFIX int default_mpn_ctx_initialized = 0; #define DEFAULT_PRIME UWORD(0x0003f00000000001) -void +static void mpn_ctx_cleanup(void) { if (default_mpn_ctx_initialized) diff --git a/src/fft_small/fmpz_poly_mul.c b/src/fft_small/fmpz_poly_mul.c index d75de3adf8..47d9b45315 100644 --- a/src/fft_small/fmpz_poly_mul.c +++ b/src/fft_small/fmpz_poly_mul.c @@ -183,7 +183,7 @@ static void _mod( } -void fmpz_neg_ui_array(fmpz_t out, const ulong * in, slong in_len) +static void fmpz_neg_ui_array(fmpz_t out, const ulong * in, slong in_len) { slong size = in_len; FLINT_ASSERT(in_len > 0); diff --git a/src/fft_small/mpn_mul.c b/src/fft_small/mpn_mul.c index 40d9fcea80..b656287962 100644 --- a/src/fft_small/mpn_mul.c +++ b/src/fft_small/mpn_mul.c @@ -192,7 +192,7 @@ static ulong crt_data_find_bits(const crt_data_t C, ulong bn) #define aindex(i) (a[i]) #if 0 -void slow_mpn_to_fft_easy( +static void slow_mpn_to_fft_easy( sd_fft_lctx_t Q, double* z, const uint32_t* a, @@ -316,7 +316,7 @@ void slow_mpn_to_fft_easy( } #else -void slow_mpn_to_fft_easy( +static void slow_mpn_to_fft_easy( const sd_fft_ctx_t Q, double* z, const uint32_t* a, @@ -393,7 +393,7 @@ void slow_mpn_to_fft_easy( #undef aindex -void slow_mpn_to_fft( +static void slow_mpn_to_fft( const sd_fft_ctx_t Q, double* z, ulong ztrunc, const ulong* a_, ulong an_, @@ -896,7 +896,7 @@ DEFINE_IT(7, 6, 5) DEFINE_IT(8, 7, 6) #undef DEFINE_IT -ulong next_fft_number(ulong p) +static ulong next_fft_number(ulong p) { ulong bits, l, q; bits = n_nbits(p); @@ -1312,7 +1312,7 @@ typedef struct { int squaring; } mod_worker_struct; -void mod_worker_func(void* varg) +static void mod_worker_func(void* varg) { mod_worker_struct* X = (mod_worker_struct*) varg; @@ -1339,7 +1339,7 @@ typedef struct fft_worker_struct { int squaring; } fft_worker_struct; -void fft_worker_func(void* varg) +static void fft_worker_func(void* varg) { fft_worker_struct* X = (fft_worker_struct*) varg; ulong m; @@ -1382,7 +1382,7 @@ typedef struct mod_fft_worker_struct { int squaring; } mod_fft_worker_struct; -void mod_fft_worker_func(void* varg) +static void mod_fft_worker_func(void* varg) { mod_fft_worker_struct* X = (mod_fft_worker_struct*) varg; ulong m; @@ -1427,7 +1427,7 @@ typedef struct { ulong overhang_buffer[MPN_CTX_NCRTS]; } crt_worker_struct; -void crt_worker_func(void* varg) +static void crt_worker_func(void* varg) { crt_worker_struct* X = (crt_worker_struct*) varg; diff --git a/src/fft_small/nmod_poly_mul.c b/src/fft_small/nmod_poly_mul.c index 4258f10ba6..353888756f 100644 --- a/src/fft_small/nmod_poly_mul.c +++ b/src/fft_small/nmod_poly_mul.c @@ -359,7 +359,7 @@ static void extra_func(void* varg) sd_fft_trunc(Q, X->bbuf, X->depth, X->btrunc, X->ztrunc); } -void s1worker_func(void* varg) +static void s1worker_func(void* varg) { s1worker_struct* X = (s1worker_struct*) varg; ulong i, m; @@ -432,7 +432,7 @@ typedef struct { nmod_t mod); } s2worker_struct; -void s2worker_func(void* varg) +static void s2worker_func(void* varg) { s2worker_struct* X = (s2worker_struct*) varg; @@ -641,7 +641,7 @@ static void _nmod_poly_mul_mod_xpnm1_naive( } #endif -void _nmod_poly_mul_mod_xpnm1( +static void _nmod_poly_mul_mod_xpnm1( ulong* z, ulong ztrunc, const ulong* a, ulong an, const ulong* b, ulong bn, @@ -787,7 +787,7 @@ typedef struct { nmod_t mod; } s1pworker_struct; -void s1pworker_func(void* varg) +static void s1pworker_func(void* varg) { s1pworker_struct* X = (s1pworker_struct*) varg; ulong i, m; @@ -1003,7 +1003,7 @@ int _nmod_poly_mul_mid_precomp( return 1; } -void _nmod_poly_mul_mod_xpnm1_precomp( +static void _nmod_poly_mul_mod_xpnm1_precomp( ulong* z, ulong ztrunc, const ulong* a, ulong an, mul_precomp_struct* M, @@ -1089,7 +1089,7 @@ void _nmod_poly_mul_mod_xpnm1_precomp( /* z -= a mod x^N-1, write coeffs [0,ztrunc) */ -void _nmod_poly_sub_mod_xpNm1( +static void _nmod_poly_sub_mod_xpNm1( ulong* z, ulong ztrunc, const ulong* a, ulong an, ulong N, nmod_t mod) @@ -1311,7 +1311,7 @@ requires k <= l < 3k < h <= 4k */ -void _nmod_poly_mul_mid_unbalanced( +static void _nmod_poly_mul_mid_unbalanced( ulong* z, slong zl, slong zh, const ulong* a, slong an, const ulong* b, slong bn, diff --git a/src/fft_small/sd_fft.c b/src/fft_small/sd_fft.c index cf050048bc..c2c2ec5398 100644 --- a/src/fft_small/sd_fft.c +++ b/src/fft_small/sd_fft.c @@ -755,7 +755,7 @@ static void sd_fft_no_trunc_block( -void sd_fft_no_trunc_internal( +static void sd_fft_no_trunc_internal( const sd_fft_ctx_t Q, double* x, ulong S, /* stride */ diff --git a/src/fft_small/sd_ifft.c b/src/fft_small/sd_ifft.c index 5700ee6c56..218952775f 100644 --- a/src/fft_small/sd_ifft.c +++ b/src/fft_small/sd_ifft.c @@ -570,7 +570,7 @@ static void sd_ifft_basecase_5_0(const sd_fft_ctx_t Q, double* X, ulong j_mr, ul /* use with n = m-2 and m >= 6 */ #define EXTEND_BASECASE(n, m) \ -void CAT3(sd_ifft_basecase, m, 1)(const sd_fft_ctx_t Q, double* X) \ +static void CAT3(sd_ifft_basecase, m, 1)(const sd_fft_ctx_t Q, double* X) \ { \ ulong l = n_pow2(m - 2); \ CAT3(sd_ifft_basecase, n, 1)(Q, X+0*l); \ @@ -585,7 +585,7 @@ void CAT3(sd_ifft_basecase, m, 1)(const sd_fft_ctx_t Q, double* X) \ FLINT_ASSERT(i == l); \ } \ } \ -void CAT3(sd_ifft_basecase, m, 0)(const sd_fft_ctx_t Q, double* X, ulong j_mr, ulong j_bits) \ +static void CAT3(sd_ifft_basecase, m, 0)(const sd_fft_ctx_t Q, double* X, ulong j_mr, ulong j_bits) \ { \ ulong l = n_pow2(m - 2); \ FLINT_ASSERT(j_bits != 0); \ @@ -609,7 +609,7 @@ EXTEND_BASECASE(7, 9) #undef EXTEND_BASECASE /* parameter 1: j can be zero */ -void sd_ifft_base_8_1(const sd_fft_ctx_t Q, double* x, ulong j) +static void sd_ifft_base_8_1(const sd_fft_ctx_t Q, double* x, ulong j) { ulong j_bits, j_mr; @@ -622,7 +622,7 @@ void sd_ifft_base_8_1(const sd_fft_ctx_t Q, double* x, ulong j) } /* parameter 0: j cannot be zero */ -void sd_ifft_base_8_0(const sd_fft_ctx_t Q, double* x, ulong j) +static void sd_ifft_base_8_0(const sd_fft_ctx_t Q, double* x, ulong j) { ulong j_bits, j_mr; @@ -633,7 +633,7 @@ void sd_ifft_base_8_0(const sd_fft_ctx_t Q, double* x, ulong j) sd_ifft_basecase_8_0(Q, x, j_mr, j_bits); } -void sd_ifft_base_9_1(const sd_fft_ctx_t Q, double* x, ulong j) +static void sd_ifft_base_9_1(const sd_fft_ctx_t Q, double* x, ulong j) { ulong j_bits, j_mr; diff --git a/src/fft_small/test/t-sd_fft.c b/src/fft_small/test/t-sd_fft.c index 9ad4b7c68e..22cbe05d04 100644 --- a/src/fft_small/test/t-sd_fft.c +++ b/src/fft_small/test/t-sd_fft.c @@ -51,7 +51,7 @@ void test_sd_fft_trunc(sd_fft_ctx_t Q, ulong minL, ulong maxL, ulong ireps, flin sd_fft_trunc(Q, data, L, itrunc, otrunc); - for (int check_reps = 0; check_reps < 2+50/(1+L); check_reps++) + for (ulong check_reps = 0; check_reps < 2+50/(1+L); check_reps++) { i = n_randint(state, otrunc); double point = sd_fft_ctx_w(Q, i); @@ -73,7 +73,7 @@ void test_sd_fft_trunc(sd_fft_ctx_t Q, ulong minL, ulong maxL, ulong ireps, flin sd_fft_trunc(Q, data, L, trunc, trunc); sd_ifft_trunc(Q, data, L, trunc); - for (int check_reps = 0; check_reps < 2+90/(1+L); check_reps++) + for (ulong check_reps = 0; check_reps < 2+90/(1+L); check_reps++) { i = n_randint(state, trunc); double m = vec1d_reduce_0n_to_pmhn(nmod_pow_ui(2, L, Q->mod), Q->p); From e9cae3159beb5a248526baadf2f42f6411881c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 19:31:19 +0200 Subject: [PATCH 061/114] fmpz_poly_q --- src/fmpz_poly_q/get_str.c | 2 +- src/fmpz_poly_q/get_str_pretty.c | 2 +- src/fmpz_poly_q/set_str.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fmpz_poly_q/get_str.c b/src/fmpz_poly_q/get_str.c index 3a19b8820a..983d9354aa 100644 --- a/src/fmpz_poly_q/get_str.c +++ b/src/fmpz_poly_q/get_str.c @@ -20,7 +20,7 @@ */ char * fmpz_poly_q_get_str(const fmpz_poly_q_t op) { - int i, j; + size_t i, j; char * str; char * numstr; char * denstr; diff --git a/src/fmpz_poly_q/get_str_pretty.c b/src/fmpz_poly_q/get_str_pretty.c index d53e07cff7..215ae2ed2b 100644 --- a/src/fmpz_poly_q/get_str_pretty.c +++ b/src/fmpz_poly_q/get_str_pretty.c @@ -23,7 +23,7 @@ */ char * fmpz_poly_q_get_str_pretty(const fmpz_poly_q_t op, const char *x) { - int i, j; + size_t i, j; char * str; char * numstr; char * denstr; diff --git a/src/fmpz_poly_q/set_str.c b/src/fmpz_poly_q/set_str.c index d6cfdf9040..fde8eda7ec 100644 --- a/src/fmpz_poly_q/set_str.c +++ b/src/fmpz_poly_q/set_str.c @@ -33,8 +33,8 @@ */ int fmpz_poly_q_set_str(fmpz_poly_q_t rop, const char *s) { - int ans, i, m; - size_t len; + int ans; + size_t i, m, len; char * numstr; len = strlen(s); From afae44c96c20d63cfa7e8485dd40ce0ff48115f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 19:43:02 +0200 Subject: [PATCH 062/114] fmpz_lll --- src/fmpz_lll/d_lll.c | 7 +++---- src/fmpz_lll/mpf2_lll.c | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/fmpz_lll/d_lll.c b/src/fmpz_lll/d_lll.c index 358969856a..e3188ba605 100644 --- a/src/fmpz_lll/d_lll.c +++ b/src/fmpz_lll/d_lll.c @@ -83,7 +83,7 @@ FUNC_HEAD for (i = 0; i < d; i++) { expo[i] = _fmpz_vec_get_d_vec_2exp(appB->rows[i], B->rows[i], n); - max_exp = FLINT_MAX(max_exp, expo[i]); + max_exp = FLINT_MAX((int) max_exp, expo[i]); } max_iter = (ulong) ((d - 1) + @@ -444,7 +444,7 @@ FUNC_HEAD for (i = 0; i < d; i++) { fmpz_get_d_2exp(&exp, fmpz_mat_entry(GM, i, i)); - max_exp = FLINT_MAX(max_exp, (expo[i] = exp)); + max_exp = FLINT_MAX((int) max_exp, (expo[i] = exp)); } max_iter = (ulong) ((d - 1) + @@ -457,8 +457,7 @@ FUNC_HEAD kappamax = 0; i = 0; - do - ; + do { } while ((fmpz_cmp_ui(fmpz_mat_entry(GM, i, i), 0) <= 0) && (++i < d)); zeros = i - 1; /* all vectors B[i] with i <= zeros are zero vectors */ diff --git a/src/fmpz_lll/mpf2_lll.c b/src/fmpz_lll/mpf2_lll.c index b9bf82e59d..f284149fc8 100644 --- a/src/fmpz_lll/mpf2_lll.c +++ b/src/fmpz_lll/mpf2_lll.c @@ -370,8 +370,7 @@ FUNC_HEAD kappamax = 0; i = 0; - do - ; + do { } while ((fmpz_cmp_ui(fmpz_mat_entry(GM, i, i), 0) <= 0) && (++i < d)); zeros = i - 1; /* all vectors B[i] with i <= zeros are zero vectors */ From da3f9d0fd48bf5aa6d2092584bdf0667680cce01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 19:53:06 +0200 Subject: [PATCH 063/114] n_poly --- src/n_poly/n_fq_bpoly_gcd.c | 26 +++++++++++++------------- src/n_poly/n_fq_poly_divrem.c | 10 ++++++---- src/n_poly/n_fq_poly_gcd.c | 2 +- src/n_poly/n_fq_poly_mullow.c | 8 +++++++- src/n_poly/n_fq_pow_cache.c | 8 ++++---- src/n_poly/n_polyu1n_gcd.c | 4 ++-- src/n_poly/nmod_n_fq_interp.c | 4 ++-- src/n_poly/nmod_pow_cache.c | 6 +++--- src/n_poly/zippel_helpers.c | 2 +- 9 files changed, 39 insertions(+), 31 deletions(-) diff --git a/src/n_poly/n_fq_bpoly_gcd.c b/src/n_poly/n_fq_bpoly_gcd.c index f3543a721b..776b1c23ae 100644 --- a/src/n_poly/n_fq_bpoly_gcd.c +++ b/src/n_poly/n_fq_bpoly_gcd.c @@ -56,7 +56,7 @@ static void n_fq_bpoly_divexact_poly_var1( } -void n_fq_bpoly_mul_last(n_bpoly_t A, const n_poly_t b, const fq_nmod_ctx_t ctx) +static void n_fq_bpoly_mul_last(n_bpoly_t A, const n_poly_t b, const fq_nmod_ctx_t ctx) { slong i; n_fq_poly_t t; @@ -77,7 +77,7 @@ void n_fq_bpoly_mul_last(n_bpoly_t A, const n_poly_t b, const fq_nmod_ctx_t ctx) /*****************************************************************************/ -void n_fq_poly_eval2p_pow( +static void n_fq_poly_eval2p_pow( ulong * vp, ulong * vm, const n_fq_poly_t P, @@ -137,7 +137,7 @@ void n_fq_poly_eval2p_pow( } } -void n_fq_bpoly_interp_reduce_2psm_poly( +static void n_fq_bpoly_interp_reduce_2psm_poly( n_fq_poly_t Ap, n_fq_poly_t Am, const n_fq_bpoly_t A, @@ -166,7 +166,7 @@ void n_fq_bpoly_interp_reduce_2psm_poly( } -void n_fq_bpoly_interp_lift_2psm_poly( +static void n_fq_bpoly_interp_lift_2psm_poly( slong * deg1, n_fq_bpoly_t T, const n_fq_poly_t A, @@ -267,7 +267,7 @@ void n_fq_bpoly_interp_lift_2psm_poly( FLINT_ASSERT(n_fq_bpoly_is_canonical(T, ctx)); } -void _n_fq_poly_addmul_plinear( +static void _n_fq_poly_addmul_plinear( n_fq_poly_t A, ulong * Bcoeffs, slong Blen, const n_poly_t C, @@ -312,7 +312,7 @@ void _n_fq_poly_addmul_plinear( _n_fq_poly_normalise(A, d); } -int n_fq_bpoly_interp_crt_2psm_poly( +static int n_fq_bpoly_interp_crt_2psm_poly( slong * deg1, n_fq_bpoly_t F, n_fq_bpoly_t T, @@ -403,7 +403,7 @@ int n_fq_bpoly_interp_crt_2psm_poly( } -int n_fq_bpoly_gcd_brown_smprime2p( +static int n_fq_bpoly_gcd_brown_smprime2p( n_fq_bpoly_t G, n_fq_bpoly_t Abar, n_fq_bpoly_t Bbar, @@ -411,8 +411,8 @@ int n_fq_bpoly_gcd_brown_smprime2p( const n_fq_bpoly_t B, const fq_nmod_ctx_t ctx, n_poly_bpoly_stack_t Sp, - n_fq_poly_t cA, - n_fq_poly_t cB, + n_fq_poly_t FLINT_UNUSED(cA), + n_fq_poly_t FLINT_UNUSED(cB), n_fq_poly_t cG, n_fq_poly_t cAbar, n_fq_poly_t cBbar, @@ -436,7 +436,7 @@ int n_fq_bpoly_gcd_brown_smprime2p( deggamma = n_fq_poly_degree(gamma); bound = 1 + deggamma + FLINT_MAX(ldegA, ldegB); - if (bound >= mod.n/2) + if (bound >= (slong) (mod.n / 2)) return 0; FLINT_ASSERT(A->length > 0); @@ -659,7 +659,7 @@ int n_fq_bpoly_gcd_brown_smprime2p( /*****************************************************************************/ -void n_fq_bpoly_interp_reduce_sm_poly( +static void n_fq_bpoly_interp_reduce_sm_poly( n_fq_poly_t E, const n_fq_bpoly_t A, n_fq_poly_t alphapow, @@ -680,7 +680,7 @@ void n_fq_bpoly_interp_reduce_sm_poly( _n_fq_poly_normalise(E, d); } -void n_fq_bpoly_interp_lift_sm_poly( +static void n_fq_bpoly_interp_lift_sm_poly( n_fq_bpoly_t T, const n_fq_poly_t A, const fq_nmod_ctx_t ctx) @@ -705,7 +705,7 @@ void n_fq_bpoly_interp_lift_sm_poly( } -int n_fq_bpoly_interp_crt_sm_poly( +static int n_fq_bpoly_interp_crt_sm_poly( slong * deg1, n_fq_bpoly_t F, n_fq_bpoly_t T, diff --git a/src/n_poly/n_fq_poly_divrem.c b/src/n_poly/n_fq_poly_divrem.c index 9d40848672..492ff2f002 100644 --- a/src/n_poly/n_fq_poly_divrem.c +++ b/src/n_poly/n_fq_poly_divrem.c @@ -19,8 +19,9 @@ #define N_FQ_POLY_DIVREM_BASECASE_ITCH \ FLINT_MAX(FLINT_MAX(4, N_FQ_MUL_ITCH), 2 + (N_FQ_REDUCE_ITCH)) +#if 0 void _n_fq_poly_rem_basecase_( - ulong * Q, + ulong * FLINT_UNUSED(Q), ulong * A, const ulong * AA, slong Alen, const ulong * B, slong Blen, @@ -78,9 +79,10 @@ void _n_fq_poly_rem_basecase_( n_poly_stack_vec_clear(St); } +#endif -void _n_fq_poly_divrem_basecase_( +static void _n_fq_poly_divrem_basecase_( ulong * Q, ulong * A, const ulong * AA, slong Alen, @@ -145,7 +147,7 @@ void _n_fq_poly_divrem_basecase_( n_poly_stack_vec_clear(St); } -void _n_fq_poly_divrem_divconquer_recursive_( +static void _n_fq_poly_divrem_divconquer_recursive_( ulong * Q, ulong * BQ, ulong * W, @@ -259,7 +261,7 @@ static void __n_fq_poly_divrem_divconquer_( } -void _n_fq_poly_divrem_divconquer_( +static void _n_fq_poly_divrem_divconquer_( ulong * Q, ulong * R, ulong * A, slong lenA, diff --git a/src/n_poly/n_fq_poly_gcd.c b/src/n_poly/n_fq_poly_gcd.c index 3cf1fac41f..11d994e4e5 100644 --- a/src/n_poly/n_fq_poly_gcd.c +++ b/src/n_poly/n_fq_poly_gcd.c @@ -13,7 +13,7 @@ #include "fq_nmod_poly.h" #include "n_poly.h" -slong _n_fq_poly_gcd_euclidean_inplace_( +static slong _n_fq_poly_gcd_euclidean_inplace_( ulong * A, slong Alen, ulong * B, slong Blen, const fq_nmod_ctx_t ctx, diff --git a/src/n_poly/n_fq_poly_mullow.c b/src/n_poly/n_fq_poly_mullow.c index 5ad647d736..52e3247f2d 100644 --- a/src/n_poly/n_fq_poly_mullow.c +++ b/src/n_poly/n_fq_poly_mullow.c @@ -17,7 +17,13 @@ # include "fq_nmod_poly.h" #endif -void _n_fq_poly_mullow_( +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + +static void _n_fq_poly_mullow_( ulong * rop, const ulong * op1, slong len1, const ulong * op2, slong len2, diff --git a/src/n_poly/n_fq_pow_cache.c b/src/n_poly/n_fq_pow_cache.c index b698c4dfb3..9b85bfe0ce 100644 --- a/src/n_poly/n_fq_pow_cache.c +++ b/src/n_poly/n_fq_pow_cache.c @@ -136,7 +136,7 @@ void n_fq_pow_cache_mulpow_ui( ulong e, n_poly_t pos, n_poly_t bin, - n_poly_t neg, + n_poly_t FLINT_UNUSED(neg), const fq_nmod_ctx_t ctx) { slong d = fq_nmod_ctx_degree(ctx); @@ -153,8 +153,8 @@ void n_fq_pow_cache_mulpow_ui( if (e < 50) { - n_poly_fit_length(pos, d*(FLINT_MAX(e + 1, i) + N_FQ_MUL_ITCH)); - while (i <= e) + n_poly_fit_length(pos, d * (FLINT_MAX(e + 1, (ulong) i) + N_FQ_MUL_ITCH)); + while ((ulong) i <= e) { FLINT_ASSERT(d*(i + 1 + N_FQ_MUL_ITCH) <= pos->alloc); _n_fq_mul(pos->coeffs + d*i, pos->coeffs + d*1, @@ -223,7 +223,7 @@ void n_fq_pow_cache_mulpow_neg_ui( i = neg->length; n_poly_fit_length(neg, d*(e + 1)); - while (i <= e) + while ((ulong) i <= e) { _n_fq_mul(neg->coeffs + d*i, neg->coeffs + d*1, neg->coeffs + d*(i - 1), ctx, tmp); diff --git a/src/n_poly/n_polyu1n_gcd.c b/src/n_poly/n_polyu1n_gcd.c index 051559f184..59b200c3fe 100644 --- a/src/n_poly/n_polyu1n_gcd.c +++ b/src/n_poly/n_polyu1n_gcd.c @@ -409,11 +409,11 @@ int n_polyu1n_mod_gcd_brown_smprime( if (n_poly_degree(modulus) > 0) { FLINT_ASSERT(G->length > 0); - if (n_poly_degree(Gevalp) > G->exps[0]) + if ((ulong) n_poly_degree(Gevalp) > G->exps[0]) { goto choose_prime; } - else if (n_poly_degree(Gevalp) < G->exps[0]) + else if ((ulong) n_poly_degree(Gevalp) < G->exps[0]) { n_poly_one(modulus); } diff --git a/src/n_poly/nmod_n_fq_interp.c b/src/n_poly/nmod_n_fq_interp.c index 8512c81f09..97e1d47fea 100644 --- a/src/n_poly/nmod_n_fq_interp.c +++ b/src/n_poly/nmod_n_fq_interp.c @@ -390,7 +390,7 @@ static int _fill_matrices2( n_poly_t g, h; ulong g0i, c; - if (2*d >= ctx.n) + if (2 * (ulong) d >= ctx.n) return 0; n_poly_init2(g, 2*d + 2); @@ -653,7 +653,7 @@ int nmod_eval_interp_set_degree_modulus( FLINT_ASSERT(deg >= 0); - if (p < 3 || (p % 2) == 0 || deg >= p) + if (p < 3 || (p % 2) == 0 || (ulong) deg >= p) return 0; if ((p % 4) == 1) diff --git a/src/n_poly/nmod_pow_cache.c b/src/n_poly/nmod_pow_cache.c index d0555c00ae..396745c1e0 100644 --- a/src/n_poly/nmod_pow_cache.c +++ b/src/n_poly/nmod_pow_cache.c @@ -101,7 +101,7 @@ ulong nmod_pow_cache_mulpow_ui( ulong e, n_poly_t pos, n_poly_t bin, - n_poly_t neg, + n_poly_t FLINT_UNUSED(neg), nmod_t ctx) { slong i; @@ -117,7 +117,7 @@ ulong nmod_pow_cache_mulpow_ui( { n_poly_fit_length(pos, e + 1); i = pos->length; - while (i <= e) + while ((ulong) i <= e) { pos->coeffs[i] = nmod_mul(b, pos->coeffs[i - 1], ctx); pos->length = ++i; @@ -160,7 +160,7 @@ ulong nmod_pow_cache_mulpow_neg_ui( n_poly_fit_length(neg, e + 1); i = neg->length; - while (i <= e) + while ((ulong) i <= e) { neg->coeffs[i] = nmod_mul(neg->coeffs[1], neg->coeffs[i - 1], ctx); diff --git a/src/n_poly/zippel_helpers.c b/src/n_poly/zippel_helpers.c index d68a2209f5..9ed1366f31 100644 --- a/src/n_poly/zippel_helpers.c +++ b/src/n_poly/zippel_helpers.c @@ -27,7 +27,7 @@ void n_fq_poly_product_roots_n_fq( const ulong * monomials, slong mlength, const fq_nmod_ctx_t ctx, - n_poly_stack_t St) + n_poly_stack_t FLINT_UNUSED(St)) { slong d = fq_nmod_ctx_degree(ctx); slong i; From 3d17ec62c25442e3c507d07330b380424f2641e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 6 Oct 2024 23:35:37 +0200 Subject: [PATCH 064/114] arith --- src/arith/bell_number.c | 3 ++- src/arith/bell_number_multi_mod.c | 4 ++-- src/arith/bell_number_nmod.c | 8 ++++---- src/arith/bell_number_nmod_vec.c | 4 ++-- src/arith/bell_number_nmod_vec_series.c | 6 ++++++ src/arith/bernoulli_number_denom.c | 3 +-- src/arith/bernoulli_polynomial.c | 2 +- src/arith/dedekind_cosine_sum_factored.c | 2 +- src/arith/divisors.c | 6 +++--- src/arith/euler_number_vec.c | 2 +- src/arith/landau_function_vec.c | 3 ++- src/arith/number_of_partitions.c | 1 + src/arith/ramanujan_tau.c | 6 +++--- src/arith/stirling1.c | 14 +++++++------- src/arith/stirling2.c | 22 ++++++++++++---------- src/arith/stirlingmat.c | 1 + src/arith/sum_of_squares.c | 2 +- src/arith/test/t-bernoulli_number.c | 12 ++++++------ 18 files changed, 56 insertions(+), 45 deletions(-) diff --git a/src/arith/bell_number.c b/src/arith/bell_number.c index d9ae15d298..207c0ad2d5 100644 --- a/src/arith/bell_number.c +++ b/src/arith/bell_number.c @@ -27,7 +27,8 @@ static void arith_bell_number_recursive(fmpz_t res, ulong n) { ulong t[3 * MAX_N_3LIMBS]; - slong i, k; + ulong i; + slong k; t[0] = 1; for (i = 1; i < FLINT_MIN(n, MAX_N_1LIMBS); i++) diff --git a/src/arith/bell_number_multi_mod.c b/src/arith/bell_number_multi_mod.c index aa170713c3..2143ecb835 100644 --- a/src/arith/bell_number_multi_mod.c +++ b/src/arith/bell_number_multi_mod.c @@ -31,7 +31,7 @@ arith_bell_number_nmod2(unsigned int * divtab, nn_ptr facs, nn_ptr pows, ulong n pows[0] = nmod_pow_ui(0, n, mod); pows[1] = nmod_pow_ui(1, n, mod); - for (i = 2; i <= n; i++) + for (i = 2; (ulong) i <= n; i++) { if (divtab[2 * i] == 1) pows[i] = nmod_pow_ui(i, n, mod); @@ -41,7 +41,7 @@ arith_bell_number_nmod2(unsigned int * divtab, nn_ptr facs, nn_ptr pows, ulong n s2 = s1 = s0 = 0; - for (t = i = 0; i <= n; i++) + for (t = i = 0; (ulong) i <= n; i++) { if (i % 2 == 0) t = nmod_add(t, facs[i], mod); diff --git a/src/arith/bell_number_nmod.c b/src/arith/bell_number_nmod.c index 347346dd5a..a61ca8d831 100644 --- a/src/arith/bell_number_nmod.c +++ b/src/arith/bell_number_nmod.c @@ -28,7 +28,7 @@ const ulong bell_number_tab[] = static const char bell_mod_2[3] = {1, 1, 0}; static const char bell_mod_3[13] = {1, 1, 2, 2, 0, 1, 2, 1, 0, 0, 1, 0, 1}; -ulong +static ulong arith_bell_number_nmod_fallback(ulong n, nmod_t mod) { nn_ptr bvec; @@ -90,19 +90,19 @@ arith_bell_number_nmod(ulong n, nmod_t mod) pows[0] = nmod_pow_ui(0, n, mod); pows[1] = nmod_pow_ui(1, n, mod); - for (i = 2; i <= n; i++) + for (i = 2; (ulong) i <= n; i++) { if (pows[i] == 0) pows[i] = nmod_pow_ui(i, n, mod); - for (j = 2; j <= i && i * j <= n; j++) + for (j = 2; j <= i && (ulong) (i * j) <= n; j++) if (pows[i * j] == 0) pows[i * j] = nmod_mul(pows[i], pows[j], mod); } s2 = s1 = s0 = 0; - for (t = i = 0; i <= n; i++) + for (t = i = 0; (ulong) i <= n; i++) { if (i % 2 == 0) t = nmod_add(t, facs[i], mod); diff --git a/src/arith/bell_number_nmod_vec.c b/src/arith/bell_number_nmod_vec.c index 96345619ee..26f71c37e0 100644 --- a/src/arith/bell_number_nmod_vec.c +++ b/src/arith/bell_number_nmod_vec.c @@ -21,10 +21,10 @@ arith_bell_number_nmod_vec(nn_ptr b, slong len, nmod_t mod) } else { - if (mod.n >= len && arith_bell_number_nmod_vec_series(b, len, mod)) + if (mod.n >= (ulong) len && arith_bell_number_nmod_vec_series(b, len, mod)) return; - if (len < 500 + NMOD_BITS(mod) * NMOD_BITS(mod)) + if ((ulong) len < 500 + NMOD_BITS(mod) * NMOD_BITS(mod)) arith_bell_number_nmod_vec_recursive(b, len, mod); else arith_bell_number_nmod_vec_ogf(b, len, mod); diff --git a/src/arith/bell_number_nmod_vec_series.c b/src/arith/bell_number_nmod_vec_series.c index 436744440f..c457a017ae 100644 --- a/src/arith/bell_number_nmod_vec_series.c +++ b/src/arith/bell_number_nmod_vec_series.c @@ -14,6 +14,12 @@ #include "nmod_poly.h" #include "arith.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + ulong nmod_inv_check(ulong x, nmod_t mod) { ulong r, g; diff --git a/src/arith/bernoulli_number_denom.c b/src/arith/bernoulli_number_denom.c index 16458bb603..1a833963e9 100644 --- a/src/arith/bernoulli_number_denom.c +++ b/src/arith/bernoulli_number_denom.c @@ -38,8 +38,7 @@ static const __u32 __bernoulli_denom_small[] = void arith_bernoulli_number_denom(fmpz_t den, ulong n) { - slong i; - ulong p; + ulong i, p; const ulong * primes; if (n % 2 == 1) diff --git a/src/arith/bernoulli_polynomial.c b/src/arith/bernoulli_polynomial.c index 3f9ed5b23d..72869e0837 100644 --- a/src/arith/bernoulli_polynomial.c +++ b/src/arith/bernoulli_polynomial.c @@ -19,7 +19,7 @@ void arith_bernoulli_polynomial(fmpq_poly_t poly, ulong n) { fmpz_t t; fmpz * den; - slong k; + ulong k; if (n == 0) { diff --git a/src/arith/dedekind_cosine_sum_factored.c b/src/arith/dedekind_cosine_sum_factored.c index 2756f9a71a..dc04686398 100644 --- a/src/arith/dedekind_cosine_sum_factored.c +++ b/src/arith/dedekind_cosine_sum_factored.c @@ -73,7 +73,7 @@ n_sqrtmod_ppow(ulong a, ulong p, int k, ulong pk, ulong pkinv) return r; } -void +static void trigprod_mul_prime_power(trig_prod_t prod, ulong k, ulong n, ulong p, int exp) { diff --git a/src/arith/divisors.c b/src/arith/divisors.c index 6d2fb8dc1a..98d5435f57 100644 --- a/src/arith/divisors.c +++ b/src/arith/divisors.c @@ -44,8 +44,8 @@ const ulong FLINT_TINY_DIVISORS_LOOKUP[FLINT_NUM_TINY_DIVISORS] = { }; -void -_arith_divisors(fmpz *res, slong size, fmpz_factor_t factors) +static void +_arith_divisors(fmpz *res, slong FLINT_UNUSED(size), fmpz_factor_t factors) { slong i; slong *exp = flint_malloc(sizeof(slong) * factors->num); @@ -99,7 +99,7 @@ _arith_divisors(fmpz *res, slong size, fmpz_factor_t factors) } -void +static void _arith_divisors_tiny(fmpz_poly_t res, slong n) { slong size; diff --git a/src/arith/euler_number_vec.c b/src/arith/euler_number_vec.c index 8ba1f32976..bced8d722e 100644 --- a/src/arith/euler_number_vec.c +++ b/src/arith/euler_number_vec.c @@ -45,7 +45,7 @@ __euler_number_vec_mod_p(nn_ptr res, nn_ptr tmp, slong m, nmod_t mod) #define CRT_MAX_RESOLUTION 16 -void __euler_number_vec_multi_mod(fmpz * res, slong n) +static void __euler_number_vec_multi_mod(fmpz * res, slong n) { fmpz_comb_t comb[CRT_MAX_RESOLUTION]; fmpz_comb_temp_t temp[CRT_MAX_RESOLUTION]; diff --git a/src/arith/landau_function_vec.c b/src/arith/landau_function_vec.c index 667db39421..5c5e591e83 100644 --- a/src/arith/landau_function_vec.c +++ b/src/arith/landau_function_vec.c @@ -25,7 +25,8 @@ void arith_landau_function_vec(fmpz * res, slong len) ulong p, pmax; ulong pk, pkhi; fmpz_t a; - ulong k, n; + slong k; + ulong n; if (len < 1) return; diff --git a/src/arith/number_of_partitions.c b/src/arith/number_of_partitions.c index 6be8919c85..62194e1ab4 100644 --- a/src/arith/number_of_partitions.c +++ b/src/arith/number_of_partitions.c @@ -9,6 +9,7 @@ (at your option) any later version. See . */ +#include "arith.h" #include "partitions.h" /* compatibility wrapper */ diff --git a/src/arith/ramanujan_tau.c b/src/arith/ramanujan_tau.c index 7b36d7c345..8ebacf77d5 100644 --- a/src/arith/ramanujan_tau.c +++ b/src/arith/ramanujan_tau.c @@ -40,12 +40,12 @@ void arith_ramanujan_tau_series(fmpz_poly_t res, slong n) fmpz_clear(tmp); } -void _arith_ramanujan_tau(fmpz_t res, fmpz_factor_t factors) +static void _arith_ramanujan_tau(fmpz_t res, fmpz_factor_t factors) { fmpz_poly_t poly; fmpz_t tau_p, p_11, next, this, prev; - slong k, r; - ulong max_prime; + slong k; + ulong r, max_prime; max_prime = UWORD(1); for (k = 0; k < factors->num; k++) diff --git a/src/arith/stirling1.c b/src/arith/stirling1.c index b8aba643c0..51615c7164 100644 --- a/src/arith/stirling1.c +++ b/src/arith/stirling1.c @@ -41,7 +41,7 @@ stirling_1u_ogf_bsplit(fmpz * res, ulong a, ulong b, slong len, int which, int f { ulong c, n, cbc; - len = FLINT_MIN(len, b - a + 1); + len = FLINT_MIN(len, (slong) (b - a + 1)); /* (c+x)^n has coefficients bounded by max(c,n)^n */ n = b - a; @@ -59,7 +59,7 @@ stirling_1u_ogf_bsplit(fmpz * res, ulong a, ulong b, slong len, int which, int f v[1] = 1; /* multiply by ((a+i) + x) */ - for (i = 1; i < n; i++) + for (i = 1; i < (slong) n; i++) { if (i + 1 < len) v[i + 1] = 1; @@ -74,7 +74,7 @@ stirling_1u_ogf_bsplit(fmpz * res, ulong a, ulong b, slong len, int which, int f v[1] = a; /* multiply by (1 + (a+i) x) */ - for (i = 1; i < n; i++) + for (i = 1; i < (slong) n; i++) { if (i + 1 < len) v[i + 1] = v[i] * (a + i); @@ -96,8 +96,8 @@ stirling_1u_ogf_bsplit(fmpz * res, ulong a, ulong b, slong len, int which, int f slong len1, len2; slong m = a + (b - a) / 2; - len1 = FLINT_MIN(m - a + 1, len); - len2 = FLINT_MIN(b - m + 1, len); + len1 = FLINT_MIN((slong) (m - a + 1), len); + len2 = FLINT_MIN((slong) (b - m + 1), len); L = _fmpz_vec_init(len1 + len2); R = L + len1; @@ -196,14 +196,14 @@ arith_stirling_number_1u_vec(fmpz * res, ulong n, slong klen) if (klen <= 0) return; - len = FLINT_MIN(klen - 1, n - 1); + len = FLINT_MIN(klen - 1, (slong) n - 1); if (n >= 1 && len >= 1) stirling_1u_ogf_bsplit(res + 1, 1, n, len, 1, 0); fmpz_set_ui(res + 0, n == 0); for (k = n; k < klen; k++) - fmpz_set_ui(res + k, n == k); + fmpz_set_ui(res + k, (slong) n == k); } void diff --git a/src/arith/stirling2.c b/src/arith/stirling2.c index 71570cb5dc..3883bea8f6 100644 --- a/src/arith/stirling2.c +++ b/src/arith/stirling2.c @@ -32,7 +32,8 @@ stirling_2_bound_2exp(ulong n, ulong k) { double bnk; int exp; - slong bnk_exp, j; + slong bnk_exp; + ulong j; /* binomial coefficients */ bnk = 1.0; @@ -138,7 +139,7 @@ triangular_2(nn_ptr c, slong n, slong klen) } } -void +static void arith_stirling_number_2_vec_triangular(fmpz * row, slong n, slong klen) { ulong c[2 * MAX_N_2LIMB + 2]; @@ -181,7 +182,7 @@ arith_stirling_number_2_vec_triangular(fmpz * row, slong n, slong klen) fmpz_set_ui(row + k, k == n); } -void +static void arith_stirling_number_2_vec_convolution(fmpz * res, ulong n, slong klen) { slong k, kodd, len; @@ -191,7 +192,7 @@ arith_stirling_number_2_vec_convolution(fmpz * res, ulong n, slong klen) if (klen <= 0) return; - len = FLINT_MIN(klen - 1, n - 1); + len = FLINT_MIN(klen - 1, (slong) n - 1); t = _fmpz_vec_init(len + 1); u = _fmpz_vec_init(len); @@ -228,7 +229,7 @@ arith_stirling_number_2_vec_convolution(fmpz * res, ulong n, slong klen) fmpz_set_ui(res + 0, n == 0); for (k = n; k < klen; k++) - fmpz_set_ui(res + k, n == k); + fmpz_set_ui(res + k, (slong) n == k); _fmpz_vec_clear(t, len + 1); _fmpz_vec_clear(u, len); @@ -303,7 +304,7 @@ arith_stirling_number_2_nmod_vec(nn_ptr res, const unsigned int * divtab, ulong #define CRT_MAX_RESOLUTION 16 -void +static void arith_stirling_number_2_vec_multi_mod(fmpz * res, ulong n, slong klen) { fmpz_comb_t comb[CRT_MAX_RESOLUTION]; @@ -328,7 +329,7 @@ arith_stirling_number_2_vec_multi_mod(fmpz * res, ulong n, slong klen) return; } - if (klen > n + 1) + if ((ulong) klen > n + 1) { _fmpz_vec_zero(res + n + 1, klen - n - 1); klen = n + 1; @@ -432,7 +433,7 @@ arith_stirling_number_2_vec(fmpz * row, ulong n, slong klen) { if (n <= 80) arith_stirling_number_2_vec_triangular(row, n, klen); - else if (klen < n / 2) + else if (klen < (slong) (n / 2)) arith_stirling_number_2_vec_convolution(row, n, klen); else arith_stirling_number_2_vec_multi_mod(row, n, klen); @@ -486,7 +487,8 @@ stirling_2_powsum(fmpz_t s, ulong n, ulong k) { fmpz_t t, u; fmpz *b; - slong i, j, m, max_b; + slong i; + ulong j, m, max_b; max_b = (k + 1) / 2; @@ -542,7 +544,7 @@ stirling_2_nmod(const unsigned int * divtab, ulong n, ulong k, nmod_t mod) TMP_START; pow_len = k + 1; - bin_len = FLINT_MIN(pow_len, k / 2 + 1); + bin_len = FLINT_MIN(pow_len, (slong) k / 2 + 1); t = TMP_ALLOC(bin_len * sizeof(ulong)); u = TMP_ALLOC(pow_len * sizeof(ulong)); diff --git a/src/arith/stirlingmat.c b/src/arith/stirlingmat.c index 2b36743247..cc04aa4712 100644 --- a/src/arith/stirlingmat.c +++ b/src/arith/stirlingmat.c @@ -9,6 +9,7 @@ (at your option) any later version. See . */ +#include "arith.h" #include "fmpz_mat.h" #include "gr.h" #include "gr_mat.h" diff --git a/src/arith/sum_of_squares.c b/src/arith/sum_of_squares.c index f4f444b61b..475baf0b0c 100644 --- a/src/arith/sum_of_squares.c +++ b/src/arith/sum_of_squares.c @@ -69,7 +69,7 @@ static void sum_of_squares_recursive(fmpz_t r, slong k, ulong n) { fmpz_t t, u; - slong i, j; + ulong i, j; fmpz_init(t); fmpz_init(u); diff --git a/src/arith/test/t-bernoulli_number.c b/src/arith/test/t-bernoulli_number.c index 0e7a256de8..a089af1d85 100644 --- a/src/arith/test/t-bernoulli_number.c +++ b/src/arith/test/t-bernoulli_number.c @@ -59,18 +59,18 @@ TEST_FUNCTION_START(arith_bernoulli_number, state) /* Check non underscore versions */ do { - slong N = 100; + slong N0 = 100; fmpq * x; fmpq_t t; fmpq_init(t); - x = flint_malloc(sizeof(fmpq) * N); + x = flint_malloc(sizeof(fmpq) * N0); - for (n = 0; n < N; n++) + for (n = 0; n < N0; n++) fmpq_init(x + n); - arith_bernoulli_number_vec(x, N); - for (n = 0; n < N; n++) + arith_bernoulli_number_vec(x, N0); + for (n = 0; n < N0; n++) { arith_bernoulli_number(t, n); if (!fmpq_equal(x + n, t)) @@ -81,7 +81,7 @@ TEST_FUNCTION_START(arith_bernoulli_number, state) } } - for (n = 0; n < N; n++) + for (n = 0; n < N0; n++) fmpq_clear(x + n); flint_free(x); fmpq_clear(t); From a2fbe4a468a5f430ce8ddfb09e6ffbdb6ad7f18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 07:20:30 +0200 Subject: [PATCH 065/114] qsieve --- src/qsieve/block_lanczos.c | 6 +++--- src/qsieve/collect_relations.c | 14 +++++++------- src/qsieve/compute_poly_data.c | 10 +++++----- src/qsieve/factor.c | 4 ++-- src/qsieve/init.c | 2 +- src/qsieve/knuth_schroeppel.c | 2 +- src/qsieve/large_prime_variant.c | 8 ++++++-- src/qsieve/poly.c | 4 ++-- src/qsieve/primes_init.c | 2 +- 9 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/qsieve/block_lanczos.c b/src/qsieve/block_lanczos.c index ec54ab3aa5..4b803e0055 100644 --- a/src/qsieve/block_lanczos.c +++ b/src/qsieve/block_lanczos.c @@ -484,7 +484,7 @@ static slong find_nonsingular_sub(uint64_t *t, slong *s, } /*-------------------------------------------------------------------*/ -void mul_MxN_Nx64(slong vsize, slong dense_rows, +static void mul_MxN_Nx64(slong vsize, slong dense_rows, slong ncols, la_col_t *A, uint64_t *x, uint64_t *b) { @@ -524,7 +524,7 @@ void mul_MxN_Nx64(slong vsize, slong dense_rows, } /*-------------------------------------------------------------------*/ -void mul_trans_MxN_Nx64(slong dense_rows, slong ncols, +static void mul_trans_MxN_Nx64(slong dense_rows, slong ncols, la_col_t *A, uint64_t *x, uint64_t *b) { /* Multiply the vector x[] by the transpose of the @@ -587,7 +587,7 @@ static void transpose_vector(slong ncols, uint64_t *v, uint64_t **trans) { } /*-----------------------------------------------------------------------*/ -void combine_cols(slong ncols, +static void combine_cols(slong ncols, uint64_t *x, uint64_t *v, uint64_t *ax, uint64_t *av) { diff --git a/src/qsieve/collect_relations.c b/src/qsieve/collect_relations.c index 6de4bf1ab8..02b63c06fa 100644 --- a/src/qsieve/collect_relations.c +++ b/src/qsieve/collect_relations.c @@ -287,7 +287,7 @@ slong qsieve_evaluate_candidate(qs_t qs_inf, ulong i, unsigned char * sieve, qs_ pinv = factor_base[j].pinv; modp = n_mod2_preinv(i, prime, pinv); - if (modp == soln1[j] || modp == soln2[j]) + if (modp == (ulong) soln1[j] || modp == (ulong) soln2[j]) { fmpz_set_ui(p, prime); exp = fmpz_remove(res, res, p); @@ -323,7 +323,7 @@ slong qsieve_evaluate_candidate(qs_t qs_inf, ulong i, unsigned char * sieve, qs_ if (soln2[j] != 0) /* not a prime dividing A */ { - if (modp == soln1[j] || modp == soln2[j]) + if (modp == (ulong) soln1[j] || modp == (ulong) soln2[j]) { fmpz_set_ui(p, prime); exp = fmpz_remove(res, res, p); @@ -367,7 +367,7 @@ slong qsieve_evaluate_candidate(qs_t qs_inf, ulong i, unsigned char * sieve, qs_ for (k = 0; k < qs_inf->s; k++) /* Commit any outstanding A factors */ { - if (A_ind[k] >= j) /* check it is beyond where loop above ended */ + if (A_ind[k] >= (ulong) j) /* check it is beyond where loop above ended */ { factor[num_factors].ind = A_ind[k]; factor[num_factors++].exp = 1; @@ -407,11 +407,11 @@ slong qsieve_evaluate_candidate(qs_t qs_inf, ulong i, unsigned char * sieve, qs_ FB prime; skip values not coprime with multiplier, as this will lead to factors of kn, not n */ - if (prime < 60*factor_base[qs_inf->num_primes - 1].p && n_gcd(prime, qs_inf->k) == 1) + if (prime < (ulong) 60 * factor_base[qs_inf->num_primes - 1].p && n_gcd(prime, qs_inf->k) == 1) { for (k = 0; k < qs_inf->s; k++) /* commit any outstanding A factors */ { - if (A_ind[k] >= j) /* check beyond where loop above ended */ + if (A_ind[k] >= (ulong) j) /* check beyond where loop above ended */ { factor[num_factors].ind = A_ind[k]; factor[num_factors++].exp = 1; @@ -463,7 +463,7 @@ slong qsieve_evaluate_sieve(qs_t qs_inf, unsigned char * sieve, qs_poly_t poly) unsigned char bits = qs_inf->sieve_bits; slong rels = 0; - while (j < qs_inf->sieve_size / sizeof(ulong)) + while (j < (slong) (qs_inf->sieve_size / sizeof(ulong))) { /* scan 4 or 8 bytes at once for sieve entries over threshold */ #if FLINT64 @@ -478,7 +478,7 @@ slong qsieve_evaluate_sieve(qs_t qs_inf, unsigned char * sieve, qs_poly_t poly) i = j * sizeof(ulong); /* check bytes individually in word */ - while (i < (j + 1) * sizeof(ulong) && i < qs_inf->sieve_size) + while (i < (slong) ((j + 1) * sizeof(ulong)) && i < qs_inf->sieve_size) { /* if we are over the threshold, check candidate for smoothness */ if (sieve[i] > bits) diff --git a/src/qsieve/compute_poly_data.c b/src/qsieve/compute_poly_data.c index e85365a323..ad275cc4b8 100644 --- a/src/qsieve/compute_poly_data.c +++ b/src/qsieve/compute_poly_data.c @@ -50,8 +50,8 @@ int qsieve_init_A(qs_t qs_inf) { slong i, j; - slong s, low, high, span, m, h; - ulong bits, num_factors, rem, mid; + slong s, low, high, m, h, mid; + ulong bits, num_factors, rem, span; ulong factor_bound[40]; ulong * A_ind; ulong * curr_subset, * first_subset; @@ -267,7 +267,7 @@ int qsieve_init_A(qs_t qs_inf) if (found_j) break; /* success */ /* (s - 1)-tuple failed, step to next (s - 1)-tuple */ - h = (4*(m + h + 1)/3 >= span) ? h + 1 : 1; + h = ((ulong) 4 * (m + h + 1) / 3 >= span) ? h + 1 : 1; m = curr_subset[s - h - 1] + 1; for (j = 0; j < h; j++) @@ -413,7 +413,7 @@ int qsieve_next_A(qs_t qs_inf) if (s <= 3) { - if (curr_subset[0] != span - s + 1) + if (curr_subset[0] != (ulong) (span - s + 1)) { h = (m >= span - h) ? h + 1 : 1; m = curr_subset[s - h] + 1; @@ -438,7 +438,7 @@ int qsieve_next_A(qs_t qs_inf) while (1) { - if (4*(curr_subset[0] + s + diff)/3 + 1 >= span) /* have run out of A's */ + if (4 * (curr_subset[0] + s + diff) / 3 + 1 >= (ulong) span) /* have run out of A's */ { ret = 0; goto next_A_cleanup; diff --git a/src/qsieve/factor.c b/src/qsieve/factor.c index b859ff5f11..2fbb8e63a7 100644 --- a/src/qsieve/factor.c +++ b/src/qsieve/factor.c @@ -38,7 +38,7 @@ # include #endif -int compare_facs(const void * a, const void * b) +static int compare_facs(const void * a, const void * b) { fmpz * x = (fmpz *) a; fmpz * y = (fmpz *) b; @@ -285,7 +285,7 @@ void qsieve_factor(fmpz_factor_t factors, const fmpz_t n) #endif if (qs_inf->full_relation + qs_inf->num_cycles >= - ((slong) (1.10*qs_inf->num_primes) + qs_inf->ks_primes + qs_inf->extra_rels)) + (slong) ((slong) (1.10*qs_inf->num_primes) + qs_inf->ks_primes + qs_inf->extra_rels)) { int ok; diff --git a/src/qsieve/init.c b/src/qsieve/init.c index 51a1b0eb65..e2227c4772 100644 --- a/src/qsieve/init.c +++ b/src/qsieve/init.c @@ -20,7 +20,7 @@ void qsieve_init(qs_t qs_inf, const fmpz_t n) { size_t fname_alloc_size; - slong i; + ulong i; #if (defined(__WIN32) && !defined(__CYGWIN__)) || defined(_MSC_VER) fname_alloc_size = MAX_PATH; diff --git a/src/qsieve/knuth_schroeppel.c b/src/qsieve/knuth_schroeppel.c index 9e188ef21f..4a4dee7b16 100644 --- a/src/qsieve/knuth_schroeppel.c +++ b/src/qsieve/knuth_schroeppel.c @@ -63,7 +63,7 @@ ulong qsieve_knuth_schroeppel(qs_t qs_inf) maximum number of primes to try may not exceed number of factor base primes (recall k and 2 and -1 are factor base primes) */ - max = FLINT_MIN(qs_inf->ks_primes, qs_inf->num_primes - 3); + max = FLINT_MIN(qs_inf->ks_primes, (ulong) qs_inf->num_primes - 3); n_primes_init(iter); n_primes_next(iter); diff --git a/src/qsieve/large_prime_variant.c b/src/qsieve/large_prime_variant.c index 767e83917a..84537930c5 100644 --- a/src/qsieve/large_prime_variant.c +++ b/src/qsieve/large_prime_variant.c @@ -27,6 +27,7 @@ * *****************************************************************************/ +#if 0 /* Display a relation for debugging purposes */ @@ -47,11 +48,13 @@ void qsieve_display_relation(qs_t qs_inf, relation_t a) fmpz_print(a.Y); flint_printf("\n"); } +#endif +#if 0 /* Check a relation is valid (debugging) */ -int qsieve_is_relation(qs_t qs_inf, relation_t a) +static int qsieve_is_relation(qs_t qs_inf, relation_t a) { slong i; fmpz_t temp, temp2; @@ -92,6 +95,7 @@ int qsieve_is_relation(qs_t qs_inf, relation_t a) return 1; } +#endif /* Write partial or full relation to file @@ -642,7 +646,7 @@ int qsieve_process_relation(qs_t qs_inf) flint_printf("Sorting relations\n"); #endif - if (rlist_length < qs_inf->num_primes + qs_inf->ks_primes + qs_inf->extra_rels) + if (rlist_length < qs_inf->num_primes + (slong) qs_inf->ks_primes + qs_inf->extra_rels) { qs_inf->edges -= 100; done = 0; diff --git a/src/qsieve/poly.c b/src/qsieve/poly.c index b4ac259288..fcbde67c4c 100644 --- a/src/qsieve/poly.c +++ b/src/qsieve/poly.c @@ -53,10 +53,10 @@ ulong qsieve_poly_init(qs_t qs_inf) A_inv2B = qs_inf->A_inv2B; - for (i = 0; i < s; i++) + for (i = 0; (ulong) i < s; i++) A_inv2B[i] = flint_malloc(num_primes * sizeof(ulong)); - for (i = 0; i < s; i++) + for (i = 0; (ulong) i < s; i++) { fmpz_init(qs_inf->A_divp[i]); fmpz_init(qs_inf->B_terms[i]); diff --git a/src/qsieve/primes_init.c b/src/qsieve/primes_init.c index 369b8130d7..71dd83ffd9 100644 --- a/src/qsieve/primes_init.c +++ b/src/qsieve/primes_init.c @@ -104,7 +104,7 @@ ulong qsieve_primes_init(qs_t qs_inf) prime_t * factor_base; /* determine which index in the tuning table n corresponds to */ - for (i = 1; i < QS_TUNE_SIZE; i++) + for (i = 1; (ulong) i < QS_TUNE_SIZE; i++) { if (qsieve_tune[i][0] > qs_inf->bits) break; From 59527c4d17ff2d9cf6dcbdb0385aaf40a2243e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 13:01:37 +0200 Subject: [PATCH 066/114] aprcl --- src/aprcl/config_jacobi.c | 9 +++++---- src/aprcl/f_table.c | 3 +-- src/aprcl/is_prime_gauss.c | 5 +++-- src/aprcl/is_prime_jacobi.c | 3 ++- src/aprcl/test/t-unity_zp_aut_inv.c | 2 +- src/aprcl/unity_zp_coeff.c | 4 ++-- src/aprcl/unity_zp_jacobi_sum.c | 2 +- src/aprcl/unity_zp_pow_2k.c | 4 ++-- src/aprcl/unity_zp_pow_sliding.c | 8 ++++---- src/aprcl/unity_zpq_clear.c | 2 +- src/aprcl/unity_zpq_copy.c | 2 +- src/aprcl/unity_zpq_equal.c | 2 +- src/aprcl/unity_zpq_gauss_sum.c | 2 +- src/aprcl/unity_zpq_gauss_sum_character_pow.c | 2 +- src/aprcl/unity_zpq_init.c | 2 +- src/aprcl/unity_zpq_mul.c | 3 +-- 16 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/aprcl/config_jacobi.c b/src/aprcl/config_jacobi.c index c8a0c563d2..2a706ef702 100644 --- a/src/aprcl/config_jacobi.c +++ b/src/aprcl/config_jacobi.c @@ -77,7 +77,8 @@ aprcl_R_value(const fmpz_t n) static void _aprcl_config_jacobi_reduce_s2(aprcl_config conf, const fmpz_t n) { - ulong i, j, q; + slong i, j; + ulong q; double * w; n_factor_t q_factors; fmpz_t new_s, p; @@ -98,10 +99,10 @@ _aprcl_config_jacobi_reduce_s2(aprcl_config conf, const fmpz_t n) for (j = 0; j < q_factors.num; j++) { - ulong p, euler_phi; + ulong px, euler_phi; - p = q_factors.p[j]; - euler_phi = n_pow(p, q_factors.exp[j] - 1) * (p - 1); + px = q_factors.p[j]; + euler_phi = n_pow(px, q_factors.exp[j] - 1) * (px - 1); euler_phi = euler_phi * euler_phi; w[i] += euler_phi; diff --git a/src/aprcl/f_table.c b/src/aprcl/f_table.c index 587029892a..364a24ef50 100644 --- a/src/aprcl/f_table.c +++ b/src/aprcl/f_table.c @@ -23,8 +23,7 @@ nn_ptr aprcl_f_table(const ulong q) { - int i; - ulong g, g_pow, qinv; + ulong i, g, g_pow, qinv; nn_ptr g_table, f_table; g = n_primitive_root_prime(q); diff --git a/src/aprcl/is_prime_gauss.c b/src/aprcl/is_prime_gauss.c index cba3dcabeb..44fb07e83f 100644 --- a/src/aprcl/is_prime_gauss.c +++ b/src/aprcl/is_prime_gauss.c @@ -153,8 +153,9 @@ _aprcl_is_gausspower_from_unity_p(ulong q, ulong r, const fmpz_t n) primality_test_status _aprcl_is_prime_gauss(const fmpz_t n, const aprcl_config config) { - int *lambdas; - ulong i, j, k, nmod4; + int * lambdas; + slong i, j, k; + ulong nmod4; primality_test_status result; /* diff --git a/src/aprcl/is_prime_jacobi.c b/src/aprcl/is_prime_jacobi.c index 71972a00a7..a9f164b57e 100644 --- a/src/aprcl/is_prime_jacobi.c +++ b/src/aprcl/is_prime_jacobi.c @@ -542,7 +542,8 @@ primality_test_status _aprcl_is_prime_jacobi(const fmpz_t n, const aprcl_config config) { int *lambdas; - ulong i, j, nmod4; + slong i, j; + ulong nmod4; primality_test_status result; fmpz_t temp, p2, ndec, ndecdiv, u, q_pow; diff --git a/src/aprcl/test/t-unity_zp_aut_inv.c b/src/aprcl/test/t-unity_zp_aut_inv.c index 2ae0a10011..96bb111096 100644 --- a/src/aprcl/test/t-unity_zp_aut_inv.c +++ b/src/aprcl/test/t-unity_zp_aut_inv.c @@ -10,6 +10,7 @@ */ #include "test_helpers.h" +#include "ulong_extras.h" #include "fmpz.h" #include "aprcl.h" @@ -50,7 +51,6 @@ TEST_FUNCTION_START(aprcl_unity_zp_aut_inv, state) for (j = 0; j < 100; j++) { - ulong ind; fmpz_t val; fmpz_init(val); diff --git a/src/aprcl/unity_zp_coeff.c b/src/aprcl/unity_zp_coeff.c index 1cbb882fe5..75e1676124 100644 --- a/src/aprcl/unity_zp_coeff.c +++ b/src/aprcl/unity_zp_coeff.c @@ -55,7 +55,7 @@ unity_zp_coeff_add_ui(unity_zp f, ulong ind, ulong x) void unity_zp_coeff_inc(unity_zp f, ulong ind) { - if (ind >= f->poly->length) + if (ind >= (ulong) f->poly->length) { fmpz_mod_poly_set_coeff_ui(f->poly, ind, 1, f->ctx); return; @@ -69,7 +69,7 @@ unity_zp_coeff_inc(unity_zp f, ulong ind) void unity_zp_coeff_dec(unity_zp f, ulong ind) { - if (ind >= f->poly->length) + if (ind >= (ulong) f->poly->length) { fmpz_mod_poly_set_coeff_si(f->poly, ind, -1, f->ctx); return; diff --git a/src/aprcl/unity_zp_jacobi_sum.c b/src/aprcl/unity_zp_jacobi_sum.c index c15cacfbaa..bb0fb8a9e5 100644 --- a/src/aprcl/unity_zp_jacobi_sum.c +++ b/src/aprcl/unity_zp_jacobi_sum.c @@ -20,7 +20,7 @@ void _unity_zp_jacobi_sum_pq_general(unity_zp f, const nn_ptr table, ulong p, ulong q, ulong k, ulong a, ulong b) { - int i, j; + ulong i, j; ulong size, pow, pow_dec; unity_zp_set_zero(f); diff --git a/src/aprcl/unity_zp_pow_2k.c b/src/aprcl/unity_zp_pow_2k.c index 09c5d9ce51..32e875360c 100644 --- a/src/aprcl/unity_zp_pow_2k.c +++ b/src/aprcl/unity_zp_pow_2k.c @@ -49,7 +49,7 @@ unity_zp_pow_2k_fmpz(unity_zp f, const unity_zp g, const fmpz_t pow) unity_zp_copy(g_powers[1], g); /* sets g_powers[i] = g^2 * g_powers[i - 1] */ - for (i = 2; i <= pow2k; i++) + for (i = 2; (ulong) i <= pow2k; i++) { unity_zp_init(g_powers[i], f->p, f->exp, fmpz_mod_ctx_modulus(f->ctx)); unity_zp_mul(g_powers[i], g_powers[i - 1], temp); @@ -111,7 +111,7 @@ unity_zp_pow_2k_fmpz(unity_zp f, const unity_zp g, const fmpz_t pow) } - for (i = 0; i <= pow2k; i++) + for (i = 0; (ulong) i <= pow2k; i++) unity_zp_clear(g_powers[i]); flint_free(g_powers); diff --git a/src/aprcl/unity_zp_pow_sliding.c b/src/aprcl/unity_zp_pow_sliding.c index 33bcd295f1..3eef232bca 100644 --- a/src/aprcl/unity_zp_pow_sliding.c +++ b/src/aprcl/unity_zp_pow_sliding.c @@ -53,7 +53,7 @@ unity_zp_pow_sliding_fmpz(unity_zp f, unity_zp g, const fmpz_t pow) unity_zp_copy(g_powers[1], g); /* sets g_powers[i] = g^2 * g_powers[i - 1] */ - for (i = 2; i <= n_pow(2, k - 1); i++) + for (i = 2; (ulong) i <= n_pow(2, k - 1); i++) { unity_zp_init(g_powers[i], f->p, f->exp, fmpz_mod_ctx_modulus(f->ctx)); unity_zp_mul_inplace(g_powers[i], g_powers[i - 1], temp, t); @@ -83,7 +83,7 @@ unity_zp_pow_sliding_fmpz(unity_zp f, unity_zp g, const fmpz_t pow) j++; /* f = f^(2^(i - j + 1)) */ - for (h = 0; h < i - j + 1; h++) + for (h = 0; (slong) h < i - j + 1; h++) { unity_zp_sqr_inplace(temp, f, t); unity_zp_swap(temp, f); @@ -93,7 +93,7 @@ unity_zp_pow_sliding_fmpz(unity_zp f, unity_zp g, const fmpz_t pow) value = binary number (e_i, ... , e_j) in decimal base */ value = 0; - for (h = 0; h < i - j + 1; h++) + for (h = 0; (slong) h < i - j + 1; h++) value += fmpz_tstbit(pow, j + h) << h; /* f = f * g^value */ @@ -109,7 +109,7 @@ unity_zp_pow_sliding_fmpz(unity_zp f, unity_zp g, const fmpz_t pow) fmpz_clear(t[i]); flint_free(t); - for (i = 0; i <= n_pow(2, k - 1); i++) + for (i = 0; (ulong) i <= n_pow(2, k - 1); i++) unity_zp_clear(g_powers[i]); flint_free(g_powers); diff --git a/src/aprcl/unity_zpq_clear.c b/src/aprcl/unity_zpq_clear.c index 7f1d07f47b..55933c5341 100644 --- a/src/aprcl/unity_zpq_clear.c +++ b/src/aprcl/unity_zpq_clear.c @@ -16,7 +16,7 @@ void unity_zpq_clear(unity_zpq f) { - slong i; + ulong i; for (i = 0; i < f->p; i++) { diff --git a/src/aprcl/unity_zpq_copy.c b/src/aprcl/unity_zpq_copy.c index 8352b55fb7..b414ddb67a 100644 --- a/src/aprcl/unity_zpq_copy.c +++ b/src/aprcl/unity_zpq_copy.c @@ -15,7 +15,7 @@ void unity_zpq_copy(unity_zpq f, const unity_zpq g) { - slong i; + ulong i; for (i = 0; i < f->p; i++) { diff --git a/src/aprcl/unity_zpq_equal.c b/src/aprcl/unity_zpq_equal.c index 7aa52a33d5..72f5c70f91 100644 --- a/src/aprcl/unity_zpq_equal.c +++ b/src/aprcl/unity_zpq_equal.c @@ -17,7 +17,7 @@ int unity_zpq_equal(const unity_zpq f, const unity_zpq g) { - slong i; + ulong i; if (f->p != g->p) return 0; diff --git a/src/aprcl/unity_zpq_gauss_sum.c b/src/aprcl/unity_zpq_gauss_sum.c index 49273f9388..9cf1cfeaa6 100644 --- a/src/aprcl/unity_zpq_gauss_sum.c +++ b/src/aprcl/unity_zpq_gauss_sum.c @@ -18,7 +18,7 @@ void unity_zpq_gauss_sum(unity_zpq f, ulong q, ulong p) { - slong i, qinv, qpow, ppow, g; + ulong i, qinv, qpow, ppow, g; g = n_primitive_root_prime(q); qinv = n_preinvert_limb(q); diff --git a/src/aprcl/unity_zpq_gauss_sum_character_pow.c b/src/aprcl/unity_zpq_gauss_sum_character_pow.c index 5f32ac406e..3ec94916ab 100644 --- a/src/aprcl/unity_zpq_gauss_sum_character_pow.c +++ b/src/aprcl/unity_zpq_gauss_sum_character_pow.c @@ -20,7 +20,7 @@ void unity_zpq_gauss_sum_character_pow(unity_zpq f, ulong q, ulong p, ulong pow) { - slong i, qinv, pinv, qpow, ppow, g; + ulong i, qinv, pinv, qpow, ppow, g; g = n_primitive_root_prime(q); qinv = n_preinvert_limb(q); diff --git a/src/aprcl/unity_zpq_init.c b/src/aprcl/unity_zpq_init.c index 6ce468b85e..aa61c5eb1c 100644 --- a/src/aprcl/unity_zpq_init.c +++ b/src/aprcl/unity_zpq_init.c @@ -16,7 +16,7 @@ void unity_zpq_init(unity_zpq f, ulong q, ulong p, const fmpz_t n) { - slong i; + ulong i; f->p = p; f->q = q; diff --git a/src/aprcl/unity_zpq_mul.c b/src/aprcl/unity_zpq_mul.c index 4335f54359..8b8207aa26 100644 --- a/src/aprcl/unity_zpq_mul.c +++ b/src/aprcl/unity_zpq_mul.c @@ -18,8 +18,7 @@ void unity_zpq_mul(unity_zpq f, const unity_zpq g, const unity_zpq h) { - slong i, j, k; - ulong p, q; + ulong i, j, k, p, q; fmpz_mod_poly_t temp; FLINT_ASSERT(fmpz_equal(fmpz_mod_ctx_modulus(f->ctx), From 1eade773f861afd65fa3cb4c3cf5e4ca130f36f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 13:08:49 +0200 Subject: [PATCH 067/114] nf_elem --- src/nf_elem/add.c | 4 ++-- src/nf_elem/mod_fmpz.c | 4 ++-- src/nf_elem/mul.c | 2 +- src/nf_elem/sub.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/nf_elem/add.c b/src/nf_elem/add.c index 0f1c08aa82..8f27311c92 100644 --- a/src/nf_elem/add.c +++ b/src/nf_elem/add.c @@ -15,7 +15,7 @@ void _nf_elem_add_lf(nf_elem_t a, const nf_elem_t b, - const nf_elem_t c, const nf_t nf, int can) + const nf_elem_t c, const nf_t FLINT_UNUSED(nf), int can) { const fmpz *const p = LNF_ELEM_NUMREF(b); const fmpz *const q = LNF_ELEM_DENREF(b); @@ -83,7 +83,7 @@ _nf_elem_add_lf(nf_elem_t a, const nf_elem_t b, void _nf_elem_add_qf(nf_elem_t a, const nf_elem_t b, - const nf_elem_t c, const nf_t nf, int can) + const nf_elem_t c, const nf_t FLINT_UNUSED(nf), int can) { fmpz_t d; diff --git a/src/nf_elem/mod_fmpz.c b/src/nf_elem/mod_fmpz.c index ec2eace532..0e0bfe7eee 100644 --- a/src/nf_elem/mod_fmpz.c +++ b/src/nf_elem/mod_fmpz.c @@ -51,7 +51,7 @@ _nf_elem_mod_fmpz(nf_elem_t res, const nf_elem_t a, const fmpz_t mod, const nf_t nf_elem_canonicalise(res, nf); } -void +static void _nf_elem_mod_fmpz_den(nf_elem_t res, const nf_elem_t a, const fmpz_t mod, const nf_t nf, int den, int sign) { if (!den || nf_elem_den_is_one(a, nf)) @@ -135,7 +135,7 @@ _fmpz_ppio(fmpz_t ppi, fmpz_t ppo, const fmpz_t a, const fmpz_t b) fmpz_clear(g); } -void +static void _nf_elem_coprime_den(nf_elem_t res, const nf_elem_t a, const fmpz_t mod, const nf_t nf, int sign) { if (nf_elem_is_zero(a, nf)) diff --git a/src/nf_elem/mul.c b/src/nf_elem/mul.c index 67d7dba371..2a6bc6b7c0 100644 --- a/src/nf_elem/mul.c +++ b/src/nf_elem/mul.c @@ -12,7 +12,7 @@ #include "fmpz_vec.h" #include "nf_elem.h" -void _nf_elem_mul_gaussian(fmpz * anum, fmpz * aden, +static void _nf_elem_mul_gaussian(fmpz * anum, fmpz * aden, const fmpz * bnum, const fmpz * bden, const fmpz * cnum, const fmpz * cden) { diff --git a/src/nf_elem/sub.c b/src/nf_elem/sub.c index 29ec72034c..76c7447218 100644 --- a/src/nf_elem/sub.c +++ b/src/nf_elem/sub.c @@ -15,7 +15,7 @@ void _nf_elem_sub_lf(nf_elem_t a, const nf_elem_t b, - const nf_elem_t c, const nf_t nf, int can) + const nf_elem_t c, const nf_t FLINT_UNUSED(nf), int can) { const fmpz *const p = LNF_ELEM_NUMREF(b); const fmpz *const q = LNF_ELEM_DENREF(b); @@ -83,7 +83,7 @@ _nf_elem_sub_lf(nf_elem_t a, const nf_elem_t b, void _nf_elem_sub_qf(nf_elem_t a, const nf_elem_t b, - const nf_elem_t c, const nf_t nf, int can) + const nf_elem_t c, const nf_t FLINT_UNUSED(nf), int can) { fmpz_t d; From 1e9c656af36006cb6d35c6aa83f74e4ca88aed21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 13:16:45 +0200 Subject: [PATCH 068/114] qfb --- src/qfb/exponent_element.c | 9 +++++---- src/qfb/reduced_forms.c | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/qfb/exponent_element.c b/src/qfb/exponent_element.c index 5fce2da6bd..89a31d8980 100644 --- a/src/qfb/exponent_element.c +++ b/src/qfb/exponent_element.c @@ -15,7 +15,7 @@ /* find which power of the base is the exponent of f */ -ulong find_power(qfb_t f, fmpz_t n, ulong base) +static ulong find_power(qfb_t f, fmpz_t n, ulong base) { ulong s = 1; @@ -28,11 +28,12 @@ ulong find_power(qfb_t f, fmpz_t n, ulong base) return s; } -ulong qfb_exponent_element_stage2(qfb_t f, fmpz_t n, ulong B2_sqrt) +static ulong qfb_exponent_element_stage2(qfb_t f, fmpz_t n, ulong B2_sqrt) { qfb_t pow, pow2, f2; fmpz_t L, r; - slong i, i2, ret = 0; + ulong i; + slong i2, ret = 0; slong depth = FLINT_BIT_COUNT(B2_sqrt) + 1; qfb_hash_t * qhash = qfb_hash_init(depth); @@ -311,7 +312,7 @@ int qfb_exponent_element(fmpz_t exponent, qfb_t f, fmpz_t n, ulong B1, ulong B2_ go_restart; } - iters = FLINT_MIN(2*iters, hi); + iters = FLINT_MIN(2 * iters, (slong) hi); } while (pr <= B1); ret = 0; diff --git a/src/qfb/reduced_forms.c b/src/qfb/reduced_forms.c index e97493c395..25c614e760 100644 --- a/src/qfb/reduced_forms.c +++ b/src/qfb/reduced_forms.c @@ -17,7 +17,7 @@ into n prime powers whose maximum values are stored in exp, storing the values at the current iteration in pows. */ -int pow_incr(int * pows, int * exp, int n) +static int pow_incr(int * pows, int * exp, int n) { int i; @@ -125,7 +125,7 @@ slong qfb_reduced_forms_large(qfb ** forms, slong d) */ ulong c = ((ulong) (b*b) + (ulong) (-d))/(4*(ulong) a); - if (c >= (ulong) a && (b >= 0 || a != c)) /* we have a form */ + if (c >= (ulong) a && (b >= 0 || (ulong) a != c)) /* we have a form */ { ulong g; @@ -200,7 +200,7 @@ slong qfb_reduced_forms(qfb ** forms, slong d) for (i = 0; i < num; i++) /* sieve with each sqrt mod p */ { ulong off = s[i]; - while (off <= blim) + while (off <= (ulong) blim) { b2 = (off*off - (ulong) d)/4; From bf45f1c780119be2819daf9f3d7e0fa845d5aa0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 13:54:21 +0200 Subject: [PATCH 069/114] double_interval --- src/double_interval/fast_log_nonnegative.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/double_interval/fast_log_nonnegative.c b/src/double_interval/fast_log_nonnegative.c index 212c44c99f..274fc850e6 100644 --- a/src/double_interval/fast_log_nonnegative.c +++ b/src/double_interval/fast_log_nonnegative.c @@ -12,9 +12,6 @@ #include "double_interval.h" #include "mag.h" -double mag_d_log_lower_bound(double x); -double mag_d_log_upper_bound(double x); - di_t di_fast_log_nonnegative(di_t x) { di_t res; From 83d1fa25185ff3e049ad9bec4c7115359683f327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 14:08:46 +0200 Subject: [PATCH 070/114] dlog --- src/dlog.h | 4 ++++ src/dlog/1modpe_mod1p.c | 3 +-- src/dlog/crt.c | 3 +-- src/dlog/crt_clear.c | 2 +- src/dlog/crt_init.c | 2 +- src/dlog/mod2e.c | 3 +-- src/dlog/once.c | 3 +-- src/dlog/power.c | 3 +-- src/dlog/power_init.c | 2 +- src/dlog/precomp_small_init.c | 2 +- src/dlog/rho.c | 3 +-- src/dlog/test/t-vec.c | 2 +- src/dlog/vec_loop.c | 2 +- src/dlog/vec_loop_add.c | 2 +- src/dlog/vec_pindex_factorgcd.c | 2 +- src/dlog/vec_set_not_found.c | 2 +- 16 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/dlog.h b/src/dlog.h index 84a207a207..38415b59a3 100644 --- a/src/dlog.h +++ b/src/dlog.h @@ -24,6 +24,8 @@ extern "C" { #endif +FLINT_HEADER_START + enum { DLOG_MODPE, DLOG_CRT, DLOG_POWER, DLOG_BSGS, DLOG_TABLE, DLOG_23 @@ -267,6 +269,8 @@ void dlog_vec_sieve_precomp(ulong *v, ulong nv, dlog_precomp_t pre, ulong a, ul void dlog_vec_sieve_add_precomp(ulong *v, ulong nv, dlog_precomp_t pre, ulong a, ulong va, nmod_t mod, ulong na, nmod_t order); void dlog_vec_add_precomp(ulong *v, ulong nv, dlog_precomp_t pre, ulong a, ulong va, nmod_t mod, ulong na, nmod_t order); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/dlog/1modpe_mod1p.c b/src/dlog/1modpe_mod1p.c index dece8e0ba9..cb8fe68a46 100644 --- a/src/dlog/1modpe_mod1p.c +++ b/src/dlog/1modpe_mod1p.c @@ -16,8 +16,7 @@ ulong dlog_1modpe_1modp(ulong b1, ulong p, ulong e, ulong inv1p, nmod_t pe) { - int f; - ulong x, xf, pf, pf1; + ulong f, x, xf, pf, pf1; pf1 = 1; pf = p; x = 0; diff --git a/src/dlog/crt.c b/src/dlog/crt.c index 41a45dceb5..e348c784a1 100644 --- a/src/dlog/crt.c +++ b/src/dlog/crt.c @@ -15,8 +15,7 @@ ulong dlog_crt(const dlog_crt_t t, ulong b) { - int k; - ulong r = 0; + ulong k, r = 0; for (k = 0; k < t->num; k++) { ulong bk, rk; diff --git a/src/dlog/crt_clear.c b/src/dlog/crt_clear.c index 9e475f0183..7e62063475 100644 --- a/src/dlog/crt_clear.c +++ b/src/dlog/crt_clear.c @@ -14,7 +14,7 @@ void dlog_crt_clear(dlog_crt_t t) { - int k; + ulong k; flint_free(t->expo); flint_free(t->crt_coeffs); for (k = 0; k < t->num; k++) diff --git a/src/dlog/crt_init.c b/src/dlog/crt_init.c index 818d39663c..844cdef333 100644 --- a/src/dlog/crt_init.c +++ b/src/dlog/crt_init.c @@ -15,7 +15,7 @@ ulong dlog_crt_init(dlog_crt_t t, ulong a, ulong mod, ulong n, ulong num) { - int k; + ulong k; n_factor_t fac; ulong * M, * u; ulong cost = 0; diff --git a/src/dlog/mod2e.c b/src/dlog/mod2e.c index fa716beeaa..124df4dc3f 100644 --- a/src/dlog/mod2e.c +++ b/src/dlog/mod2e.c @@ -15,8 +15,7 @@ ulong dlog_mod2e_1mod4(ulong b1, ulong e, ulong inv5, nmod_t pe) { - slong f; - ulong pf1, pf, x, xf; + ulong f, pf1, pf, x, xf; pf1 = 1; pf = 4; x = 0; diff --git a/src/dlog/once.c b/src/dlog/once.c index 11ae349e15..d51d055e9a 100644 --- a/src/dlog/once.c +++ b/src/dlog/once.c @@ -19,8 +19,7 @@ dlog_once(ulong b, ulong a, const nmod_t mod, ulong n) return 0; if (n < 50) { - slong k; - ulong ak = 1; + ulong k, ak = 1; for (k = 0; k < n; k++) { diff --git a/src/dlog/power.c b/src/dlog/power.c index 80239689c1..8ac07e01f2 100644 --- a/src/dlog/power.c +++ b/src/dlog/power.c @@ -15,8 +15,7 @@ ulong dlog_power(const dlog_power_t t, ulong b) { - int k; - ulong x, pk[30]; /* 3^30*2+1, 2^30*3+1 are primes */ + ulong k, x, pk[30]; /* 3^30*2+1, 2^30*3+1 are primes */ pk[0] = 1; diff --git a/src/dlog/power_init.c b/src/dlog/power_init.c index 8ef306515a..3a474a7307 100644 --- a/src/dlog/power_init.c +++ b/src/dlog/power_init.c @@ -15,7 +15,7 @@ ulong dlog_power_init(dlog_power_t t, ulong a, ulong mod, ulong p, ulong e, ulong num) { - int k; + ulong k; nmod_init(&t->mod, mod); t->p = p; t->e = e; diff --git a/src/dlog/precomp_small_init.c b/src/dlog/precomp_small_init.c index d5f1de1ed5..3b47d8e80e 100644 --- a/src/dlog/precomp_small_init.c +++ b/src/dlog/precomp_small_init.c @@ -12,7 +12,7 @@ #include "dlog.h" void -dlog_precomp_small_init(dlog_precomp_t pre, ulong a, ulong mod, ulong n, ulong num) +dlog_precomp_small_init(dlog_precomp_t pre, ulong a, ulong mod, ulong n, ulong FLINT_UNUSED(num)) { if (n <= 3) { diff --git a/src/dlog/rho.c b/src/dlog/rho.c index d2ad05c8cd..02298ee3ab 100644 --- a/src/dlog/rho.c +++ b/src/dlog/rho.c @@ -23,8 +23,7 @@ dlog_single(ulong b, ulong a, const nmod_t mod, ulong n) { if (n < 50) { - int k; - ulong ak = 1; + ulong k, ak = 1; for (k=0; k < n; k++) { diff --git a/src/dlog/test/t-vec.c b/src/dlog/test/t-vec.c index 3a70437170..28b1db54df 100644 --- a/src/dlog/test/t-vec.c +++ b/src/dlog/test/t-vec.c @@ -16,7 +16,7 @@ typedef void (*vec_f) (ulong *v, ulong nv, ulong a, ulong va, const nmod_t mod, ulong na, const nmod_t order); void -dlog_vec_trivial(ulong *v, ulong nv, ulong a, ulong va, const nmod_t mod, ulong na, const nmod_t order) +dlog_vec_trivial(ulong *v, ulong nv, ulong a, ulong FLINT_UNUSED(va), const nmod_t mod, ulong na, const nmod_t FLINT_UNUSED(order)) { ulong k; dlog_precomp_t pre; diff --git a/src/dlog/vec_loop.c b/src/dlog/vec_loop.c index 35e127e3ca..c68d835806 100644 --- a/src/dlog/vec_loop.c +++ b/src/dlog/vec_loop.c @@ -14,7 +14,7 @@ /* vector of log(k,a)*loga % order in Z/modZ */ void -dlog_vec_loop(ulong * v, ulong nv, ulong a, ulong va, nmod_t mod, ulong na, nmod_t order) +dlog_vec_loop(ulong * v, ulong nv, ulong a, ulong va, nmod_t mod, ulong FLINT_UNUSED(na), nmod_t order) { ulong x, vx; dlog_vec_fill(v, nv, DLOG_NOT_FOUND); diff --git a/src/dlog/vec_loop_add.c b/src/dlog/vec_loop_add.c index dfd51d0518..0c4612f4e4 100644 --- a/src/dlog/vec_loop_add.c +++ b/src/dlog/vec_loop_add.c @@ -14,7 +14,7 @@ /* vector of log(k,a)*loga % order in Z/modZ */ void -dlog_vec_loop_add(ulong * v, ulong nv, ulong a, ulong va, nmod_t mod, ulong na, nmod_t order) +dlog_vec_loop_add(ulong * v, ulong nv, ulong a, ulong va, nmod_t mod, ulong FLINT_UNUSED(na), nmod_t order) { ulong x, xp, vx; vx = 0; diff --git a/src/dlog/vec_pindex_factorgcd.c b/src/dlog/vec_pindex_factorgcd.c index 3cfe4d5014..44a557252c 100644 --- a/src/dlog/vec_pindex_factorgcd.c +++ b/src/dlog/vec_pindex_factorgcd.c @@ -33,7 +33,7 @@ factor_until(ulong * n, ulong nlim, const ulong * p, ulong pmax, ulong * fp, int } ulong -dlog_vec_pindex_factorgcd(ulong * v, ulong nv, ulong p, nmod_t mod, ulong a, ulong na, ulong loga, ulong logm1, nmod_t order, int maxtry) +dlog_vec_pindex_factorgcd(ulong * v, ulong nv, ulong p, nmod_t mod, ulong a, ulong FLINT_UNUSED(na), ulong loga, ulong logm1, nmod_t order, int maxtry) { int nm = 0; ulong pm, logm, pmax; diff --git a/src/dlog/vec_set_not_found.c b/src/dlog/vec_set_not_found.c index 3610fdf387..deaac3ed11 100644 --- a/src/dlog/vec_set_not_found.c +++ b/src/dlog/vec_set_not_found.c @@ -15,7 +15,7 @@ void dlog_vec_set_not_found(ulong *v, ulong nv, nmod_t mod) { n_factor_t fac; - ulong i; + slong i; n_factor_init(&fac); n_factor(&fac, mod.n, 1); From 89e641c16fd3b84fd1288574c1b5c6a212ffab92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 14:23:23 +0200 Subject: [PATCH 071/114] fmpzi --- src/fmpzi/divrem_approx.c | 20 ++++++++++---------- src/fmpzi/gcd_binary.c | 4 +++- src/fmpzi/gcd_euclidean_improved.c | 6 ++++++ src/fmpzi/gcd_shortest.c | 6 +++--- src/fmpzi/pow_ui.c | 1 - src/fmpzi/remove_one_plus_i.c | 10 +++++----- 6 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/fmpzi/divrem_approx.c b/src/fmpzi/divrem_approx.c index 565005c1af..12a8f73d29 100644 --- a/src/fmpzi/divrem_approx.c +++ b/src/fmpzi/divrem_approx.c @@ -81,20 +81,20 @@ fmpzi_divrem_approx(fmpzi_t q, fmpzi_t r, const fmpzi_t x, const fmpzi_t y) if (r != NULL) { - fmpzi_t t, u; + fmpzi_t tf, uf; - fmpzi_init(t); - fmpzi_init(u); + fmpzi_init(tf); + fmpzi_init(uf); - fmpz_set_d(fmpzi_realref(u), qa); - fmpz_set_d(fmpzi_imagref(u), qb); + fmpz_set_d(fmpzi_realref(uf), qa); + fmpz_set_d(fmpzi_imagref(uf), qb); - fmpzi_mul(t, u, y); - fmpzi_sub(r, x, t); - fmpzi_swap(q, u); + fmpzi_mul(tf, uf, y); + fmpzi_sub(r, x, tf); + fmpzi_swap(q, uf); - fmpzi_clear(t); - fmpzi_clear(u); + fmpzi_clear(tf); + fmpzi_clear(uf); } else { diff --git a/src/fmpzi/gcd_binary.c b/src/fmpzi/gcd_binary.c index e2b6a66bee..8319d4d906 100644 --- a/src/fmpzi/gcd_binary.c +++ b/src/fmpzi/gcd_binary.c @@ -13,6 +13,7 @@ #include "double_extras.h" #include "fmpzi.h" +#if 0 double fmpzi_norm_approx_d_2exp(slong * exp, const fmpzi_t x) { @@ -45,8 +46,9 @@ fmpzi_norm_approx_d_2exp(slong * exp, const fmpzi_t x) *exp = aexp; return a; } +#endif -double +static double fmpzi_norm_approx_d(const fmpzi_t x) { double a, b; diff --git a/src/fmpzi/gcd_euclidean_improved.c b/src/fmpzi/gcd_euclidean_improved.c index d47850065a..7b59786e7a 100644 --- a/src/fmpzi/gcd_euclidean_improved.c +++ b/src/fmpzi/gcd_euclidean_improved.c @@ -20,6 +20,12 @@ #define GCD_MIN_D COEFF_MIN #endif +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void _fmpzi_gcd_dddd(fmpzi_t res, double a, double b, double c, double d) { diff --git a/src/fmpzi/gcd_shortest.c b/src/fmpzi/gcd_shortest.c index f8a92e7269..3628ef6c5b 100644 --- a/src/fmpzi/gcd_shortest.c +++ b/src/fmpzi/gcd_shortest.c @@ -28,7 +28,7 @@ Simple fact: If I is a finite interval containing an integer with I > 1, then Outputs shouldn't alias the inputs. */ -void _fmpz_mat22_shortest_l_infinity( +static void _fmpz_mat22_shortest_l_infinity( fmpz_t u1, fmpz_t u2, fmpz_t t1, fmpz_t t2, const fmpz_t c, const fmpz_t b, const fmpz_t a) @@ -181,7 +181,7 @@ void _fmpz_mat22_shortest_l_infinity( } -void _fmpzi_gcd_fmpz_shortest( +static void _fmpzi_gcd_fmpz_shortest( fmpz_t gx, fmpz_t gy, const fmpz_t ax_, const fmpz_t ay_, const fmpz_t b) @@ -294,7 +294,7 @@ void _fmpzi_gcd_fmpz_shortest( it turns out that A = 1 and B = 0, and we rely on _shortest_l_infinity returning (1,0) or (0,1) instead of (1,1) in this case. */ -void _fmpzi_gcd_shortest( +static void _fmpzi_gcd_shortest( fmpz_t gx, fmpz_t gy, const fmpz_t ax, const fmpz_t ay, const fmpz_t bx_, const fmpz_t by_) diff --git a/src/fmpzi/pow_ui.c b/src/fmpzi/pow_ui.c index 53133dd402..0c1e1815b1 100644 --- a/src/fmpzi/pow_ui.c +++ b/src/fmpzi/pow_ui.c @@ -53,7 +53,6 @@ fmpzi_pow_ui(fmpzi_t res, const fmpzi_t x, ulong exp) if (res == x) { - fmpzi_t tmp; fmpzi_init(tmp); fmpzi_pow_ui(tmp, x, exp); fmpzi_swap(tmp, res); diff --git a/src/fmpzi/remove_one_plus_i.c b/src/fmpzi/remove_one_plus_i.c index ab22106621..40f14f59c2 100644 --- a/src/fmpzi/remove_one_plus_i.c +++ b/src/fmpzi/remove_one_plus_i.c @@ -63,13 +63,13 @@ fmpzi_remove_one_plus_i(fmpzi_t res, const fmpzi_t x) if (odd) { /* (a+bi) / (1+i) = ((a+b)/2) + ((b-a)/2)i */ - fmpz_t t; - fmpz_init(t); - fmpz_add(t, fmpzi_realref(res), fmpzi_imagref(res)); + fmpz_t tmp; + fmpz_init(tmp); + fmpz_add(tmp, fmpzi_realref(res), fmpzi_imagref(res)); fmpz_sub(fmpzi_imagref(res), fmpzi_imagref(res), fmpzi_realref(res)); - fmpz_tdiv_q_2exp(fmpzi_realref(res), t, 1); + fmpz_tdiv_q_2exp(fmpzi_realref(res), tmp, 1); fmpz_tdiv_q_2exp(fmpzi_imagref(res), fmpzi_imagref(res), 1); - fmpz_clear(t); + fmpz_clear(tmp); } return 2 * s + odd; From 56af5a980913475acaebbdd303caacb301a400e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 14:25:19 +0200 Subject: [PATCH 072/114] bool_mat --- src/bool_mat/randtest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bool_mat/randtest.c b/src/bool_mat/randtest.c index edec4d390c..e982ab37da 100644 --- a/src/bool_mat/randtest.c +++ b/src/bool_mat/randtest.c @@ -28,7 +28,7 @@ void bool_mat_randtest_diagonal(bool_mat_t mat, flint_rand_t state) { slong n, i; - slong density; + ulong density; n = FLINT_MIN(bool_mat_nrows(mat), bool_mat_ncols(mat)); @@ -42,7 +42,7 @@ void bool_mat_randtest_nilpotent(bool_mat_t mat, flint_rand_t state) { slong n, i, j; - slong density; + ulong density; if (!bool_mat_is_square(mat)) { From 9cf395175f3bd224237969109a0963e8663f9186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 14:30:44 +0200 Subject: [PATCH 073/114] partitions --- src/partitions/fmpz_fmpz.c | 4 ++-- src/partitions/hrr_sum_arb.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/partitions/fmpz_fmpz.c b/src/partitions/fmpz_fmpz.c index 4ef3059973..4ffcabb39a 100644 --- a/src/partitions/fmpz_fmpz.c +++ b/src/partitions/fmpz_fmpz.c @@ -45,7 +45,7 @@ partitions_lookup[NUMBER_OF_SMALL_PARTITIONS] = slong partitions_hrr_needed_terms(double n); -void +static void partitions_fmpz_fmpz_hrr(fmpz_t p, const fmpz_t n, int use_doubles) { arb_t x; @@ -99,7 +99,7 @@ partitions_vec(nn_ptr v, slong len) /* The floor+vec method *requires* n <= 1498 for floor(p(n)/2^64) to be equal to floor(T/2^64). It is faster up to n ~= 1200. With doubles, it is faster up to n ~= 500. */ -void +static void _partitions_fmpz_ui(fmpz_t res, ulong n, int use_doubles) { if (n < NUMBER_OF_SMALL_PARTITIONS) diff --git a/src/partitions/hrr_sum_arb.c b/src/partitions/hrr_sum_arb.c index 28296f4026..d9bab37805 100644 --- a/src/partitions/hrr_sum_arb.c +++ b/src/partitions/hrr_sum_arb.c @@ -23,6 +23,12 @@ # include #endif +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define VERBOSE 0 #define DOUBLE_CUTOFF 40 @@ -94,7 +100,7 @@ bound_primes(ulong k) { int i; - for (i = 0; i < sizeof(primorial_tab) / sizeof(ulong); i++) + for (i = 0; (size_t) i < sizeof(primorial_tab) / sizeof(ulong); i++) if (k <= primorial_tab[i]) return i; @@ -274,7 +280,7 @@ worker(slong i, work_t * work) } void -partitions_hrr_sum_arb(arb_t x, const fmpz_t n, slong N0, slong N, int use_doubles) +partitions_hrr_sum_arb(arb_t x, const fmpz_t n, slong N0, slong N, int FLINT_UNUSED(use_doubles)) { arb_t C, t, exp1; fmpz_t n24; From 750149a8e643ad16eacd8a94e96dfa76a1de295d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 14:32:59 +0200 Subject: [PATCH 074/114] mag --- src/mag/d_log.c | 2 +- src/mag/exp.c | 6 ++++++ src/mag/log.c | 22 +++++++++++----------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/mag/d_log.c b/src/mag/d_log.c index 80902d8a67..77383a75c8 100644 --- a/src/mag/d_log.c +++ b/src/mag/d_log.c @@ -151,7 +151,7 @@ const double d_log_inverses[] = { 0.02127659574468085106383, /* 1/47 */ }; -double +static double mag_d_bad_log(double x) { double t, u, v, t1, t2, t3; diff --git a/src/mag/exp.c b/src/mag/exp.c index 0aac22b14c..4933a2449a 100644 --- a/src/mag/exp.c +++ b/src/mag/exp.c @@ -12,6 +12,12 @@ #include "double_extras.h" #include "mag.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + static const double inverse_factorials[] = { 1.0, 1.0, diff --git a/src/mag/log.c b/src/mag/log.c index 03bf2c3401..2748858e39 100644 --- a/src/mag/log.c +++ b/src/mag/log.c @@ -159,12 +159,12 @@ mag_log(mag_t z, const mag_t x) else { /* log(2^exp) = exp*log(2), log(2) < 744261118/2^30 */ - fmpz_t t; - fmpz_init(t); - fmpz_mul_ui(t, MAG_EXPREF(x), 744261118); - mag_set_fmpz(z, t); + fmpz_t tmp; + fmpz_init(tmp); + fmpz_mul_ui(tmp, MAG_EXPREF(x), 744261118); + mag_set_fmpz(z, tmp); mag_mul_2exp_si(z, z, -30); - fmpz_clear(t); + fmpz_clear(tmp); } } } @@ -213,13 +213,13 @@ mag_log_lower(mag_t z, const mag_t x) else { /* log(2^exp) = exp*log(2), log(2) > 744261117/2^30 */ - fmpz_t t; - fmpz_init(t); - fmpz_sub_ui(t, MAG_EXPREF(x), 1); /* lower bound for x */ - fmpz_mul_ui(t, t, 744261117); - mag_set_fmpz_lower(z, t); + fmpz_t tmp; + fmpz_init(tmp); + fmpz_sub_ui(tmp, MAG_EXPREF(x), 1); /* lower bound for x */ + fmpz_mul_ui(tmp, tmp, 744261117); + mag_set_fmpz_lower(z, tmp); mag_mul_2exp_si(z, z, -30); - fmpz_clear(t); + fmpz_clear(tmp); } } } From 73f6d6bfcdf6b197a34d3e0267b9ff0494b6f54f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 19:43:34 +0200 Subject: [PATCH 075/114] arf --- src/arf/add.c | 2 +- src/arf/add_mpn.c | 4 ++-- src/arf/approx_dot.c | 6 +++--- src/arf/div.c | 2 +- src/arf/memory_manager.c | 4 ++-- src/arf/mul_rnd_down.c | 2 +- src/arf/set_round.c | 4 ++-- src/arf/sub.c | 2 +- src/arf/sum.c | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/arf/add.c b/src/arf/add.c index 4c4439ca75..70abdf6249 100644 --- a/src/arf/add.c +++ b/src/arf/add.c @@ -11,7 +11,7 @@ #include "arf.h" -int +static int arf_add_special(arf_t z, const arf_t x, const arf_t y, slong prec, arf_rnd_t rnd) { if (arf_is_zero(x)) diff --git a/src/arf/add_mpn.c b/src/arf/add_mpn.c index 0169ad23e3..261b1a3d29 100644 --- a/src/arf/add_mpn.c +++ b/src/arf/add_mpn.c @@ -216,9 +216,9 @@ _arf_add_mpn(arf_t z, nn_srcptr xp, slong xn, int xsgnbit, const fmpz_t xexp, } /* x +/- eps */ - if (shift > prec + FLINT_BITS + 1 && + if (shift > (ulong) prec + FLINT_BITS + 1 && prec != ARF_PREC_EXACT && - shift > (xn + 1) * FLINT_BITS) + shift > (ulong) (xn + 1) * FLINT_BITS) { zn = (prec + FLINT_BITS - 1) / FLINT_BITS; zn_original = zn = FLINT_MAX(zn, xn) + 2; diff --git a/src/arf/approx_dot.c b/src/arf/approx_dot.c index 0c086345e8..dbce3d0024 100644 --- a/src/arf/approx_dot.c +++ b/src/arf/approx_dot.c @@ -22,7 +22,7 @@ _arb_dot_add_generic(nn_ptr sum, nn_ptr serr, nn_ptr tmp, slong sn, nn_srcptr xptr, slong xn, int negative, flint_bitcnt_t shift); -void +static void arf_approx_dot_simple(arf_t res, const arf_t initial, int subtract, arf_srcptr x, slong xstep, arf_srcptr y, slong ystep, slong len, slong prec, arf_rnd_t rnd) { @@ -219,7 +219,7 @@ arf_approx_dot(arf_t res, const arf_t initial, int subtract, arf_srcptr x, slong shift = sum_exp - xexp; - if (shift < sn * FLINT_BITS) + if (shift < (ulong) sn * FLINT_BITS) { xptr = (xn <= ARF_NOPTR_LIMBS) ? ARF_NOPTR_D(xm) : ARF_PTR_D(xm); _arb_dot_add_generic(sum, &serr, tmp, sn, xptr, xn, xnegative ^ subtract, shift); @@ -248,7 +248,7 @@ arf_approx_dot(arf_t res, const arf_t initial, int subtract, arf_srcptr x, slong exp = xexp + yexp; shift = sum_exp - exp; - if (shift >= sn * FLINT_BITS) + if (shift >= (ulong) sn * FLINT_BITS) { /* do nothing */ } diff --git a/src/arf/div.c b/src/arf/div.c index e2ba0d82a7..20555f6639 100644 --- a/src/arf/div.c +++ b/src/arf/div.c @@ -14,7 +14,7 @@ void __gmpn_div_q(nn_ptr, nn_srcptr, slong, nn_srcptr, slong, nn_ptr); -void +static void arf_div_special(arf_t z, const arf_t x, const arf_t y) { if ((arf_is_zero(x) && !arf_is_zero(y) && !arf_is_nan(y)) || diff --git a/src/arf/memory_manager.c b/src/arf/memory_manager.c index 6a77a1f0da..13c14af885 100644 --- a/src/arf/memory_manager.c +++ b/src/arf/memory_manager.c @@ -20,9 +20,9 @@ FLINT_TLS_PREFIX ulong arf_free_num = 0; FLINT_TLS_PREFIX ulong arf_free_alloc = 0; FLINT_TLS_PREFIX int arf_have_registered_cleanup = 0; -void _arf_cleanup(void) +static void _arf_cleanup(void) { - slong i; + ulong i; for (i = 0; i < arf_free_num; i++) flint_free(arf_free_arr[i]); diff --git a/src/arf/mul_rnd_down.c b/src/arf/mul_rnd_down.c index 485d99fb37..ee2f554c65 100644 --- a/src/arf/mul_rnd_down.c +++ b/src/arf/mul_rnd_down.c @@ -183,7 +183,7 @@ arf_mul_rnd_down(arf_ptr z, arf_srcptr x, arf_srcptr y, slong prec) } else { - slong zn, alloc; + slong alloc; nn_srcptr xptr, yptr; nn_ptr tmp; ARF_MUL_TMP_DECL diff --git a/src/arf/set_round.c b/src/arf/set_round.c index f9334d9e67..533e123709 100644 --- a/src/arf/set_round.c +++ b/src/arf/set_round.c @@ -91,7 +91,7 @@ _arf_set_round_mpn(arf_t y, slong * exp_shift, nn_srcptr x, slong xn, val_bits = flint_ctz(x[val_limbs]); val = val_limbs * FLINT_BITS + val_bits; - if (exp - val <= prec) + if (exp - val <= (ulong) prec) { inexact = 0; increment = 0; @@ -113,7 +113,7 @@ _arf_set_round_mpn(arf_t y, slong * exp_shift, nn_srcptr x, slong xn, /* If exactly one excess bit, there is a tie; the rounding direction is determined by the bit to the left of the truncation point. */ - if (exp - val - 1 == prec) + if (exp - val - 1 == (ulong) prec) { increment = (x[val_limbs] >> val_bits) & 1; } diff --git a/src/arf/sub.c b/src/arf/sub.c index 4e498291be..a8955afa38 100644 --- a/src/arf/sub.c +++ b/src/arf/sub.c @@ -11,7 +11,7 @@ #include "arf.h" -int +static int arf_sub_special(arf_t z, const arf_t x, const arf_t y, slong prec, arf_rnd_t rnd) { if (arf_is_zero(x)) diff --git a/src/arf/sum.c b/src/arf/sum.c index 4ad28adef8..fdede0c379 100644 --- a/src/arf/sum.c +++ b/src/arf/sum.c @@ -11,7 +11,7 @@ #include "arf.h" -int _arf_are_close(const arf_t x, const arf_t y, slong prec) +static int _arf_are_close(const arf_t x, const arf_t y, slong prec) { fmpz_t xb, yb; fmpz_t delta; @@ -39,7 +39,7 @@ int _arf_are_close(const arf_t x, const arf_t y, slong prec) return result; } -int +static int _arf_add_eps(arf_t s, const arf_t x, int sgn, slong prec, arf_rnd_t rnd) { arf_t t; From a3e08b15b198ad169f13f3251a98e9236039f801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 19:43:39 +0200 Subject: [PATCH 076/114] acf --- src/acf/approx_dot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/acf/approx_dot.c b/src/acf/approx_dot.c index 0d5001d89a..ad76522522 100644 --- a/src/acf/approx_dot.c +++ b/src/acf/approx_dot.c @@ -84,7 +84,7 @@ _arb_dot_output(arf_t res, nn_ptr sum, slong sn, int negative, xn = ARF_SIZE(xm); \ xnegative = ARF_SGNBIT(xm); \ shift = s_sum_exp - xexp; \ - if (shift >= s_sn * FLINT_BITS) \ + if (shift >= (ulong) s_sn * FLINT_BITS) \ { \ } \ else \ @@ -173,7 +173,7 @@ _arf_complex_mul_gauss(arf_t e, arf_t f, const arf_t a, const arf_t b, FLINT_DLL extern slong acb_dot_gauss_dot_cutoff; #define GAUSS_CUTOFF acb_dot_gauss_dot_cutoff -void +static void acf_approx_dot_simple(acf_t res, const acf_t initial, int subtract, acf_srcptr x, slong xstep, acf_srcptr y, slong ystep, slong len, slong prec, arf_rnd_t rnd) { @@ -584,7 +584,7 @@ acf_approx_dot(acf_t res, const acf_t initial, int subtract, acf_srcptr x, slong exp = xexp + yexp; shift = sum_exp - exp; - if (shift >= sn * FLINT_BITS) + if (shift >= (ulong) sn * FLINT_BITS) { } else if (xn <= 2 && yn <= 2 && sn <= 3) From f7be6570796d18d945d3d202f10fc1d43d592409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 19:49:00 +0200 Subject: [PATCH 077/114] arb --- src/arb.h | 8 +++--- src/arb/agm.c | 8 +++++- src/arb/approx_dot.c | 6 ++--- src/arb/atan_arf.c | 4 +-- src/arb/atan_arf_bb.c | 38 ++++++++++++++-------------- src/arb/atan_newton.c | 2 +- src/arb/atan_sum_bs_powtab.c | 4 +-- src/arb/atan_taylor_rs.c | 2 +- src/arb/bell_fmpz.c | 2 +- src/arb/bell_sum_bsplit.c | 2 +- src/arb/bell_sum_taylor.c | 2 +- src/arb/bernoulli_ui.c | 2 +- src/arb/const_apery.c | 2 +- src/arb/const_catalan.c | 2 +- src/arb/const_e.c | 2 +- src/arb/const_euler.c | 16 ++++++------ src/arb/const_glaisher.c | 2 +- src/arb/const_khinchin.c | 6 ++--- src/arb/const_log10.c | 2 +- src/arb/const_log2.c | 4 +-- src/arb/const_log_sqrt2pi.c | 2 +- src/arb/const_pi.c | 4 +-- src/arb/const_reciprocal_fibonacci.c | 8 +++--- src/arb/const_sqrt_pi.c | 2 +- src/arb/div.c | 10 ++++++-- src/arb/div_2expm1_ui.c | 4 +-- src/arb/dot.c | 10 ++++++-- src/arb/dot_siui.c | 6 ++--- src/arb/dot_uiui.c | 6 ++--- src/arb/euler_number_ui.c | 35 +++++++++++++++---------- src/arb/exp.c | 2 +- src/arb/exp_arf.c | 6 +++++ src/arb/exp_arf_bb.c | 12 +++++---- src/arb/exp_arf_rs_generic.c | 19 +++++++++----- src/arb/exp_sum_bs_powtab.c | 10 ++++++-- src/arb/exp_taylor_rs.c | 2 +- src/arb/gamma.c | 13 +++++++--- src/arb/get_fmpz_mid_rad_10exp.c | 4 +-- src/arb/get_rand_fmpq.c | 2 +- src/arb/get_str.c | 6 ++--- src/arb/lambertw.c | 20 ++++++++++----- src/arb/log_arf.c | 20 +++++++-------- src/arb/log_precompute_reductions.c | 7 +++++ src/arb/log_primes.c | 18 ++++++++----- src/arb/log_reduce.c | 26 +++++++++---------- src/arb/pow.c | 2 +- src/arb/root_ui.c | 4 +-- src/arb/sin_cos.c | 2 +- src/arb/sin_cos_arf_bb.c | 21 ++++++++++----- src/arb/sin_cos_arf_generic.c | 7 +++++ src/arb/sin_cos_pi_fmpq.c | 8 +++--- src/arb/sin_cos_taylor_rs.c | 2 +- src/arb/sinc.c | 4 +-- src/arb/sinh_cosh.c | 2 +- src/arb/sqrt.c | 6 ++--- src/arb/test/t-pos_times_posinf.c | 4 ++- src/arb/test/t-sin_cos_arf_generic.c | 1 - src/arb/ui_pow_ui.c | 9 +++---- src/arb/zeta_ui_borwein_bsplit.c | 6 +++++ src/arb/zeta_ui_euler_product.c | 6 +++++ 60 files changed, 276 insertions(+), 178 deletions(-) diff --git a/src/arb.h b/src/arb.h index e9a7b4ecc2..fe16feb15f 100644 --- a/src/arb.h +++ b/src/arb.h @@ -613,15 +613,15 @@ arb_sqr(arb_t res, const arb_t val, slong prec) arb_mul(res, val, val, prec); } -#define ARB_DEF_CACHED_CONSTANT(name, comp_func) \ +#define _ARB_DEF_CACHED_CONSTANT(DECL1, DECL2, name, comp_func) \ FLINT_TLS_PREFIX slong name ## _cached_prec = 0; \ FLINT_TLS_PREFIX arb_t name ## _cached_value; \ - void name ## _cleanup(void) \ + DECL1 void name ## _cleanup(void) \ { \ arb_clear(name ## _cached_value); \ name ## _cached_prec = 0; \ } \ - void name(arb_t x, slong prec) \ + DECL2 void name(arb_t x, slong prec) \ { \ if (name ## _cached_prec < prec) \ { \ @@ -636,6 +636,8 @@ arb_sqr(arb_t res, const arb_t val, slong prec) arb_set_round(x, name ## _cached_value, prec); \ } +#define ARB_DEF_CACHED_CONSTANT(name, comp_func) _ARB_DEF_CACHED_CONSTANT(static,, name, comp_func) + /* vector functions */ arb_ptr _arb_vec_entry_ptr(arb_ptr vec, slong i); diff --git a/src/arb/agm.c b/src/arb/agm.c index 066a36be46..410faaab57 100644 --- a/src/arb/agm.c +++ b/src/arb/agm.c @@ -11,6 +11,12 @@ #include "arb.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + /* Use series expansion of the elliptic integral pi/(4K(z^2)) = 1/2 - z^2/8 - 5z^4/128 - 11z^6/512 - 469z^8/32768 + O(z^10) to avoid computing the last couple of AGM iterations. @@ -93,7 +99,7 @@ mag_agm(mag_t res, const mag_t x, const mag_t y) } } -void +static void mag_agm_lower(mag_t res, const mag_t x, const mag_t y) { if (mag_is_zero(x) || mag_is_zero(y)) diff --git a/src/arb/approx_dot.c b/src/arb/approx_dot.c index f9fd8e2aca..5f19a87698 100644 --- a/src/arb/approx_dot.c +++ b/src/arb/approx_dot.c @@ -26,7 +26,7 @@ _arb_dot_add_generic(nn_ptr sum, nn_ptr serr, nn_ptr tmp, slong sn, nn_srcptr xptr, slong xn, int negative, flint_bitcnt_t shift); -void +static void arb_approx_dot_simple(arb_t res, const arb_t initial, int subtract, arb_srcptr x, slong xstep, arb_srcptr y, slong ystep, slong len, slong prec) { @@ -223,7 +223,7 @@ arb_approx_dot(arb_t res, const arb_t initial, int subtract, arb_srcptr x, slong shift = sum_exp - xexp; - if (shift < sn * FLINT_BITS) + if (shift < (ulong) sn * FLINT_BITS) { xptr = (xn <= ARF_NOPTR_LIMBS) ? ARF_NOPTR_D(xm) : ARF_PTR_D(xm); _arb_dot_add_generic(sum, &serr, tmp, sn, xptr, xn, xnegative ^ subtract, shift); @@ -252,7 +252,7 @@ arb_approx_dot(arb_t res, const arb_t initial, int subtract, arb_srcptr x, slong exp = xexp + yexp; shift = sum_exp - exp; - if (shift >= sn * FLINT_BITS) + if (shift >= (ulong) sn * FLINT_BITS) { /* do nothing */ } diff --git a/src/arb/atan_arf.c b/src/arb/atan_arf.c index 756a08a9ef..41feb96fe0 100644 --- a/src/arb/atan_arf.c +++ b/src/arb/atan_arf.c @@ -15,7 +15,7 @@ #define TMP_ALLOC_LIMBS(size) TMP_ALLOC((size) * sizeof(ulong)) /* atan(x) = x + eps, |eps| < x^3*/ -void +static void arb_atan_eps(arb_t z, const arf_t x, slong prec) { fmpz_t mag; @@ -28,7 +28,7 @@ arb_atan_eps(arb_t z, const arf_t x, slong prec) } /* atan(x) = pi/2 - eps, eps < 1/x <= 2^(1-mag) */ -void +static void arb_atan_inf_eps(arb_t z, const arf_t x, slong prec) { fmpz_t mag; diff --git a/src/arb/atan_arf_bb.c b/src/arb/atan_arf_bb.c index 9fce6ea82d..8b98ab66af 100644 --- a/src/arb/atan_arf_bb.c +++ b/src/arb/atan_arf_bb.c @@ -54,7 +54,7 @@ bs_num_terms(slong mag, slong prec) together with absolute error err. With an initial inversion if xmag > 0. */ -void +static void arb_atan_bb_reduce(fmpz_t res, mag_t err, const arf_t x, slong xmag, slong r, slong prec) { int inexact; @@ -191,7 +191,7 @@ worker(slong iter, work_t * work) *Qexp += r; /* T = T / Q (+1 fixed-point ulp error). */ - if (*Qexp >= wp) + if ((slong) *Qexp >= wp) { fmpz_tdiv_q_2exp(P, P, *Qexp - wp); fmpz_tdiv_q(P, P, Q); @@ -256,37 +256,37 @@ arb_atan_arf_bb(arb_t z, const arf_t x, slong prec) /* approximate by x - x^3 / 3 or pi/2 - 1/x + (1/3)/x^3 */ if (mag < -prec / 4 - 2 || (mag-1) > prec / 5 + 3) { - arb_t t; - arb_init(t); - arb_set_arf(t, x); + arb_t ta; + arb_init(ta); + arb_set_arf(ta, x); if (mag < 0) { - arb_mul(t, t, t, prec); - arb_mul_arf(t, t, x, prec); - arb_div_ui(t, t, 3, prec); - arb_sub_arf(t, t, x, prec); - arb_neg(z, t); + arb_mul(ta, ta, ta, prec); + arb_mul_arf(ta, ta, x, prec); + arb_div_ui(ta, ta, 3, prec); + arb_sub_arf(ta, ta, x, prec); + arb_neg(z, ta); /* error is bounded by x^5 */ mag_add_ui_2exp_si(arb_radref(z), arb_radref(z), 1, 5 * mag); } else { - arb_ui_div(t, 1, t, prec); - arb_mul(z, t, t, prec); - arb_mul(z, z, t, prec); + arb_ui_div(ta, 1, ta, prec); + arb_mul(z, ta, ta, prec); + arb_mul(z, z, ta, prec); arb_div_ui(z, z, 3, prec); - arb_sub(z, t, z, prec); + arb_sub(z, ta, z, prec); - arb_const_pi(t, prec + 2); - arb_mul_2exp_si(t, t, -1); + arb_const_pi(ta, prec + 2); + arb_mul_2exp_si(ta, ta, -1); - arb_sub(z, t, z, prec); + arb_sub(z, ta, z, prec); /* error is bounded by 1/x^5, and 1/x <= 2^(1-mag) */ mag_add_ui_2exp_si(arb_radref(z), arb_radref(z), 1, 5 * (1-mag)); } - arb_clear(t); + arb_clear(ta); return; } @@ -339,7 +339,7 @@ arb_atan_arf_bb(arb_t z, const arf_t x, slong prec) *Qexp += r; /* T = T / Q (+1 fixed-point ulp error). */ - if (*Qexp >= wp) + if ((slong) *Qexp >= wp) { fmpz_tdiv_q_2exp(P, P, *Qexp - wp); fmpz_tdiv_q(P, P, Q); diff --git a/src/arb/atan_newton.c b/src/arb/atan_newton.c index db0f20ef2f..633dd63510 100644 --- a/src/arb/atan_newton.c +++ b/src/arb/atan_newton.c @@ -21,7 +21,7 @@ static const fmpz atan_coeffs[] = static const ulong atan_den = 334639305; -void +static void _arb_atan_taylor(arb_t res, const arb_t x, slong prec) { slong mag; diff --git a/src/arb/atan_sum_bs_powtab.c b/src/arb/atan_sum_bs_powtab.c index a647dda058..cb687f5607 100644 --- a/src/arb/atan_sum_bs_powtab.c +++ b/src/arb/atan_sum_bs_powtab.c @@ -88,13 +88,13 @@ atan_bsplit_struct; typedef atan_bsplit_struct atan_bsplit_t[1]; -static void atan_bsplit_init(atan_bsplit_t x, void * args) +static void atan_bsplit_init(atan_bsplit_t x, void * FLINT_UNUSED(args)) { fmpz_init(x->T); fmpz_init(x->Q); } -static void atan_bsplit_clear(atan_bsplit_t x, void * args) +static void atan_bsplit_clear(atan_bsplit_t x, void * FLINT_UNUSED(args)) { fmpz_clear(x->T); fmpz_clear(x->Q); diff --git a/src/arb/atan_taylor_rs.c b/src/arb/atan_taylor_rs.c index 9e589a770e..0c9827bb45 100644 --- a/src/arb/atan_taylor_rs.c +++ b/src/arb/atan_taylor_rs.c @@ -641,7 +641,7 @@ void _arb_atan_taylor_rs(nn_ptr y, ulong * error, old_denom = odd_reciprocal_tab_denom[k+1]; /* change denominators */ - if (new_denom != old_denom && k < N - 1) + if (new_denom != old_denom && (ulong) k < N - 1) { /* hack when s is negative: add 1 to get a positive number */ if (alternating && (k % 2 == 0)) diff --git a/src/arb/bell_fmpz.c b/src/arb/bell_fmpz.c index 1752c95900..f7ae3f6277 100644 --- a/src/arb/bell_fmpz.c +++ b/src/arb/bell_fmpz.c @@ -167,7 +167,7 @@ _arb_bell_mag(fmpz_t mmag, const fmpz_t n, const fmpz_t k) } } -void +static void arb_bell_find_cutoffs(fmpz_t A, fmpz_t B, fmpz_t M, fmpz_t Mmag, const fmpz_t n, slong prec) { fmpz_t a, amag, b, bmag, m, mmag, w, wmag, Amag, Bmag; diff --git a/src/arb/bell_sum_bsplit.c b/src/arb/bell_sum_bsplit.c index a651338609..c7a7a1facf 100644 --- a/src/arb/bell_sum_bsplit.c +++ b/src/arb/bell_sum_bsplit.c @@ -76,7 +76,7 @@ bsplit(arb_t P, arb_t Q, const fmpz_t n, const fmpz_t a, const fmpz_t b, slong p void arb_bell_sum_bsplit(arb_t res, const fmpz_t n, - const fmpz_t a, const fmpz_t b, const fmpz_t mmag, slong prec) + const fmpz_t a, const fmpz_t b, const fmpz_t FLINT_UNUSED(mmag), slong prec) { if (fmpz_cmp(a, b) >= 0) { diff --git a/src/arb/bell_sum_taylor.c b/src/arb/bell_sum_taylor.c index 8dee20a019..969f33b752 100644 --- a/src/arb/bell_sum_taylor.c +++ b/src/arb/bell_sum_taylor.c @@ -15,7 +15,7 @@ /* tuning parameter */ #define RADIUS_BITS 3 -void +static void _arb_bell_sum_taylor(arb_t res, const fmpz_t n, const fmpz_t a, const fmpz_t b, const fmpz_t mmag, slong tol) { diff --git a/src/arb/bernoulli_ui.c b/src/arb/bernoulli_ui.c index adde3b5d12..ab87550c58 100644 --- a/src/arb/bernoulli_ui.c +++ b/src/arb/bernoulli_ui.c @@ -16,7 +16,7 @@ void arb_bernoulli_ui(arb_t b, ulong n, slong prec) { - if (n < bernoulli_cache_num) + if (n < (ulong) bernoulli_cache_num) { arb_set_fmpq(b, bernoulli_cache + n, prec); } diff --git a/src/arb/const_apery.c b/src/arb/const_apery.c index 6b31e4831c..ccb029cd75 100644 --- a/src/arb/const_apery.c +++ b/src/arb/const_apery.c @@ -13,7 +13,7 @@ #include "arb.h" #include "hypgeom.h" -void +static void arb_const_apery_eval(arb_t s, slong prec) { hypgeom_t series; diff --git a/src/arb/const_catalan.c b/src/arb/const_catalan.c index 934cf2ef8b..af55131205 100644 --- a/src/arb/const_catalan.c +++ b/src/arb/const_catalan.c @@ -13,7 +13,7 @@ #include "arb.h" #include "hypgeom.h" -void +static void arb_const_catalan_eval(arb_t s, slong prec) { hypgeom_t series; diff --git a/src/arb/const_e.c b/src/arb/const_e.c index a2df47a62d..01a55cb8b3 100644 --- a/src/arb/const_e.c +++ b/src/arb/const_e.c @@ -13,7 +13,7 @@ #include "arb.h" #include "hypgeom.h" -void +static void arb_const_e_eval(arb_t s, slong prec) { hypgeom_t series; diff --git a/src/arb/const_euler.c b/src/arb/const_euler.c index cc3c7f7540..38804acf2d 100644 --- a/src/arb/const_euler.c +++ b/src/arb/const_euler.c @@ -29,7 +29,7 @@ typedef struct typedef euler_bsplit_1_struct euler_bsplit_1_t[1]; -static void euler_bsplit_1_init(euler_bsplit_1_t s, void * args) +static void euler_bsplit_1_init(euler_bsplit_1_t s, void * FLINT_UNUSED(args)) { arb_init(s->P); arb_init(s->Q); @@ -39,7 +39,7 @@ static void euler_bsplit_1_init(euler_bsplit_1_t s, void * args) arb_init(s->V); } -static void euler_bsplit_1_clear(euler_bsplit_1_t s, void * args) +static void euler_bsplit_1_clear(euler_bsplit_1_t s, void * FLINT_UNUSED(args)) { arb_clear(s->P); arb_clear(s->Q); @@ -142,7 +142,7 @@ euler_bsplit_1_basecase(euler_bsplit_1_t s, slong n1, slong n2, bsplit_args_t * } static void -euler_bsplit_1(euler_bsplit_1_t s, slong n1, slong n2, slong N, slong wp, int cont) +euler_bsplit_1(euler_bsplit_1_t s, slong n1, slong n2, slong N, slong wp, int FLINT_UNUSED(cont)) { bsplit_args_t args; @@ -171,14 +171,14 @@ typedef struct typedef euler_bsplit_2_struct euler_bsplit_2_t[1]; -static void euler_bsplit_2_init(euler_bsplit_2_t s, void * args) +static void euler_bsplit_2_init(euler_bsplit_2_t s, void * FLINT_UNUSED(args)) { arb_init(s->P); arb_init(s->Q); arb_init(s->T); } -static void euler_bsplit_2_clear(euler_bsplit_2_t s, void * args) +static void euler_bsplit_2_clear(euler_bsplit_2_t s, void * FLINT_UNUSED(args)) { arb_clear(s->P); arb_clear(s->Q); @@ -266,7 +266,7 @@ euler_bsplit_2_basecase(euler_bsplit_2_t s, slong n1, slong n2, bsplit_args_t * static void euler_bsplit_2(arb_t P, arb_t Q, arb_t T, slong n1, slong n2, - slong N, slong wp, int cont) + slong N, slong wp, int FLINT_UNUSED(cont)) { euler_bsplit_2_t s; bsplit_args_t args; @@ -360,7 +360,7 @@ arb_log_ui_smooth(arb_t s, ulong n, slong prec) arb_clear(t); } -void +static void arb_const_euler_eval(arb_t res, slong prec) { euler_bsplit_1_t sum; @@ -461,7 +461,7 @@ arb_const_euler_eval(arb_t res, slong prec) euler_bsplit_1_clear(sum, NULL); } -ARB_DEF_CACHED_CONSTANT(arb_const_euler_brent_mcmillan, arb_const_euler_eval) +_ARB_DEF_CACHED_CONSTANT(static, static, arb_const_euler_brent_mcmillan, arb_const_euler_eval) FLINT_DLL extern const ulong arb_hypgeom_gamma_tab_limbs[]; diff --git a/src/arb/const_glaisher.c b/src/arb/const_glaisher.c index ca20ab45f0..d16a0f7bb2 100644 --- a/src/arb/const_glaisher.c +++ b/src/arb/const_glaisher.c @@ -12,7 +12,7 @@ #include "arb.h" #include "acb_poly.h" -void +static void arb_const_glaisher_eval(arb_t y, slong prec) { acb_struct z[2]; diff --git a/src/arb/const_khinchin.c b/src/arb/const_khinchin.c index 17b6ab1669..553d97288f 100644 --- a/src/arb/const_khinchin.c +++ b/src/arb/const_khinchin.c @@ -12,12 +12,12 @@ #include #include "arb.h" -void +static void arb_const_khinchin_eval_param(arb_t s, ulong N, ulong M, slong prec) { arb_t t, u, h; arb_ptr pows; - slong k, n; + ulong k, n; arb_init(t); arb_init(u); @@ -92,7 +92,7 @@ arb_const_khinchin_eval_param(arb_t s, ulong N, ulong M, slong prec) arb_clear(h); } -void +static void arb_const_khinchin_eval(arb_t K, slong prec) { ulong N, M; diff --git a/src/arb/const_log10.c b/src/arb/const_log10.c index 01984f69e8..6179e5e757 100644 --- a/src/arb/const_log10.c +++ b/src/arb/const_log10.c @@ -36,7 +36,7 @@ atanh_bsplit(arb_t s, ulong c, slong a, slong prec) hypgeom_clear(series); } -void +static void arb_const_log10_eval(arb_t s, slong prec) { arb_t t; diff --git a/src/arb/const_log2.c b/src/arb/const_log2.c index 65b4810e84..c67ba9c819 100644 --- a/src/arb/const_log2.c +++ b/src/arb/const_log2.c @@ -13,7 +13,7 @@ #include "arb.h" #include "hypgeom.h" -void +static void arb_const_log2_hypgeom_eval(arb_t s, slong prec) { hypgeom_t series; @@ -52,7 +52,7 @@ Note: for log(3) the corresponding formula is but currently we do not have a use for this as a standalone constant. */ -ARB_DEF_CACHED_CONSTANT(arb_const_log2_hypgeom, arb_const_log2_hypgeom_eval) +_ARB_DEF_CACHED_CONSTANT(static, static, arb_const_log2_hypgeom, arb_const_log2_hypgeom_eval) void arb_const_log2(arb_t res, slong prec) diff --git a/src/arb/const_log_sqrt2pi.c b/src/arb/const_log_sqrt2pi.c index ef135fc965..f60d7fd424 100644 --- a/src/arb/const_log_sqrt2pi.c +++ b/src/arb/const_log_sqrt2pi.c @@ -11,7 +11,7 @@ #include "arb.h" -void +static void _arb_const_log_sqrt2pi(arb_t t, slong prec) { arb_const_pi(t, prec + 2); diff --git a/src/arb/const_pi.c b/src/arb/const_pi.c index a97bcf2441..e4d332c9fe 100644 --- a/src/arb/const_pi.c +++ b/src/arb/const_pi.c @@ -13,7 +13,7 @@ #include "arb.h" #include "hypgeom.h" -void +static void arb_const_pi_chudnovsky_eval(arb_t s, slong prec) { hypgeom_t series; @@ -42,7 +42,7 @@ arb_const_pi_chudnovsky_eval(arb_t s, slong prec) arb_clear(u); } -ARB_DEF_CACHED_CONSTANT(arb_const_pi_chudnovsky, arb_const_pi_chudnovsky_eval) +_ARB_DEF_CACHED_CONSTANT(static, static, arb_const_pi_chudnovsky, arb_const_pi_chudnovsky_eval) void arb_const_pi(arb_t res, slong prec) diff --git a/src/arb/const_reciprocal_fibonacci.c b/src/arb/const_reciprocal_fibonacci.c index b4b7fd153d..dff6599bf2 100644 --- a/src/arb/const_reciprocal_fibonacci.c +++ b/src/arb/const_reciprocal_fibonacci.c @@ -39,7 +39,7 @@ typedef struct bsplit_args_struct; static void -bsplit_init(bsplit_t x, void * args) +bsplit_init(bsplit_t x, void * FLINT_UNUSED(args)) { arb_init(x->P); arb_init(x->R); @@ -48,7 +48,7 @@ bsplit_init(bsplit_t x, void * args) } static void -bsplit_clear(bsplit_t x, void * args) +bsplit_clear(bsplit_t x, void * FLINT_UNUSED(args)) { arb_clear(x->P); arb_clear(x->R); @@ -56,7 +56,7 @@ bsplit_clear(bsplit_t x, void * args) } static void -bsplit_basecase(bsplit_t res, slong n, slong n1, void * args) +bsplit_basecase(bsplit_t res, slong n, slong n1, void * FLINT_UNUSED(args)) { fmpz_t f1, f2, f1f2, f22, f4, t; @@ -113,7 +113,7 @@ bsplit_basecase(bsplit_t res, slong n, slong n1, void * args) } static void -bsplit_merge(bsplit_t res, bsplit_t X1, bsplit_t X2, bsplit_args_struct * args) +bsplit_merge(bsplit_t FLINT_UNUSED(res), bsplit_t X1, bsplit_t X2, bsplit_args_struct * args) { slong prec = args->prec; slong a = X1->a; diff --git a/src/arb/const_sqrt_pi.c b/src/arb/const_sqrt_pi.c index 1c9e7866c1..81ab399928 100644 --- a/src/arb/const_sqrt_pi.c +++ b/src/arb/const_sqrt_pi.c @@ -11,7 +11,7 @@ #include "arb.h" -void +static void _arb_const_sqrt_pi(arb_t t, slong prec) { arb_const_pi(t, prec + 2); diff --git a/src/arb/div.c b/src/arb/div.c index 78a075109f..5ecb06f6b7 100644 --- a/src/arb/div.c +++ b/src/arb/div.c @@ -11,6 +11,12 @@ #include "arb.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + /* We do Newton iteration in floating-point arithmetic with some guard bits. With GUARD_BITS = 32 the result is certainly accurate to more than GUARD_BITS / 2 extra bits. With a detailed error @@ -30,7 +36,7 @@ #define WANT_NEWTON(prec, xbits, ybits) 0 #endif -void +static void _arf_inv_newton(arf_t res, const arf_t x, slong prec) { slong wp = prec + GUARD_BITS; @@ -72,7 +78,7 @@ _arf_inv_newton(arf_t res, const arf_t x, slong prec) } /* Karp-Markstein */ -void +static void _arf_div_newton(arf_t res, const arf_t x, const arf_t y, slong prec) { arf_t xn, yn, t; diff --git a/src/arb/div_2expm1_ui.c b/src/arb/div_2expm1_ui.c index 9055691b30..27f279e08d 100644 --- a/src/arb/div_2expm1_ui.c +++ b/src/arb/div_2expm1_ui.c @@ -18,7 +18,7 @@ arb_div_2expm1_ui(arb_t y, const arb_t x, ulong n, slong prec) { arb_div_ui(y, x, (UWORD(1) << n) - 1, prec); } - else if (n < 1024 + prec / 32 || n > WORD_MAX / 4) + else if (n < 1024 + (ulong) (prec / 32) || n > WORD_MAX / 4) { arb_t t; fmpz_t e; @@ -47,7 +47,7 @@ arb_div_2expm1_ui(arb_t y, const arb_t x, ulong n, slong prec) arb_set(t, s); b = 1; - for (i = 2; i <= prec / n + 1; i++) + for (i = 2; (ulong) i <= prec / n + 1; i++) { arb_mul_2exp_si(t, t, -n); arb_add(s, s, t, prec); diff --git a/src/arb/dot.c b/src/arb/dot.c index 760ba15368..6bc7b73cb8 100644 --- a/src/arb/dot.c +++ b/src/arb/dot.c @@ -16,6 +16,12 @@ safe summation of 30-bit error bounds. */ #include +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void mpfr_mulhigh_n(nn_ptr rp, nn_srcptr np, nn_srcptr mp, slong n); void mpfr_sqrhigh_n(nn_ptr rp, nn_srcptr np, slong n); @@ -622,7 +628,7 @@ arb_dot(arb_t res, const arb_t initial, int subtract, arb_srcptr x, slong xstep, shift = sum_exp - xexp; - if (shift >= sn * FLINT_BITS) + if (shift >= (ulong) sn * FLINT_BITS) { serr++; } @@ -669,7 +675,7 @@ arb_dot(arb_t res, const arb_t initial, int subtract, arb_srcptr x, slong xstep, exp = xexp + yexp; shift = sum_exp - exp; - if (shift >= sn * FLINT_BITS) + if (shift >= (ulong) sn * FLINT_BITS) { /* We may yet need the top limbs for bounds. */ ARF_GET_TOP_LIMB(xtop, xm); diff --git a/src/arb/dot_siui.c b/src/arb/dot_siui.c index d8c48c5608..f47050b021 100644 --- a/src/arb/dot_siui.c +++ b/src/arb/dot_siui.c @@ -77,9 +77,9 @@ arb_dot_siui(arb_t res, const arb_t initial, int subtract, arb_srcptr x, slong x arb_zero(res); else { - arf_t t; - arf_shallow_set_siui(t, y[1], y[0]); - arb_mul_arf(res, x, t, prec); + arf_t tf; + arf_shallow_set_siui(tf, y[1], y[0]); + arb_mul_arf(res, x, tf, prec); if (subtract) arb_neg(res, res); } diff --git a/src/arb/dot_uiui.c b/src/arb/dot_uiui.c index fdd725e9ba..72996fc2cb 100644 --- a/src/arb/dot_uiui.c +++ b/src/arb/dot_uiui.c @@ -68,9 +68,9 @@ arb_dot_uiui(arb_t res, const arb_t initial, int subtract, arb_srcptr x, slong x arb_zero(res); else { - arf_t t; - arf_shallow_set_uiui(t, y[1], y[0]); - arb_mul_arf(res, x, t, prec); + arf_t tf; + arf_shallow_set_uiui(tf, y[1], y[0]); + arb_mul_arf(res, x, tf, prec); if (subtract) arb_neg(res, res); } diff --git a/src/arb/euler_number_ui.c b/src/arb/euler_number_ui.c index a98779355a..cc397b962e 100644 --- a/src/arb/euler_number_ui.c +++ b/src/arb/euler_number_ui.c @@ -19,6 +19,15 @@ # include #endif +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma message "euler_mod_p_powsum only needs a symbol for test" +# pragma message "euler_mod_p_powsum_noredc only needs a symbol for test" +# pragma message "euler_mod_p_powsum_1 only needs a symbol for test" +#endif + #if FLINT64 #define ARB_EULER_NUMBER_TAB_SIZE 25 #else @@ -44,7 +53,7 @@ arb_euler_number_mag(double n) return x; } -void +static void arb_euler_number_ui_beta(arb_t res, ulong n, slong prec) { slong pi_prec; @@ -143,7 +152,7 @@ nmod_from_redc(ulong x, nmod_redc_t rmod) return nmod_redc(x, rmod.n, rmod.ninv); } -ulong +static ulong nmod_redc_pow_ui(ulong a, ulong exp, nmod_redc_t rmod) { ulong x; @@ -170,8 +179,7 @@ nmod_redc_pow_ui(ulong a, ulong exp, nmod_redc_t rmod) ulong euler_mod_p_powsum_1(ulong n, ulong p) { - slong j; - ulong s, t; + ulong j, s, t; nmod_t mod; if (n % 2 == 1) @@ -202,8 +210,8 @@ ulong euler_mod_p_powsum_noredc(ulong n, ulong p, const unsigned int * divtab) { unsigned int * pows; - slong i, N, horner_point; - ulong s, t, z; + slong i, horner_point; + ulong N, s, t, z; ulong v2n, power_of_two; nmod_t mod; TMP_INIT; @@ -226,6 +234,7 @@ euler_mod_p_powsum_noredc(ulong n, ulong p, const unsigned int * divtab) s = z = 0; /* Evaluate as a polynomial in 2^n */ + /* FIXME: This can be done quicker. This is 2**(flog2(N)). */ power_of_two = 1; while (power_of_two * 2 <= N) power_of_two *= 2; @@ -233,7 +242,7 @@ euler_mod_p_powsum_noredc(ulong n, ulong p, const unsigned int * divtab) horner_point = 1; v2n = nmod_pow_ui(2, n, mod); - for (i = 1; i <= N / 3; i += 2) + for (i = 1; (ulong) i <= N / 3; i += 2) { if (divtab[i] == 1) t = nmod_pow_ui(i, n, mod); @@ -257,7 +266,7 @@ euler_mod_p_powsum_noredc(ulong n, ulong p, const unsigned int * divtab) } /* Same as above, but here we don't need to write the powers. */ - for ( ; i <= N; i += 2) + for ( ; (ulong) i <= N; i += 2) { if (divtab[i] == 1) t = nmod_pow_ui(i, n, mod); @@ -292,12 +301,12 @@ euler_mod_p_powsum_noredc(ulong n, ulong p, const unsigned int * divtab) return s; } -ulong +static ulong euler_mod_p_powsum_redc(ulong n, ulong p, const unsigned int * divtab) { unsigned int * pows; - slong i, N, horner_point; - ulong s, t, z; + slong i, horner_point; + ulong N, s, t, z; ulong v2n, power_of_two; nmod_t mod; nmod_redc_t rmod; @@ -329,7 +338,7 @@ euler_mod_p_powsum_redc(ulong n, ulong p, const unsigned int * divtab) horner_point = 1; v2n = nmod_redc_pow_ui(nmod_to_redc(2, mod, rmod), n, rmod); - for (i = 1; i <= N / 3; i += 2) + for (i = 1; (ulong) i <= N / 3; i += 2) { if (divtab[i] == 1) t = nmod_redc_pow_ui(nmod_to_redc(i, mod, rmod), n, rmod); @@ -354,7 +363,7 @@ euler_mod_p_powsum_redc(ulong n, ulong p, const unsigned int * divtab) } /* Same as above, but here we don't need to write the powers. */ - for ( ; i <= N; i += 2) + for ( ; (ulong) i <= N; i += 2) { if (divtab[i] == 1) t = nmod_redc_pow_ui(nmod_to_redc(i, mod, rmod), n, rmod); diff --git a/src/arb/exp.c b/src/arb/exp.c index 0a29c5d4b7..062885a04e 100644 --- a/src/arb/exp.c +++ b/src/arb/exp.c @@ -14,7 +14,7 @@ #define MAGLIM(prec) FLINT_MAX(128, 2 * (prec)) /* todo: min prec by MAG_BITS everywhere? */ -void +static void arb_exp_wide(arb_t res, const arb_t x, slong prec, slong maglim) { mag_t t, u; diff --git a/src/arb/exp_arf.c b/src/arb/exp_arf.c index dd28309c11..a5b60c288d 100644 --- a/src/arb/exp_arf.c +++ b/src/arb/exp_arf.c @@ -13,6 +13,12 @@ #include "thread_support.h" #include "mpn_extras.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define TMP_ALLOC_LIMBS(__n) TMP_ALLOC((__n) * sizeof(ulong)) void diff --git a/src/arb/exp_arf_bb.c b/src/arb/exp_arf_bb.c index a2c30054df..5dce43c216 100644 --- a/src/arb/exp_arf_bb.c +++ b/src/arb/exp_arf_bb.c @@ -54,7 +54,8 @@ work_t; static void worker(slong iter, work_t * work) { - slong mag, wp, N; + slong mag, N; + ulong wp; flint_bitcnt_t Qexp[1]; fmpz_t T, Q; @@ -131,7 +132,7 @@ pmerge(arb_t res, const arb_t a, const arb_t b, pwork_t * work) arb_mul(res, a, b, work->prec); } -void +static void _arb_vec_prod_bsplit_threaded(arb_t res, arb_srcptr vec, slong len, slong prec) { pwork_t work; @@ -151,9 +152,10 @@ _arb_vec_prod_bsplit_threaded(arb_t res, arb_srcptr vec, slong len, slong prec) void arb_exp_arf_bb(arb_t z, const arf_t x, slong prec, int minus_one) { - slong k, bits, r, mag, q, wp, N; - slong argred_bits, start_bits; + slong k, r, mag, q, N; slong num_threads; + ulong wp; + flint_bitcnt_t bits, argred_bits, start_bits; flint_bitcnt_t Qexp[1]; int inexact; fmpz_t t, u, T, Q; @@ -196,7 +198,7 @@ arb_exp_arf_bb(arb_t z, const arf_t x, slong prec, int minus_one) /* Argument reduction: exp(x) -> exp(x/2^q). This improves efficiency of the first iteration in the bit-burst algorithm. */ - q = FLINT_MAX(0, mag + argred_bits); + q = FLINT_MAX(0, (slong) (mag + argred_bits)); /* Determine working precision. */ wp = prec + 10 + 2 * q + 2 * FLINT_BIT_COUNT(prec); diff --git a/src/arb/exp_arf_rs_generic.c b/src/arb/exp_arf_rs_generic.c index 44556f6fe7..2f72b28227 100644 --- a/src/arb/exp_arf_rs_generic.c +++ b/src/arb/exp_arf_rs_generic.c @@ -18,6 +18,13 @@ # include #endif +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma message "arb_exp_taylor_sum_rs_generic only needs a symbol for test" +#endif + void arb_exp_taylor_sum_rs_generic(arb_t res, const arb_t x, slong N, slong prec) { @@ -154,14 +161,14 @@ arb_exp_arf_rs_generic(arb_t res, const arf_t x, slong prec, int minus_one) because the main exp function already takes care of it. */ if (xmag < -prec - 4) { - mag_t t; - mag_init(t); - arf_get_mag(t, x); - mag_exp_tail(t, t, 2); + mag_t tm; + mag_init(tm); + arf_get_mag(tm, x); + mag_exp_tail(tm, tm, 2); arb_set_arf(res, x); arb_add_ui(res, res, minus_one ? 0 : 1, prec); - arb_add_error_mag(res, t); - mag_clear(t); + arb_add_error_mag(res, tm); + mag_clear(tm); return; } diff --git a/src/arb/exp_sum_bs_powtab.c b/src/arb/exp_sum_bs_powtab.c index 9fc3cb2383..5e2b7cc865 100644 --- a/src/arb/exp_sum_bs_powtab.c +++ b/src/arb/exp_sum_bs_powtab.c @@ -13,6 +13,12 @@ #include "fmpz_vec.h" #include "arb.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + /* When splitting [a,b) into [a,m), [m,b), we need the power x^(m-a). This function computes all the exponents (m-a) that can appear when doing binary splitting with the top-level interval [0,n), @@ -194,13 +200,13 @@ exp_bsplit_struct; typedef exp_bsplit_struct exp_bsplit_t[1]; -static void exp_bsplit_init(exp_bsplit_t x, void * args) +static void exp_bsplit_init(exp_bsplit_t x, void * FLINT_UNUSED(args)) { fmpz_init(x->T); fmpz_init(x->Q); } -static void exp_bsplit_clear(exp_bsplit_t x, void * args) +static void exp_bsplit_clear(exp_bsplit_t x, void * FLINT_UNUSED(args)) { fmpz_clear(x->T); fmpz_clear(x->Q); diff --git a/src/arb/exp_taylor_rs.c b/src/arb/exp_taylor_rs.c index 2dbc7f58f8..1580ffcf58 100644 --- a/src/arb/exp_taylor_rs.c +++ b/src/arb/exp_taylor_rs.c @@ -1273,7 +1273,7 @@ void _arb_exp_taylor_rs(nn_ptr y, ulong * error, old_denom = factorial_tab_denom[k+1]; /* change denominators */ - if (new_denom != old_denom && k < N - 1) + if (new_denom != old_denom && (ulong) k < N - 1) { mpn_divrem_1(s, 0, s, xn + 1, old_denom); } diff --git a/src/arb/gamma.c b/src/arb/gamma.c index 3f6d2c4801..bfc260f34e 100644 --- a/src/arb/gamma.c +++ b/src/arb/gamma.c @@ -9,13 +9,20 @@ (at your option) any later version. See . */ -#include "acb.h" +#include "arb.h" #include "arb_hypgeom.h" +#include "acb.h" #include "bernoulli.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + /* todo: move/cleanup helper functions */ -void +static void acb_gamma_bound_phase(mag_t bound, const acb_t z) { arf_t x, y, t, u; @@ -177,8 +184,6 @@ arb_gamma_stirling_coeff(arb_t b, ulong k, int digamma, slong prec) fmpz_clear(d); } - - void arb_gamma_stirling_eval(arb_t s, const arb_t z, slong nterms, int digamma, slong prec) { diff --git a/src/arb/get_fmpz_mid_rad_10exp.c b/src/arb/get_fmpz_mid_rad_10exp.c index 6ac15f8517..9aded60dc5 100644 --- a/src/arb/get_fmpz_mid_rad_10exp.c +++ b/src/arb/get_fmpz_mid_rad_10exp.c @@ -12,7 +12,7 @@ #include "arb.h" /* todo: make arb_pow_fmpz automatic */ -void +static void _arb_10_pow_fmpz(arb_t res, const fmpz_t m, slong prec) { slong bits = fmpz_bits(m); @@ -67,7 +67,7 @@ arb_get_fmpz_mid_rad_10exp(fmpz_t mid, fmpz_t rad, fmpz_t exp, const arb_t x, sl fmpz_set(e, ARF_EXPREF(arb_radref(x))); prec = fmpz_bits(e); - prec = FLINT_MAX(prec, FLINT_BIT_COUNT(n)) + 15; + prec = FLINT_MAX((ulong) prec, FLINT_BIT_COUNT(n)) + 15; arb_const_log2(t, prec); arb_const_log10(u, prec); diff --git a/src/arb/get_rand_fmpq.c b/src/arb/get_rand_fmpq.c index 39579c0bc9..1a870c7181 100644 --- a/src/arb/get_rand_fmpq.c +++ b/src/arb/get_rand_fmpq.c @@ -12,7 +12,7 @@ #include "fmpq.h" #include "arb.h" -void +static void _arb_get_rand_fmpq(fmpz_t num, fmpz_t den, flint_rand_t state, const fmpz_t den_mult, const arb_t x) { diff --git a/src/arb/get_str.c b/src/arb/get_str.c index 4e6f927539..e714462234 100644 --- a/src/arb/get_str.c +++ b/src/arb/get_str.c @@ -15,7 +15,7 @@ #define RADIUS_DIGITS 3 -char * +static char * _arb_condense_digits(char * s, slong n) { slong i, j, run, out; @@ -77,7 +77,7 @@ _arb_condense_digits(char * s, slong n) /* Format (digits=d, exponent=e) as floating-point or fixed-point. Reallocates the input and mutates the exponent. */ -void +static void _arb_digits_as_float_str(char ** d, fmpz_t e, slong minfix, slong maxfix) { slong i, n, alloc, dotpos; @@ -291,7 +291,7 @@ _arb_digits_round_inplace(char * s, flint_bitcnt_t * shift, fmpz_t error, slong } } -void +static void arb_get_str_parts(int * negative, char **mid_digits, fmpz_t mid_exp, char **rad_digits, fmpz_t rad_exp, const arb_t x, slong n, int more) diff --git a/src/arb/lambertw.c b/src/arb/lambertw.c index 2b430a13eb..c86747fa31 100644 --- a/src/arb/lambertw.c +++ b/src/arb/lambertw.c @@ -12,6 +12,12 @@ #include "arb.h" #include "double_extras.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + /* Helper functions to compute W_{-1}(x) on (-1/e,0) in double precision -- just to get a good starting value for the multiprecision code, and not optimized for accuracy. Has underflow problems very close to 0. @@ -109,7 +115,7 @@ d_lambertw_branch1(double x) For the -1 branch: |W'(x)| <= 2 / sqrt(1+e*x) + 2/|x|. */ -void +static void arb_lambertw_bound_prime(mag_t w, const arb_t x, int branch, slong prec) { arb_t t; @@ -158,7 +164,7 @@ arb_lambertw_bound_prime(mag_t w, const arb_t x, int branch, slong prec) /* Given an approximation w for W(x), compute a rigorous error bound. The precomputed value ew = e^w is optional. */ -void +static void arb_lambertw_bound_error(mag_t res, const arb_t x, const arf_t w, const arb_t ew, int branch, slong prec) { @@ -279,8 +285,8 @@ arb_lambertw_halley_step(arb_t res, const arb_t x, const arf_t w, /* Double precision approximation good for x >= 2^1000, or roughly |x| <= 2^(1000-60) for the -1 branch. */ -slong -arb_lambertw_initial_asymp1(arf_t res, const arf_t x, int branch, slong prec) +static slong +arb_lambertw_initial_asymp1(arf_t res, const arf_t x, int branch, slong FLINT_UNUSED(prec)) { fmpz_t e; double l, ll, h, t2, t3, t4; @@ -324,8 +330,8 @@ _arf_log(arf_t res, const arf_t x, slong prec) arb_clear(t); } -slong -arb_lambertw_initial_asymp2(arf_t res, const arf_t x, int branch, slong prec) +static slong +arb_lambertw_initial_asymp2(arf_t res, const arf_t x, int branch, slong FLINT_UNUSED(prec)) { arf_t l, ll; slong wp, acc; @@ -366,7 +372,7 @@ in bits, clamped between 0 and a reasonable value related to the bit length of the exponent of x; thus the return value plus 2 can be used as a precision. */ -slong +static slong arb_lambertw_initial(arf_t res, const arf_t x, int branch, slong prec) { if (arf_cmp_d(x, -ONE_OVER_E + 0.001) >= 0) diff --git a/src/arb/log_arf.c b/src/arb/log_arf.c index e329e8d7f2..504da6aecf 100644 --- a/src/arb/log_arf.c +++ b/src/arb/log_arf.c @@ -63,7 +63,7 @@ arf_log_via_mpfr(arf_t z, const arf_t x, slong prec, arf_rnd_t rnd) } #endif -void +static void arb_log_arf_huge(arb_t z, const arf_t x, slong prec) { arf_t t; @@ -186,18 +186,18 @@ arb_log_arf(arb_t z, const arf_t x, slong prec) } else if (2 * closeness_to_one > prec + 1) { - arf_t t, u; - arf_init(t); - arf_init(u); - arf_sub_ui(t, x, 1, ARF_PREC_EXACT, ARF_RND_DOWN); - arf_mul(u, t, t, ARF_PREC_EXACT, ARF_RND_DOWN); - arf_mul_2exp_si(u, u, -1); - inexact = arf_sub(arb_midref(z), t, u, prec, ARB_RND); + arf_t tf, uf; + arf_init(tf); + arf_init(uf); + arf_sub_ui(tf, x, 1, ARF_PREC_EXACT, ARF_RND_DOWN); + arf_mul(uf, tf, tf, ARF_PREC_EXACT, ARF_RND_DOWN); + arf_mul_2exp_si(uf, uf, -1); + inexact = arf_sub(arb_midref(z), tf, uf, prec, ARB_RND); mag_set_ui_2exp_si(arb_radref(z), 1, -3 * closeness_to_one); if (inexact) arf_mag_add_ulp(arb_radref(z), arb_radref(z), arb_midref(z), prec); - arf_clear(t); - arf_clear(u); + arf_clear(tf); + arf_clear(uf); return; } diff --git a/src/arb/log_precompute_reductions.c b/src/arb/log_precompute_reductions.c index c90a0540de..5760311ab4 100644 --- a/src/arb/log_precompute_reductions.c +++ b/src/arb/log_precompute_reductions.c @@ -22,6 +22,13 @@ # include #endif +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma message "_arb_log_precompute_reductions is currently unused/untested/undocumented!" +#endif + #define TERMINATOR -32768 void diff --git a/src/arb/log_primes.c b/src/arb/log_primes.c index 341212cd01..c4fa781a64 100644 --- a/src/arb/log_primes.c +++ b/src/arb/log_primes.c @@ -20,6 +20,12 @@ # include #endif +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define HAVE_64_BIT (FLINT_BITS == 64) /* one coefficient doesn't fit in 64 bits */ @@ -473,7 +479,7 @@ arb_log_primes_vec_bsplit(arb_ptr res, slong n, slong prec) FLINT_TLS_PREFIX arb_struct _arb_log_p_cache[ARB_LOG_PRIME_CACHE_NUM]; FLINT_TLS_PREFIX slong _arb_log_p_cache_prec = 0; -void _arb_log_p_cleanup(void) +static void _arb_log_p_cleanup(void) { slong i; for (i = 0; i < ARB_LOG_PRIME_CACHE_NUM; i++) @@ -654,7 +660,7 @@ arb_atan_gauss_primes_vec_bsplit(arb_ptr res, slong n, slong prec) for (i = ln; i < n; i++) { - double best = 100, t; + double best = 100, td; slong xa, xb, ya, yb; slong best_j = 0; @@ -666,11 +672,11 @@ arb_atan_gauss_primes_vec_bsplit(arb_ptr res, slong n, slong prec) ya = small_gaussian_primes[2 * j]; yb = small_gaussian_primes[2 * j + 1]; - t = (xb*ya - xa*yb) / (double) (xa*ya + xb*yb); + td = (xb*ya - xa*yb) / (double) (xa*ya + xb*yb); - if (fabs(t) < best) + if (fabs(td) < best) { - best = fabs(t); + best = fabs(td); best_j = j; } } @@ -694,7 +700,7 @@ arb_atan_gauss_primes_vec_bsplit(arb_ptr res, slong n, slong prec) FLINT_TLS_PREFIX arb_struct _arb_atan_gauss_p_cache[ARB_ATAN_GAUSS_PRIME_CACHE_NUM]; FLINT_TLS_PREFIX slong _arb_atan_gauss_p_cache_prec = 0; -void _arb_atan_gauss_p_cleanup(void) +static void _arb_atan_gauss_p_cleanup(void) { slong i; for (i = 0; i < ARB_ATAN_GAUSS_PRIME_CACHE_NUM; i++) diff --git a/src/arb/log_reduce.c b/src/arb/log_reduce.c index e775d79b11..b7241c34c5 100644 --- a/src/arb/log_reduce.c +++ b/src/arb/log_reduce.c @@ -228,7 +228,7 @@ static const double log_rel_epsilon_inv[] = { -1.11266647552533214e+55, }; -void +static void _arb_log_reduce_fixed(slong * rel, const short * d, const double * epsilon, const double * epsilon_inv, const fmpz * alpha, const float * weights, slong num_alpha, const fmpz_t x, slong prec, double max_weight) @@ -352,11 +352,11 @@ rel_product(fmpz_t p, fmpz_t q, const short * primes, const slong * rel, slong l } /* todo: error propagation */ -void +static void _arb_exp_arf_precomp(arb_t res, const arf_t x, slong prec, int minus_one, slong num_logs, arb_srcptr logs, const short * primes, const float * weights, - const short * log_rel_d, + const short * lrd, const double * epsilon, const double * epsilon_inv, double max_weight) { arb_t t; @@ -388,7 +388,7 @@ _arb_exp_arf_precomp(arb_t res, const arf_t x, slong prec, int minus_one, arf_get_fmpz_fixed_si(alpha + i, arb_midref(logs + i), -wp); arf_get_fmpz_fixed_si(r, x, -wp); - _arb_log_reduce_fixed(rel, log_rel_d, epsilon, epsilon_inv, + _arb_log_reduce_fixed(rel, lrd, epsilon, epsilon_inv, alpha, weights, num_logs, r, wp, max_weight); fmpz_clear(r); @@ -788,11 +788,11 @@ gaussian_rel_product(fmpzi_t p, fmpzi_t q, const char * primes, const slong * re } } -void +static void _arb_sin_cos_arf_precomp(arb_t res1, arb_t res2, const arf_t x, slong prec, - slong num_logs, arb_srcptr logs, const char * primes, + slong num_logs, arb_srcptr logs, const char * FLINT_UNUSED(primes), const float * weights, - const short * log_rel_d, + const short * lrd, const double * epsilon, const double * epsilon_inv, double max_weight) { arb_t t; @@ -801,7 +801,7 @@ _arb_sin_cos_arf_precomp(arb_t res1, arb_t res2, const arf_t x, slong prec, slong * rel; slong i; fmpz * alpha; - fmpz_t r; + fmpz_t rf; slong mag; arb_init(t); @@ -809,7 +809,7 @@ _arb_sin_cos_arf_precomp(arb_t res1, arb_t res2, const arf_t x, slong prec, rel = flint_malloc(num_logs * sizeof(slong)); alpha = _fmpz_vec_init(num_logs); - fmpz_init(r); + fmpz_init(rf); if (prec <= 10000) wp = 256; @@ -821,9 +821,9 @@ _arb_sin_cos_arf_precomp(arb_t res1, arb_t res2, const arf_t x, slong prec, for (i = 0; i < num_logs; i++) arf_get_fmpz_fixed_si(alpha + i, arb_midref(logs + i), -wp); - arf_get_fmpz_fixed_si(r, x, -wp); - _arb_log_reduce_fixed(rel, log_rel_d, epsilon, epsilon_inv, - alpha, weights, num_logs, r, wp, max_weight); + arf_get_fmpz_fixed_si(rf, x, -wp); + _arb_log_reduce_fixed(rel, lrd, epsilon, epsilon_inv, + alpha, weights, num_logs, rf, wp, max_weight); /* { @@ -834,7 +834,7 @@ _arb_sin_cos_arf_precomp(arb_t res1, arb_t res2, const arf_t x, slong prec, } */ - fmpz_clear(r); + fmpz_clear(rf); _fmpz_vec_clear(alpha, num_logs); wp = prec + 5 + 2 * FLINT_BIT_COUNT(prec); diff --git a/src/arb/pow.c b/src/arb/pow.c index 4d0d6b77b3..b42fd00fb2 100644 --- a/src/arb/pow.c +++ b/src/arb/pow.c @@ -15,7 +15,7 @@ typedef enum {POSITIVE = 0, NEGATIVE_EVEN, NEGATIVE_ODD} sign_type; -void +static void _arb_pow_exp(arb_t z, const arb_t x, sign_type negx, const arb_t y, slong prec) { arb_t t; diff --git a/src/arb/root_ui.c b/src/arb/root_ui.c index 786271b829..d85db70065 100644 --- a/src/arb/root_ui.c +++ b/src/arb/root_ui.c @@ -22,7 +22,7 @@ arb_root_arf(arb_t z, const arf_t x, ulong k, slong prec) mag_zero(arb_radref(z)); } -void +static void arb_root_ui_algebraic(arb_t res, const arb_t x, ulong k, slong prec) { mag_t r, msubr, m1k, t; @@ -72,7 +72,7 @@ arb_root_ui_algebraic(arb_t res, const arb_t x, ulong k, slong prec) mag_clear(t); } -void +static void arb_root_ui_exp(arb_t res, const arb_t x, ulong k, slong prec) { arb_log(res, x, prec + 4); diff --git a/src/arb/sin_cos.c b/src/arb/sin_cos.c index 0d5c1e0f82..1f126ffbe8 100644 --- a/src/arb/sin_cos.c +++ b/src/arb/sin_cos.c @@ -73,7 +73,7 @@ mag_fast_set(mag_t x, const mag_t y) MAG_MAN(x) = MAG_MAN(y); } -void +static void _arb_sin_cos(arb_t zsin, arb_t zcos, const arf_t x, const mag_t xrad, slong prec) { int want_sin, want_cos; diff --git a/src/arb/sin_cos_arf_bb.c b/src/arb/sin_cos_arf_bb.c index c7689a002f..39d0a5afc6 100644 --- a/src/arb/sin_cos_arf_bb.c +++ b/src/arb/sin_cos_arf_bb.c @@ -14,6 +14,13 @@ #include "arb.h" #include "acb.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma message "arb_sin_cos_fmpz_div_2exp_bsplit only needs a symbol for test" +#endif + slong _arb_compute_bs_exponents(slong * tab, slong n); slong _arb_get_exp_pos(const slong * tab, slong step); @@ -91,13 +98,13 @@ cos_bsplit_struct; typedef cos_bsplit_struct cos_bsplit_t[1]; -static void cos_bsplit_init(cos_bsplit_t x, void * args) +static void cos_bsplit_init(cos_bsplit_t x, void * FLINT_UNUSED(args)) { fmpz_init(x->T); fmpz_init(x->Q); } -static void cos_bsplit_clear(cos_bsplit_t x, void * args) +static void cos_bsplit_clear(cos_bsplit_t x, void * FLINT_UNUSED(args)) { fmpz_clear(x->T); fmpz_clear(x->Q); @@ -188,7 +195,7 @@ bsplit2(fmpz_t T, fmpz_t Q, flint_bitcnt_t * Qexp, } /* todo: also allow computing cos, using the same table... */ -void +static void _arb_sin_sum_bs_powtab(fmpz_t T, fmpz_t Q, flint_bitcnt_t * Qexp, const fmpz_t x, flint_bitcnt_t r, slong N) { @@ -282,7 +289,7 @@ arb_sin_cos_fmpz_div_2exp_bsplit(arb_t wsin, arb_t wcos, const fmpz_t x, flint_b fmpz_init(T); fmpz_init(Q); - if (r > prec) + if (r > (ulong) prec) flint_throw(FLINT_ERROR, "(%s)\n", __func__); /* Binary splitting (+1 fixed-point ulp truncation error). */ @@ -295,7 +302,7 @@ arb_sin_cos_fmpz_div_2exp_bsplit(arb_t wsin, arb_t wcos, const fmpz_t x, flint_b Qexp[0] += r; /* T = T / Q (+1 fixed-point ulp error). */ - if (Qexp[0] >= prec) + if (Qexp[0] >= (ulong) prec) fmpz_tdiv_q_2exp(T, T, Qexp[0] - prec); else fmpz_mul_2exp(T, T, prec - Qexp[0]); @@ -362,7 +369,7 @@ pbasecase(acb_t res, slong a, slong b, pwork_t * work) } static void -pmerge(acb_t res, acb_t a, acb_t b, pwork_t * work) +pmerge(acb_t res, acb_t FLINT_UNUSED(a), acb_t b, pwork_t * work) { arb_t tmp1; arb_ptr zsin, zcos, wsin, wcos; @@ -390,7 +397,7 @@ pmerge(acb_t res, acb_t a, acb_t b, pwork_t * work) arb_clear(tmp1); } -void +static void _acb_vec_prod_bsplit_threaded(acb_t res, acb_ptr vec, slong len, slong prec) { pwork_t work; diff --git a/src/arb/sin_cos_arf_generic.c b/src/arb/sin_cos_arf_generic.c index 6dc68c5bae..fd7704b339 100644 --- a/src/arb/sin_cos_arf_generic.c +++ b/src/arb/sin_cos_arf_generic.c @@ -19,6 +19,13 @@ # include #endif +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma message "arb_sin_cos_taylor_sum_rs only needs a symbol for test" +#endif + /* Computes sin(x) or cos(x) using Taylor series truncated at x^N exclusive. Computes error bound automatically. Does not allow aliasing of s and x. */ void diff --git a/src/arb/sin_cos_pi_fmpq.c b/src/arb/sin_cos_pi_fmpq.c index 068e08b2ad..63c3e9c4ea 100644 --- a/src/arb/sin_cos_pi_fmpq.c +++ b/src/arb/sin_cos_pi_fmpq.c @@ -12,7 +12,7 @@ #include "arb.h" static int -use_algebraic(const fmpz_t v, const fmpz_t w, slong prec) +use_algebraic(const fmpz_t FLINT_UNUSED(v), const fmpz_t w, slong prec) { fmpz q = *w; int r; @@ -38,7 +38,7 @@ use_algebraic(const fmpz_t v, const fmpz_t w, slong prec) return 1; } -void +static void _arb_sin_cos_pi_fmpq_oct(arb_t s, arb_t c, const fmpz_t v, const fmpz_t w, slong prec) { @@ -55,7 +55,7 @@ _arb_sin_cos_pi_fmpq_oct(arb_t s, arb_t c, } } -void +static void _arb_sin_pi_fmpq_oct(arb_t s, const fmpz_t v, const fmpz_t w, slong prec) { if (use_algebraic(v, w, prec)) @@ -71,7 +71,7 @@ _arb_sin_pi_fmpq_oct(arb_t s, const fmpz_t v, const fmpz_t w, slong prec) } } -void +static void _arb_cos_pi_fmpq_oct(arb_t c, const fmpz_t v, const fmpz_t w, slong prec) { if (use_algebraic(v, w, prec)) diff --git a/src/arb/sin_cos_taylor_rs.c b/src/arb/sin_cos_taylor_rs.c index 43e7afda51..c0b16bb910 100644 --- a/src/arb/sin_cos_taylor_rs.c +++ b/src/arb/sin_cos_taylor_rs.c @@ -97,7 +97,7 @@ void _arb_sin_cos_taylor_rs(nn_ptr ysin, nn_ptr ycos, old_denom = factorial_tab_denom[2 * k + cosorsin + 2]; /* change denominators */ - if (new_denom != old_denom && k < N - 1) + if (new_denom != old_denom && (ulong) k < N - 1) { if (alternating && (k % 2 == 0)) s[xn] += old_denom; diff --git a/src/arb/sinc.c b/src/arb/sinc.c index 4ea79089db..48a557f6dd 100644 --- a/src/arb/sinc.c +++ b/src/arb/sinc.c @@ -11,7 +11,7 @@ #include "arb.h" -void +static void _arb_sinc_derivative_bound(mag_t d, const arb_t x) { /* |f'(x)| < min(arb_get_mag(x), 1) / 2 */ @@ -26,7 +26,7 @@ _arb_sinc_derivative_bound(mag_t d, const arb_t x) mag_clear(one); } -void +static void _arb_sinc_direct(arb_t z, const arb_t x, slong prec) { /* z = sin(x) / x */ diff --git a/src/arb/sinh_cosh.c b/src/arb/sinh_cosh.c index c71ae42592..5b2b56fb0d 100644 --- a/src/arb/sinh_cosh.c +++ b/src/arb/sinh_cosh.c @@ -11,7 +11,7 @@ #include "arb.h" -void +static void arb_sinh_cosh_wide(arb_t s, arb_t c, const arb_t x, slong prec) { mag_t t, u, v, w; diff --git a/src/arb/sqrt.c b/src/arb/sqrt.c index e7f10bc358..8952301e2a 100644 --- a/src/arb/sqrt.c +++ b/src/arb/sqrt.c @@ -16,7 +16,7 @@ #define RSQRT_NEWTON_CUTOFF 4000 #define SQRT_NEWTON_CUTOFF 200000 -void +static void _arf_rsqrt_newton(arf_t res, const arf_t x, slong prec) { slong wp = prec + GUARD_BITS; @@ -63,7 +63,7 @@ _arf_rsqrt_newton(arf_t res, const arf_t x, slong prec) } } -void +static void _arf_sqrt_newton(arf_t res, const arf_t x, slong prec) { arf_t t, u, v; @@ -120,7 +120,7 @@ arb_rsqrt_arf_newton(arb_t res, const arf_t x, slong prec) arb_set_round(res, res, prec); } -void +static void arb_rsqrt_arf(arb_t res, const arf_t x, slong prec) { if (arf_is_special(x) || arf_sgn(x) < 0) diff --git a/src/arb/test/t-pos_times_posinf.c b/src/arb/test/t-pos_times_posinf.c index e899ca0623..c0ff72ad8a 100644 --- a/src/arb/test/t-pos_times_posinf.c +++ b/src/arb/test/t-pos_times_posinf.c @@ -148,7 +148,9 @@ TEST_FUNCTION_START(arb_pos_times_posinf, state) for(k = 0; test_values_arb[k].value != NULL; ++k) { - value_type vw = test_values_arb[k].type, expected = addition[vw][multiplication[vt][vu]]; + value_type vw = test_values_arb[k].type; + + expected = addition[vw][multiplication[vt][vu]]; arb_set_str(w, test_values_arb[k].value, prec); arb_addmul(w, t, u, prec); diff --git a/src/arb/test/t-sin_cos_arf_generic.c b/src/arb/test/t-sin_cos_arf_generic.c index a5042716f9..a8e23ef83e 100644 --- a/src/arb/test/t-sin_cos_arf_generic.c +++ b/src/arb/test/t-sin_cos_arf_generic.c @@ -14,7 +14,6 @@ /* these functions are not exposed to the public for now, but it still makes sense to test them explicitly */ -void arb_sin_cos_arf_rs_generic(arb_t res_sin, arb_t res_cos, const arf_t x, slong prec); void arb_sin_cos_taylor_sum_rs(arb_t s, const arb_t x, slong N, int cosine, slong prec); TEST_FUNCTION_START(arb_sin_cos_arf_generic, state) diff --git a/src/arb/ui_pow_ui.c b/src/arb/ui_pow_ui.c index f80b9869ad..2a4769ad09 100644 --- a/src/arb/ui_pow_ui.c +++ b/src/arb/ui_pow_ui.c @@ -22,7 +22,7 @@ arb_si_pow_ui(arb_t res, slong b, ulong e, slong prec) arb_neg(res, res); } -void +static void arb_set_round_ui(arb_t res, ulong lo, slong prec) { if (lo == 0) @@ -42,7 +42,7 @@ arb_set_round_ui(arb_t res, ulong lo, slong prec) } } -void +static void arb_set_round_uiui(arb_t res, ulong hi, ulong lo, slong prec) { if (hi == 0 && lo == 0) @@ -89,7 +89,6 @@ arb_ui_pow_ui(arb_t res, ulong a, ulong exp, slong prec) } else { - ulong hi, lo; umul_ppmm(hi, lo, a, a); arb_set_round_uiui(res, hi, lo, prec); } @@ -121,7 +120,7 @@ arb_ui_pow_ui(arb_t res, ulong a, ulong exp, slong prec) umul_ppmm(hi, lo, awidth, exp); if (hi == 0) - prec = FLINT_MIN(prec, lo); + prec = FLINT_MIN((ulong) prec, lo); wp = prec + 2 * FLINT_BIT_COUNT(exp) + 4; wp_limbs = (wp + FLINT_BITS - 1) / FLINT_BITS; @@ -241,8 +240,6 @@ arb_ui_pow_ui(arb_t res, ulong a, ulong exp, slong prec) /* note: we must have yn == 1 here if wp_limbs == 1 */ if (wp_limbs == 1) { - ulong hi, lo; - /* y = y^2: mantissa */ umul_ppmm(hi, lo, yman[0], yman[0]); if (!(hi >> (FLINT_BITS - 1))) diff --git a/src/arb/zeta_ui_borwein_bsplit.c b/src/arb/zeta_ui_borwein_bsplit.c index 1f211466d6..61561c0e6d 100644 --- a/src/arb/zeta_ui_borwein_bsplit.c +++ b/src/arb/zeta_ui_borwein_bsplit.c @@ -11,6 +11,12 @@ #include "arb.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + /* With parameter n, the error is bounded by 3/(3+sqrt(8))^n */ #define ERROR_A 1.5849625007211561815 /* log2(3) */ #define ERROR_B 2.5431066063272239453 /* log2(3+sqrt(8)) */ diff --git a/src/arb/zeta_ui_euler_product.c b/src/arb/zeta_ui_euler_product.c index 991493984f..e03ff22f4a 100644 --- a/src/arb/zeta_ui_euler_product.c +++ b/src/arb/zeta_ui_euler_product.c @@ -12,6 +12,12 @@ #include "arb.h" #include "acb_dirichlet.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void arb_zeta_inv_ui_euler_product(arb_t z, ulong s, slong prec) { From df27e387d183ed75c23518ae4d0865c887226f1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 00:39:51 +0200 Subject: [PATCH 078/114] acb --- src/acb/agm1.c | 10 ++++----- src/acb/approx_dot.c | 6 +++--- src/acb/atan.c | 2 +- src/acb/barnes_g.c | 8 +++---- src/acb/dot.c | 4 ++-- src/acb/dot_siui.c | 8 +++---- src/acb/dot_uiui.c | 8 +++---- src/acb/gamma.c | 7 +++++- src/acb/get_rad_ubound_arf.c | 2 +- src/acb/lambertw.c | 38 ++++++++++++++++----------------- src/acb/lambertw_check_branch.c | 2 +- src/acb/pow.c | 6 +++--- src/acb/real_sgn.c | 2 +- src/acb/rising_ui_get_mag.c | 2 +- src/acb/rsqrt.c | 16 ++++++++------ src/acb/test/t-approx_dot.c | 4 ++++ src/acb/test/t-dot.c | 4 ++++ src/acb/vec_sort_pretty.c | 2 +- src/acb/zeta.c | 6 ++++++ 19 files changed, 78 insertions(+), 59 deletions(-) diff --git a/src/acb/agm1.c b/src/acb/agm1.c index ed250cf5a9..7040fc9753 100644 --- a/src/acb/agm1.c +++ b/src/acb/agm1.c @@ -99,7 +99,7 @@ acb_agm_close_taylor(acb_t res, acb_t z, acb_t z2, } static void -acb_agm1_around_zero(acb_t res, const acb_t z, slong prec) +acb_agm1_around_zero(acb_t res, const acb_t z, slong FLINT_UNUSED(prec)) { mag_t a, b; mag_init(a); @@ -113,7 +113,7 @@ acb_agm1_around_zero(acb_t res, const acb_t z, slong prec) mag_clear(b); } -void +static void acb_agm1_basecase(acb_t res, const acb_t z, slong prec) { acb_t a, b, t, u; @@ -207,7 +207,7 @@ acb_agm1_basecase(acb_t res, const acb_t z, slong prec) Computes (M(z), M'(z)) using a finite difference. Assumes z exact, |arg(z)| <= 3 pi / 4. */ -void +static void acb_agm1_deriv_diff(acb_t Mz, acb_t Mzp, const acb_t z, slong prec) { mag_t err, t, C; @@ -341,7 +341,7 @@ This is assuming that the circle at z with radius |eps| + r does not cross the negative half axis, which we check. */ -void +static void acb_agm1_deriv_right(acb_t Mz, acb_t Mzp, const acb_t z, slong prec) { if (acb_is_exact(z)) @@ -496,7 +496,7 @@ acb_agm1(acb_t res, const acb_t z, slong prec) } } -void +static void acb_agm1_deriv(acb_t Mz, acb_t Mzp, const acb_t z, slong prec) { /* diff --git a/src/acb/approx_dot.c b/src/acb/approx_dot.c index 11167b52e4..0db66d012a 100644 --- a/src/acb/approx_dot.c +++ b/src/acb/approx_dot.c @@ -84,7 +84,7 @@ _arb_dot_output(arb_t res, nn_ptr sum, slong sn, int negative, xn = ARF_SIZE(xm); \ xnegative = ARF_SGNBIT(xm); \ shift = s_sum_exp - xexp; \ - if (shift >= s_sn * FLINT_BITS) \ + if (shift >= (ulong) s_sn * FLINT_BITS) \ { \ } \ else \ @@ -173,7 +173,7 @@ _arf_complex_mul_gauss(arf_t e, arf_t f, const arf_t a, const arf_t b, FLINT_DLL extern slong acb_dot_gauss_dot_cutoff; #define GAUSS_CUTOFF acb_dot_gauss_dot_cutoff -void +static void acb_approx_dot_simple(acb_t res, const acb_t initial, int subtract, acb_srcptr x, slong xstep, acb_srcptr y, slong ystep, slong len, slong prec) { @@ -584,7 +584,7 @@ acb_approx_dot(acb_t res, const acb_t initial, int subtract, acb_srcptr x, slong exp = xexp + yexp; shift = sum_exp - exp; - if (shift >= sn * FLINT_BITS) + if (shift >= (ulong) sn * FLINT_BITS) { } else if (xn <= 2 && yn <= 2 && sn <= 3) diff --git a/src/acb/atan.c b/src/acb/atan.c index 44c0f4a377..2184ee1abb 100644 --- a/src/acb/atan.c +++ b/src/acb/atan.c @@ -12,7 +12,7 @@ #include "acb.h" /* branch cuts are on (+/-i)*[1,inf] */ -int +static int acb_atan_on_branch_cut(const acb_t z) { arb_t unit; diff --git a/src/acb/barnes_g.c b/src/acb/barnes_g.c index a8ac79a050..96337d2a69 100644 --- a/src/acb/barnes_g.c +++ b/src/acb/barnes_g.c @@ -12,7 +12,7 @@ #include "acb.h" #include "acb_poly.h" -void +static void _arb_const_zeta_minus_one_eval(arb_t y, slong prec) { acb_struct z[2]; @@ -31,12 +31,12 @@ _arb_const_zeta_minus_one_eval(arb_t y, slong prec) acb_clear(a); } -ARB_DEF_CACHED_CONSTANT(_arb_const_zeta_minus_one, _arb_const_zeta_minus_one_eval) +_ARB_DEF_CACHED_CONSTANT(static, static, _arb_const_zeta_minus_one, _arb_const_zeta_minus_one_eval) /* LogG(z) = (z-1) LogGamma(z) - zeta'(-1,z) + zeta'(-1) LogG'(z) = (1/2)(-2z + 1 + log(2pi)) + (z-1) digamma(z) */ -void +static void _acb_log_barnes_g_zeta(acb_t res, const acb_t z, slong prec) { acb_struct t[3]; @@ -62,7 +62,7 @@ _acb_log_barnes_g_zeta(acb_t res, const acb_t z, slong prec) acb_clear(t + 2); } -void +static void _acb_barnes_g_ui_rec(acb_t res, ulong n, slong prec) { acb_t t; diff --git a/src/acb/dot.c b/src/acb/dot.c index d1a2e3c7cb..637b0e00d8 100644 --- a/src/acb/dot.c +++ b/src/acb/dot.c @@ -176,7 +176,7 @@ _arb_dot_output(arb_t res, nn_ptr sum, slong sn, int negative, xn = ARF_SIZE(xm); \ xnegative = ARF_SGNBIT(xm); \ shift = s_sum_exp - xexp; \ - if (shift >= s_sn * FLINT_BITS) \ + if (shift >= (ulong) s_sn * FLINT_BITS) \ { \ s_serr++; \ } \ @@ -736,7 +736,7 @@ acb_dot(acb_t res, const acb_t initial, int subtract, acb_srcptr x, slong xstep, exp = xexp + yexp; shift = sum_exp - exp; - if (shift >= sn * FLINT_BITS) + if (shift >= (ulong) sn * FLINT_BITS) { /* We may yet need the top limbs for bounds. */ ARF_GET_TOP_LIMB(xtop, xm); diff --git a/src/acb/dot_siui.c b/src/acb/dot_siui.c index dfbd645f64..2043656d0a 100644 --- a/src/acb/dot_siui.c +++ b/src/acb/dot_siui.c @@ -77,10 +77,10 @@ acb_dot_siui(acb_t res, const acb_t initial, int subtract, acb_srcptr x, slong x acb_zero(res); else { - arf_t t; - arf_shallow_set_siui(t, y[1], y[0]); - arb_mul_arf(acb_realref(res), acb_realref(x), t, prec); - arb_mul_arf(acb_imagref(res), acb_imagref(x), t, prec); + arf_t tf; + arf_shallow_set_siui(tf, y[1], y[0]); + arb_mul_arf(acb_realref(res), acb_realref(x), tf, prec); + arb_mul_arf(acb_imagref(res), acb_imagref(x), tf, prec); if (subtract) acb_neg(res, res); } diff --git a/src/acb/dot_uiui.c b/src/acb/dot_uiui.c index ee1d61198e..d95a3db0ff 100644 --- a/src/acb/dot_uiui.c +++ b/src/acb/dot_uiui.c @@ -68,10 +68,10 @@ acb_dot_uiui(acb_t res, const acb_t initial, int subtract, acb_srcptr x, slong x acb_zero(res); else { - arf_t t; - arf_shallow_set_uiui(t, y[1], y[0]); - arb_mul_arf(acb_realref(res), acb_realref(x), t, prec); - arb_mul_arf(acb_imagref(res), acb_imagref(x), t, prec); + arf_t tf; + arf_shallow_set_uiui(tf, y[1], y[0]); + arb_mul_arf(acb_realref(res), acb_realref(x), tf, prec); + arb_mul_arf(acb_imagref(res), acb_imagref(x), tf, prec); if (subtract) acb_neg(res, res); } diff --git a/src/acb/gamma.c b/src/acb/gamma.c index 8d1d3101fb..c79875b599 100644 --- a/src/acb/gamma.c +++ b/src/acb/gamma.c @@ -13,6 +13,12 @@ #include "acb.h" #include "acb_hypgeom.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void acb_gamma_stirling_choose_param(int * reflect, slong * r, slong * n, const acb_t z, int use_reflect, int digamma, slong prec); @@ -21,7 +27,6 @@ void acb_gamma_stirling_bound(mag_ptr err, const acb_t z, slong k0, slong knum, void arb_gamma_stirling_coeff(arb_t b, ulong k, int digamma, slong prec); - void acb_gamma_stirling_eval(acb_t s, const acb_t z, slong nterms, int digamma, slong prec) { diff --git a/src/acb/get_rad_ubound_arf.c b/src/acb/get_rad_ubound_arf.c index 185dfad275..a13ed20512 100644 --- a/src/acb/get_rad_ubound_arf.c +++ b/src/acb/get_rad_ubound_arf.c @@ -12,7 +12,7 @@ #include "acb.h" void -acb_get_rad_ubound_arf(arf_t u, const acb_t z, slong prec) +acb_get_rad_ubound_arf(arf_t u, const acb_t z, slong FLINT_UNUSED(prec)) { /* fixme: this bound is very sloppy */ diff --git a/src/acb/lambertw.c b/src/acb/lambertw.c index 06df5ffef9..2ed61e802a 100644 --- a/src/acb/lambertw.c +++ b/src/acb/lambertw.c @@ -23,7 +23,7 @@ #endif /* Check if z crosses a branch cut. */ -int +static int acb_lambertw_branch_crossing(const acb_t z, const acb_t ez1, const fmpz_t k) { if (arb_contains_zero(acb_imagref(z)) && !arb_is_nonnegative(acb_imagref(z))) @@ -45,7 +45,7 @@ acb_lambertw_branch_crossing(const acb_t z, const acb_t ez1, const fmpz_t k) } /* todo: remove radii */ -void +static void acb_lambertw_halley_step(acb_t res, acb_t ew, const acb_t z, const acb_t w, slong prec) { acb_t t, u, v; @@ -77,7 +77,7 @@ acb_lambertw_halley_step(acb_t res, acb_t ew, const acb_t z, const acb_t w, slon } /* assumes no aliasing of w and p */ -void +static void acb_lambertw_branchpoint_series(acb_t w, const acb_t t, int bound, slong prec) { slong i; @@ -109,7 +109,7 @@ acb_lambertw_branchpoint_series(acb_t w, const acb_t t, int bound, slong prec) } } -void +static void acb_lambertw_principal_d(acb_t res, const acb_t z) { double za, zb, wa, wb, ewa, ewb, t, u, q, r; @@ -169,7 +169,7 @@ acb_lambertw_principal_d(acb_t res, const acb_t z) acb_set_d_d(res, wa, wb); } -void +static void acb_lambertw_initial_asymp(acb_t w, const acb_t z, const fmpz_t k, slong prec) { acb_t L1, L2, t; @@ -204,7 +204,7 @@ acb_lambertw_initial_asymp(acb_t w, const acb_t z, const fmpz_t k, slong prec) } /* assumes no aliasing */ -slong +static slong acb_lambertw_initial(acb_t res, const acb_t z, const acb_t ez1, const fmpz_t k, slong prec) { /* Handle z very close to 0 on the principal branch. */ @@ -255,8 +255,8 @@ acb_lambertw_initial(acb_t res, const acb_t z, const acb_t ez1, const fmpz_t k, } /* note: z should be exact here */ -void acb_lambertw_main(acb_t res, const acb_t z, - const acb_t ez1, const fmpz_t k, int flags, slong prec) +static void acb_lambertw_main(acb_t res, const acb_t z, + const acb_t ez1, const fmpz_t k, int FLINT_UNUSED(flags), slong prec) { acb_t w, t, oldw, ew; mag_t err; @@ -306,7 +306,7 @@ void acb_lambertw_main(acb_t res, const acb_t z, during the Halley iteration. */ have_ew = 0; - for (i = 0; i < 5 + FLINT_BIT_COUNT(prec + extraprec); i++) + for (i = 0; i < 5 + (slong) FLINT_BIT_COUNT(prec + extraprec); i++) { /* todo: should we restart? */ if (!acb_is_finite(w)) @@ -353,13 +353,12 @@ void acb_lambertw_main(acb_t res, const acb_t z, if (acb_lambertw_check_branch(w, k, wp)) { acb_t u, r, eu1; - mag_t err, rad; + mag_t rad; acb_init(u); acb_init(r); acb_init(eu1); - mag_init(err); mag_init(rad); if (have_ew) @@ -397,7 +396,6 @@ void acb_lambertw_main(acb_t res, const acb_t z, acb_clear(u); acb_clear(r); acb_clear(eu1); - mag_clear(err); mag_clear(rad); } else @@ -412,7 +410,7 @@ void acb_lambertw_main(acb_t res, const acb_t z, mag_clear(err); } -void +static void acb_lambertw_cleared_cut(acb_t res, const acb_t z, const fmpz_t k, int flags, slong prec) { acb_t ez1; @@ -456,9 +454,9 @@ acb_lambertw_cleared_cut(acb_t res, const acb_t z, const fmpz_t k, int flags, sl } /* Extremely close to the branch point at -1/e, use the series expansion directly. */ -int +static int acb_lambertw_try_near_branch_point(acb_t res, const acb_t z, - const acb_t ez1, const fmpz_t k, int flags, slong prec) + const acb_t ez1, const fmpz_t k, int FLINT_UNUSED(flags), slong prec) { if (fmpz_is_zero(k) || (fmpz_is_one(k) && arb_is_negative(acb_imagref(z))) || (fmpz_equal_si(k, -1) && arb_is_nonnegative(acb_imagref(z)))) @@ -482,7 +480,7 @@ acb_lambertw_try_near_branch_point(acb_t res, const acb_t z, return 0; } -void +static void acb_lambertw_cleared_cut_fix_small(acb_t res, const acb_t z, const acb_t ez1, const fmpz_t k, int flags, slong prec) { @@ -530,7 +528,7 @@ acb_lambertw_cleared_cut_fix_small(acb_t res, const acb_t z, arf_clear(eps); } -void +static void _acb_lambertw(acb_t res, const acb_t z, const acb_t ez1, const fmpz_t k, int flags, slong prec) { slong goal, ebits, ebits2, ls, lt; @@ -569,7 +567,7 @@ _acb_lambertw(acb_t res, const acb_t z, const acb_t ez1, const fmpz_t k, int fla /* ebits ~= log2(|log(z) + 2 pi i k|) */ /* ebits2 ~= log2(log(log(z))) */ - ebits = FLINT_MAX(ebits, fmpz_bits(k)); + ebits = FLINT_MAX(ebits, (slong) fmpz_bits(k)); ebits = FLINT_MAX(ebits, 1) - 1; ebits2 = FLINT_BIT_COUNT(ebits); ebits2 = FLINT_MAX(ebits2, 1) - 1; @@ -655,7 +653,7 @@ _acb_lambertw(acb_t res, const acb_t z, const acb_t ez1, const fmpz_t k, int fla } } -void +static void acb_lambertw_middle(acb_t res, const acb_t z, slong prec) { fmpz_t k; @@ -741,7 +739,7 @@ acb_lambertw_middle(acb_t res, const acb_t z, slong prec) fmpz_clear(k); } -void +static void acb_lambertw_left(acb_t res, const acb_t z, const fmpz_t k, slong prec) { if (acb_contains_zero(z) && !(fmpz_equal_si(k, -1) && acb_is_real(z))) diff --git a/src/acb/lambertw_check_branch.c b/src/acb/lambertw_check_branch.c index 6b4e682bdd..429afdfc89 100644 --- a/src/acb/lambertw_check_branch.c +++ b/src/acb/lambertw_check_branch.c @@ -11,7 +11,7 @@ #include "acb.h" -int +static int _acb_lambertw_check_branch(const acb_t w, const fmpz_t k, slong prec) { arb_t t, u, v, a, b; diff --git a/src/acb/pow.c b/src/acb/pow.c index 2a982667c3..ecdcd935b2 100644 --- a/src/acb/pow.c +++ b/src/acb/pow.c @@ -11,7 +11,7 @@ #include "acb.h" -void +static void acb_pow_fmpz_binexp(acb_t y, const acb_t b, const fmpz_t e, slong prec) { slong i, wp, bits; @@ -128,7 +128,7 @@ acb_pow_si(acb_t y, const acb_t b, slong e, slong prec) fmpz_clear(f); } -void +static void _acb_pow_exp(acb_t z, const acb_t x, const acb_t y, slong prec) { acb_t t; @@ -139,7 +139,7 @@ _acb_pow_exp(acb_t z, const acb_t x, const acb_t y, slong prec) acb_clear(t); } -void +static void _acb_pow_arb_exp(acb_t z, const acb_t x, const arb_t y, slong prec) { acb_t t; diff --git a/src/acb/real_sgn.c b/src/acb/real_sgn.c index 56feb1479a..06081dd2ca 100644 --- a/src/acb/real_sgn.c +++ b/src/acb/real_sgn.c @@ -12,7 +12,7 @@ #include "acb.h" void -acb_real_sgn(acb_t res, const acb_t z, int analytic, slong prec) +acb_real_sgn(acb_t res, const acb_t z, int analytic, slong FLINT_UNUSED(prec)) { if (!acb_is_finite(z) || (analytic && arb_contains_zero(acb_realref(z)))) { diff --git a/src/acb/rising_ui_get_mag.c b/src/acb/rising_ui_get_mag.c index b4fc0c21e5..b541e4e10d 100644 --- a/src/acb/rising_ui_get_mag.c +++ b/src/acb/rising_ui_get_mag.c @@ -67,7 +67,7 @@ acb_rising_ui_get_mag(mag_t bound, const acb_t s, ulong n) else { arb_t a; - slong k; + ulong k; mag_t bound2, t, u; arb_init(a); diff --git a/src/acb/rsqrt.c b/src/acb/rsqrt.c index c2fdd6d23f..edc3f42341 100644 --- a/src/acb/rsqrt.c +++ b/src/acb/rsqrt.c @@ -12,7 +12,7 @@ #include "acb.h" /* r - |m| */ -void +static void arb_get_mag_reverse(mag_t res, const arb_t x) { mag_t t; @@ -24,7 +24,7 @@ arb_get_mag_reverse(mag_t res, const arb_t x) /* upper bound for re(rsqrt(x+yi)) / |rsqrt(x+yi)|, given upper bound for x, lower bound for y */ -void +static void mag_rsqrt_re_quadrant1_upper(mag_t res, const mag_t x, const mag_t y) { if (mag_is_zero(x)) @@ -55,9 +55,10 @@ mag_rsqrt_re_quadrant1_upper(mag_t res, const mag_t x, const mag_t y) mag_sqrt(res, res); } +#if 0 /* lower bound for re(rsqrt(x+yi)) / |rsqrt(x+yi)|, given lower bound for x, upper bound for y */ -void +static void mag_rsqrt_re_quadrant1_lower(mag_t res, const mag_t x, const mag_t y) { if (mag_is_zero(x)) @@ -87,10 +88,11 @@ mag_rsqrt_re_quadrant1_lower(mag_t res, const mag_t x, const mag_t y) mag_sqrt_lower(res, res); } +#endif /* upper bound for re(rsqrt(-x+yi)) / |rsqrt(x+yi)|, given lower bound for -x, upper bound for y */ -void +static void mag_rsqrt_re_quadrant2_upper(mag_t res, const mag_t x, const mag_t y) { if (mag_is_zero(x)) @@ -128,7 +130,7 @@ mag_rsqrt_re_quadrant2_upper(mag_t res, const mag_t x, const mag_t y) /* lower bound for re(rsqrt(-x+yi)) / |rsqrt(x+yi)|, given upper bound for -x, lower bound for y */ -void +static void mag_rsqrt_re_quadrant2_lower(mag_t res, const mag_t x, const mag_t y) { if (mag_is_zero(x)) @@ -164,7 +166,7 @@ mag_rsqrt_re_quadrant2_lower(mag_t res, const mag_t x, const mag_t y) mag_sqrt_lower(res, res); } -void +static void acb_rsqrt_wide(acb_t res, const acb_t z, slong prec) { mag_t ax, ay, bx, by, cx, cy, dx, dy, am, bm; @@ -328,7 +330,7 @@ acb_rsqrt_wide(acb_t res, const acb_t z, slong prec) mag_clear(one); } -void +static void acb_rsqrt_precise(acb_t y, const acb_t x, slong prec) { #define a acb_realref(x) diff --git a/src/acb/test/t-approx_dot.c b/src/acb/test/t-approx_dot.c index 57c248112b..a7d566b008 100644 --- a/src/acb/test/t-approx_dot.c +++ b/src/acb/test/t-approx_dot.c @@ -12,7 +12,11 @@ #include "test_helpers.h" #include "acb.h" +/* Defined in t-approx_dot.c and t-dot.c */ +#ifndef acb_dot_gauss_dot_cutoff +# define acb_dot_gauss_dot_cutoff acb_dot_gauss_dot_cutoff FLINT_DLL extern slong acb_dot_gauss_dot_cutoff; +#endif TEST_FUNCTION_START(acb_approx_dot, state) { diff --git a/src/acb/test/t-dot.c b/src/acb/test/t-dot.c index 670143a0bf..4ce6f54df3 100644 --- a/src/acb/test/t-dot.c +++ b/src/acb/test/t-dot.c @@ -12,7 +12,11 @@ #include "test_helpers.h" #include "acb.h" +/* Defined in t-approx_dot.c and t-dot.c */ +#ifndef acb_dot_gauss_dot_cutoff +# define acb_dot_gauss_dot_cutoff acb_dot_gauss_dot_cutoff FLINT_DLL extern slong acb_dot_gauss_dot_cutoff; +#endif TEST_FUNCTION_START(acb_dot, state) { diff --git a/src/acb/vec_sort_pretty.c b/src/acb/vec_sort_pretty.c index 0660eb1d22..cb3dac4521 100644 --- a/src/acb/vec_sort_pretty.c +++ b/src/acb/vec_sort_pretty.c @@ -20,7 +20,7 @@ typedef int(*__compar_fn_t) (__const void *, __const void *); #endif #endif -int acb_cmp_pretty(const acb_t a, const acb_t b) +static int acb_cmp_pretty(const acb_t a, const acb_t b) { arb_t t, u, v; int res; diff --git a/src/acb/zeta.c b/src/acb/zeta.c index aa87f67b6d..37e99ddf9d 100644 --- a/src/acb/zeta.c +++ b/src/acb/zeta.c @@ -13,6 +13,12 @@ #include "acb_poly.h" #include "acb_dirichlet.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void acb_zeta_si(acb_t z, slong s, slong prec) { From 4c51e01bebdc08dc72d2bad0863d8c08c89a2b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 09:25:37 +0200 Subject: [PATCH 079/114] arb_mat --- src/arb_mat/approx_lu.c | 6 +++--- src/arb_mat/approx_mul.c | 2 +- src/arb_mat/approx_solve_tril.c | 4 ++-- src/arb_mat/approx_solve_triu.c | 4 ++-- src/arb_mat/dct.c | 2 +- src/arb_mat/det_lu.c | 6 +++--- src/arb_mat/det_precond.c | 2 +- src/arb_mat/exp.c | 6 ++++++ src/arb_mat/mul_block.c | 6 +++--- src/arb_mat/mul_threaded.c | 2 +- src/arb_mat/randtest.c | 4 ++-- src/arb_mat/solve_preapprox.c | 2 +- src/arb_mat/solve_precond.c | 4 ++-- src/arb_mat/test/t-solve_preapprox.c | 16 ++++++++-------- 14 files changed, 36 insertions(+), 30 deletions(-) diff --git a/src/arb_mat/approx_lu.c b/src/arb_mat/approx_lu.c index a8348e1fac..8b794e30b4 100644 --- a/src/arb_mat/approx_lu.c +++ b/src/arb_mat/approx_lu.c @@ -36,7 +36,7 @@ _apply_permutation(slong * AP, arb_mat_t A, slong * P, } } -void +static void _arb_vec_approx_scalar_addmul(arb_ptr res, arb_srcptr vec, slong len, const arb_t c, slong prec) { @@ -46,7 +46,7 @@ _arb_vec_approx_scalar_addmul(arb_ptr res, arb_srcptr vec, arb_midref(vec + i), arb_midref(c), prec, ARF_RND_DOWN); } -int +static int arb_mat_approx_lu_classical(slong * P, arb_mat_t LU, const arb_mat_t A, slong prec) { arf_t d; @@ -108,7 +108,7 @@ arb_mat_approx_lu_classical(slong * P, arb_mat_t LU, const arb_mat_t A, slong pr return result; } -int +static int arb_mat_approx_lu_recursive(slong * P, arb_mat_t LU, const arb_mat_t A, slong prec) { slong i, m, n, r1, r2, n1; diff --git a/src/arb_mat/approx_mul.c b/src/arb_mat/approx_mul.c index 9cc270768a..cf92f6112e 100644 --- a/src/arb_mat/approx_mul.c +++ b/src/arb_mat/approx_mul.c @@ -12,7 +12,7 @@ #include "arb.h" #include "arb_mat.h" -void +static void arb_mat_approx_mul_classical(arb_mat_t C, const arb_mat_t A, const arb_mat_t B, slong prec) { slong ar, br, bc, i, j, k; diff --git a/src/arb_mat/approx_solve_tril.c b/src/arb_mat/approx_solve_tril.c index ea66e9d064..b43c743975 100644 --- a/src/arb_mat/approx_solve_tril.c +++ b/src/arb_mat/approx_solve_tril.c @@ -18,7 +18,7 @@ arb_approx_div(arb_t z, const arb_t x, const arb_t y, slong prec) arf_div(arb_midref(z), arb_midref(x), arb_midref(y), prec, ARB_RND); } -void +static void arb_mat_approx_solve_tril_classical(arb_mat_t X, const arb_mat_t L, const arb_mat_t B, int unit, slong prec) { @@ -55,7 +55,7 @@ arb_mat_approx_solve_tril_classical(arb_mat_t X, arb_clear(s); } -void +static void arb_mat_approx_solve_tril_recursive(arb_mat_t X, const arb_mat_t L, const arb_mat_t B, int unit, slong prec) { diff --git a/src/arb_mat/approx_solve_triu.c b/src/arb_mat/approx_solve_triu.c index 4992f0918e..3733ee2401 100644 --- a/src/arb_mat/approx_solve_triu.c +++ b/src/arb_mat/approx_solve_triu.c @@ -18,7 +18,7 @@ arb_approx_div(arb_t z, const arb_t x, const arb_t y, slong prec) arf_div(arb_midref(z), arb_midref(x), arb_midref(y), prec, ARB_RND); } -void +static void arb_mat_approx_solve_triu_classical(arb_mat_t X, const arb_mat_t U, const arb_mat_t B, int unit, slong prec) { @@ -55,7 +55,7 @@ arb_mat_approx_solve_triu_classical(arb_mat_t X, const arb_mat_t U, arb_clear(s); } -void +static void arb_mat_approx_solve_triu_recursive(arb_mat_t X, const arb_mat_t U, const arb_mat_t B, int unit, slong prec) { diff --git a/src/arb_mat/dct.c b/src/arb_mat/dct.c index 14b08b2bdf..246a4d097b 100644 --- a/src/arb_mat/dct.c +++ b/src/arb_mat/dct.c @@ -14,7 +14,7 @@ #include "acb_dirichlet.h" void -arb_mat_dct(arb_mat_t res, int kind, slong prec) +arb_mat_dct(arb_mat_t res, int FLINT_UNUSED(kind), slong prec) { acb_dirichlet_roots_t roots; acb_t t; diff --git a/src/arb_mat/det_lu.c b/src/arb_mat/det_lu.c index d88fdcc8b3..82f5141fb6 100644 --- a/src/arb_mat/det_lu.c +++ b/src/arb_mat/det_lu.c @@ -12,7 +12,7 @@ #include "arb.h" #include "arb_mat.h" -slong +static slong arb_mat_gauss_partial(arb_mat_t A, slong prec) { arb_t e; @@ -59,7 +59,7 @@ arb_mat_gauss_partial(arb_mat_t A, slong prec) return rank * sign; } -void +static void arb_vec_get_arf_2norm_squared_bound(arf_t s, arb_srcptr vec, slong len, slong prec) { slong i; @@ -77,7 +77,7 @@ arb_vec_get_arf_2norm_squared_bound(arf_t s, arb_srcptr vec, slong len, slong pr arf_clear(t); } -void +static void arb_mat_det_lu_inplace(arb_t det, arb_mat_t A, slong prec) { slong i, n, sign, rank; diff --git a/src/arb_mat/det_precond.c b/src/arb_mat/det_precond.c index 7f9de49c1d..c51f94a714 100644 --- a/src/arb_mat/det_precond.c +++ b/src/arb_mat/det_precond.c @@ -26,7 +26,7 @@ _apply_permutation(arb_mat_t A, slong * P, slong n) /* Enclosure of det(I + eps) using Gershgorin circles. Can be improved. */ -void +static void arb_mat_det_one_gershgorin(arb_t det, const arb_mat_t A) { slong n, i, j; diff --git a/src/arb_mat/exp.c b/src/arb_mat/exp.c index d98d9942b9..7447e14c05 100644 --- a/src/arb_mat/exp.c +++ b/src/arb_mat/exp.c @@ -15,6 +15,12 @@ #include "arb.h" #include "arb_mat.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define LOG2_OVER_E 0.25499459743395350926 slong diff --git a/src/arb_mat/mul_block.c b/src/arb_mat/mul_block.c index c4ce53a048..d6a7569d53 100644 --- a/src/arb_mat/mul_block.c +++ b/src/arb_mat/mul_block.c @@ -13,7 +13,7 @@ #include "arb.h" #include "arb_mat.h" -int arb_mat_is_lagom(const arb_mat_t A) +static int arb_mat_is_lagom(const arb_mat_t A) { slong i, j, M, N; @@ -35,7 +35,7 @@ int arb_mat_is_lagom(const arb_mat_t A) /* allow changing this from the test code */ FLINT_DLL slong arb_mat_mul_block_min_block_size = 0; -void +static void arb_mat_mid_addmul_block_fallback(arb_mat_t C, const arb_mat_t A, const arb_mat_t B, slong block_start, @@ -85,7 +85,7 @@ arb_mat_mid_addmul_block_fallback(arb_mat_t C, flint_free(tmpA); } -void +static void arb_mat_mid_addmul_block_prescaled(arb_mat_t C, const arb_mat_t A, const arb_mat_t B, slong block_start, diff --git a/src/arb_mat/mul_threaded.c b/src/arb_mat/mul_threaded.c index 44e6e81a13..65e78ad2bd 100644 --- a/src/arb_mat/mul_threaded.c +++ b/src/arb_mat/mul_threaded.c @@ -29,7 +29,7 @@ typedef struct } _worker_arg; -void +static void _arb_mat_mul_thread(void * arg_ptr) { _worker_arg arg = *((_worker_arg *) arg_ptr); diff --git a/src/arb_mat/randtest.c b/src/arb_mat/randtest.c index 62f28152f5..3b58f346f3 100644 --- a/src/arb_mat/randtest.c +++ b/src/arb_mat/randtest.c @@ -22,14 +22,14 @@ arb_mat_randtest(arb_mat_t mat, flint_rand_t state, slong prec, slong mag_bits) if (n_randint(state, 2)) for (i = 0; i < arb_mat_nrows(mat); i++) for (j = 0; j < arb_mat_ncols(mat); j++) - if (n_randint(state, 100) < density) + if ((slong) n_randint(state, 100) < density) arb_randtest(arb_mat_entry(mat, i, j), state, prec, mag_bits); else arb_zero(arb_mat_entry(mat, i, j)); else for (i = 0; i < arb_mat_nrows(mat); i++) for (j = 0; j < arb_mat_ncols(mat); j++) - if (n_randint(state, 100) < density) + if ((slong) n_randint(state, 100) < density) arb_randtest_precise(arb_mat_entry(mat, i, j), state, prec, mag_bits); else arb_zero(arb_mat_entry(mat, i, j)); diff --git a/src/arb_mat/solve_preapprox.c b/src/arb_mat/solve_preapprox.c index 8927149472..65d1d146d9 100644 --- a/src/arb_mat/solve_preapprox.c +++ b/src/arb_mat/solve_preapprox.c @@ -16,7 +16,7 @@ * Helper function to compute a lower bound of 1 - inf_norm(I - A*B). * Returns zero when this lower bound is zero. */ -int _mag_err_complement(mag_t m, +static int _mag_err_complement(mag_t m, const arb_mat_t A, const arb_mat_t B, slong prec) { slong n; diff --git a/src/arb_mat/solve_precond.c b/src/arb_mat/solve_precond.c index 0be3052c74..3b8671824d 100644 --- a/src/arb_mat/solve_precond.c +++ b/src/arb_mat/solve_precond.c @@ -12,7 +12,7 @@ #include "arb.h" #include "arb_mat.h" -int +static int _arb_mat_solve_c(arb_mat_t X, const arb_mat_t A, const arb_mat_t B, slong prec) { int result; @@ -52,7 +52,7 @@ _arb_mat_solve_c(arb_mat_t X, const arb_mat_t A, const arb_mat_t B, slong prec) return result; } -int +static int _arb_mat_solve_d(arb_mat_t X, const arb_mat_t A, const arb_mat_t B, slong prec) { int result; diff --git a/src/arb_mat/test/t-solve_preapprox.c b/src/arb_mat/test/t-solve_preapprox.c index 3d6f862a62..3970b2de61 100644 --- a/src/arb_mat/test/t-solve_preapprox.c +++ b/src/arb_mat/test/t-solve_preapprox.c @@ -100,20 +100,20 @@ TEST_FUNCTION_START(arb_mat_solve_preapprox, state) /* Sample a square matrix QE with inf-norm less than 1. */ { - fmpq_t m; - fmpq_init(m); + fmpq_t mq; + fmpq_init(mq); fmpq_mat_randtest(QE, state, qbits); - _fmpq_mat_inf_norm(m, QE); - if (!fmpq_is_zero(m)) + _fmpq_mat_inf_norm(mq, QE); + if (!fmpq_is_zero(mq)) { slong p, q; q = 64; p = n_randint(state, q); - fmpq_inv(m, m); - _fmpq_mul_si_frac(m, m, p, q); - _fmpq_mat_scalar_mul_fmpq(QE, QE, m); + fmpq_inv(mq, mq); + _fmpq_mul_si_frac(mq, mq, p, q); + _fmpq_mat_scalar_mul_fmpq(QE, QE, mq); } - fmpq_clear(m); + fmpq_clear(mq); } /* Sample an unrestricted square matrix QR. */ From e4dbbc9c6b7c99b0ab1b2a2c571e911e4563815d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 09:32:03 +0200 Subject: [PATCH 080/114] arb_poly --- src/arb_poly/gamma_series.c | 10 ++++++++-- src/arb_poly/interpolate_fast.c | 2 +- src/arb_poly/lgamma_series.c | 2 -- src/arb_poly/mullow_block.c | 2 +- src/arb_poly/nth_derivative.c | 2 +- src/arb_poly/rgamma_series.c | 2 -- src/arb_poly/swinnerton_dyer_ui.c | 8 ++++---- src/arb_poly/taylor_shift.c | 6 ++++++ 8 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/arb_poly/gamma_series.c b/src/arb_poly/gamma_series.c index 48380cd476..87c7bbae68 100644 --- a/src/arb_poly/gamma_series.c +++ b/src/arb_poly/gamma_series.c @@ -11,6 +11,12 @@ #include "arb_poly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void arb_gamma_stirling_bound(mag_ptr err, const arb_t x, slong k0, slong knum, slong n); void arb_hypgeom_gamma_stirling_choose_param(int * reflect, slong * r, slong * n, @@ -88,7 +94,7 @@ bsplit(arb_ptr Q, arb_ptr T, const arb_t z, slong a, slong b, slong num, slong p } } -void +static void _arb_poly_mullow_cpx(arb_ptr res, arb_srcptr src, slong len, const arb_t c, slong trunc, slong prec) { slong i; @@ -105,7 +111,7 @@ _arb_poly_mullow_cpx(arb_ptr res, arb_srcptr src, slong len, const arb_t c, slon arb_mul(res, src, c, prec); } -void +static void _arb_poly_log_cpx_series(arb_ptr res, const arb_t c, slong num, slong prec) { slong i; diff --git a/src/arb_poly/interpolate_fast.c b/src/arb_poly/interpolate_fast.c index 734ba32cfe..55a83275da 100644 --- a/src/arb_poly/interpolate_fast.c +++ b/src/arb_poly/interpolate_fast.c @@ -60,7 +60,7 @@ _arb_poly_interpolate_fast_precomp(arb_ptr poly, for (i = 0; i < len; i++) arb_mul(poly + i, weights + i, ys + i, prec); - for (i = 0; i < FLINT_CLOG2(len); i++) + for (i = 0; (ulong) i < FLINT_CLOG2(len); i++) { pow = (WORD(1) << i); pa = tree[i]; diff --git a/src/arb_poly/lgamma_series.c b/src/arb_poly/lgamma_series.c index 185b7d4f74..6f3de8636c 100644 --- a/src/arb_poly/lgamma_series.c +++ b/src/arb_poly/lgamma_series.c @@ -12,8 +12,6 @@ #include "arb_poly.h" #include "arb_hypgeom.h" -slong arf_get_si(const arf_t x, arf_rnd_t rnd); - void _arb_poly_lgamma_series_at_one(arb_ptr u, slong len, slong prec); void arb_hypgeom_gamma_stirling_choose_param(int * reflect, slong * r, slong * n, diff --git a/src/arb_poly/mullow_block.c b/src/arb_poly/mullow_block.c index 675bd0caf6..c6d2e7f5d6 100644 --- a/src/arb_poly/mullow_block.c +++ b/src/arb_poly/mullow_block.c @@ -19,7 +19,7 @@ # include #endif -void +static void _arb_poly_get_scale(fmpz_t scale, arb_srcptr x, slong xlen, arb_srcptr y, slong ylen) { diff --git a/src/arb_poly/nth_derivative.c b/src/arb_poly/nth_derivative.c index d79fe3dc6a..fbe0ea5cea 100644 --- a/src/arb_poly/nth_derivative.c +++ b/src/arb_poly/nth_derivative.c @@ -26,7 +26,7 @@ arb_poly_nth_derivative(arb_poly_t res, const arb_poly_t poly, ulong n, slong pr { const slong len = poly->length; - if (len <= n) + if ((ulong) len <= n) { arb_poly_zero(res); } diff --git a/src/arb_poly/rgamma_series.c b/src/arb_poly/rgamma_series.c index e06ee09d6d..f055291f94 100644 --- a/src/arb_poly/rgamma_series.c +++ b/src/arb_poly/rgamma_series.c @@ -11,8 +11,6 @@ #include "arb_poly.h" -slong arf_get_si(const arf_t x, arf_rnd_t rnd); - void _arb_poly_lgamma_series_at_one(arb_ptr u, slong len, slong prec); void arb_hypgeom_gamma_stirling_choose_param(int * reflect, slong * r, slong * n, diff --git a/src/arb_poly/swinnerton_dyer_ui.c b/src/arb_poly/swinnerton_dyer_ui.c index cfcedc19f7..8aeee0c26e 100644 --- a/src/arb_poly/swinnerton_dyer_ui.c +++ b/src/arb_poly/swinnerton_dyer_ui.c @@ -23,7 +23,7 @@ slong _arb_poly_swinnerton_dyer_ui_prec(ulong n) { - slong i; + ulong i; double u, N; N = UWORD(1) << n; @@ -69,7 +69,7 @@ _arb_poly_swinnerton_dyer_ui(arb_ptr T, ulong n, slong trunc, slong prec) tmp2 = flint_malloc((N / 4 + 1) * sizeof(arb_struct)); tmp3 = _arb_vec_init(N / 2); - for (i = 0; i < n; i++) + for (i = 0; (ulong) i < n; i++) arb_sqrt_ui(square_roots + i, n_nth_prime(i + 1), prec); /* Build deflated quadratic factors */ @@ -77,7 +77,7 @@ _arb_poly_swinnerton_dyer_ui(arb_ptr T, ulong n, slong trunc, slong prec) { arb_zero(T + i); - for (j = 0; j < n; j++) + for (j = 0; (ulong) j < n; j++) { if ((i >> j) & 1) arb_add(T + i, T + i, square_roots + j, prec); @@ -90,7 +90,7 @@ _arb_poly_swinnerton_dyer_ui(arb_ptr T, ulong n, slong trunc, slong prec) } /* For each level... */ - for (i = 0; i < n - 1; i++) + for (i = 0; (ulong) i < n - 1; i++) { slong stride = UWORD(1) << i; diff --git a/src/arb_poly/taylor_shift.c b/src/arb_poly/taylor_shift.c index 2ba5e1615e..3f5f57e04c 100644 --- a/src/arb_poly/taylor_shift.c +++ b/src/arb_poly/taylor_shift.c @@ -18,6 +18,12 @@ # include #endif +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + int _gr_arb_poly_taylor_shift(arb_ptr res, arb_srcptr poly, slong n, const arb_t c, gr_ctx_t ctx) { From df651f35e2a9e89eb7fb2b46ac19c55ce4f2a0fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 10:01:24 +0200 Subject: [PATCH 081/114] arb_hypgeom --- src/arb_hypgeom/2f1_integration.c | 2 +- src/arb_hypgeom/airy_zero.c | 2 +- src/arb_hypgeom/erf.c | 23 +++++------ src/arb_hypgeom/erfinv.c | 2 +- src/arb_hypgeom/gamma.c | 6 +++ src/arb_hypgeom/gamma_fmpq.c | 22 +++++----- src/arb_hypgeom/gamma_stirling_sum_improved.c | 24 +++++------ src/arb_hypgeom/gamma_taylor.c | 40 +++++++++---------- src/arb_hypgeom/gamma_upper_fmpq.c | 6 ++- .../gamma_upper_fmpq_step_bsplit.c | 2 +- src/arb_hypgeom/legendre_p_ui.c | 6 +-- src/arb_hypgeom/legendre_p_ui_asymp.c | 6 +-- src/arb_hypgeom/legendre_p_ui_one.c | 10 ++--- src/arb_hypgeom/legendre_p_ui_root.c | 2 +- src/arb_hypgeom/legendre_p_ui_zero.c | 2 +- src/arb_hypgeom/lgamma.c | 2 +- src/arb_hypgeom/rising_ui_forward.c | 6 +++ src/arb_hypgeom/rising_ui_jet.c | 2 +- src/arb_hypgeom/rising_ui_jet_bs.c | 8 ++-- src/arb_hypgeom/rising_ui_jet_powsum.c | 8 ++-- src/arb_hypgeom/rising_ui_jet_rs.c | 15 +++---- src/arb_hypgeom/rising_ui_rec.c | 2 +- src/arb_hypgeom/rising_ui_rs.c | 5 ++- src/arb_hypgeom/si.c | 4 +- src/arb_hypgeom/sum_fmpq_arb_bs.c | 2 +- src/arb_hypgeom/sum_fmpq_arb_rs.c | 6 +++ src/arb_hypgeom/sum_fmpq_imag_arb_bs.c | 2 +- src/arb_hypgeom/u_integration.c | 2 +- 28 files changed, 120 insertions(+), 99 deletions(-) diff --git a/src/arb_hypgeom/2f1_integration.c b/src/arb_hypgeom/2f1_integration.c index bd72750f68..96afda37ce 100644 --- a/src/arb_hypgeom/2f1_integration.c +++ b/src/arb_hypgeom/2f1_integration.c @@ -376,7 +376,7 @@ estimate_magnitude(mag_t res, const arb_t ra, const arb_t rb, const arb_t rc, co } } -int +static int _arb_hypgeom_2f1_integration(arb_t res, const arb_t a, const arb_t b, const arb_t c, const arb_t z, int regularized, slong prec) { acb_calc_integrate_opt_t opt; diff --git a/src/arb_hypgeom/airy_zero.c b/src/arb_hypgeom/airy_zero.c index ab293b4b3d..b79c413d4e 100644 --- a/src/arb_hypgeom/airy_zero.c +++ b/src/arb_hypgeom/airy_zero.c @@ -55,7 +55,7 @@ static const double initial[4][10] = {{ -3098043823061022.0,-3359196018589429.0,-3610552233837226.0, }}; -void +static void _arb_hypgeom_airy_zero(arb_t res, const fmpz_t n, int which, slong prec) { slong asymp_accuracy, wp; diff --git a/src/arb_hypgeom/erf.c b/src/arb_hypgeom/erf.c index a0059f81ba..b954ee12ef 100644 --- a/src/arb_hypgeom/erf.c +++ b/src/arb_hypgeom/erf.c @@ -18,7 +18,7 @@ #define EXP1 2.7182818284590452354 #define INV_LOG2 1.4426950408889634074 -void +static void arb_hypgeom_erf_one_eps(arb_t res, const arb_t z) { mag_t t, u; @@ -52,7 +52,7 @@ arb_hypgeom_erf_one_eps(arb_t res, const arb_t z) mag_clear(u); } -void +static void arb_hypgeom_erf_propagated_error(mag_t err, const arb_t z) { mag_t x; @@ -75,7 +75,7 @@ arb_hypgeom_erf_propagated_error(mag_t err, const arb_t z) mag_clear(x); } -void +static void arb_hypgeom_erf_1f1b(arb_t res, const arb_t z, slong prec) { arb_t t, u; @@ -95,14 +95,14 @@ arb_hypgeom_erf_1f1b(arb_t res, const arb_t z, slong prec) } else { - double u, dz; + double ud, dz; dz = arf_get_d(arb_midref(z), ARF_RND_DOWN); dz = fabs(dz); - u = -dz * dz + prec * LOG2 + log(dz); + ud = -dz * dz + prec * LOG2 + log(dz); if (dz < 1.0) - u = FLINT_MAX(u, 1e-6); - u = u / d_lambertw(u / (EXP1 * dz * dz)); - N = u + 1; + ud = FLINT_MAX(ud, 1e-6); + ud = ud / d_lambertw(ud / (EXP1 * dz * dz)); + N = ud + 1; } N = FLINT_MAX(N, 1); @@ -128,7 +128,7 @@ arb_hypgeom_erf_1f1b(arb_t res, const arb_t z, slong prec) mag_clear(err); } -void +static void arb_hypgeom_erf_asymp(arb_t res, const arb_t z, slong N, int complementary, slong prec, slong prec2) { arb_t t, u; @@ -139,7 +139,6 @@ arb_hypgeom_erf_asymp(arb_t res, const arb_t z, slong N, int complementary, slon (complementary && arb_rel_accuracy_bits(z) < prec))) { arb_t zmid; - mag_t err; arb_init(zmid); mag_init(err); @@ -195,7 +194,7 @@ arb_hypgeom_erf_asymp(arb_t res, const arb_t z, slong N, int complementary, slon mag_clear(tm); } -void +static void arb_hypgeom_erf_1f1(arb_t res, const arb_t z, slong prec, slong wp) { if (arb_rel_accuracy_bits(z) >= wp) @@ -243,7 +242,7 @@ arb_extract_bits(arb_t t, const arb_t z, slong b) /* Compute Gamma(a,z) using the bit-burst algorithm. Todo: allow passing precomputed Gamma(a) as input. */ -void +static void _arb_gamma_upper_fmpq_bb(arb_t res, const fmpq_t a, const arb_t z, const mag_t abs_tol, slong prec_lower, slong prec_upper) { slong start_bits, bits, wp, NN; diff --git a/src/arb_hypgeom/erfinv.c b/src/arb_hypgeom/erfinv.c index fead492267..589a397fc8 100644 --- a/src/arb_hypgeom/erfinv.c +++ b/src/arb_hypgeom/erfinv.c @@ -219,7 +219,7 @@ arb_hypgeom_erfinv_guess(arb_t res, const arb_t x, const arb_t one_sub_x, slong } } -void +static void arb_hypgeom_erfinv_precise(arb_t res, const arb_t x, const arb_t one_sub_x, int near_one, slong prec) { slong wp; diff --git a/src/arb_hypgeom/gamma.c b/src/arb_hypgeom/gamma.c index df0d2e70d3..28bf9f79a3 100644 --- a/src/arb_hypgeom/gamma.c +++ b/src/arb_hypgeom/gamma.c @@ -14,6 +14,12 @@ #include "arb_hypgeom.h" #include "bernoulli.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + /* tuning factor */ double GAMMA_STIRLING_BETA = 0.0; diff --git a/src/arb_hypgeom/gamma_fmpq.c b/src/arb_hypgeom/gamma_fmpq.c index 6045303bb4..6abea6f49a 100644 --- a/src/arb_hypgeom/gamma_fmpq.c +++ b/src/arb_hypgeom/gamma_fmpq.c @@ -16,7 +16,7 @@ #include "arb_hypgeom.h" #include "hypgeom.h" -void +static void arb_gamma_const_1_3_eval(arb_t s, slong prec) { hypgeom_t series; @@ -50,9 +50,9 @@ arb_gamma_const_1_3_eval(arb_t s, slong prec) arb_clear(u); } -ARB_DEF_CACHED_CONSTANT(arb_gamma_const_1_3, arb_gamma_const_1_3_eval) +_ARB_DEF_CACHED_CONSTANT(static, static, arb_gamma_const_1_3, arb_gamma_const_1_3_eval) -void +static void arb_gamma_const_1_4_eval(arb_t x, slong prec) { arb_t t, u; @@ -77,13 +77,13 @@ arb_gamma_const_1_4_eval(arb_t x, slong prec) arb_clear(u); } -ARB_DEF_CACHED_CONSTANT(arb_gamma_const_1_4, arb_gamma_const_1_4_eval) +_ARB_DEF_CACHED_CONSTANT(static, static, arb_gamma_const_1_4, arb_gamma_const_1_4_eval) void arb_hypgeom_gamma_stirling_choose_param(int * reflect, slong * r, slong * n, const arb_t x, int use_reflect, int digamma, slong prec); void arb_hypgeom_gamma_stirling_inner(arb_t s, const arb_t z, slong N, slong prec); -void +static void arb_hypgeom_gamma_fmpq_stirling(arb_t y, const fmpq_t a, slong prec) { int reflect; @@ -138,7 +138,7 @@ arb_hypgeom_gamma_fmpq_stirling(arb_t y, const fmpq_t a, slong prec) arb_clear(x); } -void +static void arb_hypgeom_gamma_small_frac(arb_t y, unsigned int p, unsigned int q, slong prec) { slong wp = prec + 4; @@ -227,7 +227,7 @@ slong _arb_get_exp_pos(const slong * tab, slong step); static void bsplit2(arb_t P, arb_t Q, const fmpz_t zp, const fmpz_t zq, const slong * xexp, arb_srcptr xpow, - ulong N, slong a, slong b, int cont, slong prec) + ulong N, slong a, slong b, int FLINT_UNUSED(cont), slong prec) { if (b - a == 1) { @@ -477,7 +477,7 @@ arb_hypgeom_gamma_fmpq_general_off1(arb_t res, const fmpq_t z, slong prec) } /* assumes z in (0, 1] */ -void +static void arb_hypgeom_gamma_fmpq_hyp(arb_t res, const fmpq_t z, slong prec) { fmpq_t t; @@ -489,7 +489,7 @@ arb_hypgeom_gamma_fmpq_hyp(arb_t res, const fmpq_t z, slong prec) fmpq_clear(t); } -void +static void arb_hypgeom_gamma_fmpq_outward(arb_t y, const fmpq_t x, slong prec) { fmpq_t a; @@ -553,7 +553,7 @@ arb_hypgeom_gamma_fmpq_outward(arb_t y, const fmpq_t x, slong prec) arb_clear(u); } -int +static int arb_hypgeom_gamma_fmpq_taylor(arb_t y, const fmpq_t x, slong prec) { fmpq_t a; @@ -668,7 +668,7 @@ arb_hypgeom_gamma_fmpq(arb_t y, const fmpq_t x, slong prec) } } - if (q != 1 && prec > 7000 + 300 * fmpz_bits(fmpq_denref(x)) && + if (q != 1 && prec > 7000 + 300 * (slong) fmpz_bits(fmpq_denref(x)) && (slong) fmpz_bits(fmpq_numref(x)) - (slong) fmpz_bits(fmpq_denref(x)) < FLINT_BITS && fabs(fmpq_get_d(x)) < 0.03 * prec * sqrt(prec)) { diff --git a/src/arb_hypgeom/gamma_stirling_sum_improved.c b/src/arb_hypgeom/gamma_stirling_sum_improved.c index 94e291491b..f8d3ca26f9 100644 --- a/src/arb_hypgeom/gamma_stirling_sum_improved.c +++ b/src/arb_hypgeom/gamma_stirling_sum_improved.c @@ -106,12 +106,12 @@ arb_hypgeom_gamma_stirling_sum_improved(arb_t s, const arb_t z, slong N, slong K while (Mk[k] > 2) { - slong err, Mnew; + slong errs, Mnew; Mnew = Mk[k] - 1; - err = term_mags[Mnew] - log2_k * (2 * Mnew) + FLINT_BIT_COUNT(N - Mnew); + errs = term_mags[Mnew] - log2_k * (2 * Mnew) + FLINT_BIT_COUNT(N - Mnew); - if (err < -prec) + if (errs < -prec) Mk[k] = Mnew; else break; @@ -136,15 +136,15 @@ arb_hypgeom_gamma_stirling_sum_improved(arb_t s, const arb_t z, slong N, slong K for (k = 1; k < K; k++) { - mag_t t; - mag_init(t); - mag_set_ui_lower(t, k); - mag_inv(t, t); - mag_pow_ui(t, t, 2 * Mk[k]); - mag_mul_ui(t, t, N - Mk[k]); - mag_mul_2exp_si(t, t, term_mags[Mk[k]]); - mag_add(err, err, t); - mag_clear(t); + mag_t tm; + mag_init(tm); + mag_set_ui_lower(tm, k); + mag_inv(tm, tm); + mag_pow_ui(tm, tm, 2 * Mk[k]); + mag_mul_ui(tm, tm, N - Mk[k]); + mag_mul_2exp_si(tm, tm, term_mags[Mk[k]]); + mag_add(err, err, tm); + mag_clear(tm); } } else diff --git a/src/arb_hypgeom/gamma_taylor.c b/src/arb_hypgeom/gamma_taylor.c index 12d096f7b1..c196c73b79 100644 --- a/src/arb_hypgeom/gamma_taylor.c +++ b/src/arb_hypgeom/gamma_taylor.c @@ -152,7 +152,7 @@ const double arb_hypgeom_rgamma_d_tab[128] = { /* Crude upper bound for psi(x) for x > 0, adequate for perturbation bounds for gamma. */ -double +static double d_abs_digamma_ubound(double x) { if (x <= 1.0) @@ -184,7 +184,7 @@ d_abs_digamma_ubound(double x) /* Upper or lower bound (depending on direction) for gamma(x), assuming x > 0, no overflow. */ -double +static double _arb_hypgeom_d_gamma(double x, int direction) { double s, t, p; @@ -221,7 +221,7 @@ _arb_hypgeom_d_gamma(double x, int direction) } /* Set res = [a, b]; not checking overflow or underflow. */ -void arb_set_interval_d_fast(arb_t res, double a, double b, slong prec) +static void arb_set_interval_d_fast(arb_t res, double a, double b, slong prec) { double mid, rad; @@ -361,11 +361,11 @@ arb_hypgeom_gamma_taylor(arb_t res, const arb_t x, int reciprocal, slong prec) /* 1/gamma(x) = (-1)^r * rgamma(1+x-r) * rf(1+r-x,-r) * (x-r) */ if (dx < 0.0) { - arb_t t, u, v; + arb_t t, ub, vb; arb_init(t); - arb_init(u); - arb_init(v); + arb_init(ub); + arb_init(vb); arb_sub_si(t, x, r, prec + 10); @@ -377,16 +377,16 @@ arb_hypgeom_gamma_taylor(arb_t res, const arb_t x, int reciprocal, slong prec) } else { - arb_add_si(u, x, 1 - r, prec + 10); + arb_add_si(ub, x, 1 - r, prec + 10); success = 1; - if (reciprocal && !arb_is_positive(u)) + if (reciprocal && !arb_is_positive(ub)) { /* todo: accurate wide interval */ success = 0; } - success = arb_hypgeom_gamma_taylor(u, u, reciprocal, prec + 10); + success = arb_hypgeom_gamma_taylor(ub, ub, reciprocal, prec + 10); if (success) { @@ -405,30 +405,30 @@ arb_hypgeom_gamma_taylor(arb_t res, const arb_t x, int reciprocal, slong prec) b = b * ((d + i) * (1 + 1e-15)); } - arb_set_interval_d_fast(v, a, b, 53); + arb_set_interval_d_fast(vb, a, b, 53); if (reciprocal) { - arb_mul(res, u, v, prec + 10); + arb_mul(res, ub, vb, prec + 10); arb_mul(res, res, t, prec); } else { - arb_div(res, u, v, prec + 10); + arb_div(res, ub, vb, prec + 10); arb_div(res, res, t, prec); } } else { - arb_neg(v, x); - arb_add_si(v, v, 1 + r, prec + 10); - arb_hypgeom_rising_ui_rec(v, v, -r, prec + 10); - arb_mul(v, v, t, prec + 10); + arb_neg(vb, x); + arb_add_si(vb, vb, 1 + r, prec + 10); + arb_hypgeom_rising_ui_rec(vb, vb, -r, prec + 10); + arb_mul(vb, vb, t, prec + 10); if (reciprocal) - arb_mul(res, u, v, prec); + arb_mul(res, ub, vb, prec); else - arb_div(res, u, v, prec); + arb_div(res, ub, vb, prec); } if (r % 2) @@ -437,8 +437,8 @@ arb_hypgeom_gamma_taylor(arb_t res, const arb_t x, int reciprocal, slong prec) } arb_clear(t); - arb_clear(u); - arb_clear(v); + arb_clear(ub); + arb_clear(vb); return success; } diff --git a/src/arb_hypgeom/gamma_upper_fmpq.c b/src/arb_hypgeom/gamma_upper_fmpq.c index a4b556b830..7ff1472304 100644 --- a/src/arb_hypgeom/gamma_upper_fmpq.c +++ b/src/arb_hypgeom/gamma_upper_fmpq.c @@ -45,7 +45,7 @@ mag_pow_fmpq_fast(mag_t res, const mag_t x, const fmpq_t e) fmpz_clear(b); } -slong +static slong _arb_hypgeom_gamma_upper_fmpq_inf_choose_N_1(mag_t err, const fmpq_t a, const arb_t z, int prefactor, const mag_t abs_tol) { slong N, aa, ab; @@ -136,7 +136,8 @@ _arb_hypgeom_gamma_upper_fmpq_inf_choose_N(mag_t err, const fmpq_t a, const arb_ return _arb_hypgeom_gamma_upper_fmpq_inf_choose_N_1(err, a, z, 1, abs_tol); } -slong +#if 0 +static slong _arb_hypgeom_gamma_upper_fmpq_inf_choose_N_rel(mag_t err, const fmpq_t a, const arb_t z, slong prec) { mag_t tol; @@ -147,6 +148,7 @@ _arb_hypgeom_gamma_upper_fmpq_inf_choose_N_rel(mag_t err, const fmpq_t a, const mag_clear(tol); return N; } +#endif static void upper_bsplit(arb_t M, arb_t S, arb_t Q, const fmpz_t ap, const fmpz_t aq, const arb_t z, slong na, slong nb, int cont, slong prec) diff --git a/src/arb_hypgeom/gamma_upper_fmpq_step_bsplit.c b/src/arb_hypgeom/gamma_upper_fmpq_step_bsplit.c index 4b374a92c0..be9357062b 100644 --- a/src/arb_hypgeom/gamma_upper_fmpq_step_bsplit.c +++ b/src/arb_hypgeom/gamma_upper_fmpq_step_bsplit.c @@ -22,7 +22,7 @@ #endif static void -taylor_M(mag_t M, const arb_t a, const arb_t z, const mag_t x, slong Rexp) +taylor_M(mag_t M, const arb_t a, const arb_t z, const mag_t FLINT_UNUSED(x), slong Rexp) { arb_t t, u; arb_init(t); diff --git a/src/arb_hypgeom/legendre_p_ui.c b/src/arb_hypgeom/legendre_p_ui.c index 7f7d9ab8d3..b2c9ebddc6 100644 --- a/src/arb_hypgeom/legendre_p_ui.c +++ b/src/arb_hypgeom/legendre_p_ui.c @@ -36,9 +36,8 @@ static double log2_bin_uiui_fast(ulong n, ulong k) return n * htab[FLINT_MIN(k, 15)]; } -/* x is unused but part of the API */ void -arb_hypgeom_legendre_p_ui_deriv_bound(mag_t dp, mag_t dp2, ulong n, const arb_t x, const arb_t x2sub1) +arb_hypgeom_legendre_p_ui_deriv_bound(mag_t dp, mag_t dp2, ulong n, const arb_t FLINT_UNUSED(x), const arb_t x2sub1) { mag_t c, t, u; @@ -81,7 +80,8 @@ arb_hypgeom_legendre_p_ui(arb_t res, arb_t res_prime, ulong n, const arb_t x, sl double log2x, log2u, tolerance, asymp_error; double yy, log2nsy, log2k, size; slong wp; - slong d, k, K_zero, K_one, K_asymp; + slong d; + ulong k, K_zero, K_one, K_asymp; int basecase_ok; if (!arb_is_finite(x) || n > UWORD_MAX / 4) diff --git a/src/arb_hypgeom/legendre_p_ui_asymp.c b/src/arb_hypgeom/legendre_p_ui_asymp.c index ba13d1c73c..a614a5122d 100644 --- a/src/arb_hypgeom/legendre_p_ui_asymp.c +++ b/src/arb_hypgeom/legendre_p_ui_asymp.c @@ -138,7 +138,7 @@ _arb_hypgeom_legendre_p_ui_asymp_error(mag_t res, ulong n, const mag_t y, slong mag_fac_ui(u, K); mag_div(t, u, t); - if (K < n / 16) + if (K < (slong) (n / 16)) { /* (2n)^K */ mag_set_ui_lower(u, n); @@ -167,7 +167,7 @@ _arb_hypgeom_legendre_p_ui_asymp_error(mag_t res, ulong n, const mag_t y, slong mag_clear(u); } -int +static int arb_abs_le_ui(const arb_t x, ulong n) { arf_struct u[3]; @@ -199,7 +199,7 @@ arb_abs_le_ui(const arb_t x, ulong n) return res; } -void +static void _arb_hypgeom_legendre_p_ui_asymp(arb_t res, ulong n, const arb_t x, const arb_t y, acb_srcptr w4pow, const arb_t binom, slong m, slong K, slong prec) { diff --git a/src/arb_hypgeom/legendre_p_ui_one.c b/src/arb_hypgeom/legendre_p_ui_one.c index ebb381408f..fea6bf2f85 100644 --- a/src/arb_hypgeom/legendre_p_ui_one.c +++ b/src/arb_hypgeom/legendre_p_ui_one.c @@ -115,7 +115,7 @@ arb_hypgeom_legendre_p_ui_one(arb_t res, arb_t res_prime, ulong n, mag_init(t); mag_init(err); - K = FLINT_MIN(K, n + 1); + K = FLINT_MIN((ulong) K, n + 1); if (res != NULL && res_prime != NULL) m = n_sqrt(2 * K); @@ -129,7 +129,7 @@ arb_hypgeom_legendre_p_ui_one(arb_t res, arb_t res_prime, ulong n, _arb_vec_set_powers(xpow, v, m + 1, prec); /* truncating */ - if (K < n + 1) + if ((ulong) K < n + 1) { arb_get_mag(u, v); mag_mul_ui(t, u, n - K); @@ -146,7 +146,7 @@ arb_hypgeom_legendre_p_ui_one(arb_t res, arb_t res_prime, ulong n, sum_rs_inner(s, xpow, m, n, K, 0, prec); arb_add_ui(res, s, 1, prec); - if (K < n + 1) + if ((ulong) K < n + 1) { mag_set(err, u); mag_bin_uiui(t, n, K); @@ -159,7 +159,7 @@ arb_hypgeom_legendre_p_ui_one(arb_t res, arb_t res_prime, ulong n, if (res_prime != NULL) { - K = FLINT_MIN(K, n); + K = FLINT_MIN((ulong) K, n); sum_rs_inner(s, xpow, m, n, K, 1, prec); arb_add_ui(res_prime, s, 1, prec); arb_mul_ui(res_prime, res_prime, n, prec); @@ -167,7 +167,7 @@ arb_hypgeom_legendre_p_ui_one(arb_t res, arb_t res_prime, ulong n, arb_mul_2exp_si(res_prime, res_prime, -1); /* truncating */ - if (K < n) + if ((ulong) K < n) { mag_set(err, u); mag_bin_uiui(t, n, K + 1); diff --git a/src/arb_hypgeom/legendre_p_ui_root.c b/src/arb_hypgeom/legendre_p_ui_root.c index f5e8f1f522..303cc65640 100644 --- a/src/arb_hypgeom/legendre_p_ui_root.c +++ b/src/arb_hypgeom/legendre_p_ui_root.c @@ -13,7 +13,7 @@ #include "arb_hypgeom.h" /* Compute initial isolating interval, following K. Petras. */ -void +static void arb_hypgeom_legendre_p_ui_root_initial(arb_t res, ulong n, ulong k, slong prec) { arb_t phi, psi, s, c, t, u; diff --git a/src/arb_hypgeom/legendre_p_ui_zero.c b/src/arb_hypgeom/legendre_p_ui_zero.c index cd4f1cfebb..f53d6aef5d 100644 --- a/src/arb_hypgeom/legendre_p_ui_zero.c +++ b/src/arb_hypgeom/legendre_p_ui_zero.c @@ -201,7 +201,7 @@ arb_hypgeom_legendre_p_ui_zero(arb_t res, arb_t res2, ulong n, arb_init(u); arb_init(v); - K = FLINT_MIN(K, n / 2 + 1); + K = FLINT_MIN((ulong) K, n / 2 + 1); if (res2 != NULL) m = n_sqrt(2 * K); diff --git a/src/arb_hypgeom/lgamma.c b/src/arb_hypgeom/lgamma.c index 94b68bc601..447258213f 100644 --- a/src/arb_hypgeom/lgamma.c +++ b/src/arb_hypgeom/lgamma.c @@ -16,7 +16,7 @@ void arb_hypgeom_gamma_stirling_choose_param(int * reflect, slong * r, slong * n int arb_hypgeom_gamma_exact(arb_t res, const arb_t x, int reciprocal, slong prec); void arb_hypgeom_gamma_stirling_inner(arb_t s, const arb_t z, slong N, slong prec); -void +static void arb_hypgeom_lgamma_stirling(arb_t y, const arb_t x, slong prec) { int reflect; diff --git a/src/arb_hypgeom/rising_ui_forward.c b/src/arb_hypgeom/rising_ui_forward.c index cc9e908845..955477a63c 100644 --- a/src/arb_hypgeom/rising_ui_forward.c +++ b/src/arb_hypgeom/rising_ui_forward.c @@ -12,6 +12,12 @@ #include "arb.h" #include "arb_hypgeom.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + int _arf_increment_fast(arf_t x, slong prec) { diff --git a/src/arb_hypgeom/rising_ui_jet.c b/src/arb_hypgeom/rising_ui_jet.c index e1cf8e93a3..83fd21aec7 100644 --- a/src/arb_hypgeom/rising_ui_jet.c +++ b/src/arb_hypgeom/rising_ui_jet.c @@ -32,7 +32,7 @@ arb_hypgeom_rising_ui_jet(arb_ptr res, const arb_t x, ulong n, slong len, slong } else { - if (n <= 20 || (n <= 200 && prec > 400 * n && arb_bits(x) >= prec / 4)) + if (n <= 20 || (n <= 200 && (ulong) prec > 400 * n && arb_bits(x) >= prec / 4)) { arb_hypgeom_rising_ui_jet_powsum(res, x, n, len, prec); } diff --git a/src/arb_hypgeom/rising_ui_jet_bs.c b/src/arb_hypgeom/rising_ui_jet_bs.c index 4c585bb51a..edb4c20d9f 100644 --- a/src/arb_hypgeom/rising_ui_jet_bs.c +++ b/src/arb_hypgeom/rising_ui_jet_bs.c @@ -13,7 +13,7 @@ #include "arb_hypgeom.h" static void -bsplit(arb_ptr res, const arb_t x, ulong a, ulong b, slong trunc, slong prec) +bsplit(arb_ptr res, const arb_t x, ulong a, ulong b, ulong trunc, slong prec) { trunc = FLINT_MIN(trunc, b - a + 1); @@ -49,7 +49,7 @@ bsplit(arb_ptr res, const arb_t x, ulong a, ulong b, slong trunc, slong prec) bsplit(R, x, m, b, trunc, prec); _arb_poly_mullow(res, L, len1, R, len2, - FLINT_MIN(trunc, len1 + len2 - 1), prec); + FLINT_MIN(trunc, (ulong) (len1 + len2 - 1)), prec); _arb_vec_clear(L, len1 + len2); } @@ -61,13 +61,13 @@ arb_hypgeom_rising_ui_jet_bs(arb_ptr res, const arb_t x, ulong n, slong len, slo if (len == 0) return; - if (len > n + 1) + if ((ulong) len > n + 1) { _arb_vec_zero(res + n + 1, len - n - 1); len = n + 1; } - if (len == n + 1) + if ((ulong) len == n + 1) { arb_one(res + n); len = n; diff --git a/src/arb_hypgeom/rising_ui_jet_powsum.c b/src/arb_hypgeom/rising_ui_jet_powsum.c index 29c332da39..1105007985 100644 --- a/src/arb_hypgeom/rising_ui_jet_powsum.c +++ b/src/arb_hypgeom/rising_ui_jet_powsum.c @@ -24,13 +24,13 @@ arb_hypgeom_rising_ui_jet_powsum(arb_ptr res, const arb_t x, ulong n, slong len, if (len == 0) return; - if (len > n + 1) + if ((ulong) len > n + 1) { _arb_vec_zero(res + n + 1, len - n - 1); len = n + 1; } - if (len == n + 1) + if ((ulong) len == n + 1) { arb_one(res + n); len = n; @@ -72,7 +72,7 @@ arb_hypgeom_rising_ui_jet_powsum(arb_ptr res, const arb_t x, ulong n, slong len, c[1] = 1; c[(n + 1) + 0] = 1; - for (i = 2; i <= n; i++) + for (i = 2; (ulong) i <= n; i++) { for (j = FLINT_MIN(len - 1, i); j >= 0; j--) { @@ -118,7 +118,7 @@ arb_hypgeom_rising_ui_jet_powsum(arb_ptr res, const arb_t x, ulong n, slong len, fmpz_one(c + 1); fmpz_one(c + (n + 1) + 0); - for (i = 2; i <= n; i++) + for (i = 2; (ulong) i <= n; i++) { for (j = FLINT_MIN(len - 1, i); j >= 0; j--) { diff --git a/src/arb_hypgeom/rising_ui_jet_rs.c b/src/arb_hypgeom/rising_ui_jet_rs.c index 24190792a5..6782168c6c 100644 --- a/src/arb_hypgeom/rising_ui_jet_rs.c +++ b/src/arb_hypgeom/rising_ui_jet_rs.c @@ -23,7 +23,8 @@ void arb_hypgeom_rising_ui_jet_rs(arb_ptr res, const arb_t x, ulong n, ulong m, slong len, slong prec) { - slong i, j, k, l, m0, xmlen, tlen, ulen, climbs, climbs_max, wp; + slong i, j, k, l, xmlen, tlen, ulen, climbs, climbs_max, wp; + ulong m0; arb_ptr tmp, xpow; arb_ptr t, u; nn_ptr c; @@ -32,13 +33,13 @@ arb_hypgeom_rising_ui_jet_rs(arb_ptr res, const arb_t x, ulong n, ulong m, slong if (len == 0) return; - if (len > n + 1) + if ((ulong) len > n + 1) { _arb_vec_zero(res + n + 1, len - n - 1); len = n + 1; } - if (len == n + 1) + if ((ulong) len == n + 1) { arb_one(res + n); len = n; @@ -82,7 +83,7 @@ arb_hypgeom_rising_ui_jet_rs(arb_ptr res, const arb_t x, ulong n, ulong m, slong c = TMP_ALLOC(sizeof(ulong) * climbs_max * m); /* length of (x+t)^m */ - xmlen = FLINT_MIN(len, m + 1); + xmlen = FLINT_MIN((ulong) len, m + 1); tmp = _arb_vec_init(2 * len + (m + 1) * xmlen); t = tmp; @@ -94,7 +95,7 @@ arb_hypgeom_rising_ui_jet_rs(arb_ptr res, const arb_t x, ulong n, ulong m, slong tlen = 1; /* First derivatives */ - for (i = 1; i <= m; i++) + for (i = 1; (ulong) i <= m; i++) arb_mul_ui(xpow + (m + 1) + i, xpow + i - 1, i, wp); /* Higher derivatives if we need them */ @@ -105,7 +106,7 @@ arb_hypgeom_rising_ui_jet_rs(arb_ptr res, const arb_t x, ulong n, ulong m, slong fmpz_one(f + 0); fmpz_one(f + 1); - for (i = 2; i <= m; i++) + for (i = 2; (ulong) i <= m; i++) { for (j = FLINT_MIN(xmlen - 1, i + 1); j >= 1; j--) fmpz_add(f + j, f + j, f + j - 1); @@ -117,7 +118,7 @@ arb_hypgeom_rising_ui_jet_rs(arb_ptr res, const arb_t x, ulong n, ulong m, slong _fmpz_vec_clear(f, len); } - for (k = 0; k < n; k += m) + for (k = 0; (ulong) k < n; k += m) { l = FLINT_MIN(m, n - k); climbs = FLINT_BIT_COUNT(k + l - 1) * l; diff --git a/src/arb_hypgeom/rising_ui_rec.c b/src/arb_hypgeom/rising_ui_rec.c index aa80afd516..a5efb32153 100644 --- a/src/arb_hypgeom/rising_ui_rec.c +++ b/src/arb_hypgeom/rising_ui_rec.c @@ -32,7 +32,7 @@ arb_hypgeom_rising_ui_rec(arb_t res, const arb_t x, ulong n, slong prec) return; } - if ((prec < 512 && n <= 20) || (n <= FLINT_MIN(80, 6000 / prec))) + if ((prec < 512 && n <= 20) || (n <= (ulong) FLINT_MIN(80, 6000 / prec))) { arb_hypgeom_rising_ui_forward(res, x, n, prec); } diff --git a/src/arb_hypgeom/rising_ui_rs.c b/src/arb_hypgeom/rising_ui_rs.c index db24a3a437..543a46de2a 100644 --- a/src/arb_hypgeom/rising_ui_rs.c +++ b/src/arb_hypgeom/rising_ui_rs.c @@ -110,7 +110,8 @@ _arb_hypgeom_rising_coeffs_fmpz(fmpz * c, ulong k, slong l) void arb_hypgeom_rising_ui_rs(arb_t res, const arb_t x, ulong n, ulong m, slong prec) { - slong i, k, l, m0, climbs, climbs_max, wp; + slong i, k, l, climbs, climbs_max, wp; + ulong m0; arb_ptr xpow; arb_t t, u; nn_ptr c; @@ -154,7 +155,7 @@ arb_hypgeom_rising_ui_rs(arb_t res, const arb_t x, ulong n, ulong m, slong prec) arb_init(t); arb_init(u); - for (k = 0; k < n; k += m) + for (k = 0; (ulong) k < n; k += m) { l = FLINT_MIN(m, n - k); climbs = FLINT_BIT_COUNT(k + l - 1) * l; diff --git a/src/arb_hypgeom/si.c b/src/arb_hypgeom/si.c index 3c7912e2ef..6ed7e5293c 100644 --- a/src/arb_hypgeom/si.c +++ b/src/arb_hypgeom/si.c @@ -20,8 +20,8 @@ double arf_get_d_log2_abs_approx_clamped(const arf_t x); /* todo: minima and maxima at multiples of pi */ -void -arb_hypgeom_si_wide(arb_t res, const arb_t z, slong prec) +static void +arb_hypgeom_si_wide(arb_t res, const arb_t FLINT_UNUSED(z), slong FLINT_UNUSED(prec)) { mag_set_ui_2exp_si(arb_radref(res), 1988502269, -30); arf_zero(arb_midref(res)); diff --git a/src/arb_hypgeom/sum_fmpq_arb_bs.c b/src/arb_hypgeom/sum_fmpq_arb_bs.c index d261d795a4..61b054a808 100644 --- a/src/arb_hypgeom/sum_fmpq_arb_bs.c +++ b/src/arb_hypgeom/sum_fmpq_arb_bs.c @@ -13,7 +13,7 @@ #include "arb_hypgeom.h" static void -factor(arb_t A, const fmpq * a, slong alen, const fmpq * b, slong blen, const fmpz_t bden, const arb_t z, slong k, slong prec) +factor(arb_t A, const fmpq * a, slong alen, const fmpq * FLINT_UNUSED(b), slong FLINT_UNUSED(blen), const fmpz_t bden, const arb_t z, slong k, slong prec) { slong i; diff --git a/src/arb_hypgeom/sum_fmpq_arb_rs.c b/src/arb_hypgeom/sum_fmpq_arb_rs.c index b9bbad11d4..8c8fc05662 100644 --- a/src/arb_hypgeom/sum_fmpq_arb_rs.c +++ b/src/arb_hypgeom/sum_fmpq_arb_rs.c @@ -21,6 +21,12 @@ # include #endif +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + static double d_log2_fac(double n) { diff --git a/src/arb_hypgeom/sum_fmpq_imag_arb_bs.c b/src/arb_hypgeom/sum_fmpq_imag_arb_bs.c index f642afe003..97c69cc731 100644 --- a/src/arb_hypgeom/sum_fmpq_imag_arb_bs.c +++ b/src/arb_hypgeom/sum_fmpq_imag_arb_bs.c @@ -13,7 +13,7 @@ #include "arb_hypgeom.h" static void -factor(arb_t A, const fmpq * a, slong alen, const fmpq * b, slong blen, const fmpz_t bden, const arb_t z, slong k, slong prec) +factor(arb_t A, const fmpq * a, slong alen, const fmpq * FLINT_UNUSED(b), slong FLINT_UNUSED(blen), const fmpz_t bden, const arb_t z, slong k, slong prec) { slong i; diff --git a/src/arb_hypgeom/u_integration.c b/src/arb_hypgeom/u_integration.c index 82c10c784e..786a42dc0d 100644 --- a/src/arb_hypgeom/u_integration.c +++ b/src/arb_hypgeom/u_integration.c @@ -394,7 +394,7 @@ bound_tail(mag_t bound, const arb_t a1, const arb_t ba1, const arb_t z, const ar arb_clear(C); } -int +static int _arb_hypgeom_u_integration(arb_t res, const arb_t a, const arb_t b, const arb_t z, slong prec) { acb_calc_integrate_opt_t opt; From fd1ad12b8a7a24733e1fea62863951a871685439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 10:09:26 +0200 Subject: [PATCH 082/114] acb_mat --- src/acb_mat/approx_eig_qr.c | 12 ++++++------ src/acb_mat/approx_lu.c | 4 ++-- src/acb_mat/approx_mul.c | 2 +- src/acb_mat/approx_solve_tril.c | 4 ++-- src/acb_mat/approx_solve_triu.c | 4 ++-- src/acb_mat/det_lu.c | 6 +++--- src/acb_mat/det_precond.c | 2 +- src/acb_mat/dft.c | 2 +- src/acb_mat/eig_enclosure_rump.c | 6 +++--- src/acb_mat/eig_simple_vdhoeven_mourrain.c | 4 ++-- src/acb_mat/find_pivot_partial.c | 2 +- src/acb_mat/mul.c | 2 ++ src/acb_mat/mul_threaded.c | 2 +- src/acb_mat/randtest.c | 3 ++- src/acb_mat/solve_precond.c | 4 ++-- 15 files changed, 31 insertions(+), 28 deletions(-) diff --git a/src/acb_mat/approx_eig_qr.c b/src/acb_mat/approx_eig_qr.c index 0b12f35ae0..ebe7092e3f 100644 --- a/src/acb_mat/approx_eig_qr.c +++ b/src/acb_mat/approx_eig_qr.c @@ -94,7 +94,7 @@ acb_approx_div(acb_t z, const acb_t x, const acb_t y, slong prec) acb_clear(t); } -void +static void acb_mat_approx_qr_step(acb_mat_t A, acb_mat_t Q, slong n0, slong n1, const acb_t shift, slong prec) { slong j, k, n; @@ -306,7 +306,7 @@ acb_mat_approx_qr_step(acb_mat_t A, acb_mat_t Q, slong n0, slong n1, const acb_t arb_clear(u); } -void +static void acb_mat_approx_hessenberg_reduce_0(acb_mat_t A, acb_ptr T, slong prec) { slong i, j, k, n; @@ -484,7 +484,7 @@ acb_mat_approx_hessenberg_reduce_0(acb_mat_t A, acb_ptr T, slong prec) acb_clear(TT); } -void +static void acb_mat_approx_hessenberg_reduce_1(acb_mat_t A, acb_srcptr T, slong prec) { slong i, j, k, n; @@ -546,7 +546,7 @@ acb_mat_approx_hessenberg_reduce_1(acb_mat_t A, acb_srcptr T, slong prec) } /* Right eigenvectors of a triu matrix. No aliasing. */ -void +static void acb_mat_approx_eig_triu_r(acb_mat_t ER, const acb_mat_t A, slong prec) { slong i, j, k, n; @@ -647,7 +647,7 @@ acb_mat_approx_eig_triu_r(acb_mat_t ER, const acb_mat_t A, slong prec) } /* Left eigenvectors of a triu matrix. No aliasing. */ -void +static void acb_mat_approx_eig_triu_l(acb_mat_t EL, const acb_mat_t A, slong prec) { slong i, j, k, n; @@ -750,7 +750,7 @@ acb_mat_approx_eig_triu_l(acb_mat_t EL, const acb_mat_t A, slong prec) mag_clear(rmax); } -int +static int acb_mat_approx_hessenberg_qr(acb_mat_t A, acb_mat_t Q, const mag_t tol, slong maxiter, slong prec) { slong n, i, j, k, n0, n1, iter, total_iter; diff --git a/src/acb_mat/approx_lu.c b/src/acb_mat/approx_lu.c index 01b42d1dca..329485724c 100644 --- a/src/acb_mat/approx_lu.c +++ b/src/acb_mat/approx_lu.c @@ -82,7 +82,7 @@ _acb_vec_approx_scalar_addmul(acb_ptr res, acb_srcptr vec, acb_clear(t); } -int +static int acb_mat_approx_lu_classical(slong * P, acb_mat_t LU, const acb_mat_t A, slong prec) { acb_t d, e; @@ -143,7 +143,7 @@ acb_mat_approx_lu_classical(slong * P, acb_mat_t LU, const acb_mat_t A, slong pr return result; } -int +static int acb_mat_approx_lu_recursive(slong * P, acb_mat_t LU, const acb_mat_t A, slong prec) { slong i, m, n, r1, r2, n1; diff --git a/src/acb_mat/approx_mul.c b/src/acb_mat/approx_mul.c index b60363181c..f9efc6467a 100644 --- a/src/acb_mat/approx_mul.c +++ b/src/acb_mat/approx_mul.c @@ -12,7 +12,7 @@ #include "acb.h" #include "acb_mat.h" -void +static void acb_mat_approx_mul_classical(acb_mat_t C, const acb_mat_t A, const acb_mat_t B, slong prec) { slong ar, br, bc, i, j; diff --git a/src/acb_mat/approx_solve_tril.c b/src/acb_mat/approx_solve_tril.c index ae59de7d50..6d29072a5d 100644 --- a/src/acb_mat/approx_solve_tril.c +++ b/src/acb_mat/approx_solve_tril.c @@ -35,7 +35,7 @@ acb_approx_div(acb_t z, const acb_t x, const acb_t y, acb_t t, slong prec) acb_approx_mul(z, x, t, prec); } -void +static void acb_mat_approx_solve_tril_classical(acb_mat_t X, const acb_mat_t L, const acb_mat_t B, int unit, slong prec) { @@ -74,7 +74,7 @@ acb_mat_approx_solve_tril_classical(acb_mat_t X, acb_clear(t); } -void +static void acb_mat_approx_solve_tril_recursive(acb_mat_t X, const acb_mat_t L, const acb_mat_t B, int unit, slong prec) { diff --git a/src/acb_mat/approx_solve_triu.c b/src/acb_mat/approx_solve_triu.c index 874b0cc5b9..f180210aad 100644 --- a/src/acb_mat/approx_solve_triu.c +++ b/src/acb_mat/approx_solve_triu.c @@ -35,7 +35,7 @@ acb_approx_div(acb_t z, const acb_t x, const acb_t y, acb_t t, slong prec) acb_approx_mul(z, x, t, prec); } -void +static void acb_mat_approx_solve_triu_classical(acb_mat_t X, const acb_mat_t U, const acb_mat_t B, int unit, slong prec) { @@ -74,7 +74,7 @@ acb_mat_approx_solve_triu_classical(acb_mat_t X, const acb_mat_t U, acb_clear(t); } -void +static void acb_mat_approx_solve_triu_recursive(acb_mat_t X, const acb_mat_t U, const acb_mat_t B, int unit, slong prec) { diff --git a/src/acb_mat/det_lu.c b/src/acb_mat/det_lu.c index 0f926c8ab3..1cf48f6e03 100644 --- a/src/acb_mat/det_lu.c +++ b/src/acb_mat/det_lu.c @@ -12,7 +12,7 @@ #include "acb.h" #include "acb_mat.h" -slong +static slong acb_mat_gauss_partial(acb_mat_t A, slong prec) { acb_t e; @@ -59,7 +59,7 @@ acb_mat_gauss_partial(acb_mat_t A, slong prec) return rank * sign; } -void +static void acb_vec_get_arf_2norm_squared_bound(arf_t s, acb_srcptr vec, slong len, slong prec) { slong i; @@ -79,7 +79,7 @@ acb_vec_get_arf_2norm_squared_bound(arf_t s, acb_srcptr vec, slong len, slong pr arf_clear(t); } -void +static void acb_mat_det_lu_inplace(acb_t det, acb_mat_t A, slong prec) { slong i, n, sign, rank; diff --git a/src/acb_mat/det_precond.c b/src/acb_mat/det_precond.c index 8bb894db03..c9e8043417 100644 --- a/src/acb_mat/det_precond.c +++ b/src/acb_mat/det_precond.c @@ -26,7 +26,7 @@ _apply_permutation(acb_mat_t A, slong * P, slong n) /* Enclosure of det(I + eps) using Gershgorin circles. Can be improved. */ -void +static void acb_mat_det_one_gershgorin(acb_t det, const acb_mat_t A) { slong n, i, j; diff --git a/src/acb_mat/dft.c b/src/acb_mat/dft.c index 9a8bbe9c2c..b13525a6cf 100644 --- a/src/acb_mat/dft.c +++ b/src/acb_mat/dft.c @@ -14,7 +14,7 @@ #include "acb_dirichlet.h" void -acb_mat_dft(acb_mat_t res, int kind, slong prec) +acb_mat_dft(acb_mat_t res, int FLINT_UNUSED(kind), slong prec) { acb_dirichlet_roots_t roots; acb_t t; diff --git a/src/acb_mat/eig_enclosure_rump.c b/src/acb_mat/eig_enclosure_rump.c index 0f271dc5a2..0bc78efb54 100644 --- a/src/acb_mat/eig_enclosure_rump.c +++ b/src/acb_mat/eig_enclosure_rump.c @@ -50,7 +50,7 @@ acb_approx_sub(acb_t res, const acb_t x, const acb_t y, slong prec) } /* todo: separate out */ -void +static void acb_mat_bound_max_norm(mag_t res, const acb_mat_t A) { mag_t t; @@ -150,7 +150,7 @@ acb_approx_mag(mag_t res, const acb_t x) /* Extract k largest rows to freeze */ static void -partition_X_sorted(slong * u, slong * v, const acb_mat_t X, slong prec) +partition_X_sorted(slong * u, slong * v, const acb_mat_t X, slong FLINT_UNUSED(prec)) { slong i, j, n, k, c; slong * row_idx; @@ -204,7 +204,7 @@ partition_X_sorted(slong * u, slong * v, const acb_mat_t X, slong prec) } static void -partition_X_trivial(slong * u, slong * v, const acb_mat_t X, slong prec) +partition_X_trivial(slong * u, slong * v, const acb_mat_t X, slong FLINT_UNUSED(prec)) { slong n, k, i; diff --git a/src/acb_mat/eig_simple_vdhoeven_mourrain.c b/src/acb_mat/eig_simple_vdhoeven_mourrain.c index 0822eff741..e8798e16db 100644 --- a/src/acb_mat/eig_simple_vdhoeven_mourrain.c +++ b/src/acb_mat/eig_simple_vdhoeven_mourrain.c @@ -13,7 +13,7 @@ #include "acb_mat.h" /* todo: move out */ -void +static void acb_mat_inf_norm(arb_t res, const acb_mat_t A, slong prec) { slong i, j, m, n; @@ -125,7 +125,7 @@ diagonal_certify(arb_t epsilon, arb_t eta1, arb_t eta2, const acb_mat_t D, const int acb_mat_eig_simple_vdhoeven_mourrain(acb_ptr E, acb_mat_t L, acb_mat_t R, const acb_mat_t A, - acb_srcptr E_approx, const acb_mat_t R_approx, slong prec) + acb_srcptr FLINT_UNUSED(E_approx), const acb_mat_t R_approx, slong prec) { acb_mat_t D, T, AT; int result; diff --git a/src/acb_mat/find_pivot_partial.c b/src/acb_mat/find_pivot_partial.c index 64711d29ce..d65bcc2b8d 100644 --- a/src/acb_mat/find_pivot_partial.c +++ b/src/acb_mat/find_pivot_partial.c @@ -12,7 +12,7 @@ #include "acb.h" #include "acb_mat.h" -int +static int acb_cmpabs_approx(const acb_t x, const acb_t y) { const arf_struct *xm, *ym; diff --git a/src/acb_mat/mul.c b/src/acb_mat/mul.c index e5de41f348..254b9d392e 100644 --- a/src/acb_mat/mul.c +++ b/src/acb_mat/mul.c @@ -30,6 +30,7 @@ acb_mat_bits(const acb_mat_t A) return b; } +#if 0 int acb_mat_is_lagom(const acb_mat_t A) { slong i, j, M, N; @@ -49,6 +50,7 @@ int acb_mat_is_lagom(const acb_mat_t A) return 1; } +#endif void acb_mat_mul(acb_mat_t C, const acb_mat_t A, const acb_mat_t B, slong prec) diff --git a/src/acb_mat/mul_threaded.c b/src/acb_mat/mul_threaded.c index a008af5c98..4fc30c3957 100644 --- a/src/acb_mat/mul_threaded.c +++ b/src/acb_mat/mul_threaded.c @@ -29,7 +29,7 @@ typedef struct } _worker_arg; -void +static void _acb_mat_mul_thread(void * arg_ptr) { _worker_arg arg = *((_worker_arg *) arg_ptr); diff --git a/src/acb_mat/randtest.c b/src/acb_mat/randtest.c index 6a1fa2b89b..74383da865 100644 --- a/src/acb_mat/randtest.c +++ b/src/acb_mat/randtest.c @@ -15,7 +15,8 @@ void acb_mat_randtest(acb_mat_t mat, flint_rand_t state, slong prec, slong mag_bits) { - slong i, j, density; + slong i, j; + ulong density; density = n_randint(state, 100); diff --git a/src/acb_mat/solve_precond.c b/src/acb_mat/solve_precond.c index a60bb0da95..cd4cb2e959 100644 --- a/src/acb_mat/solve_precond.c +++ b/src/acb_mat/solve_precond.c @@ -12,7 +12,7 @@ #include "acb.h" #include "acb_mat.h" -int +static int _acb_mat_solve_c(acb_mat_t X, const acb_mat_t A, const acb_mat_t B, slong prec) { int result; @@ -53,7 +53,7 @@ _acb_mat_solve_c(acb_mat_t X, const acb_mat_t A, const acb_mat_t B, slong prec) return result; } -int +static int _acb_mat_solve_d(acb_mat_t X, const acb_mat_t A, const acb_mat_t B, slong prec) { int result, real; From f78d8698254642706c533adcec33223bbd2d126d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 10:25:34 +0200 Subject: [PATCH 083/114] acb_poly --- src/acb_poly/find_roots.c | 12 +++++++----- src/acb_poly/gamma_series.c | 8 +++++++- src/acb_poly/interpolate_fast.c | 2 +- src/acb_poly/nth_derivative.c | 2 +- src/acb_poly/polylog_series.c | 10 ++++++++-- src/acb_poly/powsum_series_naive_threaded.c | 2 +- src/acb_poly/taylor_shift.c | 6 ++++++ src/acb_poly/validate_real_roots.c | 4 ++-- src/acb_poly/zeta_em_sum.c | 2 +- src/acb_poly/zeta_em_tail_naive.c | 2 -- 10 files changed, 34 insertions(+), 16 deletions(-) diff --git a/src/acb_poly/find_roots.c b/src/acb_poly/find_roots.c index 1ce9e1a3c1..e2714298ca 100644 --- a/src/acb_poly/find_roots.c +++ b/src/acb_poly/find_roots.c @@ -19,7 +19,7 @@ #include "gr_poly.h" #include "nfloat.h" -slong +static slong _acb_get_mid_mag(const acb_t z) { slong rm, im; @@ -30,7 +30,8 @@ _acb_get_mid_mag(const acb_t z) return FLINT_MAX(rm, im); } -slong +#if 0 +static slong _acb_get_rad_mag(const acb_t z) { slong rm, im; @@ -49,6 +50,7 @@ _acb_get_rad_mag(const acb_t z) return FLINT_MAX(rm, im); } +#endif /* Compute res[0, ..., n-1] = {i} indexing the convex hull of {i, y[i]}. */ static slong convex_hull(slong * res, const double * y, slong len) @@ -68,7 +70,7 @@ static slong convex_hull(slong * res, const double * y, slong len) return n; } -void +static void _acb_poly_roots_initial_values(acb_ptr roots, acb_srcptr poly, slong deg, slong prec) { double * alog; @@ -152,8 +154,8 @@ _acb_poly_roots_initial_values(acb_ptr roots, acb_srcptr poly, slong deg, slong /* todo: this method often gets called with degree 2 or 3 polynomials; consider doing something direct there */ -int -_acb_poly_find_roots_iter(gr_ptr w, gr_ptr z, gr_srcptr f, gr_srcptr f_prime, slong deg, slong maxiter, gr_ctx_t fp_ctx, gr_ctx_t acb_ctx, slong prec) +static int +_acb_poly_find_roots_iter(gr_ptr w, gr_ptr z, gr_srcptr f, gr_srcptr FLINT_UNUSED(f_prime), slong deg, slong maxiter, gr_ctx_t fp_ctx, gr_ctx_t acb_ctx, slong prec) { slong iter, i; slong rootmag, max_rootmag, correction, max_correction; diff --git a/src/acb_poly/gamma_series.c b/src/acb_poly/gamma_series.c index c01acfdd2d..18f962cde3 100644 --- a/src/acb_poly/gamma_series.c +++ b/src/acb_poly/gamma_series.c @@ -12,6 +12,12 @@ #include "arb_poly.h" #include "acb_poly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void acb_gamma_stirling_bound(mag_ptr err, const acb_t x, slong k0, slong knum, slong n); void acb_hypgeom_gamma_stirling_choose_param(int * reflect, slong * r, slong * n, @@ -73,7 +79,7 @@ bsplit(acb_ptr Q, acb_ptr T, const acb_t z, slong a, slong b, slong num, slong p } } -void +static void _acb_poly_log_cpx_series(acb_ptr res, const acb_t c, slong num, slong prec) { slong i; diff --git a/src/acb_poly/interpolate_fast.c b/src/acb_poly/interpolate_fast.c index 6e8c001a53..5d23c10643 100644 --- a/src/acb_poly/interpolate_fast.c +++ b/src/acb_poly/interpolate_fast.c @@ -60,7 +60,7 @@ _acb_poly_interpolate_fast_precomp(acb_ptr poly, for (i = 0; i < len; i++) acb_mul(poly + i, weights + i, ys + i, prec); - for (i = 0; i < FLINT_CLOG2(len); i++) + for (i = 0; i < (slong) FLINT_CLOG2(len); i++) { pow = (WORD(1) << i); pa = tree[i]; diff --git a/src/acb_poly/nth_derivative.c b/src/acb_poly/nth_derivative.c index 7c071c45cb..d689439523 100644 --- a/src/acb_poly/nth_derivative.c +++ b/src/acb_poly/nth_derivative.c @@ -26,7 +26,7 @@ acb_poly_nth_derivative(acb_poly_t res, const acb_poly_t poly, ulong n, slong pr { const slong len = poly->length; - if (len <= n) + if ((ulong) len <= n) { acb_poly_zero(res); } diff --git a/src/acb_poly/polylog_series.c b/src/acb_poly/polylog_series.c index 24e83c203d..45a49f6dca 100644 --- a/src/acb_poly/polylog_series.c +++ b/src/acb_poly/polylog_series.c @@ -12,8 +12,14 @@ #include "acb_poly.h" #include "acb_hypgeom.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + /* note: will not return a wrong value, as arf_get_si aborts on overflow */ -slong +static slong arb_get_si_lower(const arb_t x) { arf_t t; @@ -30,7 +36,7 @@ arb_get_si_lower(const arb_t x) return v; } -slong +static slong polylog_choose_terms(mag_t err, slong sigma, const mag_t z, slong d, slong prec) { slong N; diff --git a/src/acb_poly/powsum_series_naive_threaded.c b/src/acb_poly/powsum_series_naive_threaded.c index e0bafddf90..b3d2206406 100644 --- a/src/acb_poly/powsum_series_naive_threaded.c +++ b/src/acb_poly/powsum_series_naive_threaded.c @@ -28,7 +28,7 @@ typedef struct } _worker_arg; -void +static void _acb_zeta_powsum_evaluator(void * arg_ptr) { _worker_arg arg = *((_worker_arg *) arg_ptr); diff --git a/src/acb_poly/taylor_shift.c b/src/acb_poly/taylor_shift.c index 7b3b559679..b53d228342 100644 --- a/src/acb_poly/taylor_shift.c +++ b/src/acb_poly/taylor_shift.c @@ -18,6 +18,12 @@ # include #endif +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + int _gr_acb_poly_taylor_shift(acb_ptr res, acb_srcptr poly, slong n, const acb_t c, gr_ctx_t ctx) { diff --git a/src/acb_poly/validate_real_roots.c b/src/acb_poly/validate_real_roots.c index d3c42fc70b..573d0b60b0 100644 --- a/src/acb_poly/validate_real_roots.c +++ b/src/acb_poly/validate_real_roots.c @@ -20,12 +20,12 @@ typedef int(*__compar_fn_t) (__const void *, __const void *); #endif #endif -int arb_cmp_mid(const arb_t a, const arb_t b) +static int arb_cmp_mid(const arb_t a, const arb_t b) { return arf_cmp(arb_midref(a), arb_midref(b)); } -void _arb_vec_sort_mid(arb_ptr vec, slong len) +static void _arb_vec_sort_mid(arb_ptr vec, slong len) { qsort(vec, len, sizeof(arb_struct), (__compar_fn_t) arb_cmp_mid); } diff --git a/src/acb_poly/zeta_em_sum.c b/src/acb_poly/zeta_em_sum.c index 494966b868..a9a4d12c78 100644 --- a/src/acb_poly/zeta_em_sum.c +++ b/src/acb_poly/zeta_em_sum.c @@ -119,7 +119,7 @@ _acb_poly_zeta_em_sum(acb_ptr z, const acb_t s, const acb_t a, int deflate, ulon _acb_vec_add(sum, sum, u, d, prec); /* Euler-Maclaurin formula tail */ - if (d < 5 || d < M / 10) + if (d < 5 || d < (slong) (M / 10)) _acb_poly_zeta_em_tail_naive(u, s, Na, t, M, d, prec); else _acb_poly_zeta_em_tail_bsplit(u, s, Na, t, M, d, prec); diff --git a/src/acb_poly/zeta_em_tail_naive.c b/src/acb_poly/zeta_em_tail_naive.c index 592ddfdd01..6ad785df26 100644 --- a/src/acb_poly/zeta_em_tail_naive.c +++ b/src/acb_poly/zeta_em_tail_naive.c @@ -12,8 +12,6 @@ #include "acb_poly.h" #include "bernoulli.h" -void _acb_poly_mullow_cpx(acb_ptr res, acb_srcptr src, slong len, const acb_t c, slong trunc, slong prec); - void _acb_poly_zeta_em_tail_naive(acb_ptr sum, const acb_t s, const acb_t Na, acb_srcptr Nasx, slong M, slong d, slong prec) { From 5eab58af72673b3183afc97305965fa4e46111de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 10:28:58 +0200 Subject: [PATCH 084/114] acb_calc --- src/acb_calc/integrate_gl_auto_deg.c | 34 +++++++++++----------- src/acb_calc/integrate_taylor.c | 12 ++++---- src/acb_calc/test/t-cauchy_bound.c | 2 +- src/acb_calc/test/t-integrate.c | 40 +++++++++++++------------- src/acb_calc/test/t-integrate_taylor.c | 2 +- 5 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/acb_calc/integrate_gl_auto_deg.c b/src/acb_calc/integrate_gl_auto_deg.c index 4bd3a18456..30b3d408e5 100644 --- a/src/acb_calc/integrate_gl_auto_deg.c +++ b/src/acb_calc/integrate_gl_auto_deg.c @@ -39,7 +39,7 @@ gl_cache_struct; FLINT_TLS_PREFIX gl_cache_struct * gl_cache = NULL; -void gl_cleanup(void) +static void gl_cleanup(void) { slong i; @@ -59,7 +59,7 @@ void gl_cleanup(void) gl_cache = NULL; } -void gl_init(void) +static void gl_init(void) { gl_cache = flint_calloc(1, sizeof(gl_cache_struct)); flint_register_cleanup_function(gl_cleanup); @@ -83,7 +83,7 @@ nodes_worker(slong jj, nodes_work_t * work) /* if k >= 0, compute the node and weight of index k */ /* if k < 0, compute the first (n+1)/2 nodes and weights (the others are given by symmetry) */ -void +static void acb_calc_gl_node(arb_ptr x, arb_ptr w, slong i, slong k, slong prec) { slong n, kk, wp; @@ -350,34 +350,34 @@ acb_calc_integrate_gl_auto_deg(acb_t res, slong * eval_count, if (nt >= 2 && best_n >= 2) { gl_work_t work; - acb_ptr v; - arb_ptr x, w; + acb_ptr vp; + arb_ptr xp, wp; - v = _acb_vec_init(best_n); - w = _arb_vec_init((best_n + 1) / 2); - x = _arb_vec_init((best_n + 1) / 2); + vp = _acb_vec_init(best_n); + wp = _arb_vec_init((best_n + 1) / 2); + xp = _arb_vec_init((best_n + 1) / 2); - acb_calc_gl_node(x, w, i, -1, prec); + acb_calc_gl_node(xp, wp, i, -1, prec); work.n = best_n; - work.x = x; - work.w = w; + work.x = xp; + work.w = wp; work.prec = prec; work.delta = delta; work.mid = mid; - work.v = v; + work.v = vp; work.f = f; work.param = param; flint_parallel_do((do_func_t) gl_worker, &work, best_n, -1, FLINT_PARALLEL_STRIDED); - acb_add(s, v, v + 1, prec); + acb_add(s, vp, vp + 1, prec); for (k = 2; k < best_n; k++) - acb_add(s, s, v + k, prec); + acb_add(s, s, vp + k, prec); - _acb_vec_clear(v, best_n); - _arb_vec_clear(x, (best_n + 1) / 2); - _arb_vec_clear(w, (best_n + 1) / 2); + _acb_vec_clear(vp, best_n); + _arb_vec_clear(xp, (best_n + 1) / 2); + _arb_vec_clear(wp, (best_n + 1) / 2); } else { diff --git a/src/acb_calc/integrate_taylor.c b/src/acb_calc/integrate_taylor.c index d95abf6726..8b980b3a17 100644 --- a/src/acb_calc/integrate_taylor.c +++ b/src/acb_calc/integrate_taylor.c @@ -139,12 +139,12 @@ acb_calc_integrate_taylor(acb_t res, /* Tail bound: D / (N + 1) * T^N */ { - mag_t TT; - mag_init(TT); - arf_get_mag(TT, T); - mag_pow_ui(TT, TT, N); - arf_set_mag(T, TT); - mag_clear(TT); + mag_t TTm; + mag_init(TTm); + arf_get_mag(TTm, T); + mag_pow_ui(TTm, TTm, N); + arf_set_mag(T, TTm); + mag_clear(TTm); } arf_mul(D, D, T, bp, ARF_RND_UP); arf_div_ui(err, D, N + 1, bp, ARF_RND_UP); diff --git a/src/acb_calc/test/t-cauchy_bound.c b/src/acb_calc/test/t-cauchy_bound.c index 28d1d4f45c..a38b84c854 100644 --- a/src/acb_calc/test/t-cauchy_bound.c +++ b/src/acb_calc/test/t-cauchy_bound.c @@ -17,7 +17,7 @@ #ifndef sin_x #define sin_x sin_x int -sin_x(acb_ptr out, const acb_t inp, void * params, slong order, slong prec) +sin_x(acb_ptr out, const acb_t inp, void * FLINT_UNUSED(params), slong order, slong prec) { int xlen = FLINT_MIN(2, order); diff --git a/src/acb_calc/test/t-integrate.c b/src/acb_calc/test/t-integrate.c index 5edbf13d1f..19ba5b1da1 100644 --- a/src/acb_calc/test/t-integrate.c +++ b/src/acb_calc/test/t-integrate.c @@ -14,7 +14,7 @@ #include "acb_calc.h" int -f_zero(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_zero(acb_ptr res, const acb_t FLINT_UNUSED(z), void * FLINT_UNUSED(param), slong order, slong FLINT_UNUSED(prec)) { if (order > 1) flint_abort(); /* Would be needed for Taylor method. */ @@ -25,7 +25,7 @@ f_zero(acb_ptr res, const acb_t z, void * param, slong order, slong prec) } int -f_indet(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_indet(acb_ptr res, const acb_t FLINT_UNUSED(z), void * FLINT_UNUSED(param), slong order, slong FLINT_UNUSED(prec)) { if (order > 1) flint_abort(); /* Would be needed for Taylor method. */ @@ -36,7 +36,7 @@ f_indet(acb_ptr res, const acb_t z, void * param, slong order, slong prec) } int -f_cube(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_cube(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { if (order > 1) flint_abort(); /* Would be needed for Taylor method. */ @@ -47,7 +47,7 @@ f_cube(acb_ptr res, const acb_t z, void * param, slong order, slong prec) } int -f_sin(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_sin(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { if (order > 1) flint_abort(); /* Would be needed for Taylor method. */ @@ -58,7 +58,7 @@ f_sin(acb_ptr res, const acb_t z, void * param, slong order, slong prec) } int -f_sqrt(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_sqrt(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { if (order > 1) flint_abort(); /* Would be needed for Taylor method. */ @@ -69,7 +69,7 @@ f_sqrt(acb_ptr res, const acb_t z, void * param, slong order, slong prec) } int -f_rsqrt(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_rsqrt(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { if (order > 1) flint_abort(); /* Would be needed for Taylor method. */ @@ -80,7 +80,7 @@ f_rsqrt(acb_ptr res, const acb_t z, void * param, slong order, slong prec) } int -f_log(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_log(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { if (order > 1) flint_abort(); /* Would be needed for Taylor method. */ @@ -91,7 +91,7 @@ f_log(acb_ptr res, const acb_t z, void * param, slong order, slong prec) } int -f_pow_pi(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_pow_pi(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { if (order > 1) flint_abort(); /* Would be needed for Taylor method. */ @@ -103,7 +103,7 @@ f_pow_pi(acb_ptr res, const acb_t z, void * param, slong order, slong prec) } int -f_circle(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_circle(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { if (order > 1) flint_abort(); /* Would be needed for Taylor method. */ @@ -117,7 +117,7 @@ f_circle(acb_ptr res, const acb_t z, void * param, slong order, slong prec) /* f(z) = sin(z + exp(z)) -- Rump's oscillatory example */ int -f_rump(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_rump(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { if (order > 1) flint_abort(); /* Would be needed for Taylor method. */ @@ -132,7 +132,7 @@ f_rump(acb_ptr res, const acb_t z, void * param, slong order, slong prec) /* f(z) = |z^4 + 10z^3 + 19z^2 - 6z - 6| exp(z) (for real z) -- Helfgott's integral on MathOverflow */ int -f_helfgott(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_helfgott(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { if (order > 1) flint_abort(); /* Would be needed for Taylor method. */ @@ -161,7 +161,7 @@ f_helfgott(acb_ptr res, const acb_t z, void * param, slong order, slong prec) /* f(z) = z sin(1/z), assume on real interval */ int -f_essing2(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_essing2(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { if (order > 1) flint_abort(); /* Would be needed for Taylor method. */ @@ -185,7 +185,7 @@ f_essing2(acb_ptr res, const acb_t z, void * param, slong order, slong prec) /* f(z) = sech(10(x-0.2))^2 + sech(100(x-0.4))^4 + sech(1000(x-0.6))^6 */ int -f_spike(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_spike(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { acb_t a, b, c; @@ -225,7 +225,7 @@ f_spike(acb_ptr res, const acb_t z, void * param, slong order, slong prec) /* abs(sin(x))*cos(1+x) */ int -f_abs(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_abs(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { acb_t s, c; acb_init(s); @@ -242,7 +242,7 @@ f_abs(acb_ptr res, const acb_t z, void * param, slong order, slong prec) /* sign(sin(x))*cos(1+x) */ int -f_sgn(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_sgn(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { acb_t s, c; acb_init(s); @@ -259,7 +259,7 @@ f_sgn(acb_ptr res, const acb_t z, void * param, slong order, slong prec) /* heaviside(sin(x))*cos(1+x) */ int -f_heaviside(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_heaviside(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { acb_t s, c; acb_init(s); @@ -276,7 +276,7 @@ f_heaviside(acb_ptr res, const acb_t z, void * param, slong order, slong prec) /* floor(x-5) cos(1+x) */ int -f_floor(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_floor(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { acb_t c; acb_init(c); @@ -293,7 +293,7 @@ f_floor(acb_ptr res, const acb_t z, void * param, slong order, slong prec) /* ceil(x-5) cos(1+x) */ int -f_ceil(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_ceil(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { acb_t c; acb_init(c); @@ -308,7 +308,7 @@ f_ceil(acb_ptr res, const acb_t z, void * param, slong order, slong prec) /* max(sin(x),cos(x)) */ int -f_max(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_max(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { acb_t s, c; acb_init(s); @@ -322,7 +322,7 @@ f_max(acb_ptr res, const acb_t z, void * param, slong order, slong prec) /* min(sin(x),cos(x)) */ int -f_min(acb_ptr res, const acb_t z, void * param, slong order, slong prec) +f_min(acb_ptr res, const acb_t z, void * FLINT_UNUSED(param), slong order, slong prec) { acb_t s, c; acb_init(s); diff --git a/src/acb_calc/test/t-integrate_taylor.c b/src/acb_calc/test/t-integrate_taylor.c index 0fe8510a6d..82a299664f 100644 --- a/src/acb_calc/test/t-integrate_taylor.c +++ b/src/acb_calc/test/t-integrate_taylor.c @@ -17,7 +17,7 @@ #ifndef sin_x #define sin_x sin_x int -sin_x(acb_ptr out, const acb_t inp, void * params, slong order, slong prec) +sin_x(acb_ptr out, const acb_t inp, void * FLINT_UNUSED(params), slong order, slong prec) { int xlen = FLINT_MIN(2, order); From 74ac4d92332133409d9625a5d6480005ea032884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 11:17:11 +0200 Subject: [PATCH 085/114] arb_fpwrap --- src/arb_fpwrap/fpwrap.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/arb_fpwrap/fpwrap.c b/src/arb_fpwrap/fpwrap.c index 0cc9f90433..e98d26398f 100644 --- a/src/arb_fpwrap/fpwrap.c +++ b/src/arb_fpwrap/fpwrap.c @@ -18,7 +18,7 @@ #include "acb_modular.h" #include "arb_fpwrap.h" -int +static int arb_accurate_enough_d(const arb_t x, int flags) { if (flags & FPWRAP_CORRECT_ROUNDING) @@ -46,7 +46,7 @@ arb_accurate_enough_d(const arb_t x, int flags) return 0; } -int +static int acb_accurate_enough_d(const acb_t x, int flags) { if (flags & FPWRAP_CORRECT_ROUNDING) @@ -171,7 +171,7 @@ typedef void (*acb_func_3_int)(acb_t, const acb_t, const acb_t, const acb_t, int typedef void (*acb_func_4_int)(acb_t, const acb_t, const acb_t, const acb_t, const acb_t, int, slong prec); -int arb_fpwrap_double_1(double * res, arb_func_1 func, double x, int flags) +static int arb_fpwrap_double_1(double * res, arb_func_1 func, double x, int flags) { arb_t arb_res, arb_x; slong wp; @@ -202,7 +202,7 @@ int arb_fpwrap_double_1(double * res, arb_func_1 func, double x, int flags) return status; } -int arb_fpwrap_double_2(double * res, arb_func_2 func, double x1, double x2, int flags) +static int arb_fpwrap_double_2(double * res, arb_func_2 func, double x1, double x2, int flags) { arb_t arb_res, arb_x1, arb_x2; slong wp; @@ -236,7 +236,7 @@ int arb_fpwrap_double_2(double * res, arb_func_2 func, double x1, double x2, int return status; } -int arb_fpwrap_double_3(double * res, arb_func_3 func, double x1, double x2, double x3, int flags) +static int arb_fpwrap_double_3(double * res, arb_func_3 func, double x1, double x2, double x3, int flags) { arb_t arb_res, arb_x1, arb_x2, arb_x3; slong wp; @@ -273,7 +273,7 @@ int arb_fpwrap_double_3(double * res, arb_func_3 func, double x1, double x2, dou return status; } -int arb_fpwrap_double_4(double * res, arb_func_4 func, double x1, double x2, double x3, double x4, int flags) +static int arb_fpwrap_double_4(double * res, arb_func_4 func, double x1, double x2, double x3, double x4, int flags) { arb_t arb_res, arb_x1, arb_x2, arb_x3, arb_x4; slong wp; @@ -313,7 +313,7 @@ int arb_fpwrap_double_4(double * res, arb_func_4 func, double x1, double x2, dou return status; } -int arb_fpwrap_cdouble_1(complex_double * res, acb_func_1 func, complex_double x, int flags) +static int arb_fpwrap_cdouble_1(complex_double * res, acb_func_1 func, complex_double x, int flags) { acb_t acb_res, acb_x; slong wp; @@ -345,7 +345,7 @@ int arb_fpwrap_cdouble_1(complex_double * res, acb_func_1 func, complex_double x return status; } -int arb_fpwrap_cdouble_2(complex_double * res, acb_func_2 func, complex_double x1, complex_double x2, int flags) +static int arb_fpwrap_cdouble_2(complex_double * res, acb_func_2 func, complex_double x1, complex_double x2, int flags) { acb_t acb_res, acb_x1, acb_x2; slong wp; @@ -380,7 +380,7 @@ int arb_fpwrap_cdouble_2(complex_double * res, acb_func_2 func, complex_double x return status; } -int arb_fpwrap_cdouble_3(complex_double * res, acb_func_3 func, complex_double x1, complex_double x2, complex_double x3, int flags) +static int arb_fpwrap_cdouble_3(complex_double * res, acb_func_3 func, complex_double x1, complex_double x2, complex_double x3, int flags) { acb_t acb_res, acb_x1, acb_x2, acb_x3; slong wp; @@ -418,7 +418,7 @@ int arb_fpwrap_cdouble_3(complex_double * res, acb_func_3 func, complex_double x return status; } -int arb_fpwrap_cdouble_4(complex_double * res, acb_func_4 func, complex_double x1, complex_double x2, complex_double x3, complex_double x4, int flags) +static int arb_fpwrap_cdouble_4(complex_double * res, acb_func_4 func, complex_double x1, complex_double x2, complex_double x3, complex_double x4, int flags) { acb_t acb_res, acb_x1, acb_x2, acb_x3, acb_x4; slong wp; @@ -459,7 +459,7 @@ int arb_fpwrap_cdouble_4(complex_double * res, acb_func_4 func, complex_double x return status; } -int arb_fpwrap_double_1_int(double * res, arb_func_1_int func, double x, int intx, int flags) +static int arb_fpwrap_double_1_int(double * res, arb_func_1_int func, double x, int intx, int flags) { arb_t arb_res, arb_x; slong wp; @@ -490,7 +490,7 @@ int arb_fpwrap_double_1_int(double * res, arb_func_1_int func, double x, int int return status; } -int arb_fpwrap_double_2_int(double * res, arb_func_2_int func, double x1, double x2, int intx, int flags) +static int arb_fpwrap_double_2_int(double * res, arb_func_2_int func, double x1, double x2, int intx, int flags) { arb_t arb_res, arb_x1, arb_x2; slong wp; @@ -524,7 +524,7 @@ int arb_fpwrap_double_2_int(double * res, arb_func_2_int func, double x1, double return status; } -int arb_fpwrap_double_3_int(double * res, arb_func_3_int func, double x1, double x2, double x3, int intx, int flags) +static int arb_fpwrap_double_3_int(double * res, arb_func_3_int func, double x1, double x2, double x3, int intx, int flags) { arb_t arb_res, arb_x1, arb_x2, arb_x3; slong wp; @@ -561,7 +561,7 @@ int arb_fpwrap_double_3_int(double * res, arb_func_3_int func, double x1, double return status; } -int arb_fpwrap_double_4_int(double * res, arb_func_4_int func, double x1, double x2, double x3, double x4, int intx, int flags) +static int arb_fpwrap_double_4_int(double * res, arb_func_4_int func, double x1, double x2, double x3, double x4, int intx, int flags) { arb_t arb_res, arb_x1, arb_x2, arb_x3, arb_x4; slong wp; @@ -601,7 +601,7 @@ int arb_fpwrap_double_4_int(double * res, arb_func_4_int func, double x1, double return status; } -int arb_fpwrap_cdouble_1_int(complex_double * res, acb_func_1_int func, complex_double x, int intx, int flags) +static int arb_fpwrap_cdouble_1_int(complex_double * res, acb_func_1_int func, complex_double x, int intx, int flags) { acb_t acb_res, acb_x; slong wp; @@ -633,7 +633,7 @@ int arb_fpwrap_cdouble_1_int(complex_double * res, acb_func_1_int func, complex_ return status; } -int arb_fpwrap_cdouble_2_int(complex_double * res, acb_func_2_int func, complex_double x1, complex_double x2, int intx, int flags) +static int arb_fpwrap_cdouble_2_int(complex_double * res, acb_func_2_int func, complex_double x1, complex_double x2, int intx, int flags) { acb_t acb_res, acb_x1, acb_x2; slong wp; @@ -668,7 +668,7 @@ int arb_fpwrap_cdouble_2_int(complex_double * res, acb_func_2_int func, complex_ return status; } -int arb_fpwrap_cdouble_3_int(complex_double * res, acb_func_3_int func, complex_double x1, complex_double x2, complex_double x3, int intx, int flags) +static int arb_fpwrap_cdouble_3_int(complex_double * res, acb_func_3_int func, complex_double x1, complex_double x2, complex_double x3, int intx, int flags) { acb_t acb_res, acb_x1, acb_x2, acb_x3; slong wp; @@ -706,7 +706,7 @@ int arb_fpwrap_cdouble_3_int(complex_double * res, acb_func_3_int func, complex_ return status; } -int arb_fpwrap_cdouble_4_int(complex_double * res, acb_func_4_int func, complex_double x1, complex_double x2, complex_double x3, complex_double x4, int intx, int flags) +static int arb_fpwrap_cdouble_4_int(complex_double * res, acb_func_4_int func, complex_double x1, complex_double x2, complex_double x3, complex_double x4, int intx, int flags) { acb_t acb_res, acb_x1, acb_x2, acb_x3, acb_x4; slong wp; @@ -1433,7 +1433,7 @@ int arb_fpwrap_double_legendre_root(double * res1, double * res2, ulong n, ulong return status; } -int _arb_fpwrap_double_airy_zero(double * res, ulong n, int which, int flags) +static int _arb_fpwrap_double_airy_zero(double * res, ulong n, int which, int flags) { fmpz_t t; arb_t arb_res; From 058e498689ba1307f245605db7ef5cbea1bd623e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 11:17:19 +0200 Subject: [PATCH 086/114] acb_dft --- src/acb_dft/convol.c | 2 +- src/acb_dft/convol_dft.c | 2 +- src/acb_dft/convol_rad2.c | 2 +- src/acb_dft/crt.c | 2 ++ src/acb_dft/cyc.c | 2 ++ src/acb_dft/rad2.c | 6 ++++++ src/acb_dft/rad2_threaded.c | 2 +- 7 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/acb_dft/convol.c b/src/acb_dft/convol.c index db6183b9fd..0792ab1c6f 100644 --- a/src/acb_dft/convol.c +++ b/src/acb_dft/convol.c @@ -11,7 +11,7 @@ #include "acb_dft.h" -static int use_dft(slong len, slong prec) +static int use_dft(slong len, slong FLINT_UNUSED(prec)) { slong l2 = len; while (l2 >= 16) l2 >>= 1; diff --git a/src/acb_dft/convol_dft.c b/src/acb_dft/convol_dft.c index 2c3266e32d..4c20e0279f 100644 --- a/src/acb_dft/convol_dft.c +++ b/src/acb_dft/convol_dft.c @@ -11,7 +11,7 @@ #include "acb_dft.h" -void +static void acb_dft_convol_dft_precomp(acb_ptr w, acb_srcptr f, acb_srcptr g, const acb_dft_pre_t pre, slong prec) { acb_ptr fp, gp; diff --git a/src/acb_dft/convol_rad2.c b/src/acb_dft/convol_rad2.c index 91a240773e..bc31f9ecc1 100644 --- a/src/acb_dft/convol_rad2.c +++ b/src/acb_dft/convol_rad2.c @@ -12,7 +12,7 @@ #include "acb_dft.h" /* assume np >= 2 * n - 1 */ -void +static void acb_dft_convol_pad(acb_ptr fp, acb_ptr gp, acb_srcptr f, acb_srcptr g, slong n, slong np) { slong k; diff --git a/src/acb_dft/crt.c b/src/acb_dft/crt.c index 5c1666698c..bf2518599d 100644 --- a/src/acb_dft/crt.c +++ b/src/acb_dft/crt.c @@ -39,6 +39,7 @@ crt_init(crt_t c, ulong n) } } +#if 0 void crt_print(const crt_t c) { @@ -51,6 +52,7 @@ crt_print(const crt_t c) flint_printf("Z/%wuZ ", c->m[k]); flint_printf("\n"); } +#endif #if 0 /* lexicographic index of crt elt j */ diff --git a/src/acb_dft/cyc.c b/src/acb_dft/cyc.c index 55a321fa4a..ef2a48fb0e 100644 --- a/src/acb_dft/cyc.c +++ b/src/acb_dft/cyc.c @@ -110,6 +110,7 @@ acb_dft_cyc(acb_ptr w, acb_srcptr v, slong len, slong prec) acb_dft_cyc_clear(cyc); } +#if 0 void acb_dft_inverse_cyc(acb_ptr w, acb_srcptr v, slong len, slong prec) { @@ -119,3 +120,4 @@ acb_dft_inverse_cyc(acb_ptr w, acb_srcptr v, slong len, slong prec) acb_dft_cyc(w, w, len, prec); acb_vec_swap_ri(w, len); } +#endif diff --git a/src/acb_dft/rad2.c b/src/acb_dft/rad2.c index 44f51046b3..92cf0fc2c8 100644 --- a/src/acb_dft/rad2.c +++ b/src/acb_dft/rad2.c @@ -11,6 +11,12 @@ #include "acb_dft.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + /* swap each element with one with bit-reversed index */ void acb_dft_rad2_reorder(acb_ptr v, slong n) diff --git a/src/acb_dft/rad2_threaded.c b/src/acb_dft/rad2_threaded.c index 0c51ba94d4..ab815ee7df 100644 --- a/src/acb_dft/rad2_threaded.c +++ b/src/acb_dft/rad2_threaded.c @@ -30,7 +30,7 @@ typedef struct } _worker_arg; -void +static void _acb_dft_rad2_thread(void * arg_ptr) { _worker_arg arg = *((_worker_arg *) arg_ptr); From 71da249229a2369379b5cbab97b671eee823aaaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 11:17:31 +0200 Subject: [PATCH 087/114] acb_hypgeom --- src/acb_hypgeom/0f1.c | 2 +- src/acb_hypgeom/2f1.c | 2 +- src/acb_hypgeom/2f1_transform.c | 4 +-- src/acb_hypgeom/airy.c | 6 ++-- src/acb_hypgeom/airy_asymp.c | 6 ++-- src/acb_hypgeom/airy_bound.c | 10 +++--- src/acb_hypgeom/airy_direct.c | 16 ++++----- src/acb_hypgeom/bessel_i.c | 6 ++-- src/acb_hypgeom/bessel_j.c | 4 +-- src/acb_hypgeom/bessel_k.c | 4 +-- src/acb_hypgeom/coulomb.c | 2 +- src/acb_hypgeom/dilog_transform.c | 36 +++++++++---------- src/acb_hypgeom/dilog_zero_taylor.c | 2 +- src/acb_hypgeom/erf.c | 2 +- src/acb_hypgeom/fresnel.c | 4 +-- src/acb_hypgeom/gamma.c | 6 ++++ src/acb_hypgeom/gamma_stirling_sum_improved.c | 24 ++++++------- src/acb_hypgeom/gamma_upper.c | 9 ++++- src/acb_hypgeom/gegenbauer_c.c | 2 +- src/acb_hypgeom/hermite_h.c | 2 +- src/acb_hypgeom/jacobi_p.c | 6 ++-- src/acb_hypgeom/laguerre_l.c | 2 +- src/acb_hypgeom/legendre_p_uiui_rec.c | 4 +-- src/acb_hypgeom/legendre_q.c | 10 +++++- src/acb_hypgeom/lgamma.c | 6 ++-- src/acb_hypgeom/li.c | 4 +-- src/acb_hypgeom/log_rising_ui_jet.c | 18 +++++----- src/acb_hypgeom/m.c | 6 ++-- src/acb_hypgeom/pfq_choose_n.c | 8 ++++- src/acb_hypgeom/pfq_series_direct.c | 6 ++-- src/acb_hypgeom/rising_ui_jet.c | 2 +- src/acb_hypgeom/rising_ui_jet_bs.c | 8 ++--- src/acb_hypgeom/rising_ui_jet_powsum.c | 8 ++--- src/acb_hypgeom/rising_ui_jet_rs.c | 15 ++++---- src/acb_hypgeom/rising_ui_rs.c | 8 +++-- src/acb_hypgeom/u.c | 6 ++-- src/acb_hypgeom/u_asymp.c | 8 ++++- 37 files changed, 156 insertions(+), 118 deletions(-) diff --git a/src/acb_hypgeom/0f1.c b/src/acb_hypgeom/0f1.c index da7c12900a..3f54bd6300 100644 --- a/src/acb_hypgeom/0f1.c +++ b/src/acb_hypgeom/0f1.c @@ -100,7 +100,7 @@ acb_hypgeom_0f1_direct(acb_t res, const acb_t a, const acb_t z, int regularized, } } -int +static int acb_hypgeom_0f1_use_asymp(const acb_t z, slong prec) { double x, y, c; diff --git a/src/acb_hypgeom/2f1.c b/src/acb_hypgeom/2f1.c index 9b79ecda21..e2802ff8a5 100644 --- a/src/acb_hypgeom/2f1.c +++ b/src/acb_hypgeom/2f1.c @@ -32,7 +32,7 @@ _acb_hypgeom_2f1r_reduced(acb_t res, return; } -void +static void acb_hypgeom_2f1_nointegration(acb_t res, const acb_t a, const acb_t b, const acb_t c, const acb_t z, int flags, slong prec) { diff --git a/src/acb_hypgeom/2f1_transform.c b/src/acb_hypgeom/2f1_transform.c index 87e1e398a3..dc03e543b8 100644 --- a/src/acb_hypgeom/2f1_transform.c +++ b/src/acb_hypgeom/2f1_transform.c @@ -23,7 +23,7 @@ which == 5 -- 1-1/z */ -void +static void _acb_hypgeom_2f1_transform_limit(acb_t res, const acb_poly_t a, const acb_poly_t b, const acb_poly_t c, const acb_poly_t z, int which, slong prec) { @@ -224,7 +224,7 @@ acb_hypgeom_2f1_transform_limit(acb_t res, const acb_t a, const acb_t b, acb_clear(t); } -void +static void acb_hypgeom_2f1_transform_nolimit(acb_t res, const acb_t a, const acb_t b, const acb_t c, const acb_t z, int regularized, int which, slong prec) { diff --git a/src/acb_hypgeom/airy.c b/src/acb_hypgeom/airy.c index 8e3d7c1fe7..47c8445380 100644 --- a/src/acb_hypgeom/airy.c +++ b/src/acb_hypgeom/airy.c @@ -102,7 +102,7 @@ estimate_airy(double x, double y, int ai) } /* error propagation based on derivatives */ -void +static void acb_hypgeom_airy_prop(acb_t ai, acb_t aip, acb_t bi, acb_t bip, const acb_t z, slong n, int algo, slong prec) { @@ -177,14 +177,14 @@ acb_hypgeom_airy_prop(acb_t ai, acb_t aip, acb_t bi, acb_t bip, acb_clear(zz); } -void +static void acb_hypgeom_airy_direct_prop(acb_t ai, acb_t aip, acb_t bi, acb_t bip, const acb_t z, slong n, slong prec) { acb_hypgeom_airy_prop(ai, aip, bi, bip, z, n, 0, prec); } -void +static void acb_hypgeom_airy_asymp2(acb_t ai, acb_t aip, acb_t bi, acb_t bip, const acb_t z, slong n, slong prec) { diff --git a/src/acb_hypgeom/airy_asymp.c b/src/acb_hypgeom/airy_asymp.c index efede12bf2..9206322e1c 100644 --- a/src/acb_hypgeom/airy_asymp.c +++ b/src/acb_hypgeom/airy_asymp.c @@ -33,7 +33,7 @@ arg_lt_2pi3(const acb_t z, const acb_t zeta) } /* assuming a >= b >= c >= d, e >= f */ -void +static void _acb_mul4div2_ui(acb_t x, ulong a, ulong b, ulong c, ulong d, ulong e, ulong f, slong prec) { if (a < (UWORD(1) << (FLINT_BITS / 4))) @@ -64,7 +64,7 @@ _acb_mul4div2_ui(acb_t x, ulong a, ulong b, ulong c, ulong d, ulong e, ulong f, } } -void +static void acb_hypgeom_airy_asymp_sum(acb_t s0even, acb_t s0odd, acb_t s1even, acb_t s1odd, mag_t t0n, mag_t t1n, @@ -190,7 +190,7 @@ acb_hypgeom_airy_asymp_sum(acb_t s0even, acb_t s0odd, _acb_vec_clear(z2pow, m + 1); } -void +static void acb_hypgeom_airy_asymp_bound_factor(mag_t bound, const acb_t z, const acb_t zeta, ulong n) { mag_t t, u, v; diff --git a/src/acb_hypgeom/airy_bound.c b/src/acb_hypgeom/airy_bound.c index ed43697310..524560e419 100644 --- a/src/acb_hypgeom/airy_bound.c +++ b/src/acb_hypgeom/airy_bound.c @@ -12,7 +12,7 @@ #include "acb.h" #include "acb_hypgeom.h" -void +static void arb_bound_exp_neg(mag_t b, const arb_t x) { arb_t t; @@ -27,8 +27,8 @@ arb_bound_exp_neg(mag_t b, const arb_t x) /* Implements DLMF 9.7.17. We assume |zeta| >= 1/2 and |arg(z)| <= 2 pi/3 here, ignoring the smaller points which must be dealt with separately. */ -void -acb_hypgeom_airy_bound_9_7_17(mag_t bound, const acb_t z, const acb_t zeta) +static void +acb_hypgeom_airy_bound_9_7_17(mag_t bound, const acb_t FLINT_UNUSED(z), const acb_t zeta) { mag_t D, t, u, v, zeta_lower, half; @@ -70,7 +70,7 @@ acb_hypgeom_airy_bound_9_7_17(mag_t bound, const acb_t z, const acb_t zeta) mag_clear(zeta_lower); } -void +static void acb_hypgeom_airy_bound_arg_le_2pi3(mag_t A, mag_t B, const acb_t z, slong wp) { acb_t zeta, z1; @@ -119,7 +119,7 @@ acb_hypgeom_airy_bound_arg_le_2pi3(mag_t A, mag_t B, const acb_t z, slong wp) /* near the negative half line, use |Ai(-z)|, |Bi(-z)| <= |Ai(z exp(pi i/3))| + |Ai(z exp(-pi i/3))| */ -void +static void acb_hypgeom_airy_bound_arg_ge_2pi3(mag_t A, mag_t B, const acb_t z, slong wp) { acb_t zeta, z1, z2; diff --git a/src/acb_hypgeom/airy_direct.c b/src/acb_hypgeom/airy_direct.c index 09821e9d62..1c14de13f7 100644 --- a/src/acb_hypgeom/airy_direct.c +++ b/src/acb_hypgeom/airy_direct.c @@ -14,7 +14,7 @@ #include "acb.h" #include "acb_hypgeom.h" -void +static void arb_const_airy_ai0_eval(arb_t y, slong prec) { arb_t t; fmpq_t v; arb_init(t); fmpq_init(v); @@ -26,7 +26,7 @@ arb_const_airy_ai0_eval(arb_t y, slong prec) arb_clear(t); fmpq_clear(v); } -void +static void arb_const_airy_ai1_eval(arb_t y, slong prec) { arb_t t; fmpq_t v; arb_init(t); fmpq_init(v); @@ -38,7 +38,7 @@ arb_const_airy_ai1_eval(arb_t y, slong prec) arb_clear(t); fmpq_clear(v); } -void +static void arb_const_airy_bi0_eval(arb_t y, slong prec) { arb_t t; fmpq_t v; arb_init(t); fmpq_init(v); @@ -50,7 +50,7 @@ arb_const_airy_bi0_eval(arb_t y, slong prec) arb_clear(t); fmpq_clear(v); } -void +static void arb_const_airy_bi1_eval(arb_t y, slong prec) { arb_t t; fmpq_t v; arb_init(t); fmpq_init(v); @@ -61,10 +61,10 @@ arb_const_airy_bi1_eval(arb_t y, slong prec) arb_clear(t); fmpq_clear(v); } -ARB_DEF_CACHED_CONSTANT(arb_const_airy_ai0, arb_const_airy_ai0_eval) -ARB_DEF_CACHED_CONSTANT(arb_const_airy_ai1, arb_const_airy_ai1_eval) -ARB_DEF_CACHED_CONSTANT(arb_const_airy_bi0, arb_const_airy_bi0_eval) -ARB_DEF_CACHED_CONSTANT(arb_const_airy_bi1, arb_const_airy_bi1_eval) +_ARB_DEF_CACHED_CONSTANT(static, static, arb_const_airy_ai0, arb_const_airy_ai0_eval) +_ARB_DEF_CACHED_CONSTANT(static, static, arb_const_airy_ai1, arb_const_airy_ai1_eval) +_ARB_DEF_CACHED_CONSTANT(static, static, arb_const_airy_bi0, arb_const_airy_bi0_eval) +_ARB_DEF_CACHED_CONSTANT(static, static, arb_const_airy_bi1, arb_const_airy_bi1_eval) static void acb_hypgeom_airy_0f1_sum_inner(acb_t s, acb_srcptr t, slong m, slong n, slong alpha, int real, slong prec) diff --git a/src/acb_hypgeom/bessel_i.c b/src/acb_hypgeom/bessel_i.c index 47a5708b62..6518199210 100644 --- a/src/acb_hypgeom/bessel_i.c +++ b/src/acb_hypgeom/bessel_i.c @@ -13,7 +13,7 @@ #include "arb_hypgeom.h" #include "acb_hypgeom.h" -void +static void acb_hypgeom_bessel_i_asymp_prefactors(acb_t A, acb_t B, acb_t C, const acb_t nu, const acb_t z, int scaled, slong prec) { @@ -201,7 +201,7 @@ acb_hypgeom_bessel_i_0f1(acb_t res, const acb_t nu, const acb_t z, int scaled, s acb_clear(t); } -void +static void acb_hypgeom_bessel_i_nointegration(acb_t res, const acb_t nu, const acb_t z, int scaled, slong prec) { mag_t zmag; @@ -218,7 +218,7 @@ acb_hypgeom_bessel_i_nointegration(acb_t res, const acb_t nu, const acb_t z, int mag_clear(zmag); } -void +static void _acb_hypgeom_bessel_i(acb_t res, const acb_t nu, const acb_t z, int scaled, slong prec) { acb_t res2; diff --git a/src/acb_hypgeom/bessel_j.c b/src/acb_hypgeom/bessel_j.c index e19bdba769..fb7e42818f 100644 --- a/src/acb_hypgeom/bessel_j.c +++ b/src/acb_hypgeom/bessel_j.c @@ -14,7 +14,7 @@ /* assumes no aliasing */ /* (+/- iz)^(-1/2-v) * z^v * exp(+/- iz) */ -void +static void acb_hypgeom_bessel_j_asymp_prefactors_fallback(acb_t Ap, acb_t Am, acb_t C, const acb_t nu, const acb_t z, slong prec) { @@ -57,7 +57,7 @@ acb_hypgeom_bessel_j_asymp_prefactors_fallback(acb_t Ap, acb_t Am, acb_t C, acb_clear(v); } -void +static void acb_hypgeom_bessel_j_asymp_prefactors(acb_t Ap, acb_t Am, acb_t C, const acb_t nu, const acb_t z, slong prec) { diff --git a/src/acb_hypgeom/bessel_k.c b/src/acb_hypgeom/bessel_k.c index 4ddc6a149c..f37cdf0b14 100644 --- a/src/acb_hypgeom/bessel_k.c +++ b/src/acb_hypgeom/bessel_k.c @@ -207,7 +207,7 @@ acb_hypgeom_bessel_k_0f1(acb_t res, const acb_t nu, const acb_t z, int scaled, s } } -void +static void acb_hypgeom_bessel_k_nointegration(acb_t res, const acb_t nu, const acb_t z, int scaled, slong prec) { mag_t zmag; @@ -224,7 +224,7 @@ acb_hypgeom_bessel_k_nointegration(acb_t res, const acb_t nu, const acb_t z, int mag_clear(zmag); } -void +static void _acb_hypgeom_bessel_k(acb_t res, const acb_t nu, const acb_t z, int scaled, slong prec) { acb_t res2; diff --git a/src/acb_hypgeom/coulomb.c b/src/acb_hypgeom/coulomb.c index b236eae938..c352138611 100644 --- a/src/acb_hypgeom/coulomb.c +++ b/src/acb_hypgeom/coulomb.c @@ -37,7 +37,7 @@ acb_hypgeom_coulomb_is_real(int * C, int * F, int * G, const acb_t l1, const acb } } -void +static void _acb_hypgeom_coulomb(acb_t F, acb_t G, acb_t Hpos, acb_t Hneg, const acb_t l, const acb_t eta, const acb_t z, int asymp, slong prec) { acb_t u, v, lu, lv, z1, z2, m, h, T1, T2, U1, U2, H1, H2, C, theta; diff --git a/src/acb_hypgeom/dilog_transform.c b/src/acb_hypgeom/dilog_transform.c index ba5f5a94a5..7c5718a7ff 100644 --- a/src/acb_hypgeom/dilog_transform.c +++ b/src/acb_hypgeom/dilog_transform.c @@ -135,36 +135,36 @@ acb_hypgeom_dilog_transform(acb_t res, const acb_t z, int algorithm, slong prec) else if (algorithm == 6) { /* Li_2((1+i)/2) = (5 pi^2 / 96 - log(2)^2/8) + (C - pi log(2) / 8) i */ - arb_t t; - arb_init(t); + arb_t tb; + arb_init(tb); acb_set_d_d(a, 0.5, 0.5); - arb_const_pi(t, prec); + arb_const_pi(tb, prec); arb_const_log2(acb_imagref(u), prec); arb_mul(acb_realref(u), acb_imagref(u), acb_imagref(u), prec); - arb_mul(acb_imagref(u), acb_imagref(u), t, prec); + arb_mul(acb_imagref(u), acb_imagref(u), tb, prec); acb_mul_2exp_si(u, u, -3); - arb_mul(t, t, t, prec); - arb_mul_ui(t, t, 5, prec); - arb_div_ui(t, t, 96, prec); - arb_sub(acb_realref(u), t, acb_realref(u), prec); - arb_const_catalan(t, prec); - arb_sub(acb_imagref(u), t, acb_imagref(u), prec); - arb_clear(t); + arb_mul(tb, tb, tb, prec); + arb_mul_ui(tb, tb, 5, prec); + arb_div_ui(tb, tb, 96, prec); + arb_sub(acb_realref(u), tb, acb_realref(u), prec); + arb_const_catalan(tb, prec); + arb_sub(acb_imagref(u), tb, acb_imagref(u), prec); + arb_clear(tb); } else { /* Li_2(1+i) = pi^2/16 + (C + pi log(2)/4) i */ - arb_t t; - arb_init(t); + arb_t tb; + arb_init(tb); acb_set_d_d(a, 1.0, 1.0); arb_const_pi(acb_realref(u), prec); arb_mul_2exp_si(acb_realref(u), acb_realref(u), -2); - arb_const_log2(t, prec); - arb_mul(acb_imagref(u), acb_realref(u), t, prec); - arb_const_catalan(t, prec); - arb_add(acb_imagref(u), acb_imagref(u), t, prec); + arb_const_log2(tb, prec); + arb_mul(acb_imagref(u), acb_realref(u), tb, prec); + arb_const_catalan(tb, prec); + arb_add(acb_imagref(u), acb_imagref(u), tb, prec); arb_mul(acb_realref(u), acb_realref(u), acb_realref(u), prec); - arb_clear(t); + arb_clear(tb); } if (arf_sgn(arb_midref(acb_imagref(z))) < 0) diff --git a/src/acb_hypgeom/dilog_zero_taylor.c b/src/acb_hypgeom/dilog_zero_taylor.c index f267038b1c..1e3f2c6f02 100644 --- a/src/acb_hypgeom/dilog_zero_taylor.c +++ b/src/acb_hypgeom/dilog_zero_taylor.c @@ -56,7 +56,7 @@ bsplit_zero(acb_t P, acb_t R, acb_t Q, const acb_t z, #define DIVLIM2 30000 #endif -void +static void acb_hypgeom_dilog_taylor_sum(acb_t res, const acb_t z, slong n, slong prec) { slong k, qk, m, power; diff --git a/src/acb_hypgeom/erf.c b/src/acb_hypgeom/erf.c index f4e252e402..79749631fe 100644 --- a/src/acb_hypgeom/erf.c +++ b/src/acb_hypgeom/erf.c @@ -232,7 +232,7 @@ acb_hypgeom_erf_propagated_error(mag_t re, mag_t im, const acb_t z) mag_clear(y); } -void +static void acb_hypgeom_erf_1f1(acb_t res, const acb_t z, slong prec, slong wp, int more_imaginary) { diff --git a/src/acb_hypgeom/fresnel.c b/src/acb_hypgeom/fresnel.c index e2bbdf844e..ba834aafd4 100644 --- a/src/acb_hypgeom/fresnel.c +++ b/src/acb_hypgeom/fresnel.c @@ -25,7 +25,7 @@ bit of a hack, and it would be better to somehow pass z^2 directly to the erf evaluation code). */ -void +static void acb_hypgeom_fresnel_erf(acb_t res1, acb_t res2, const acb_t z, slong prec) { acb_t t, u, v, w1, w2; @@ -98,7 +98,7 @@ acb_hypgeom_fresnel_erf(acb_t res1, acb_t res2, const acb_t z, slong prec) } /* derivatives: |8/sqrt(pi) sin(2z^2)|, |8/sqrt(pi) cos(2z^2)| <= 5 exp(4|xy|) */ -void +static void acb_hypgeom_fresnel_erf_error(acb_t res1, acb_t res2, const acb_t z, slong prec) { mag_t re; diff --git a/src/acb_hypgeom/gamma.c b/src/acb_hypgeom/gamma.c index 49dd226306..e538f3abf7 100644 --- a/src/acb_hypgeom/gamma.c +++ b/src/acb_hypgeom/gamma.c @@ -13,6 +13,12 @@ #include "acb_hypgeom.h" #include "arb_hypgeom.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void acb_hypgeom_gamma_stirling_choose_param(int * reflect, slong * r, slong * n, const acb_t z, int use_reflect, int digamma, slong prec); diff --git a/src/acb_hypgeom/gamma_stirling_sum_improved.c b/src/acb_hypgeom/gamma_stirling_sum_improved.c index 9adfd09a08..d511f2042e 100644 --- a/src/acb_hypgeom/gamma_stirling_sum_improved.c +++ b/src/acb_hypgeom/gamma_stirling_sum_improved.c @@ -117,12 +117,12 @@ acb_hypgeom_gamma_stirling_sum_improved(acb_t s, const acb_t z, slong N, slong K while (Mk[k] > 2) { - slong err, Mnew; + slong errs, Mnew; Mnew = Mk[k] - 1; - err = term_mags[Mnew] - log2_k * (2 * Mnew) + FLINT_BIT_COUNT(N - Mnew); + errs = term_mags[Mnew] - log2_k * (2 * Mnew) + FLINT_BIT_COUNT(N - Mnew); - if (err < -prec) + if (errs < -prec) Mk[k] = Mnew; else break; @@ -147,15 +147,15 @@ acb_hypgeom_gamma_stirling_sum_improved(acb_t s, const acb_t z, slong N, slong K for (k = 1; k < K; k++) { - mag_t t; - mag_init(t); - mag_set_ui_lower(t, k); - mag_inv(t, t); - mag_pow_ui(t, t, 2 * Mk[k]); - mag_mul_ui(t, t, N - Mk[k]); - mag_mul_2exp_si(t, t, term_mags[Mk[k]]); - mag_add(err, err, t); - mag_clear(t); + mag_t tm; + mag_init(tm); + mag_set_ui_lower(tm, k); + mag_inv(tm, tm); + mag_pow_ui(tm, tm, 2 * Mk[k]); + mag_mul_ui(tm, tm, N - Mk[k]); + mag_mul_2exp_si(tm, tm, term_mags[Mk[k]]); + mag_add(err, err, tm); + mag_clear(tm); } } else diff --git a/src/acb_hypgeom/gamma_upper.c b/src/acb_hypgeom/gamma_upper.c index f027395d02..e290404a60 100644 --- a/src/acb_hypgeom/gamma_upper.c +++ b/src/acb_hypgeom/gamma_upper.c @@ -13,6 +13,13 @@ #include "arb_hypgeom.h" #include "acb_hypgeom.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma message "_mag_gt_norm_ui only needs a symbol for test" +#endif + int acb_hypgeom_u_asymp_determine_region(const mag_t r, const mag_t zlo, const acb_t z); @@ -391,7 +398,7 @@ _acb_is_nonnegative_real(const acb_t z) return arb_is_zero(acb_imagref(z)) && arb_is_nonnegative(acb_realref(z)); } -void +static void acb_hypgeom_gamma_upper_nointegration(acb_t res, const acb_t s, const acb_t z, int regularized, slong prec) { if (!acb_is_finite(s) || !acb_is_finite(z)) diff --git a/src/acb_hypgeom/gegenbauer_c.c b/src/acb_hypgeom/gegenbauer_c.c index 094e7755bc..5db6461f12 100644 --- a/src/acb_hypgeom/gegenbauer_c.c +++ b/src/acb_hypgeom/gegenbauer_c.c @@ -28,7 +28,7 @@ use_recurrence(const acb_t n, const acb_t m, slong prec) return 1; } -void +static void acb_hypgeom_gegenbauer_c_ui_recurrence(acb_t res, ulong n, const acb_t m, const acb_t z, slong prec) { diff --git a/src/acb_hypgeom/hermite_h.c b/src/acb_hypgeom/hermite_h.c index 3fc46b4e50..50baa65427 100644 --- a/src/acb_hypgeom/hermite_h.c +++ b/src/acb_hypgeom/hermite_h.c @@ -12,7 +12,7 @@ #include "acb.h" #include "acb_hypgeom.h" -void +static void acb_hypgeom_hermite_h_ui_recurrence(acb_t res, ulong n, const acb_t z, slong prec) { acb_t t, u, v; diff --git a/src/acb_hypgeom/jacobi_p.c b/src/acb_hypgeom/jacobi_p.c index f8e5d250e1..cfe24e0b2e 100644 --- a/src/acb_hypgeom/jacobi_p.c +++ b/src/acb_hypgeom/jacobi_p.c @@ -14,7 +14,7 @@ /* this can be improved */ static int -use_recurrence(const acb_t n, const acb_t a, const acb_t b, slong prec) +use_recurrence(const acb_t n, const acb_t a, const acb_t FLINT_UNUSED(b), slong prec) { if (!acb_is_int(n) || !arb_is_nonnegative(acb_realref(n))) return 0; @@ -29,13 +29,13 @@ use_recurrence(const acb_t n, const acb_t a, const acb_t b, slong prec) return 1; } -void +static void acb_hypgeom_jacobi_p_ui_direct(acb_t res, ulong n, const acb_t a, const acb_t b, const acb_t z, slong prec) { acb_ptr terms; acb_t t, u, v; - slong k; + ulong k; terms = _acb_vec_init(n + 1); acb_init(t); diff --git a/src/acb_hypgeom/laguerre_l.c b/src/acb_hypgeom/laguerre_l.c index ccb2067164..56b4a19507 100644 --- a/src/acb_hypgeom/laguerre_l.c +++ b/src/acb_hypgeom/laguerre_l.c @@ -28,7 +28,7 @@ use_recurrence(const acb_t n, const acb_t m, slong prec) return 1; } -void +static void acb_hypgeom_laguerre_l_ui_recurrence(acb_t res, ulong n, const acb_t m, const acb_t z, slong prec) { diff --git a/src/acb_hypgeom/legendre_p_uiui_rec.c b/src/acb_hypgeom/legendre_p_uiui_rec.c index 1cb9b478cb..33eec3d37c 100644 --- a/src/acb_hypgeom/legendre_p_uiui_rec.c +++ b/src/acb_hypgeom/legendre_p_uiui_rec.c @@ -16,7 +16,7 @@ void acb_hypgeom_legendre_p_uiui_rec(acb_t res, ulong n, ulong m, const acb_t z, slong prec) { acb_t t, u, v; - slong k; + ulong k; if (!acb_is_finite(z)) { @@ -30,7 +30,7 @@ acb_hypgeom_legendre_p_uiui_rec(acb_t res, ulong n, ulong m, const acb_t z, slon return; } - if ((n - m) / 4 > prec) + if ((slong) ((n - m) / 4) > prec) { acb_indeterminate(res); return; diff --git a/src/acb_hypgeom/legendre_q.c b/src/acb_hypgeom/legendre_q.c index 332b2129de..c3e2868cce 100644 --- a/src/acb_hypgeom/legendre_q.c +++ b/src/acb_hypgeom/legendre_q.c @@ -12,8 +12,16 @@ #include "acb.h" #include "acb_hypgeom.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma message "_acb_hypgeom_legendre_q_single only needs a symbol for test" +# pragma message "_acb_hypgeom_legendre_q_double only needs a symbol for test" +#endif + /* invalid in (-1,0) */ -int +static int _acb_hypgeom_legendre_q_single_valid(const acb_t z) { arb_t t; diff --git a/src/acb_hypgeom/lgamma.c b/src/acb_hypgeom/lgamma.c index 56f19fd027..80de0b7101 100644 --- a/src/acb_hypgeom/lgamma.c +++ b/src/acb_hypgeom/lgamma.c @@ -66,16 +66,16 @@ static const double Btab[] = { -0.62578331900739100617, }; -void +static void _arb_const_log_pi(arb_t t, slong prec) { arb_const_pi(t, prec + 2); arb_log(t, t, prec); } -ARB_DEF_CACHED_CONSTANT(arb_const_log_pi, _arb_const_log_pi) +_ARB_DEF_CACHED_CONSTANT(static, static, arb_const_log_pi, _arb_const_log_pi) -int +static int acb_hypgeom_lgamma_taylor(acb_t res, const acb_t z, slong prec) { double x, y, acc; diff --git a/src/acb_hypgeom/li.c b/src/acb_hypgeom/li.c index fcb580808f..d6772ec546 100644 --- a/src/acb_hypgeom/li.c +++ b/src/acb_hypgeom/li.c @@ -26,7 +26,7 @@ _acb_hypgeom_li(acb_t res, const acb_t z, slong prec) } } -void +static void _acb_hypgeom_const_li2_eval(arb_t s, slong prec) { acb_t t; @@ -37,7 +37,7 @@ _acb_hypgeom_const_li2_eval(arb_t s, slong prec) acb_clear(t); } -ARB_DEF_CACHED_CONSTANT(_acb_hypgeom_const_li2, _acb_hypgeom_const_li2_eval) +_ARB_DEF_CACHED_CONSTANT(static, static, _acb_hypgeom_const_li2, _acb_hypgeom_const_li2_eval) static void _acb_hypgeom_li_offset(acb_t res, const acb_t z, slong prec) diff --git a/src/acb_hypgeom/log_rising_ui_jet.c b/src/acb_hypgeom/log_rising_ui_jet.c index 598b3ca9fb..5e5798ba8c 100644 --- a/src/acb_hypgeom/log_rising_ui_jet.c +++ b/src/acb_hypgeom/log_rising_ui_jet.c @@ -26,7 +26,8 @@ _acb_log_rising_correct_branch(acb_t res, acb_t f; arb_t pi, u, v; fmpz_t pi_mult; - slong i, argprec; + slong argprec; + ulong i; acb_init(f); @@ -86,7 +87,7 @@ _acb_log_rising_correct_branch(acb_t res, fmpz_clear(pi_mult); } -void +static void acb_hypgeom_log_rising_ui_jet_fallback(acb_ptr res, const acb_t z, slong r, slong len, slong prec) { acb_t t; @@ -113,7 +114,8 @@ void acb_hypgeom_log_rising_ui_jet(acb_ptr res, const acb_t z, ulong r, slong len, slong prec) { double za, zb, sa, sb, ta, tb, ma, mb, zak; - slong k, correction; + slong correction; + ulong k; int neg; if (r == 0 || len == 0) @@ -142,7 +144,7 @@ acb_hypgeom_log_rising_ui_jet(acb_ptr res, const acb_t z, ulong r, slong len, sl if (arb_is_positive(acb_realref(z))) { acb_hypgeom_rising_ui_jet(res, z, r, len, prec); - _acb_poly_log_series(res, res, FLINT_MIN(len, r + 1), len, prec); + _acb_poly_log_series(res, res, FLINT_MIN((ulong) len, r + 1), len, prec); } else if (arb_contains_int(acb_realref(z))) { @@ -164,8 +166,8 @@ acb_hypgeom_log_rising_ui_jet(acb_ptr res, const acb_t z, ulong r, slong len, sl arb_mul(t, u, t, prec); acb_hypgeom_rising_ui_jet(res, z, r, len, prec); - _acb_vec_neg(res, res, FLINT_MIN(len, r + 1)); - _acb_poly_log_series(res, res, FLINT_MIN(len, r + 1), len, prec); + _acb_vec_neg(res, res, FLINT_MIN((ulong) len, r + 1)); + _acb_poly_log_series(res, res, FLINT_MIN((ulong) len, r + 1), len, prec); arb_swap(acb_imagref(res), t); @@ -262,8 +264,8 @@ acb_hypgeom_log_rising_ui_jet(acb_ptr res, const acb_t z, ulong r, slong len, sl { acb_hypgeom_rising_ui_jet(res, z, r, len, prec); if (neg) - _acb_vec_neg(res, res, FLINT_MIN(len, r + 1)); - _acb_poly_log_series(res, res, FLINT_MIN(len, r + 1), len, prec); + _acb_vec_neg(res, res, FLINT_MIN((ulong) len, r + 1)); + _acb_poly_log_series(res, res, FLINT_MIN((ulong) len, r + 1), len, prec); } if (zb < 0.0) diff --git a/src/acb_hypgeom/m.c b/src/acb_hypgeom/m.c index 56e33a3971..10e347d7ff 100644 --- a/src/acb_hypgeom/m.c +++ b/src/acb_hypgeom/m.c @@ -84,7 +84,7 @@ acb_hypgeom_m_asymp(acb_t res, const acb_t a, const acb_t b, const acb_t z, int acb_clear(c); } -void +static void _acb_hypgeom_m_1f1(acb_t res, const acb_t a, const acb_t b, const acb_t z, int regularized, slong prec, slong gamma_prec, int kummer) { @@ -199,7 +199,7 @@ hypotmx(double x, double y) return sqrt(x * x + y * y) - x; } -void +static void acb_hypgeom_m_choose(int * asymp, int * kummer, slong * wp, const acb_t a, const acb_t b, const acb_t z, int regularized, slong prec) { @@ -304,7 +304,7 @@ acb_hypgeom_m_choose(int * asymp, int * kummer, slong * wp, } } -void +static void acb_hypgeom_m_nointegration(acb_t res, const acb_t a, const acb_t b, const acb_t z, int regularized, slong prec) { int asymp, kummer; diff --git a/src/acb_hypgeom/pfq_choose_n.c b/src/acb_hypgeom/pfq_choose_n.c index 7cfbe5383f..6cf6aebc3e 100644 --- a/src/acb_hypgeom/pfq_choose_n.c +++ b/src/acb_hypgeom/pfq_choose_n.c @@ -19,9 +19,15 @@ # include #endif +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define D_ABS(x) ((x) < 0.0 ? (-(x)) : (x)) -int +static int acb_hypgeom_pfq_choose_n_double(slong * nn, const double * are, const double * aim, slong p, const double * bre, const double * bim, slong q, diff --git a/src/acb_hypgeom/pfq_series_direct.c b/src/acb_hypgeom/pfq_series_direct.c index 564e19ea1c..04c174d362 100644 --- a/src/acb_hypgeom/pfq_series_direct.c +++ b/src/acb_hypgeom/pfq_series_direct.c @@ -13,7 +13,7 @@ #include "acb_poly.h" #include "acb_hypgeom.h" -void +static void _acb_poly_reciprocal_majorant(arb_ptr res, acb_srcptr vec, slong len, slong prec) { slong i; @@ -34,7 +34,7 @@ _acb_poly_reciprocal_majorant(arb_ptr res, acb_srcptr vec, slong len, slong prec } } -void +static void acb_poly_reciprocal_majorant(arb_poly_t res, const acb_poly_t poly, slong prec) { arb_poly_fit_length(res, poly->length); @@ -75,7 +75,7 @@ arb_poly_geometric_sum(arb_poly_t F, const arb_poly_t U, slong len, slong prec) product of (1 / (|B[0] - |B[1:]|)) * |Z| */ -void +static void acb_hypgeom_pfq_series_bound_factor(arb_poly_t F, const acb_poly_struct * a, slong p, const acb_poly_struct * b, slong q, diff --git a/src/acb_hypgeom/rising_ui_jet.c b/src/acb_hypgeom/rising_ui_jet.c index e660db494a..7c0d7beb52 100644 --- a/src/acb_hypgeom/rising_ui_jet.c +++ b/src/acb_hypgeom/rising_ui_jet.c @@ -32,7 +32,7 @@ acb_hypgeom_rising_ui_jet(acb_ptr res, const acb_t x, ulong n, slong len, slong } else { - if (n <= 20 || (n <= 200 && prec > 400 * n && acb_bits(x) >= prec / 4)) + if (n <= 20 || (n <= 200 && (ulong) prec > 400 * n && acb_bits(x) >= prec / 4)) { acb_hypgeom_rising_ui_jet_powsum(res, x, n, len, prec); } diff --git a/src/acb_hypgeom/rising_ui_jet_bs.c b/src/acb_hypgeom/rising_ui_jet_bs.c index 5ce3061a8b..a02e96819a 100644 --- a/src/acb_hypgeom/rising_ui_jet_bs.c +++ b/src/acb_hypgeom/rising_ui_jet_bs.c @@ -14,7 +14,7 @@ #include "acb_hypgeom.h" static void -bsplit(acb_ptr res, const acb_t x, ulong a, ulong b, slong trunc, slong prec) +bsplit(acb_ptr res, const acb_t x, ulong a, ulong b, ulong trunc, slong prec) { trunc = FLINT_MIN(trunc, b - a + 1); @@ -50,7 +50,7 @@ bsplit(acb_ptr res, const acb_t x, ulong a, ulong b, slong trunc, slong prec) bsplit(R, x, m, b, trunc, prec); _acb_poly_mullow(res, L, len1, R, len2, - FLINT_MIN(trunc, len1 + len2 - 1), prec); + FLINT_MIN(trunc, (ulong) (len1 + len2 - 1)), prec); _acb_vec_clear(L, len1 + len2); } @@ -62,13 +62,13 @@ acb_hypgeom_rising_ui_jet_bs(acb_ptr res, const acb_t x, ulong n, slong len, slo if (len == 0) return; - if (len > n + 1) + if ((ulong) len > n + 1) { _acb_vec_zero(res + n + 1, len - n - 1); len = n + 1; } - if (len == n + 1) + if ((ulong) len == n + 1) { acb_one(res + n); len = n; diff --git a/src/acb_hypgeom/rising_ui_jet_powsum.c b/src/acb_hypgeom/rising_ui_jet_powsum.c index a38c5ea308..49284156b1 100644 --- a/src/acb_hypgeom/rising_ui_jet_powsum.c +++ b/src/acb_hypgeom/rising_ui_jet_powsum.c @@ -24,13 +24,13 @@ acb_hypgeom_rising_ui_jet_powsum(acb_ptr res, const acb_t x, ulong n, slong len, if (len == 0) return; - if (len > n + 1) + if ((ulong) len > n + 1) { _acb_vec_zero(res + n + 1, len - n - 1); len = n + 1; } - if (len == n + 1) + if ((ulong) len == n + 1) { acb_one(res + n); len = n; @@ -72,7 +72,7 @@ acb_hypgeom_rising_ui_jet_powsum(acb_ptr res, const acb_t x, ulong n, slong len, c[1] = 1; c[(n + 1) + 0] = 1; - for (i = 2; i <= n; i++) + for (i = 2; (ulong) i <= n; i++) { for (j = FLINT_MIN(len - 1, i); j >= 0; j--) { @@ -118,7 +118,7 @@ acb_hypgeom_rising_ui_jet_powsum(acb_ptr res, const acb_t x, ulong n, slong len, fmpz_one(c + 1); fmpz_one(c + (n + 1) + 0); - for (i = 2; i <= n; i++) + for (i = 2; (ulong) i <= n; i++) { for (j = FLINT_MIN(len - 1, i); j >= 0; j--) { diff --git a/src/acb_hypgeom/rising_ui_jet_rs.c b/src/acb_hypgeom/rising_ui_jet_rs.c index d06e6176af..5575715696 100644 --- a/src/acb_hypgeom/rising_ui_jet_rs.c +++ b/src/acb_hypgeom/rising_ui_jet_rs.c @@ -24,7 +24,8 @@ void acb_hypgeom_rising_ui_jet_rs(acb_ptr res, const acb_t x, ulong n, ulong m, slong len, slong prec) { - slong i, j, k, l, m0, xmlen, tlen, ulen, climbs, climbs_max, wp; + slong i, j, k, l, xmlen, tlen, ulen, climbs, climbs_max, wp; + ulong m0; acb_ptr tmp, xpow; acb_ptr t, u; nn_ptr c; @@ -33,13 +34,13 @@ acb_hypgeom_rising_ui_jet_rs(acb_ptr res, const acb_t x, ulong n, ulong m, slong if (len == 0) return; - if (len > n + 1) + if ((ulong) len > n + 1) { _acb_vec_zero(res + n + 1, len - n - 1); len = n + 1; } - if (len == n + 1) + if ((ulong) len == n + 1) { acb_one(res + n); len = n; @@ -83,7 +84,7 @@ acb_hypgeom_rising_ui_jet_rs(acb_ptr res, const acb_t x, ulong n, ulong m, slong c = TMP_ALLOC(sizeof(ulong) * climbs_max * m); /* length of (x+t)^m */ - xmlen = FLINT_MIN(len, m + 1); + xmlen = FLINT_MIN((ulong) len, m + 1); tmp = _acb_vec_init(2 * len + (m + 1) * xmlen); t = tmp; @@ -95,7 +96,7 @@ acb_hypgeom_rising_ui_jet_rs(acb_ptr res, const acb_t x, ulong n, ulong m, slong tlen = 1; /* First derivatives */ - for (i = 1; i <= m; i++) + for (i = 1; (ulong) i <= m; i++) acb_mul_ui(xpow + (m + 1) + i, xpow + i - 1, i, wp); /* Higher derivatives if we need them */ @@ -106,7 +107,7 @@ acb_hypgeom_rising_ui_jet_rs(acb_ptr res, const acb_t x, ulong n, ulong m, slong fmpz_one(f + 0); fmpz_one(f + 1); - for (i = 2; i <= m; i++) + for (i = 2; (ulong) i <= m; i++) { for (j = FLINT_MIN(xmlen - 1, i + 1); j >= 1; j--) fmpz_add(f + j, f + j, f + j - 1); @@ -118,7 +119,7 @@ acb_hypgeom_rising_ui_jet_rs(acb_ptr res, const acb_t x, ulong n, ulong m, slong _fmpz_vec_clear(f, len); } - for (k = 0; k < n; k += m) + for (k = 0; (ulong) k < n; k += m) { l = FLINT_MIN(m, n - k); climbs = FLINT_BIT_COUNT(k + l - 1) * l; diff --git a/src/acb_hypgeom/rising_ui_rs.c b/src/acb_hypgeom/rising_ui_rs.c index 51cfb48218..94836ca199 100644 --- a/src/acb_hypgeom/rising_ui_rs.c +++ b/src/acb_hypgeom/rising_ui_rs.c @@ -23,7 +23,8 @@ void acb_hypgeom_rising_ui_rs(acb_t res, const acb_t x, ulong n, ulong m, slong prec) { - slong i, k, l, m0, climbs, climbs_max, wp; + slong i, k, l, climbs, climbs_max, wp; + ulong m0; acb_ptr xpow; acb_t t, u; nn_ptr c; @@ -40,7 +41,8 @@ acb_hypgeom_rising_ui_rs(acb_t res, const acb_t x, ulong n, ulong m, slong prec) TMP_START; - if (m == 0 || m == -1) + /* FIXME: Why is m allowed to be -1 when it is unsigned? */ + if (m == 0 || (slong) m == -1) { if (n <= 6) m = 2; @@ -67,7 +69,7 @@ acb_hypgeom_rising_ui_rs(acb_t res, const acb_t x, ulong n, ulong m, slong prec) acb_init(t); acb_init(u); - for (k = 0; k < n; k += m) + for (k = 0; (ulong) k < n; k += m) { l = FLINT_MIN(m, n - k); climbs = FLINT_BIT_COUNT(k + l - 1) * l; diff --git a/src/acb_hypgeom/u.c b/src/acb_hypgeom/u.c index 78bdb7934c..9a21b7fd6c 100644 --- a/src/acb_hypgeom/u.c +++ b/src/acb_hypgeom/u.c @@ -69,7 +69,7 @@ bsplit(acb_t A, acb_t B, acb_t C, acb_t D, } } -void +static void acb_hypgeom_u_si_rec(acb_t res, slong a, const acb_t b, const acb_t z, slong prec) { slong k; @@ -295,7 +295,7 @@ acb_hypgeom_u_1f1(acb_t res, const acb_t a, const acb_t b, const acb_t z, slong } } -void +static void acb_hypgeom_u_choose(int * asymp, slong * wp, const acb_t a, const acb_t b, const acb_t z, slong prec) { @@ -371,7 +371,7 @@ acb_hypgeom_u_choose(int * asymp, slong * wp, } } -void +static void acb_hypgeom_u_nointegration(acb_t res, const acb_t a, const acb_t b, const acb_t z, slong prec) { acb_t t; diff --git a/src/acb_hypgeom/u_asymp.c b/src/acb_hypgeom/u_asymp.c index 2ff3f4f373..588ee451f1 100644 --- a/src/acb_hypgeom/u_asymp.c +++ b/src/acb_hypgeom/u_asymp.c @@ -12,6 +12,12 @@ #include "acb.h" #include "acb_hypgeom.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + slong acb_hypgeom_pfq_choose_n_max(acb_srcptr a, slong p, acb_srcptr b, slong q, const acb_t z, @@ -62,7 +68,7 @@ acb_hypgeom_u_asymp_determine_region(const mag_t r, } /* computes the factors that are independent of n (all are upper bounds) */ -void +static void acb_hypgeom_u_asymp_bound_factors(int * R, mag_t alpha, mag_t nu, mag_t sigma, mag_t rho, mag_t zinv, const acb_t a, const acb_t b, const acb_t z) From d3764a5fb76cfe48acc2702e2d00a68cf95999b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 11:42:38 +0200 Subject: [PATCH 088/114] acb_elliptic --- src/acb_elliptic/e_inc.c | 2 +- src/acb_elliptic/f.c | 2 +- src/acb_elliptic/pi.c | 2 +- src/acb_elliptic/rf.c | 4 ++-- src/acb_elliptic/rg.c | 4 ++-- src/acb_elliptic/rj.c | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/acb_elliptic/e_inc.c b/src/acb_elliptic/e_inc.c index d13ab4750a..3df86a4dde 100644 --- a/src/acb_elliptic/e_inc.c +++ b/src/acb_elliptic/e_inc.c @@ -15,7 +15,7 @@ /* Evaluation on -pi/2 <= re(z) <= pi/2, no aliasing. */ /* s*(RF(x,y,1) - m*s^2*RD(x,y,1)/3), x = c^2, y=1-m*s^2 */ -void +static void acb_elliptic_e_reduced(acb_t r, const acb_t z, const acb_t m, int times_pi, slong prec) { acb_t s, c, x, y, rf, rd; diff --git a/src/acb_elliptic/f.c b/src/acb_elliptic/f.c index 38f35c8f2a..b1d4572bba 100644 --- a/src/acb_elliptic/f.c +++ b/src/acb_elliptic/f.c @@ -15,7 +15,7 @@ /* Evaluation on -pi/2 <= re(z) <= pi/2, no aliasing. */ /* s*RF(c^2, 1-m*s^2, 1) */ -void +static void acb_elliptic_f_reduced(acb_t r, const acb_t z, const acb_t m, int times_pi, slong prec) { acb_t s, c, a; diff --git a/src/acb_elliptic/pi.c b/src/acb_elliptic/pi.c index 70a3302506..674a0500bb 100644 --- a/src/acb_elliptic/pi.c +++ b/src/acb_elliptic/pi.c @@ -16,7 +16,7 @@ /* Evaluation on -pi/2 <= re(z) <= pi/2, no aliasing. */ /* s*(RF(x,y,1) + n*s^2*RJ(x,y,1,p)/3), x = c^2, y=1-m*s^2, p=1-n*s^2 */ /* complete: c = 0, s = 1 */ -void +static void acb_elliptic_pi_reduced(acb_t r, const acb_t n, const acb_t z, const acb_t m, int times_pi, slong prec) { diff --git a/src/acb_elliptic/rf.c b/src/acb_elliptic/rf.c index 9860baa5f3..dca9c569eb 100644 --- a/src/acb_elliptic/rf.c +++ b/src/acb_elliptic/rf.c @@ -53,7 +53,7 @@ static const unsigned short den_ratio_tab[512] = { 16,1,1994,1,4,1,2,1,8072,1,2026,1,4,1019,2042,1, }; -void +static void acb_elliptic_rf_taylor_sum(acb_t res, const acb_t E2, const acb_t E3, slong nterms, slong prec) { fmpz_t den, c, d, e; @@ -159,7 +159,7 @@ acb_elliptic_rf_taylor_sum(acb_t res, const acb_t E2, const acb_t E3, slong nter void acb_elliptic_rf(acb_t res, const acb_t x, const acb_t y, const acb_t z, - int flags, slong prec) + int FLINT_UNUSED(flags), slong prec) { acb_t xx, yy, zz, sx, sy, sz, t; acb_t X, Y, Z, E2, E3; diff --git a/src/acb_elliptic/rg.c b/src/acb_elliptic/rg.c index 0b305afc49..8b4601674a 100644 --- a/src/acb_elliptic/rg.c +++ b/src/acb_elliptic/rg.c @@ -12,9 +12,9 @@ #include "acb.h" #include "acb_elliptic.h" -void +static void _acb_elliptic_rg(acb_t res, const acb_t x, const acb_t y, const acb_t z, - int flags, slong prec) + int FLINT_UNUSED(flags), slong prec) { acb_t a, b, c, t; slong wp; diff --git a/src/acb_elliptic/rj.c b/src/acb_elliptic/rj.c index e4f03224fc..02da07802a 100644 --- a/src/acb_elliptic/rj.c +++ b/src/acb_elliptic/rj.c @@ -62,7 +62,7 @@ static inline slong rj_fdiv(slong x, slong y) return x / y; } -void +static void acb_elliptic_rj_taylor_sum(acb_t res, const acb_t E2, const acb_t E3, const acb_t E4, const acb_t E5, slong nterms, slong prec) { @@ -219,7 +219,7 @@ acb_elliptic_rj_taylor_sum(acb_t res, const acb_t E2, const acb_t E3, void acb_elliptic_rj_carlson(acb_t res, const acb_t x, const acb_t y, - const acb_t z, const acb_t p, int flags, slong prec) + const acb_t z, const acb_t p, int FLINT_UNUSED(flags), slong prec) { acb_t xx, yy, zz, pp, sx, sy, sz, sp, t, d, delta, S; acb_t A, AA, X, Y, Z, P, E2, E3, E4, E5; @@ -608,7 +608,7 @@ RJ_integrand(acb_ptr res, const acb_t t, void * param, slong order, slong prec) void acb_elliptic_rj_integration(acb_t res, const acb_t x, const acb_t y, - const acb_t z, const acb_t p, int flags, slong prec) + const acb_t z, const acb_t p, int FLINT_UNUSED(flags), slong prec) { acb_t a, b, N, I, J; arb_t A; From f7dd7b0a9ef6a978b1ddcd2bf76a545831136bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 11:42:46 +0200 Subject: [PATCH 089/114] acb_modular --- src/acb_modular/eta_sum.c | 4 ++-- src/acb_modular/fundamental_domain_approx_arf.c | 4 ++-- src/acb_modular/hilbert_class_poly.c | 2 +- src/acb_modular/theta_const_sum_rs.c | 6 ++++++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/acb_modular/eta_sum.c b/src/acb_modular/eta_sum.c index 501eacaf8f..6eec666c04 100644 --- a/src/acb_modular/eta_sum.c +++ b/src/acb_modular/eta_sum.c @@ -60,7 +60,7 @@ _acb_modular_mul(acb_t z, acb_t tmp1, acb_t tmp2, const acb_t x, const acb_t y, } } -void +static void _acb_modular_eta_sum_basecase(acb_t eta, const acb_t q, double log2q_approx, slong N, slong prec) { slong e, e1, e2, k, k1, k2, num, term_prec; @@ -151,7 +151,7 @@ _acb_modular_eta_sum_basecase(acb_t eta, const acb_t q, double log2q_approx, slo acb_clear(tmp2); } -void +static void _acb_modular_eta_sum_rs(acb_t eta, const acb_t q, double log2q_approx, slong N, slong prec) { slong * tab; diff --git a/src/acb_modular/fundamental_domain_approx_arf.c b/src/acb_modular/fundamental_domain_approx_arf.c index 7030c4ba89..9cceb6d9a0 100644 --- a/src/acb_modular/fundamental_domain_approx_arf.c +++ b/src/acb_modular/fundamental_domain_approx_arf.c @@ -43,8 +43,8 @@ acb_modular_fundamental_domain_approx_arf(psl2z_t g, break; } - if (fmpz_bits(&g->a) > prec || fmpz_bits(&g->b) > prec || - fmpz_bits(&g->c) > prec || fmpz_bits(&g->d) > prec) + if ((slong) fmpz_bits(&g->a) > prec || (slong) fmpz_bits(&g->b) > prec || + (slong) fmpz_bits(&g->c) > prec || (slong) fmpz_bits(&g->d) > prec) { psl2z_one(g); break; diff --git a/src/acb_modular/hilbert_class_poly.c b/src/acb_modular/hilbert_class_poly.c index ce263eb21e..14991e10b3 100644 --- a/src/acb_modular/hilbert_class_poly.c +++ b/src/acb_modular/hilbert_class_poly.c @@ -94,7 +94,7 @@ merge(arb_poly_t res, const arb_poly_t a, const arb_poly_t b, work_t * work) arb_poly_mul(res, a, b, work->prec); } -int +static int _acb_modular_hilbert_class_poly(fmpz_poly_t res, slong D, const slong * qbf, slong qbf_len, slong prec) { diff --git a/src/acb_modular/theta_const_sum_rs.c b/src/acb_modular/theta_const_sum_rs.c index 9f86bed3b2..32e6ccce7a 100644 --- a/src/acb_modular/theta_const_sum_rs.c +++ b/src/acb_modular/theta_const_sum_rs.c @@ -12,6 +12,12 @@ #include "acb.h" #include "acb_modular.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + static const int square_best_m[] = { 2, 3, 4, 8, 12, 16, 32, 48, 80, 96, 112, 144, 240, 288, 336, 480, 560, 576, 720, 1008, From 1f67aaa9e5837009a9ff8cdb6ffcb6c469551679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 12:12:48 +0200 Subject: [PATCH 090/114] acb_dirichlet --- src/acb_dirichlet/euler_product_real_ui.c | 17 ++++---- src/acb_dirichlet/gauss_sum.c | 2 + src/acb_dirichlet/hardy_z_zero.c | 4 +- src/acb_dirichlet/isolate_hardy_z_zero.c | 42 +++++++++---------- src/acb_dirichlet/l.c | 2 +- src/acb_dirichlet/l_fmpq.c | 2 +- src/acb_dirichlet/l_fmpq_afe.c | 4 +- src/acb_dirichlet/l_vec_hurwitz.c | 2 +- src/acb_dirichlet/lerch_phi_integral.c | 4 +- src/acb_dirichlet/platt_c_bound.c | 2 +- src/acb_dirichlet/platt_local_hardy_z_zeros.c | 11 ++--- src/acb_dirichlet/platt_multieval.c | 6 +++ src/acb_dirichlet/powsum_sieved.c | 3 +- src/acb_dirichlet/root.c | 12 +++--- src/acb_dirichlet/stieltjes.c | 14 +++++-- .../test/t-euler_product_real_ui.c | 4 ++ src/acb_dirichlet/test/t-gauss.c | 1 + src/acb_dirichlet/theta_arb.c | 8 ++-- src/acb_dirichlet/vec_mellin_arb.c | 7 ++++ src/acb_dirichlet/zeta_bound.c | 4 +- src/acb_dirichlet/zeta_jet.c | 2 +- src/acb_dirichlet/zeta_rs.c | 2 +- 22 files changed, 91 insertions(+), 64 deletions(-) diff --git a/src/acb_dirichlet/euler_product_real_ui.c b/src/acb_dirichlet/euler_product_real_ui.c index 347008d12c..4a39b171e6 100644 --- a/src/acb_dirichlet/euler_product_real_ui.c +++ b/src/acb_dirichlet/euler_product_real_ui.c @@ -81,7 +81,6 @@ void _acb_dirichlet_euler_product_real_ui(arb_t res, ulong s, arb_t t, u; ulong p; mag_t err; - slong num_threads; if (s <= 1) { @@ -108,13 +107,13 @@ void _acb_dirichlet_euler_product_real_ui(arb_t res, ulong s, if (chi[2 % mod] != 0) { - arf_t t; - arf_init(t); - arf_set_si_2exp_si(t, chi[2 % mod], -s); + arf_t tf; + arf_init(tf); + arf_set_si_2exp_si(tf, chi[2 % mod], -s); if (reciprocal) - arf_neg(t, t); - arb_add_arf(res, res, t, prec); - arf_clear(t); + arf_neg(tf, tf); + arb_add_arf(res, res, tf, prec); + arf_clear(tf); } arb_add_error_2exp_si(res, 2 - (3 * s) / 2); @@ -141,9 +140,7 @@ void _acb_dirichlet_euler_product_real_ui(arb_t res, ulong s, which gives prec ^ 1.2956 here. */ limit = 100 + prec * sqrt(prec); - num_threads = flint_get_num_available_threads(); - - if (num_threads > 1 && prec > 5000 && s > 5000) + if (flint_get_num_available_threads() > 1 && prec > 5000 && s > 5000) { n_primes_t iter; slong i; diff --git a/src/acb_dirichlet/gauss_sum.c b/src/acb_dirichlet/gauss_sum.c index fc016be79b..41183580e5 100644 --- a/src/acb_dirichlet/gauss_sum.c +++ b/src/acb_dirichlet/gauss_sum.c @@ -102,6 +102,7 @@ acb_dirichlet_gauss_sum(acb_t res, const dirichlet_group_t G, const dirichlet_ch } } +#if 0 void acb_dirichlet_gauss_sum_ui(acb_t res, const dirichlet_group_t G, ulong a, slong prec) { @@ -111,3 +112,4 @@ acb_dirichlet_gauss_sum_ui(acb_t res, const dirichlet_group_t G, ulong a, slong acb_dirichlet_gauss_sum(res, G, chi, prec); dirichlet_char_clear(chi); } +#endif diff --git a/src/acb_dirichlet/hardy_z_zero.c b/src/acb_dirichlet/hardy_z_zero.c index 046b2e1173..fb12aec4e3 100644 --- a/src/acb_dirichlet/hardy_z_zero.c +++ b/src/acb_dirichlet/hardy_z_zero.c @@ -43,7 +43,7 @@ _acb_dirichlet_definite_hardy_z(arb_t res, const arf_t t, slong *pprec) return msign; } -void +static void _refine_hardy_z_zero_illinois(arb_t res, const arf_t ra, const arf_t rb, slong prec) { arf_t a, b, fa, fb, c, fc, t; @@ -143,7 +143,7 @@ _refine_hardy_z_zero_illinois(arb_t res, const arf_t ra, const arf_t rb, slong p arb_clear(z); } -void +static void _refine_hardy_z_zero_newton(arb_t res, const arf_t ra, const arf_t rb, slong prec) { acb_t z, zstart; diff --git a/src/acb_dirichlet/isolate_hardy_z_zero.c b/src/acb_dirichlet/isolate_hardy_z_zero.c index 99303c407f..8f3323d3dc 100644 --- a/src/acb_dirichlet/isolate_hardy_z_zero.c +++ b/src/acb_dirichlet/isolate_hardy_z_zero.c @@ -657,8 +657,8 @@ turing_search_near(zz_node_ptr *pu, zz_node_ptr *pv, slong *psb, const fmpz_t n) zz_node_ptr u, v; slong i; slong zn; /* target number of sign changes */ - slong sb; /* the number of padding blocks required by Turing's method */ - slong cgb; /* the number of consecutive good blocks */ + ulong sb; /* the number of padding blocks required by Turing's method */ + ulong cgb; /* the number of consecutive good blocks */ const slong loopcount = 4; fmpz_t k; @@ -717,19 +717,19 @@ turing_search_near(zz_node_ptr *pu, zz_node_ptr *pv, slong *psb, const fmpz_t n) cgb = 0; while (1) { - zz_node_ptr pu; - pu = extend_to_prev_good_gram_node(u); - zn = count_gram_intervals(pu, u); - for (i = 0; i < loopcount && count_sign_changes(pu, u) < zn; i++) + zz_node_ptr pu_new; + pu_new = extend_to_prev_good_gram_node(u); + zn = count_gram_intervals(pu_new, u); + for (i = 0; i < loopcount && count_sign_changes(pu_new, u) < zn; i++) { - intercalate(pu, u); + intercalate(pu_new, u); } - if (count_sign_changes(pu, u) >= zn) + if (count_sign_changes(pu_new, u) >= zn) { cgb++; if (cgb == sb) { - u = pu; + u = pu_new; break; } } @@ -737,7 +737,7 @@ turing_search_near(zz_node_ptr *pu, zz_node_ptr *pv, slong *psb, const fmpz_t n) { cgb = 0; } - u = pu; + u = pu_new; } *pu = u; @@ -766,8 +766,8 @@ turing_search_far(zz_node_ptr *pu, zz_node_ptr *pv, slong *psb, { slong i; slong zn; /* target number of sign changes */ - slong sb; /* the number of padding blocks required by Turing's method */ - slong cgb; /* the number of consecutive good blocks */ + ulong sb; /* the number of padding blocks required by Turing's method */ + ulong cgb; /* the number of consecutive good blocks */ const slong loopcount = 4; /* @@ -812,19 +812,19 @@ turing_search_far(zz_node_ptr *pu, zz_node_ptr *pv, slong *psb, cgb = initial_cgb; while (1) { - zz_node_ptr pu; - pu = extend_to_prev_good_gram_node(u); - zn = count_gram_intervals(pu, u); - for (i = 0; i < loopcount && count_sign_changes(pu, u) < zn; i++) + zz_node_ptr pu_new; + pu_new = extend_to_prev_good_gram_node(u); + zn = count_gram_intervals(pu_new, u); + for (i = 0; i < loopcount && count_sign_changes(pu_new, u) < zn; i++) { - intercalate(pu, u); + intercalate(pu_new, u); } - if (count_sign_changes(pu, u) >= zn) + if (count_sign_changes(pu_new, u) >= zn) { cgb++; if (cgb == sb*2) { - u = pu; + u = pu_new; break; } } @@ -832,7 +832,7 @@ turing_search_far(zz_node_ptr *pu, zz_node_ptr *pv, slong *psb, { cgb = 0; } - u = pu; + u = pu_new; } *pu = u; @@ -1070,7 +1070,7 @@ _isolate_hardy_z_zeros(arf_interval_ptr res, const fmpz_t n, slong len) } /* Isolate len zeros, starting from the nth zero. */ -void +static void acb_dirichlet_isolate_hardy_z_zeros(arf_interval_ptr res, const fmpz_t n, slong len) { if (len <= 0) diff --git a/src/acb_dirichlet/l.c b/src/acb_dirichlet/l.c index 18e96ed6f3..5bbfb3b9bc 100644 --- a/src/acb_dirichlet/l.c +++ b/src/acb_dirichlet/l.c @@ -19,7 +19,7 @@ # include #endif -void +static void acb_dirichlet_l_general(acb_t res, const acb_t s, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec) { diff --git a/src/acb_dirichlet/l_fmpq.c b/src/acb_dirichlet/l_fmpq.c index e8eee94962..79adb8fba0 100644 --- a/src/acb_dirichlet/l_fmpq.c +++ b/src/acb_dirichlet/l_fmpq.c @@ -21,7 +21,7 @@ # include #endif -int +static int acb_dirichlet_l_fmpq_use_afe(ulong q, const fmpq_t s, slong prec) { double cutoff; diff --git a/src/acb_dirichlet/l_fmpq_afe.c b/src/acb_dirichlet/l_fmpq_afe.c index 9a13918f2a..6e0b6920d6 100644 --- a/src/acb_dirichlet/l_fmpq_afe.c +++ b/src/acb_dirichlet/l_fmpq_afe.c @@ -32,7 +32,7 @@ log_gamma_upper_approx(double a, double z) return a * (log(a) - 1); } -void +static void acb_dirichlet_root_number2(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec) { acb_dirichlet_root_number(res, G, chi, prec); @@ -135,7 +135,7 @@ acb_dirichlet_afe_tail_bound(mag_t res, const fmpq_t sd2, slong N, ulong q, int } -void +static void acb_dirichlet_fmpq_sum_afe(acb_t res, const fmpq_t s, const dirichlet_group_t G, const dirichlet_char_t chi, const mag_t abs_tol, slong prec) { slong NN, n, start_bits, bits, wp, wp2, gamma_cached_prec; diff --git a/src/acb_dirichlet/l_vec_hurwitz.c b/src/acb_dirichlet/l_vec_hurwitz.c index b383906f4b..28dea98342 100644 --- a/src/acb_dirichlet/l_vec_hurwitz.c +++ b/src/acb_dirichlet/l_vec_hurwitz.c @@ -62,7 +62,7 @@ acb_dirichlet_l_vec_hurwitz(acb_ptr res, const acb_t s, acb_dirichlet_dft_index(res, zeta, G, prec); { - slong k; + ulong k; for (k = 0; k < G->phi_q; k++) acb_conj(res + k, res + k); } diff --git a/src/acb_dirichlet/lerch_phi_integral.c b/src/acb_dirichlet/lerch_phi_integral.c index 60f358ee3d..df70e7cfab 100644 --- a/src/acb_dirichlet/lerch_phi_integral.c +++ b/src/acb_dirichlet/lerch_phi_integral.c @@ -14,7 +14,7 @@ #include "acb_dirichlet.h" static void -integral_tail(mag_t bound, const acb_t z, const acb_t log_z, const acb_t s, const acb_t a, const arb_t R, slong prec) +integral_tail(mag_t bound, const acb_t FLINT_UNUSED(z), const acb_t log_z, const acb_t s, const acb_t a, const arb_t R, slong prec) { arb_t C, s1; mag_t t; @@ -156,7 +156,7 @@ integrand2(acb_ptr res, const acb_t t, void * param, slong order, slong prec) return _integrand(res, t, param, order, 1, prec); } -void +static void _acb_dirichlet_lerch_phi_integral(acb_t res, const acb_t z, const acb_t s, const acb_t a, slong prec) { acb_t log_z, t, u, v, w, zero, N; diff --git a/src/acb_dirichlet/platt_c_bound.c b/src/acb_dirichlet/platt_c_bound.c index d2d426e64d..b208d087da 100644 --- a/src/acb_dirichlet/platt_c_bound.c +++ b/src/acb_dirichlet/platt_c_bound.c @@ -199,7 +199,7 @@ acb_dirichlet_platt_c_precomp_clear(acb_dirichlet_platt_c_precomp_t pre) void acb_dirichlet_platt_c_bound_precomp(arb_t res, const acb_dirichlet_platt_c_precomp_t pre, slong sigma, const arb_t t0, - const arb_t h, slong k, slong prec) + const arb_t FLINT_UNUSED(h), slong FLINT_UNUSED(k), slong prec) { /* requires sigma + 1/2 <= t0 */ arb_t lhs; diff --git a/src/acb_dirichlet/platt_local_hardy_z_zeros.c b/src/acb_dirichlet/platt_local_hardy_z_zeros.c index 35cd320298..2e15386ed0 100644 --- a/src/acb_dirichlet/platt_local_hardy_z_zeros.c +++ b/src/acb_dirichlet/platt_local_hardy_z_zeros.c @@ -829,7 +829,8 @@ create_initial_double_superblock(zz_node_ptr *pu, zz_node_ptr *pv, slong *pbound, const platt_ctx_t ctx, const fmpz_t n, slong prec) { zz_node_ptr p, q, u, v; - slong i, k, bound, zn; + slong i, bound, zn; + ulong k; slong good_block_count; slong result = 1; @@ -1075,7 +1076,7 @@ _isolate_zeros(arf_interval_ptr res, return zeros_count; } - +#if 0 slong _acb_dirichlet_platt_isolate_local_hardy_z_zeros( arf_interval_ptr res, const fmpz_t n, slong len, @@ -1091,7 +1092,7 @@ _acb_dirichlet_platt_isolate_local_hardy_z_zeros( platt_ctx_clear(ctx); return zeros_count; } - +#endif static void _refine_local_hardy_z_zero_illinois(arb_t res, @@ -1440,7 +1441,7 @@ _create_heuristic_context(const fmpz_t n, slong prec) return p; } - +#if 0 /* Returns the number of zeros found. */ slong acb_dirichlet_platt_isolate_local_hardy_z_zeros( @@ -1468,7 +1469,7 @@ acb_dirichlet_platt_isolate_local_hardy_z_zeros( } return 0; } - +#endif /* Returns the number of zeros found. */ slong diff --git a/src/acb_dirichlet/platt_multieval.c b/src/acb_dirichlet/platt_multieval.c index b077cba207..30adbc604f 100644 --- a/src/acb_dirichlet/platt_multieval.c +++ b/src/acb_dirichlet/platt_multieval.c @@ -14,6 +14,12 @@ #include "arb_hypgeom.h" #include "acb_dft.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + static void _acb_dot_arb(acb_t res, const acb_t initial, int subtract, acb_srcptr x, slong xstep, arb_srcptr y, slong ystep, diff --git a/src/acb_dirichlet/powsum_sieved.c b/src/acb_dirichlet/powsum_sieved.c index 9fb750ef24..413c8c68f1 100644 --- a/src/acb_dirichlet/powsum_sieved.c +++ b/src/acb_dirichlet/powsum_sieved.c @@ -20,8 +20,7 @@ acb_dirichlet_powsum_sieved(acb_ptr z, const acb_t s, ulong n, slong len, slong { slong * divisors; slong powers_alloc; - slong i, j, k, ibound, power_of_two, horner_point; - ulong kprev; + ulong i, j, k, ibound, kprev, power_of_two, horner_point; int critical_line, integer; acb_ptr powers; diff --git a/src/acb_dirichlet/root.c b/src/acb_dirichlet/root.c index a1eceedf88..0a3b25053e 100644 --- a/src/acb_dirichlet/root.c +++ b/src/acb_dirichlet/root.c @@ -60,13 +60,13 @@ acb_dirichlet_root(acb_t z, const acb_dirichlet_roots_t t, ulong k, slong prec) else { ulong r; - fmpq_t t; - fmpq_init(t); + fmpq_t tq; + fmpq_init(tq); r = n_gcd(n, 2 * k); /* no overflow since since k <= n / 2 */ - fmpz_set_ui(fmpq_numref(t), (2 * k) / r); - fmpz_set_ui(fmpq_denref(t), n / r); - arb_sin_cos_pi_fmpq(acb_imagref(z), acb_realref(z), t, prec); - fmpq_clear(t); + fmpz_set_ui(fmpq_numref(tq), (2 * k) / r); + fmpz_set_ui(fmpq_denref(tq), n / r); + arb_sin_cos_pi_fmpq(acb_imagref(z), acb_realref(z), tq, prec); + fmpq_clear(tq); } } else if (t->depth == 1) diff --git a/src/acb_dirichlet/stieltjes.c b/src/acb_dirichlet/stieltjes.c index 2750a7d5ce..ec7b7c2e06 100644 --- a/src/acb_dirichlet/stieltjes.c +++ b/src/acb_dirichlet/stieltjes.c @@ -25,6 +25,14 @@ # include #endif +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma message "acb_dirichlet_stieltjes_em only needs a symbol for test" +# pragma message "acb_dirichlet_stieltjes_integral only needs a symbol for test" +#endif + /* Bound the quadratic Taylor error term. */ static void stieltjes_bound_quadratic_term(arb_t B, const acb_t z, @@ -173,7 +181,7 @@ stieltjes_bound_large(acb_t res, const acb_t x, arb_init(B); mag_init(t); - prec = FLINT_MIN(prec, 30 + fmpz_bits(n1)); + prec = FLINT_MIN((ulong) prec, 30 + fmpz_bits(n1)); stieltjes_bound_large3(B, x, n1, alpha, prec); arb_get_mag(t, B); @@ -301,7 +309,7 @@ stieltjes_mag_approx(arb_t C, mag_t tol, const fmpz_t n1, const acb_t alpha) acb_clear(q); } -int +static int _f_stieltjes(acb_ptr res, const acb_t x, void * param, slong order, slong prec) { const fmpz * n1; @@ -489,7 +497,7 @@ stieltjes_tail_bound(mag_t bound, const arb_t N, const fmpz_t n1, const acb_t al mag_clear(u); } -void +static void _acb_dirichlet_stieltjes_integral2(acb_t res, const fmpz_t n, const acb_t alpha, slong prec) { double gamma_mag, max_mag, cancellation, xa; diff --git a/src/acb_dirichlet/test/t-euler_product_real_ui.c b/src/acb_dirichlet/test/t-euler_product_real_ui.c index 1d273b668d..37c54584d1 100644 --- a/src/acb_dirichlet/test/t-euler_product_real_ui.c +++ b/src/acb_dirichlet/test/t-euler_product_real_ui.c @@ -10,6 +10,7 @@ */ #include "test_helpers.h" +#include "arb.h" #include "acb_dirichlet.h" #ifdef __GNUC__ @@ -18,6 +19,8 @@ # include #endif +/* chi cannot be a global variable in these tests */ +#define chi this_chi const signed char chi[8][6] = { {1, 1}, {2, 0, 1}, @@ -129,3 +132,4 @@ TEST_FUNCTION_START(acb_dirichlet_euler_product_real_ui, state) TEST_FUNCTION_END(state); } +#undef chi diff --git a/src/acb_dirichlet/test/t-gauss.c b/src/acb_dirichlet/test/t-gauss.c index fba2150ccf..12f94b64b8 100644 --- a/src/acb_dirichlet/test/t-gauss.c +++ b/src/acb_dirichlet/test/t-gauss.c @@ -10,6 +10,7 @@ */ #include "test_helpers.h" +#include "acb.h" #include "acb_dirichlet.h" TEST_FUNCTION_START(acb_dirichlet_gauss, state) diff --git a/src/acb_dirichlet/theta_arb.c b/src/acb_dirichlet/theta_arb.c index 8a403a10cb..6568c771b2 100644 --- a/src/acb_dirichlet/theta_arb.c +++ b/src/acb_dirichlet/theta_arb.c @@ -12,7 +12,7 @@ #include "acb_dirichlet.h" #include "acb_poly.h" -void +static void _acb_dirichlet_theta_arb_smallorder(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const arb_t xt, slong len, slong prec) { ulong order; @@ -32,7 +32,8 @@ _acb_dirichlet_theta_arb_smallorder(acb_t res, const dirichlet_group_t G, const flint_free(a); } -void +#if 0 +static void _acb_dirichlet_theta_arb_series(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const arb_t xt, slong len, slong prec) { acb_ptr a; @@ -47,8 +48,9 @@ _acb_dirichlet_theta_arb_series(acb_t res, const dirichlet_group_t G, const diri acb_dirichlet_qseries_arb(res, a, xt, len, prec); _acb_vec_clear(a, len); } +#endif -void +static void _acb_dirichlet_theta_arb_naive(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const arb_t xt, slong len, slong prec) { ulong order, * a; diff --git a/src/acb_dirichlet/vec_mellin_arb.c b/src/acb_dirichlet/vec_mellin_arb.c index 7d3e0e857a..1184c904c3 100644 --- a/src/acb_dirichlet/vec_mellin_arb.c +++ b/src/acb_dirichlet/vec_mellin_arb.c @@ -12,6 +12,13 @@ #include "acb.h" #include "acb_dirichlet.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma message "acb_dirichlet_vec_mellin_arb is currently unused/untested/undocumented!" +#endif + void acb_dirichlet_vec_mellin_arb(acb_ptr res, const dirichlet_group_t G, const dirichlet_char_t chi, slong len, const arb_t t, slong n, slong prec) { diff --git a/src/acb_dirichlet/zeta_bound.c b/src/acb_dirichlet/zeta_bound.c index 73447d65a8..fca3b560d4 100644 --- a/src/acb_dirichlet/zeta_bound.c +++ b/src/acb_dirichlet/zeta_bound.c @@ -41,7 +41,7 @@ mag_zeta1p(mag_t res, const mag_t s) } /* |zeta(s)| <= (2pi)^sigma |gamma(1-s)| exp(pi|t|/2) zeta(1-sigma) / pi */ -void +static void acb_dirichlet_zeta_bound_functional_equation(mag_t res, const acb_t s) { slong prec, p; @@ -115,7 +115,7 @@ Assume -eta <= sigma <= 1 + eta where 0 < eta <= 1/2. Then: where e = (1+eta-sigma)/2. Inside the strip, we use this formula with eta = 0.1 (this could be improved). */ -void +static void acb_dirichlet_zeta_bound_strip(mag_t res, const acb_t s) { arf_t eta, a; diff --git a/src/acb_dirichlet/zeta_jet.c b/src/acb_dirichlet/zeta_jet.c index 0afa05c394..a67faeaafe 100644 --- a/src/acb_dirichlet/zeta_jet.c +++ b/src/acb_dirichlet/zeta_jet.c @@ -18,7 +18,7 @@ # include #endif -void +static void _acb_dirichlet_zeta_jet(acb_t t, const acb_t h, int deflate, slong len, slong prec) { acb_t a; diff --git a/src/acb_dirichlet/zeta_rs.c b/src/acb_dirichlet/zeta_rs.c index ffe5af3fc4..34c133949e 100644 --- a/src/acb_dirichlet/zeta_rs.c +++ b/src/acb_dirichlet/zeta_rs.c @@ -12,7 +12,7 @@ #include "acb.h" #include "acb_dirichlet.h" -void +static void acb_dirichlet_zeta_rs_mid(acb_t res, const acb_t s, slong K, slong prec) { acb_t R1, R2, X, t; From 1a02da298789252ea74e229f338333d46cff2a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 13:30:19 +0200 Subject: [PATCH 091/114] acb_theta --- src/acb_theta/agm_mul_tight.c | 2 +- src/acb_theta/all.c | 2 +- src/acb_theta/dist_a0.c | 2 +- src/acb_theta/g2_character.c | 2 +- src/acb_theta/g2_chi10.c | 2 +- src/acb_theta/g2_chi3_6.c | 2 +- src/acb_theta/g2_chi5.c | 2 +- src/acb_theta/g2_jet_naive_1.c | 2 +- src/acb_theta/g2_psi4.c | 2 +- src/acb_theta/jet_all.c | 2 +- src/acb_theta/jet_compose.c | 3 ++- src/acb_theta/jet_naive_all.c | 2 +- src/acb_theta/jet_ql_all.c | 4 ++-- src/acb_theta/naive_00.c | 4 ++-- src/acb_theta/naive_0b.c | 6 +++--- src/acb_theta/ql_a0_naive.c | 4 ++-- src/acb_theta/ql_a0_steps.c | 2 +- src/acb_theta/ql_all.c | 4 ++-- 18 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/acb_theta/agm_mul_tight.c b/src/acb_theta/agm_mul_tight.c index 2eda1c55f2..1116a0c323 100644 --- a/src/acb_theta/agm_mul_tight.c +++ b/src/acb_theta/agm_mul_tight.c @@ -127,7 +127,7 @@ acb_theta_agm_mul_tight_gen(acb_ptr res, acb_srcptr a0, acb_srcptr a, of real & imaginary parts */ static void acb_theta_agm_mul_tight_g1(acb_ptr res, acb_srcptr a0, acb_srcptr a, - arb_srcptr d0, arb_srcptr d, slong g, slong prec) + arb_srcptr FLINT_UNUSED(d0), arb_srcptr d, slong FLINT_UNUSED(g), slong prec) { acb_t t; acb_ptr aux; diff --git a/src/acb_theta/all.c b/src/acb_theta/all.c index 2e3223ce70..5f409727d1 100644 --- a/src/acb_theta/all.c +++ b/src/acb_theta/all.c @@ -17,7 +17,7 @@ void acb_theta_all(acb_ptr th, acb_srcptr z, const acb_mat_t tau, int sqr, slong prec) { slong g = acb_mat_nrows(tau); - slong n2 = 1 << (2 * g); + ulong n2 = 1 << (2 * g); fmpz_mat_t mat, gamma; acb_mat_t w, c, N; acb_ptr x, y, aux, units; diff --git a/src/acb_theta/dist_a0.c b/src/acb_theta/dist_a0.c index 43bf9e8c64..710ae878cb 100644 --- a/src/acb_theta/dist_a0.c +++ b/src/acb_theta/dist_a0.c @@ -19,7 +19,7 @@ void acb_theta_dist_a0(arb_ptr d, acb_srcptr z, const acb_mat_t tau, slong prec) { slong g = acb_mat_nrows(tau); - slong n = 1 << g; + ulong n = UWORD(1) << g; arb_mat_t Yinv, C; arb_ptr v, w; ulong a; diff --git a/src/acb_theta/g2_character.c b/src/acb_theta/g2_character.c index fe28d042bf..243348ddbb 100644 --- a/src/acb_theta/g2_character.c +++ b/src/acb_theta/g2_character.c @@ -35,7 +35,7 @@ g2_block_det_mod_2(slong * coeffs) } static slong -g2_character_formula(slong * a, slong * b, slong * c, slong * d) +g2_character_formula(slong * a, slong * FLINT_UNUSED(b), slong * c, slong * d) { return (a[0] * c[0] + a[1] * c[0] + a[1] * c[1] + a[2] * c[2] + a[3] * c[2] + a[3] * c[3] + c[0] * c[1] + c[1] * c[2] + c[2] * c[3] + c[0] * d[3] diff --git a/src/acb_theta/g2_chi10.c b/src/acb_theta/g2_chi10.c index dba212a0e4..b7d1b9b587 100644 --- a/src/acb_theta/g2_chi10.c +++ b/src/acb_theta/g2_chi10.c @@ -16,7 +16,7 @@ void acb_theta_g2_chi10(acb_t res, acb_srcptr th2, slong prec) { slong g = 2; - slong n = 1 << (2 * g); + ulong n = UWORD(1) << (2 * g); ulong ab; acb_t t; diff --git a/src/acb_theta/g2_chi3_6.c b/src/acb_theta/g2_chi3_6.c index 4069c5604d..902af5918c 100644 --- a/src/acb_theta/g2_chi3_6.c +++ b/src/acb_theta/g2_chi3_6.c @@ -16,7 +16,7 @@ void acb_theta_g2_chi3_6(acb_poly_t res, acb_srcptr dth, slong prec) { slong g = 2; - slong n = 1 << (2 * g); + ulong n = UWORD(1) << (2 * g); slong orders[2] = {1, 0}; slong i1 = acb_theta_jet_index(orders, g) - 1; /* 0 or 1 */ slong nb = acb_theta_jet_nb(1, g); diff --git a/src/acb_theta/g2_chi5.c b/src/acb_theta/g2_chi5.c index 7f5518d871..1c642e0740 100644 --- a/src/acb_theta/g2_chi5.c +++ b/src/acb_theta/g2_chi5.c @@ -16,7 +16,7 @@ void acb_theta_g2_chi5(acb_t res, acb_srcptr th, slong prec) { slong g = 2; - slong n = 1 << (2 * g); + ulong n = UWORD(1) << (2 * g); ulong ab; acb_t t; diff --git a/src/acb_theta/g2_jet_naive_1.c b/src/acb_theta/g2_jet_naive_1.c index 58cd4ae055..6ff7c667c6 100644 --- a/src/acb_theta/g2_jet_naive_1.c +++ b/src/acb_theta/g2_jet_naive_1.c @@ -18,7 +18,7 @@ static void worker(acb_ptr dth, acb_srcptr v1, acb_srcptr v2, const slong * precs, slong len, - const acb_t cofactor, const slong * coords, slong ord, slong g, slong prec, slong fullprec) + const acb_t cofactor, const slong * coords, slong FLINT_UNUSED(ord), slong g, slong prec, slong fullprec) { slong n = 1 << g; acb_ptr v3, aux, sums_1, sums_2, diffs; diff --git a/src/acb_theta/g2_psi4.c b/src/acb_theta/g2_psi4.c index 4612a2a660..148193af1d 100644 --- a/src/acb_theta/g2_psi4.c +++ b/src/acb_theta/g2_psi4.c @@ -22,7 +22,7 @@ acb_theta_g2_psi4(acb_t res, acb_srcptr th2, slong prec) acb_init(s); acb_init(t); - for (ab = 0; ab < (1 << (2 * g)); ab++) + for (ab = 0; ab < (UWORD(1) << (2 * g)); ab++) { if (acb_theta_char_is_even(ab, g)) { diff --git a/src/acb_theta/jet_all.c b/src/acb_theta/jet_all.c index 3c9a66c7b0..290a7b4e90 100644 --- a/src/acb_theta/jet_all.c +++ b/src/acb_theta/jet_all.c @@ -100,7 +100,7 @@ void acb_theta_jet_all(acb_ptr dth, acb_srcptr z, const acb_mat_t tau, slong ord, slong prec) { slong g = acb_mat_nrows(tau); - slong n2 = 1 << (2 * g); + ulong n2 = UWORD(1) << (2 * g); slong nb = acb_theta_jet_nb(ord, g); fmpz_mat_t mat, gamma; acb_mat_t w, c, cinv, N; diff --git a/src/acb_theta/jet_compose.c b/src/acb_theta/jet_compose.c index d461665020..2a5da91ecd 100644 --- a/src/acb_theta/jet_compose.c +++ b/src/acb_theta/jet_compose.c @@ -25,7 +25,8 @@ acb_theta_jet_compose(acb_ptr res, acb_srcptr v, const acb_mat_t N, fmpz_t m, p; slong * tups; slong * term; - slong n, k, j, i, l, t; + slong n, k, i, l, t; + ulong j; tups = flint_malloc(nb * g * sizeof(slong)); term = flint_malloc(g * sizeof(slong)); diff --git a/src/acb_theta/jet_naive_all.c b/src/acb_theta/jet_naive_all.c index 0eb29898fb..a42945b42e 100644 --- a/src/acb_theta/jet_naive_all.c +++ b/src/acb_theta/jet_naive_all.c @@ -22,7 +22,7 @@ static void worker(acb_ptr dth, acb_srcptr v1, acb_srcptr v2, const slong * precs, slong len, const acb_t cofactor, const slong * coords, slong ord, slong g, slong prec, slong fullprec) { - slong n = 1 << g; + ulong n = UWORD(1) << g; slong nb = acb_theta_jet_nb(ord, g); slong * tups; slong a0, a1; diff --git a/src/acb_theta/jet_ql_all.c b/src/acb_theta/jet_ql_all.c index d00dbf6eda..5135b5d90b 100644 --- a/src/acb_theta/jet_ql_all.c +++ b/src/acb_theta/jet_ql_all.c @@ -90,7 +90,7 @@ acb_theta_jet_ql_all_red(acb_ptr dth, acb_srcptr z, const acb_mat_t tau, slong o /* Collect values around midpoint */ _acb_vec_unit_roots(zetas, b, b, hprec); - for (k = 0; k < n_pow(b, g); k++) + for (k = 0; (ulong) k < n_pow(b, g); k++) { kmod = k; for (j = g - 1; j >= 0; j--) @@ -108,7 +108,7 @@ acb_theta_jet_ql_all_red(acb_ptr dth, acb_srcptr z, const acb_mat_t tau, slong o /* Make finite differences */ for (k = 0; k < n2; k++) { - for (j = 0; j < n_pow(b, g); j++) + for (j = 0; (ulong) j < n_pow(b, g); j++) { acb_set(&val[j], &all_val[j * n2 + k]); } diff --git a/src/acb_theta/naive_00.c b/src/acb_theta/naive_00.c index e209a5c9d0..afa6254dcb 100644 --- a/src/acb_theta/naive_00.c +++ b/src/acb_theta/naive_00.c @@ -16,8 +16,8 @@ #include "acb_theta.h" static void -worker(acb_ptr th, acb_srcptr v1, acb_srcptr v2, const slong * precs, slong len, - const acb_t cofactor, const slong * coords, slong ord, slong g, slong prec, slong fullprec) +worker(acb_ptr th, acb_srcptr v1, acb_srcptr v2, const slong * FLINT_UNUSED(precs), slong len, + const acb_t cofactor, const slong * FLINT_UNUSED(coords), slong FLINT_UNUSED(ord), slong FLINT_UNUSED(g), slong prec, slong fullprec) { acb_t sum; diff --git a/src/acb_theta/naive_0b.c b/src/acb_theta/naive_0b.c index 26966fd36c..cdc2ea4294 100644 --- a/src/acb_theta/naive_0b.c +++ b/src/acb_theta/naive_0b.c @@ -16,10 +16,10 @@ #include "acb_theta.h" static void -worker(acb_ptr th, acb_srcptr v1, acb_srcptr v2, const slong * precs, slong len, - const acb_t cofactor, const slong * coords, slong ord, slong g, slong prec, slong fullprec) +worker(acb_ptr th, acb_srcptr v1, acb_srcptr v2, const slong * FLINT_UNUSED(precs), slong len, + const acb_t cofactor, const slong * coords, slong FLINT_UNUSED(ord), slong g, slong prec, slong fullprec) { - slong n = 1 << g; + ulong n = UWORD(1) << g; acb_t s0, s1, add, sub; ulong b; slong dot; diff --git a/src/acb_theta/ql_a0_naive.c b/src/acb_theta/ql_a0_naive.c index 9728f415b0..3b4f50eb74 100644 --- a/src/acb_theta/ql_a0_naive.c +++ b/src/acb_theta/ql_a0_naive.c @@ -16,7 +16,7 @@ static int acb_theta_ql_a0_naive_gen(acb_ptr th, acb_srcptr t, acb_srcptr z, arb_srcptr d0, - arb_srcptr d, const acb_mat_t tau, slong guard, slong prec) + arb_srcptr d, const acb_mat_t tau, slong FLINT_UNUSED(guard), slong prec) { slong g = acb_mat_nrows(tau); slong n = 1 << g; @@ -72,7 +72,7 @@ acb_theta_ql_a0_naive_gen(acb_ptr th, acb_srcptr t, acb_srcptr z, arb_srcptr d0, relatively more expensive */ static int acb_theta_ql_a0_naive_g1(acb_ptr th, acb_srcptr t, acb_srcptr z, arb_srcptr d0, - arb_srcptr d, const acb_mat_t tau, slong guard, slong prec) + arb_srcptr d, const acb_mat_t tau, slong FLINT_UNUSED(guard), slong prec) { int hast = !acb_is_zero(t); int hasz = !acb_is_zero(z); diff --git a/src/acb_theta/ql_a0_steps.c b/src/acb_theta/ql_a0_steps.c index 101906dc04..ec06d2608c 100644 --- a/src/acb_theta/ql_a0_steps.c +++ b/src/acb_theta/ql_a0_steps.c @@ -235,7 +235,7 @@ static void acb_theta_ql_step_3(acb_ptr res, acb_srcptr th0, acb_srcptr th, acb_srcptr rts, arb_srcptr d0, arb_srcptr d, slong g, slong prec) { - slong n = 1 << g; + ulong n = UWORD(1) << g; acb_ptr aux; ulong a; diff --git a/src/acb_theta/ql_all.c b/src/acb_theta/ql_all.c index 68dae55267..8297ecb08b 100644 --- a/src/acb_theta/ql_all.c +++ b/src/acb_theta/ql_all.c @@ -19,7 +19,7 @@ static void acb_theta_ql_dupl(acb_ptr th2, acb_srcptr th0, acb_srcptr th, arb_srcptr d0, arb_srcptr d, slong g, slong prec) { - slong n = 1 << g; + ulong n = UWORD(1) << g; acb_ptr v; ulong a, b; @@ -302,7 +302,7 @@ void acb_theta_ql_all(acb_ptr th, acb_srcptr z, const acb_mat_t tau, int sqr, slong prec) { slong g = acb_mat_nrows(tau); - slong n2 = 1 << (2 * g); + ulong n2 = UWORD(1) << (2 * g); acb_mat_t tau0; acb_ptr new_z, aux; acb_t c; From 838a5cfab25bae497f68e39468856f49d008e642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 23:51:01 +0200 Subject: [PATCH 092/114] dirichlet --- src/dirichlet.h | 4 ++++ src/dirichlet/char_exp.c | 6 +++++- src/dirichlet/char_first_primitive.c | 2 +- src/dirichlet/char_mul.c | 4 +++- src/dirichlet/char_one.c | 2 +- src/dirichlet/char_order.c | 4 ++-- src/dirichlet/char_pow.c | 2 +- src/dirichlet/chi_vec.c | 5 +++-- src/dirichlet/chi_vec_loop.c | 2 +- src/dirichlet/chi_vec_primeloop.c | 6 +++--- src/dirichlet/group_dlog_precompute.c | 2 +- src/dirichlet/group_init.c | 2 +- src/dirichlet/pairing_char.c | 3 ++- src/dirichlet/test/t-char.c | 8 ++++---- src/dirichlet/ui_order.c | 2 +- 15 files changed, 33 insertions(+), 21 deletions(-) diff --git a/src/dirichlet.h b/src/dirichlet.h index 169366ffb3..775c245ed0 100644 --- a/src/dirichlet.h +++ b/src/dirichlet.h @@ -25,6 +25,8 @@ extern "C" { #endif +FLINT_HEADER_START + #define MAX_FACTORS 15 /* should this dlog pointer be in the prime or the global group? */ @@ -169,6 +171,8 @@ void dirichlet_chi_vec_loop_order(ulong *v, const dirichlet_group_t G, const dir void dirichlet_chi_vec_primeloop_order(ulong *v, const dirichlet_group_t G, const dirichlet_char_t chi, ulong order, slong nv); void dirichlet_chi_vec_order(ulong *v, const dirichlet_group_t G, const dirichlet_char_t chi, ulong order, slong nv); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/dirichlet/char_exp.c b/src/dirichlet/char_exp.c index a72a03bb3b..ec980aaf46 100644 --- a/src/dirichlet/char_exp.c +++ b/src/dirichlet/char_exp.c @@ -14,9 +14,13 @@ ulong _dirichlet_char_exp(dirichlet_char_t x, const dirichlet_group_t G) { - ulong k, n = 1; + slong k; + ulong n = 1; + for (k = 0; k < G->num; k++) n = nmod_mul(n, nmod_pow_ui(G->generators[k], x->log[k], G->mod), G->mod); + x->n = n; + return n; } diff --git a/src/dirichlet/char_first_primitive.c b/src/dirichlet/char_first_primitive.c index 70a04ce7cd..955ff37a45 100644 --- a/src/dirichlet/char_first_primitive.c +++ b/src/dirichlet/char_first_primitive.c @@ -14,7 +14,7 @@ void dirichlet_char_first_primitive(dirichlet_char_t x, const dirichlet_group_t G) { - ulong k; + slong k; if (G->q % 4 == 2) { flint_throw(FLINT_ERROR, "Exception (dirichlet_char_first_primitive). No primitive element mod %wu.\n",G->q); diff --git a/src/dirichlet/char_mul.c b/src/dirichlet/char_mul.c index d03b8e7ffa..d8bab43300 100644 --- a/src/dirichlet/char_mul.c +++ b/src/dirichlet/char_mul.c @@ -14,8 +14,10 @@ void dirichlet_char_mul(dirichlet_char_t c, const dirichlet_group_t G, const dirichlet_char_t a, const dirichlet_char_t b) { - ulong k; + slong k; + for (k = 0; k < G->num ; k++) c->log[k] = nmod_add(a->log[k], b->log[k], G->P[k].phi); + c->n = nmod_mul(a->n, b->n, G->mod); } diff --git a/src/dirichlet/char_one.c b/src/dirichlet/char_one.c index 91ff10d085..1eb7ef8df9 100644 --- a/src/dirichlet/char_one.c +++ b/src/dirichlet/char_one.c @@ -14,7 +14,7 @@ void dirichlet_char_one(dirichlet_char_t x, const dirichlet_group_t G) { - ulong k; + slong k; for (k = 0; k < G->num ; k++) x->log[k] = 0; x->n = 1; diff --git a/src/dirichlet/char_order.c b/src/dirichlet/char_order.c index 52583e2b7e..347d03fb88 100644 --- a/src/dirichlet/char_order.c +++ b/src/dirichlet/char_order.c @@ -14,8 +14,8 @@ ulong dirichlet_order_char(const dirichlet_group_t G, const dirichlet_char_t x) { - ulong k, g; - g = G->expo; + slong k; + ulong g = G->expo; for (k = 0; k < G->num; k++) g = n_gcd(g, G->PHI[k] * x->log[k]); diff --git a/src/dirichlet/char_pow.c b/src/dirichlet/char_pow.c index 0242e5290e..e8ea29bcab 100644 --- a/src/dirichlet/char_pow.c +++ b/src/dirichlet/char_pow.c @@ -14,7 +14,7 @@ void dirichlet_char_pow(dirichlet_char_t c, const dirichlet_group_t G, const dirichlet_char_t a, ulong n) { - ulong k; + slong k; for (k = 0; k < G->num ; k++) c->log[k] = nmod_mul(a->log[k], n, G->P[k].phi); c->n = nmod_pow_ui(a->n, n, G->mod); diff --git a/src/dirichlet/chi_vec.c b/src/dirichlet/chi_vec.c index c1ce89faf8..e6487c773a 100644 --- a/src/dirichlet/chi_vec.c +++ b/src/dirichlet/chi_vec.c @@ -14,7 +14,8 @@ void dirichlet_chi_vec(ulong *v, const dirichlet_group_t G, const dirichlet_char_t chi, slong nv) { - if (2 * nv > G->phi_q) + /* nv > 0 */ + if (2 * (ulong) nv > G->phi_q) dirichlet_chi_vec_loop(v, G, chi, nv); else dirichlet_chi_vec_primeloop(v, G, chi, nv); @@ -23,7 +24,7 @@ dirichlet_chi_vec(ulong *v, const dirichlet_group_t G, const dirichlet_char_t ch void dirichlet_chi_vec_order(ulong *v, const dirichlet_group_t G, const dirichlet_char_t chi, ulong order, slong nv) { - if (2 * nv > G->phi_q) + if (2 * (ulong) nv > G->phi_q) dirichlet_chi_vec_loop_order(v, G, chi, order, nv); else dirichlet_chi_vec_primeloop_order(v, G, chi, order, nv); diff --git a/src/dirichlet/chi_vec_loop.c b/src/dirichlet/chi_vec_loop.c index 28ece5af14..ee0e1bbe23 100644 --- a/src/dirichlet/chi_vec_loop.c +++ b/src/dirichlet/chi_vec_loop.c @@ -49,7 +49,7 @@ dirichlet_chi_vec_loop_order(ulong * v, const dirichlet_group_t G, const dirichl for (k = G->num - 1; k >= j; k--) t = nmod_add(t, expo[k], o); - if (x->n < nv) + if (x->n < (ulong) nv) v[x->n] = t; } diff --git a/src/dirichlet/chi_vec_primeloop.c b/src/dirichlet/chi_vec_primeloop.c index d8cabe8e11..4dc3f5bda4 100644 --- a/src/dirichlet/chi_vec_primeloop.c +++ b/src/dirichlet/chi_vec_primeloop.c @@ -18,7 +18,7 @@ dirichlet_chi_vec_evenpart(ulong *v, const dirichlet_group_t G, const dirichlet_ if (G->neven >= 1 && chi->log[0]) { ulong x, c3 = G->PHI[0] / mult; - for (x = 3; x < nv; x += 4) + for (x = 3; x < (ulong) nv; x += 4) v[x] = c3; } if (G->neven == 2 && chi->log[1]) @@ -34,10 +34,10 @@ dirichlet_chi_vec_evenpart(ulong *v, const dirichlet_group_t G, const dirichlet_ for (x = g; x > 1;) { - for (xp = x; xp < nv; xp += pe.n) + for (xp = x; xp < (ulong) nv; xp += pe.n) v[xp] = nmod_add(v[xp], vx, o); - for (xp = pe.n - x; xp < nv; xp += pe.n) + for (xp = pe.n - x; xp < (ulong) nv; xp += pe.n) v[xp] = nmod_add(v[xp], vx, o); x = nmod_mul(x, g, pe); diff --git a/src/dirichlet/group_dlog_precompute.c b/src/dirichlet/group_dlog_precompute.c index 25577ceab0..9b0b0509c1 100644 --- a/src/dirichlet/group_dlog_precompute.c +++ b/src/dirichlet/group_dlog_precompute.c @@ -11,7 +11,7 @@ #include "dirichlet.h" -void +static void dirichlet_prime_group_dlog_precompute(dirichlet_prime_group_struct * P, ulong num) { P->dlog = flint_malloc(sizeof(dlog_precomp_t)); diff --git a/src/dirichlet/group_init.c b/src/dirichlet/group_init.c index 37b74921f0..1871e8da26 100644 --- a/src/dirichlet/group_init.c +++ b/src/dirichlet/group_init.c @@ -31,7 +31,7 @@ primitive_root_p_and_p2(ulong p) return n_primitive_root_prime(p); } -void +static void dirichlet_prime_group_init(dirichlet_prime_group_struct * P, ulong p, int e) { P->p = p; diff --git a/src/dirichlet/pairing_char.c b/src/dirichlet/pairing_char.c index d8a5177773..6d26c7e801 100644 --- a/src/dirichlet/pairing_char.c +++ b/src/dirichlet/pairing_char.c @@ -14,7 +14,8 @@ ulong dirichlet_pairing_char(const dirichlet_group_t G, const dirichlet_char_t chi, const dirichlet_char_t x) { - ulong v = 0, k; + slong k; + ulong v = 0; nmod_t order; nmod_init(&order, G->expo); diff --git a/src/dirichlet/test/t-char.c b/src/dirichlet/test/t-char.c index 8b81307460..cc59b35373 100644 --- a/src/dirichlet/test/t-char.c +++ b/src/dirichlet/test/t-char.c @@ -20,7 +20,8 @@ TEST_FUNCTION_START(dirichlet_char, state) { dirichlet_group_t G; dirichlet_char_t x, y; - ulong q, n, k, sum; + ulong q, n, sum; + slong k; slong ref; q = 1 + n_randint(state, 1000 * (1 + iter / 100)); @@ -54,7 +55,7 @@ TEST_FUNCTION_START(dirichlet_char, state) flint_printf("loop index = %wu\n\n", n); flint_abort(); } - if (sum != ref && q > 1) + if ((slong) sum != ref && q > 1) { flint_printf("FAIL: sum test\n\n"); flint_printf("q = %wu\n\n", q); @@ -70,7 +71,7 @@ TEST_FUNCTION_START(dirichlet_char, state) for (n = 1; dirichlet_char_next_primitive(x, G) >= 0; n++); ref = dirichlet_group_num_primitive(G); - if (n != ref) + if ((slong) n != ref) { flint_printf("FAIL: number of primitive elements\n\n"); flint_printf("q = %wu\n\n", q); @@ -82,7 +83,6 @@ TEST_FUNCTION_START(dirichlet_char, state) /* some random elements, check log and exp */ for (n = 0; n < 30; n++) { - slong k; ulong m; for (m = 1; n_gcd(m, q) > 1; m = n_randint(state, q)); diff --git a/src/dirichlet/ui_order.c b/src/dirichlet/ui_order.c index d8bb9e8827..df50735129 100644 --- a/src/dirichlet/ui_order.c +++ b/src/dirichlet/ui_order.c @@ -12,7 +12,7 @@ #include "dirichlet.h" /* order of an element knowing the factorization of a multiple */ -ulong +static ulong nmod_order_precomp(ulong a, nmod_t mod, ulong expo, n_factor_t fac) { int k; From ada84b9ffc5dbddaae5e7c78f5e8ec6b482bb0eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 13:35:32 +0200 Subject: [PATCH 093/114] bernoulli --- src/bernoulli/cache_compute.c | 2 +- src/bernoulli/fmpq_ui_multi_mod.c | 12 +++++++++--- src/bernoulli/mod_p_harvey.c | 24 ++++++++++++++++-------- src/bernoulli/test/t-mod_p_harvey.c | 2 +- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/bernoulli/cache_compute.c b/src/bernoulli/cache_compute.c index 6e9e2157ba..07c6c04962 100644 --- a/src/bernoulli/cache_compute.c +++ b/src/bernoulli/cache_compute.c @@ -16,7 +16,7 @@ FLINT_TLS_PREFIX slong bernoulli_cache_num = 0; FLINT_TLS_PREFIX fmpq * bernoulli_cache = NULL; -void +static void bernoulli_cleanup(void) { slong i; diff --git a/src/bernoulli/fmpq_ui_multi_mod.c b/src/bernoulli/fmpq_ui_multi_mod.c index 43288cc6ed..290b211431 100644 --- a/src/bernoulli/fmpq_ui_multi_mod.c +++ b/src/bernoulli/fmpq_ui_multi_mod.c @@ -14,6 +14,12 @@ #include "bernoulli.h" #include "arb.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define TIMING 0 #define DEBUG 0 @@ -32,14 +38,14 @@ typedef struct crt_args_t; static void -crt_init(crt_res_t * x, crt_args_t * args) +crt_init(crt_res_t * x, crt_args_t * FLINT_UNUSED(args)) { fmpz_init(&x->r); fmpz_init(&x->m); } static void -crt_clear(crt_res_t * x, crt_args_t * args) +crt_clear(crt_res_t * x, crt_args_t * FLINT_UNUSED(args)) { fmpz_clear(&x->r); fmpz_clear(&x->m); @@ -58,7 +64,7 @@ _fmpz_crt_combine(fmpz_t r1r2, fmpz_t m1m2, const fmpz_t r1, const fmpz_t m1, co } static void -crt_combine(crt_res_t * res, crt_res_t * left, crt_res_t * right, crt_args_t * args) +crt_combine(crt_res_t * res, crt_res_t * left, crt_res_t * right, crt_args_t * FLINT_UNUSED(args)) { _fmpz_crt_combine(&res->r, &res->m, &left->r, &left->m, &right->r, &right->m); } diff --git a/src/bernoulli/mod_p_harvey.c b/src/bernoulli/mod_p_harvey.c index 3b115dff1c..699b599370 100644 --- a/src/bernoulli/mod_p_harvey.c +++ b/src/bernoulli/mod_p_harvey.c @@ -61,6 +61,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ulong_extras.h" #include "bernoulli.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma message "_bernoulli_mod_p_harvey_powg only needs a symbol for test" +# pragma message "_bernoulli_mod_p_harvey_pow2 only needs a symbol for test" +# pragma message "_bernoulli_n_muldivrem_precomp only needs a symbol for test" +#endif + #define DEBUG 0 #define TIMING 1 @@ -117,7 +126,7 @@ bernoulli_sum_powg(ulong p, ulong pinv, ulong k, ulong g) g_to_km1_to_j = g_to_km1; sum = 0; - for (j = 1; j <= (p - 1) / 2; j++) + for (j = 1; (ulong) j <= (p - 1) / 2; j++) { g_to_jm1 = _bernoulli_n_muldivrem_precomp(&q, g_to_jm1, g, p, g_pinv); h = n_submod(q, half_gm1, p); @@ -187,7 +196,7 @@ expander_expand(nn_ptr res, expander_t * this, ulong s, ulong n) if (s == 1) { /* already have 1/p; just copy it */ - for (i = 1; i <= n; i++) + for (i = 1; (ulong) i <= n; i++) res[i] = this->pinv[this->max_words - n + i]; } else @@ -229,7 +238,7 @@ expander_expand(nn_ptr res, expander_t * this, ulong s, ulong n) #error Number of bits in a ulong must be divisible by TABLE_LG_SIZE #endif -ulong bernsum_pow2(ulong p, ulong pinv, ulong k, ulong g, ulong n) +static ulong bernsum_pow2(ulong p, ulong pinv, ulong k, ulong g, ulong n) { slong i, m; ulong g_to_km1, two_to_km1, B_to_km1, s_jump; @@ -294,7 +303,7 @@ ulong bernsum_pow2(ulong p, ulong pinv, ulong k, ulong g, ulong n) /* loop over outer sum */ for (i = 0; i < m; i++) { - ulong s, x, y; + ulong s, y; slong nn; /* s keeps track of g^i*2^j mod p */ @@ -333,7 +342,6 @@ ulong bernsum_pow2(ulong p, ulong pinv, ulong k, ulong g, ulong n) /* loop over whole words */ for (; bits >= FLINT_BITS; bits -= FLINT_BITS, next--) { - ulong y; #if NUM_TABLES != 8 && NUM_TABLES != 4 nn_ptr target; #else @@ -518,7 +526,7 @@ static ulong PrepRedc(ulong n) (See bernsum_pow2() for code comments; we only add comments here where something is different from bernsum_pow2()) */ -ulong bernsum_pow2_redc(ulong p, ulong pinv, ulong k, ulong g, ulong n) +static ulong bernsum_pow2_redc(ulong p, ulong pinv, ulong k, ulong g, ulong n) { ulong pinv2 = PrepRedc(p); ulong F = (UWORD(1) << (FLINT_BITS/2)) % p; @@ -582,7 +590,7 @@ ulong bernsum_pow2_redc(ulong p, ulong pinv, ulong k, ulong g, ulong n) for (i = 0; i < m; i++) { - ulong s, x, y; + ulong s, y; slong nn, bits, words; nn_ptr next; @@ -829,7 +837,7 @@ ulong _bernoulli_mod_p_harvey_pow2(ulong p, ulong pinv, ulong k) 2 <= k <= p-3, k even pinv = PrepMulMod(p) */ -ulong _bernoulli_mod_p_harvey(ulong p, ulong pinv, ulong k) +static ulong _bernoulli_mod_p_harvey(ulong p, ulong pinv, ulong k) { if (n_powmod2_preinv(2, k, p, pinv) != 1) { diff --git a/src/bernoulli/test/t-mod_p_harvey.c b/src/bernoulli/test/t-mod_p_harvey.c index 38ae1d2fcb..b80d725c39 100644 --- a/src/bernoulli/test/t-mod_p_harvey.c +++ b/src/bernoulli/test/t-mod_p_harvey.c @@ -84,7 +84,7 @@ TEST_FUNCTION_START(bernoulli_mod_p_harvey, state) } { - slong n, N, iter; + slong n, N; ulong x, y, z, p, pinv; fmpz * num; fmpz * den; From 8a6d57de9c43f884db1b97ffb73c230727c5f389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 13:39:43 +0200 Subject: [PATCH 094/114] hypgeom --- src/hypgeom/bound.c | 4 ++-- src/hypgeom/precompute.c | 6 +++--- src/hypgeom/sum.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hypgeom/bound.c b/src/hypgeom/bound.c index fb165465b3..d9bc6492fd 100644 --- a/src/hypgeom/bound.c +++ b/src/hypgeom/bound.c @@ -12,7 +12,7 @@ #include "arf.h" #include "hypgeom.h" -slong +static slong hypgeom_root_bound(const mag_t z, int r) { if (r == 0) @@ -48,7 +48,7 @@ z^n * ----------------------- * ((K+m)! / K!)^(1-r) (K-B)! (K-A+m)! (K-2B+m)! */ -void +static void hypgeom_term_bound(mag_t Tn, const mag_t TK, slong K, slong A, slong B, int r, const mag_t z, slong n) { mag_t t, u, num; diff --git a/src/hypgeom/precompute.c b/src/hypgeom/precompute.c index a29fd96cf8..c3118905d5 100644 --- a/src/hypgeom/precompute.c +++ b/src/hypgeom/precompute.c @@ -15,7 +15,7 @@ /* Compute a pure ratio P2(k)/Q2(k) for the term A(k)/B(k) * [P(1)P(2)...P(k)] / [Q(1)Q(2)...Q(k)] */ -void +static void hypgeom_standardize(fmpz_poly_t P2, fmpz_poly_t Q2, const fmpz_poly_t A, const fmpz_poly_t B, const fmpz_poly_t P, const fmpz_poly_t Q) @@ -58,7 +58,7 @@ fmpz_cdiv_abs_q(fmpz_t q, const fmpz_t x, const fmpz_t y) } } -slong +static slong hypgeom_root_norm(const fmpz_poly_t P) { slong res, i, p; @@ -100,7 +100,7 @@ fmpz_poly_evaluate_si(fmpz_t y, const fmpz_poly_t poly, slong x) fmpz_poly_evaluate_fmpz(y, poly, y); } -void +static void _hypgeom_precompute(hypgeom_t hyp, const fmpz_poly_t P, const fmpz_poly_t Q) { slong k; diff --git a/src/hypgeom/sum.c b/src/hypgeom/sum.c index 4624d59ca5..bc804a93b1 100644 --- a/src/hypgeom/sum.c +++ b/src/hypgeom/sum.c @@ -103,7 +103,7 @@ typedef struct bsplit_args_t; static void -bsplit_init(bsplit_res_t * x, void * args) +bsplit_init(bsplit_res_t * x, void * FLINT_UNUSED(args)) { arb_init(&x->P); arb_init(&x->Q); @@ -112,7 +112,7 @@ bsplit_init(bsplit_res_t * x, void * args) } static void -bsplit_clear(bsplit_res_t * x, void * args) +bsplit_clear(bsplit_res_t * x, void * FLINT_UNUSED(args)) { arb_clear(&x->P); arb_clear(&x->Q); From 86bcdc5f4fafe341c8bc2359372ffbbf298d180d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sat, 5 Oct 2024 13:25:22 +0200 Subject: [PATCH 095/114] gr --- src/gr.h | 6 +- src/gr/acb.c | 88 ++++++++++++----------- src/gr/acf.c | 68 +++++++++--------- src/gr/arb.c | 66 ++++++++++-------- src/gr/arf.c | 78 +++++++++++---------- src/gr/ca.c | 12 +++- src/gr/dirichlet.c | 13 +++- src/gr/fexpr.c | 75 +++++++++++--------- src/gr/fmpq.c | 116 ++++++++++++++++--------------- src/gr/fmpq_poly.c | 100 +++++++++++++------------- src/gr/fmpz.c | 158 ++++++++++++++++++++++-------------------- src/gr/fmpz_mod.c | 31 +++++---- src/gr/fmpz_mpoly.c | 18 +++-- src/gr/fmpz_mpoly_q.c | 10 ++- src/gr/fmpz_poly.c | 114 +++++++++++++++--------------- src/gr/fmpzi.c | 124 +++++++++++++++++---------------- src/gr/fq.c | 14 ++-- src/gr/fq_nmod.c | 14 ++-- src/gr/fq_zech.c | 18 +++-- src/gr/init_random.c | 12 ++-- src/gr/matrix.c | 10 ++- src/gr/mpoly.c | 18 +++-- src/gr/nf.c | 12 ++-- src/gr/nmod.c | 39 ++++++----- src/gr/nmod32.c | 34 +++++---- src/gr/nmod8.c | 32 +++++---- src/gr/perm.c | 13 +++- src/gr/polynomial.c | 10 ++- src/gr/psl2z.c | 35 ++++++---- src/gr/qqbar.c | 124 +++++++++++++++++---------------- src/gr/series.c | 36 ++++++---- src/gr/series_mod.c | 8 ++- src/gr/test_ring.c | 12 +++- src/gr/vector.c | 8 +++ 34 files changed, 863 insertions(+), 663 deletions(-) diff --git a/src/gr.h b/src/gr.h index 63cb0d7fcd..c9243bd6fa 100644 --- a/src/gr.h +++ b/src/gr.h @@ -1310,10 +1310,6 @@ GR_INLINE void gr_heap_clear_vec(gr_ptr x, slong len, gr_ctx_t ctx) flint_free(x); } -truth_t gr_generic_ctx_predicate(gr_ctx_t ctx); -truth_t gr_generic_ctx_predicate_true(gr_ctx_t ctx); -truth_t gr_generic_ctx_predicate_false(gr_ctx_t ctx); - /* Some base rings */ void gr_ctx_init_random(gr_ctx_t ctx, flint_rand_t state); @@ -1331,7 +1327,9 @@ void _gr_ctx_init_nmod(gr_ctx_t ctx, void * nmod_t_ref); void gr_ctx_init_nmod8(gr_ctx_t ctx, unsigned char n); void gr_ctx_init_nmod32(gr_ctx_t ctx, unsigned int n); +#ifndef MPN_MOD_H int gr_ctx_init_mpn_mod(gr_ctx_t ctx, const fmpz_t n); +#endif void gr_ctx_init_real_qqbar(gr_ctx_t ctx); void gr_ctx_init_complex_qqbar(gr_ctx_t ctx); diff --git a/src/gr/acb.c b/src/gr/acb.c index 253ae17b50..c7088daada 100644 --- a/src/gr/acb.c +++ b/src/gr/acb.c @@ -29,6 +29,12 @@ #include "gr_poly.h" #include "nfloat.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + typedef struct { slong prec; @@ -66,19 +72,19 @@ _gr_acb_ctx_write(gr_stream_t out, gr_ctx_t ctx) } void -_gr_acb_init(acb_t x, const gr_ctx_t ctx) +_gr_acb_init(acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { acb_init(x); } void -_gr_acb_clear(acb_t x, const gr_ctx_t ctx) +_gr_acb_clear(acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { acb_clear(x); } void -_gr_acb_swap(acb_t x, acb_t y, const gr_ctx_t ctx) +_gr_acb_swap(acb_t x, acb_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { acb_t t; *t = *x; @@ -87,7 +93,7 @@ _gr_acb_swap(acb_t x, acb_t y, const gr_ctx_t ctx) } void -_gr_acb_set_shallow(acb_t res, const acb_t x, const gr_ctx_t ctx) +_gr_acb_set_shallow(acb_t res, const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } @@ -101,7 +107,7 @@ _gr_acb_randtest(acb_t res, flint_rand_t state, const gr_ctx_t ctx) } int -__gr_acb_write(gr_stream_t out, const acb_t x, slong digits, int flags, const gr_ctx_t ctx) +__gr_acb_write(gr_stream_t out, const acb_t x, slong digits, int flags, const gr_ctx_t FLINT_UNUSED(ctx)) { if (arb_is_zero(acb_imagref(x))) { @@ -171,14 +177,14 @@ _gr_acb_write_n(gr_stream_t out, gr_srcptr x, slong n, gr_ctx_t ctx) } int -_gr_acb_zero(acb_t x, const gr_ctx_t ctx) +_gr_acb_zero(acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { acb_zero(x); return GR_SUCCESS; } int -_gr_acb_one(acb_t x, const gr_ctx_t ctx) +_gr_acb_one(acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { acb_one(x); return GR_SUCCESS; @@ -308,7 +314,7 @@ _gr_acb_set_other(acb_t res, gr_srcptr x, gr_ctx_t x_ctx, gr_ctx_t ctx) } int -_gr_acb_set_interval_mid_rad(acb_t res, const acb_t m, const acb_t r, const gr_ctx_t ctx) +_gr_acb_set_interval_mid_rad(acb_t res, const acb_t m, const acb_t r, const gr_ctx_t FLINT_UNUSED(ctx)) { mag_t rad1, rad2; mag_init(rad1); @@ -329,7 +335,7 @@ int _gr_arf_get_si(slong * res, const arf_t x, const gr_ctx_t ctx); int _gr_arf_get_ui(ulong * res, const arf_t x, const gr_ctx_t ctx); int -_gr_acb_get_fmpz(fmpz_t res, const acb_t x, const gr_ctx_t ctx) +_gr_acb_get_fmpz(fmpz_t res, const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!acb_is_int(x)) { @@ -343,7 +349,7 @@ _gr_acb_get_fmpz(fmpz_t res, const acb_t x, const gr_ctx_t ctx) } int -_gr_acb_get_si(slong * res, const acb_t x, const gr_ctx_t ctx) +_gr_acb_get_si(slong * res, const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!acb_is_int(x)) { @@ -357,7 +363,7 @@ _gr_acb_get_si(slong * res, const acb_t x, const gr_ctx_t ctx) } int -_gr_acb_get_ui(ulong * res, const acb_t x, const gr_ctx_t ctx) +_gr_acb_get_ui(ulong * res, const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!acb_is_int(x)) { @@ -371,14 +377,14 @@ _gr_acb_get_ui(ulong * res, const acb_t x, const gr_ctx_t ctx) } int -_gr_acb_get_d(double * res, const acb_t x, const gr_ctx_t ctx) +_gr_acb_get_d(double * res, const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = arf_get_d(arb_midref(acb_realref(x)), ARF_RND_NEAR); return GR_SUCCESS; } truth_t -_gr_acb_is_zero(const acb_t x, const gr_ctx_t ctx) +_gr_acb_is_zero(const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (acb_is_zero(x)) return T_TRUE; @@ -390,7 +396,7 @@ _gr_acb_is_zero(const acb_t x, const gr_ctx_t ctx) } truth_t -_gr_acb_is_one(const acb_t x, const gr_ctx_t ctx) +_gr_acb_is_one(const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (acb_is_one(x)) return T_TRUE; @@ -402,7 +408,7 @@ _gr_acb_is_one(const acb_t x, const gr_ctx_t ctx) } truth_t -_gr_acb_is_neg_one(const acb_t x, const gr_ctx_t ctx) +_gr_acb_is_neg_one(const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (acb_equal_si(x, -1)) return T_TRUE; @@ -414,7 +420,7 @@ _gr_acb_is_neg_one(const acb_t x, const gr_ctx_t ctx) } truth_t -_gr_acb_equal(const acb_t x, const acb_t y, const gr_ctx_t ctx) +_gr_acb_equal(const acb_t x, const acb_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (acb_is_exact(x) && acb_equal(x, y)) return T_TRUE; @@ -426,14 +432,14 @@ _gr_acb_equal(const acb_t x, const acb_t y, const gr_ctx_t ctx) } int -_gr_acb_set(acb_t res, const acb_t x, const gr_ctx_t ctx) +_gr_acb_set(acb_t res, const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { acb_set(res, x); return GR_SUCCESS; } int -_gr_acb_neg(acb_t res, const acb_t x, const gr_ctx_t ctx) +_gr_acb_neg(acb_t res, const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { acb_neg(res, x); return GR_SUCCESS; @@ -538,7 +544,7 @@ _gr_acb_submul(acb_t res, const acb_t x, const acb_t y, const gr_ctx_t ctx) } int -_gr_acb_mul_two(acb_t res, const acb_t x, const gr_ctx_t ctx) +_gr_acb_mul_two(acb_t res, const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { acb_mul_2exp_si(res, x, 1); return GR_SUCCESS; @@ -552,21 +558,21 @@ _gr_acb_sqr(acb_t res, const acb_t x, const gr_ctx_t ctx) } int -_gr_acb_mul_2exp_si(acb_t res, const acb_t x, slong y, const gr_ctx_t ctx) +_gr_acb_mul_2exp_si(acb_t res, const acb_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { acb_mul_2exp_si(res, x, y); return GR_SUCCESS; } int -_gr_acb_mul_2exp_fmpz(acb_t res, const acb_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_acb_mul_2exp_fmpz(acb_t res, const acb_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { acb_mul_2exp_fmpz(res, x, y); return GR_SUCCESS; } int -_gr_acb_set_fmpz_2exp_fmpz(acb_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_acb_set_fmpz_2exp_fmpz(acb_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { arb_set_fmpz_2exp(acb_realref(res), x, y); arb_zero(acb_imagref(res)); @@ -574,7 +580,7 @@ _gr_acb_set_fmpz_2exp_fmpz(acb_t res, const fmpz_t x, const fmpz_t y, const gr_c } int -_gr_acb_get_fmpz_2exp_fmpz(fmpz_t res1, fmpz_t res2, const acb_t x, const gr_ctx_t ctx) +_gr_acb_get_fmpz_2exp_fmpz(fmpz_t res1, fmpz_t res2, const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!acb_is_exact(x) || !acb_is_real(x)) return GR_UNABLE; @@ -664,7 +670,7 @@ _gr_acb_div_fmpz(acb_t res, const acb_t x, const fmpz_t y, const gr_ctx_t ctx) } truth_t -_gr_acb_is_invertible(const acb_t x, const gr_ctx_t ctx) +_gr_acb_is_invertible(const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (acb_is_zero(x)) return T_FALSE; @@ -773,7 +779,7 @@ _gr_acb_pow_fmpq(acb_t res, const acb_t x, const fmpq_t exp, const gr_ctx_t ctx) } truth_t -_gr_acb_is_square(const acb_t x, const gr_ctx_t ctx) +_gr_acb_is_square(const acb_t FLINT_UNUSED(x), const gr_ctx_t FLINT_UNUSED(ctx)) { return T_TRUE; } @@ -876,7 +882,7 @@ _gr_acb_nint(acb_t res, const acb_t x, const gr_ctx_t ctx) } int -_gr_acb_i(acb_t res, const gr_ctx_t ctx) +_gr_acb_i(acb_t res, const gr_ctx_t FLINT_UNUSED(ctx)) { acb_onei(res); return GR_SUCCESS; @@ -891,14 +897,14 @@ _gr_acb_abs(acb_t res, const acb_t x, const gr_ctx_t ctx) } int -_gr_acb_conj(acb_t res, const acb_t x, const gr_ctx_t ctx) +_gr_acb_conj(acb_t res, const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { acb_conj(res, x); return GR_SUCCESS; } int -_gr_acb_re(acb_t res, const acb_t x, const gr_ctx_t ctx) +_gr_acb_re(acb_t res, const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arb_set(acb_realref(res), acb_realref(x)); arb_zero(acb_imagref(res)); @@ -906,7 +912,7 @@ _gr_acb_re(acb_t res, const acb_t x, const gr_ctx_t ctx) } int -_gr_acb_im(acb_t res, const acb_t x, const gr_ctx_t ctx) +_gr_acb_im(acb_t res, const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arb_set(acb_realref(res), acb_imagref(x)); arb_zero(acb_imagref(res)); @@ -956,7 +962,7 @@ _gr_acb_ ## fname(acb_t res, const acb_t x, const acb_t y, const gr_ctx_t ctx) \ DEF_FUNC(sgn) int -_gr_acb_csgn(acb_t res, const acb_t x, const gr_ctx_t ctx) +_gr_acb_csgn(acb_t res, const acb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { acb_csgn(acb_realref(res), x); arb_zero(acb_imagref(res)); @@ -972,7 +978,7 @@ _gr_acb_arg(acb_t res, const acb_t x, const gr_ctx_t ctx) } int -_gr_acb_cmp(int * res, const acb_t x, const acb_t y, const gr_ctx_t ctx) +_gr_acb_cmp(int * res, const acb_t x, const acb_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (arb_is_zero(acb_imagref(x)) && arb_is_zero(acb_imagref(y)) && ((arb_is_exact(acb_realref(x)) && arb_is_exact(acb_realref(y))) || !arb_overlaps(acb_realref(x), acb_realref(y)))) @@ -1055,19 +1061,19 @@ _gr_acb_cmpabs(int * res, const acb_t x, const acb_t y, const gr_ctx_t ctx) } else { - arb_t t, u; + arb_t tb, u; - arb_init(t); + arb_init(tb); arb_init(u); - arb_mul(t, a, a, prec); - arb_addmul(t, b, b, prec); + arb_mul(tb, a, a, prec); + arb_addmul(tb, b, b, prec); arb_mul(u, c, c, prec); arb_addmul(u, d, d, prec); - if ((arb_is_exact(t) && arb_is_exact(u)) || !arb_overlaps(t, u)) + if ((arb_is_exact(tb) && arb_is_exact(u)) || !arb_overlaps(tb, u)) { - *res = arf_cmp(arb_midref(t), arb_midref(u)); + *res = arf_cmp(arb_midref(tb), arb_midref(u)); status = GR_SUCCESS; } else @@ -1077,7 +1083,7 @@ _gr_acb_cmpabs(int * res, const acb_t x, const acb_t y, const gr_ctx_t ctx) status = GR_UNABLE; } - arb_clear(t); + arb_clear(tb); arb_clear(u); } @@ -1684,7 +1690,7 @@ int _gr_acb_hypgeom_1f1(acb_t res, const acb_t a, const acb_t b, const acb_t x, return acb_is_finite(res) ? GR_SUCCESS : GR_UNABLE; } -int _gr_acb_hypgeom_u(acb_t res, const acb_t a, const acb_t b, const acb_t x, int flags, const gr_ctx_t ctx) +int _gr_acb_hypgeom_u(acb_t res, const acb_t a, const acb_t b, const acb_t x, int FLINT_UNUSED(flags), const gr_ctx_t ctx) { acb_hypgeom_u(res, a, b, x, ACB_CTX_PREC(ctx)); return acb_is_finite(res) ? GR_SUCCESS : GR_UNABLE; @@ -1992,7 +1998,7 @@ roots_accurate(acb_ptr roots, slong len, slong prec) /* hidden feature: also works with arb ctx */ int -_gr_acb_poly_roots(gr_vec_t roots, gr_vec_t mult, const gr_poly_t poly, int flags, gr_ctx_t ctx) +_gr_acb_poly_roots(gr_vec_t roots, gr_vec_t mult, const gr_poly_t poly, int FLINT_UNUSED(flags), gr_ctx_t ctx) { slong prec, initial_prec, target_prec, isolated, maxiter, maxprec, deg, i; acb_ptr croots; @@ -2193,7 +2199,7 @@ _gr_acb_mat_exp(acb_mat_t res, const acb_mat_t x, gr_ctx_t ctx) } int -_gr_acb_mat_diagonalization(gr_vec_t D, acb_mat_t L, acb_mat_t R, const acb_mat_t A, int flags, gr_ctx_t ctx) +_gr_acb_mat_diagonalization(gr_vec_t D, acb_mat_t L, acb_mat_t R, const acb_mat_t A, int FLINT_UNUSED(flags), gr_ctx_t ctx) { int status; slong n; diff --git a/src/gr/acf.c b/src/gr/acf.c index 8d0f7c08fe..2201c40cd9 100644 --- a/src/gr/acf.c +++ b/src/gr/acf.c @@ -19,6 +19,12 @@ #include "gr_vec.h" #include "gr_poly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + typedef struct { slong prec; @@ -54,19 +60,19 @@ _gr_acf_ctx_write(gr_stream_t out, gr_ctx_t ctx) } void -_gr_acf_init(acf_t x, const gr_ctx_t ctx) +_gr_acf_init(acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { acf_init(x); } void -_gr_acf_clear(acf_t x, const gr_ctx_t ctx) +_gr_acf_clear(acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { acf_clear(x); } void -_gr_acf_swap(acf_t x, acf_t y, const gr_ctx_t ctx) +_gr_acf_swap(acf_t x, acf_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { acf_t t; *t = *x; @@ -75,7 +81,7 @@ _gr_acf_swap(acf_t x, acf_t y, const gr_ctx_t ctx) } void -_gr_acf_set_shallow(acf_t res, const acf_t x, const gr_ctx_t ctx) +_gr_acf_set_shallow(acf_t res, const acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } @@ -129,7 +135,7 @@ _gr_acf_write(gr_stream_t out, const acf_t x, const gr_ctx_t ctx) } int -_gr_acf_zero(acf_t x, const gr_ctx_t ctx) +_gr_acf_zero(acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_zero(acf_realref(x)); arf_zero(acf_imagref(x)); @@ -137,7 +143,7 @@ _gr_acf_zero(acf_t x, const gr_ctx_t ctx) } int -_gr_acf_one(acf_t x, const gr_ctx_t ctx) +_gr_acf_one(acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_one(acf_realref(x)); arf_zero(acf_imagref(x)); @@ -177,7 +183,7 @@ _gr_acf_set_fmpq(acf_t res, const fmpq_t v, const gr_ctx_t ctx) } int -_gr_acf_set_d(acf_t res, double x, const gr_ctx_t ctx) +_gr_acf_set_d(acf_t res, double x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_set_d(acf_realref(res), x); arf_zero(acf_imagref(res)); @@ -186,7 +192,7 @@ _gr_acf_set_d(acf_t res, double x, const gr_ctx_t ctx) /* todo: set_round? */ int -_gr_acf_set(acf_t res, const acf_t x, const gr_ctx_t ctx) +_gr_acf_set(acf_t res, const acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { acf_set(res, x); return GR_SUCCESS; @@ -254,7 +260,7 @@ _gr_acf_set_other(acf_t res, gr_srcptr x, gr_ctx_t x_ctx, const gr_ctx_t ctx) } int -_gr_acf_get_fmpz(fmpz_t res, const acf_t x, const gr_ctx_t ctx) +_gr_acf_get_fmpz(fmpz_t res, const acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!arf_is_zero(acf_imagref(x))) return GR_DOMAIN; @@ -271,7 +277,7 @@ _gr_acf_get_fmpz(fmpz_t res, const acf_t x, const gr_ctx_t ctx) } int -_gr_acf_get_si(slong * res, const acf_t x, const gr_ctx_t ctx) +_gr_acf_get_si(slong * res, const acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_t t; @@ -292,7 +298,7 @@ _gr_acf_get_si(slong * res, const acf_t x, const gr_ctx_t ctx) } int -_gr_acf_get_ui(ulong * res, const acf_t x, const gr_ctx_t ctx) +_gr_acf_get_ui(ulong * res, const acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_t t; @@ -324,25 +330,25 @@ _gr_acf_get_d(double * res, const acf_t x, const gr_ctx_t ctx) } truth_t -_gr_acf_is_zero(const acf_t x, const gr_ctx_t ctx) +_gr_acf_is_zero(const acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return (arf_is_zero(acf_realref(x)) && arf_is_zero(acf_imagref(x))) ? T_TRUE : T_FALSE; } truth_t -_gr_acf_is_one(const acf_t x, const gr_ctx_t ctx) +_gr_acf_is_one(const acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return (arf_is_one(acf_realref(x)) && arf_is_zero(acf_imagref(x))) ? T_TRUE : T_FALSE; } truth_t -_gr_acf_is_neg_one(const acf_t x, const gr_ctx_t ctx) +_gr_acf_is_neg_one(const acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return (arf_equal_si(acf_realref(x), -1) && arf_is_zero(acf_imagref(x))) ? T_TRUE : T_FALSE; } truth_t -_gr_acf_equal(const acf_t x, const acf_t y, const gr_ctx_t ctx) +_gr_acf_equal(const acf_t x, const acf_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (arf_is_nan(acf_realref(x)) || arf_is_nan(acf_imagref(x)) || arf_is_nan(acf_realref(y)) || arf_is_nan(acf_imagref(y))) @@ -353,7 +359,7 @@ _gr_acf_equal(const acf_t x, const acf_t y, const gr_ctx_t ctx) /* todo: neg_round? */ int -_gr_acf_neg(acf_t res, const acf_t x, const gr_ctx_t ctx) +_gr_acf_neg(acf_t res, const acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_neg(acf_realref(res), acf_realref(x)); arf_neg(acf_imagref(res), acf_imagref(x)); @@ -454,7 +460,7 @@ _gr_acf_mul_fmpz(acf_t res, const acf_t x, const fmpz_t y, const gr_ctx_t ctx) } int -_gr_acf_mul_two(acf_t res, const acf_t x, const gr_ctx_t ctx) +_gr_acf_mul_two(acf_t res, const acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_mul_2exp_si(acf_realref(res), acf_realref(x), 1); arf_mul_2exp_si(acf_imagref(res), acf_imagref(x), 1); @@ -469,7 +475,7 @@ _gr_acf_sqr(acf_t res, const acf_t x, const gr_ctx_t ctx) } int -_gr_acf_mul_2exp_si(acf_t res, const acf_t x, slong y, const gr_ctx_t ctx) +_gr_acf_mul_2exp_si(acf_t res, const acf_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_mul_2exp_si(acf_realref(res), acf_realref(x), y); arf_mul_2exp_si(acf_imagref(res), acf_imagref(x), y); @@ -477,7 +483,7 @@ _gr_acf_mul_2exp_si(acf_t res, const acf_t x, slong y, const gr_ctx_t ctx) } int -_gr_acf_mul_2exp_fmpz(acf_t res, const acf_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_acf_mul_2exp_fmpz(acf_t res, const acf_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_mul_2exp_fmpz(acf_realref(res), acf_realref(x), y); arf_mul_2exp_fmpz(acf_imagref(res), acf_imagref(x), y); @@ -485,7 +491,7 @@ _gr_acf_mul_2exp_fmpz(acf_t res, const acf_t x, const fmpz_t y, const gr_ctx_t c } int -_gr_acf_set_fmpz_2exp_fmpz(acf_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_acf_set_fmpz_2exp_fmpz(acf_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_set_fmpz_2exp(acf_realref(res), x, y); arf_zero(acf_imagref(res)); @@ -493,7 +499,7 @@ _gr_acf_set_fmpz_2exp_fmpz(acf_t res, const fmpz_t x, const fmpz_t y, const gr_c } int -_gr_acf_get_fmpz_2exp_fmpz(fmpz_t res1, fmpz_t res2, const acf_t x, const gr_ctx_t ctx) +_gr_acf_get_fmpz_2exp_fmpz(fmpz_t res1, fmpz_t res2, const acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!arf_is_zero(acf_imagref(x)) || !arf_is_finite(acf_realref(x))) return GR_DOMAIN; @@ -548,7 +554,7 @@ _gr_acf_sqrt(acf_t res, const acf_t x, const gr_ctx_t ctx) } int -_gr_acf_pos_inf(acf_t res, const gr_ctx_t ctx) +_gr_acf_pos_inf(acf_t res, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_pos_inf(acf_realref(res)); arf_zero(acf_imagref(res)); @@ -556,7 +562,7 @@ _gr_acf_pos_inf(acf_t res, const gr_ctx_t ctx) } int -_gr_acf_neg_inf(acf_t res, const gr_ctx_t ctx) +_gr_acf_neg_inf(acf_t res, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_neg_inf(acf_realref(res)); arf_zero(acf_imagref(res)); @@ -564,7 +570,7 @@ _gr_acf_neg_inf(acf_t res, const gr_ctx_t ctx) } int -_gr_acf_nan(acf_t res, const gr_ctx_t ctx) +_gr_acf_nan(acf_t res, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_nan(acf_realref(res)); arf_nan(acf_imagref(res)); @@ -593,7 +599,7 @@ _gr_acf_abs(acf_t res, const acf_t x, const gr_ctx_t ctx) } int -_gr_acf_conj(acf_t res, const acf_t x, const gr_ctx_t ctx) +_gr_acf_conj(acf_t res, const acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_set(acf_realref(res), acf_realref(x)); arf_neg(acf_imagref(res), acf_imagref(x)); @@ -601,7 +607,7 @@ _gr_acf_conj(acf_t res, const acf_t x, const gr_ctx_t ctx) } int -_gr_acf_re(acf_t res, const acf_t x, const gr_ctx_t ctx) +_gr_acf_re(acf_t res, const acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_set(acf_realref(res), acf_realref(x)); arf_zero(acf_imagref(res)); @@ -610,7 +616,7 @@ _gr_acf_re(acf_t res, const acf_t x, const gr_ctx_t ctx) int -_gr_acf_im(acf_t res, const acf_t x, const gr_ctx_t ctx) +_gr_acf_im(acf_t res, const acf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_set(acf_realref(res), acf_imagref(x)); arf_zero(acf_imagref(res)); @@ -657,7 +663,7 @@ _gr_acf_nint(acf_t res, const acf_t x, const gr_ctx_t ctx) /* todo: handling nan */ int -_gr_acf_cmp(int * res, const acf_t x, const acf_t y, const gr_ctx_t ctx) +_gr_acf_cmp(int * res, const acf_t x, const acf_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!arf_is_zero(acf_imagref(x)) || !arf_is_zero(acf_imagref(y))) return GR_DOMAIN; @@ -881,7 +887,7 @@ _gr_acf_pow(acf_t res, const acf_t x, const acf_t y, const gr_ctx_t ctx) } int -_gr_acf_i(acf_t res, const gr_ctx_t ctx) +_gr_acf_i(acf_t res, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_zero(acf_realref(res)); arf_one(acf_imagref(res)); @@ -1032,7 +1038,7 @@ _gr_acf_poly_mullow(acf_ptr res, } int -_gr_acf_poly_roots_other(gr_vec_t roots, gr_vec_t mult, const gr_poly_t poly, gr_ctx_t other_ctx, int flags, gr_ctx_t ctx) +_gr_acf_poly_roots_other(gr_vec_t roots, gr_vec_t mult, const gr_poly_t poly, gr_ctx_t other_ctx, int FLINT_UNUSED(flags), gr_ctx_t ctx) { if (poly->length == 0) return GR_DOMAIN; @@ -1182,7 +1188,7 @@ _gr_acf_mat_mul(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx) /* todo: port the qr algorithm to generics; test */ int -_gr_acf_mat_diagonalization(gr_vec_t D, gr_mat_t L, gr_mat_t R, const gr_mat_t A, int flags, gr_ctx_t ctx) +_gr_acf_mat_diagonalization(gr_vec_t D, gr_mat_t L, gr_mat_t R, const gr_mat_t A, int FLINT_UNUSED(flags), gr_ctx_t ctx) { int status; slong n, i, j; diff --git a/src/gr/arb.c b/src/gr/arb.c index cb9fb88f58..40e3d61490 100644 --- a/src/gr/arb.c +++ b/src/gr/arb.c @@ -25,6 +25,12 @@ #include "gr_poly.h" #include "nfloat.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + typedef struct { slong prec; @@ -43,7 +49,7 @@ _gr_arb_ ## fname(arb_t res, const arb_t x, const gr_ctx_t ctx) \ #define DEF_FUNC_NOPREC(fname) \ int \ -_gr_arb_ ## fname(arb_t res, const arb_t x, const gr_ctx_t ctx) \ +_gr_arb_ ## fname(arb_t res, const arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) \ { \ arb_ ## fname(res, x); \ return GR_SUCCESS; \ @@ -107,19 +113,19 @@ _gr_arb_ctx_write(gr_stream_t out, gr_ctx_t ctx) } void -_gr_arb_init(arb_t x, const gr_ctx_t ctx) +_gr_arb_init(arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arb_init(x); } void -_gr_arb_clear(arb_t x, const gr_ctx_t ctx) +_gr_arb_clear(arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arb_clear(x); } void -_gr_arb_swap(arb_t x, arb_t y, const gr_ctx_t ctx) +_gr_arb_swap(arb_t x, arb_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { arb_t t; *t = *x; @@ -128,7 +134,7 @@ _gr_arb_swap(arb_t x, arb_t y, const gr_ctx_t ctx) } void -_gr_arb_set_shallow(arb_t res, const arb_t x, const gr_ctx_t ctx) +_gr_arb_set_shallow(arb_t res, const arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } @@ -170,7 +176,7 @@ _gr_arb_write(gr_stream_t out, const arb_t x, const gr_ctx_t ctx) } int -_gr_arb_write_n(gr_stream_t out, gr_srcptr x, slong n, gr_ctx_t ctx) +_gr_arb_write_n(gr_stream_t out, gr_srcptr x, slong n, gr_ctx_t FLINT_UNUSED(ctx)) { n = FLINT_MAX(n, 1); gr_stream_write_free(out, arb_get_str(x, n, ARB_STR_NO_RADIUS)); @@ -178,14 +184,14 @@ _gr_arb_write_n(gr_stream_t out, gr_srcptr x, slong n, gr_ctx_t ctx) } int -_gr_arb_zero(arb_t x, const gr_ctx_t ctx) +_gr_arb_zero(arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arb_zero(x); return GR_SUCCESS; } int -_gr_arb_one(arb_t x, const gr_ctx_t ctx) +_gr_arb_one(arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arb_one(x); return GR_SUCCESS; @@ -340,7 +346,7 @@ _gr_arb_set_other(arb_t res, gr_srcptr x, gr_ctx_t x_ctx, gr_ctx_t ctx) } int -_gr_arb_set_interval_mid_rad(arb_t res, const arb_t m, const arb_t r, const gr_ctx_t ctx) +_gr_arb_set_interval_mid_rad(arb_t res, const arb_t m, const arb_t r, const gr_ctx_t FLINT_UNUSED(ctx)) { mag_t rad; mag_init(rad); @@ -357,7 +363,7 @@ int _gr_arf_get_si(slong * res, const arf_t x, const gr_ctx_t ctx); int _gr_arf_get_ui(ulong * res, const arf_t x, const gr_ctx_t ctx); int -_gr_arb_get_fmpz(fmpz_t res, const arb_t x, const gr_ctx_t ctx) +_gr_arb_get_fmpz(fmpz_t res, const arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!arb_is_int(x)) { @@ -371,7 +377,7 @@ _gr_arb_get_fmpz(fmpz_t res, const arb_t x, const gr_ctx_t ctx) } int -_gr_arb_get_si(slong * res, const arb_t x, const gr_ctx_t ctx) +_gr_arb_get_si(slong * res, const arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!arb_is_int(x)) { @@ -385,7 +391,7 @@ _gr_arb_get_si(slong * res, const arb_t x, const gr_ctx_t ctx) } int -_gr_arb_get_ui(ulong * res, const arb_t x, const gr_ctx_t ctx) +_gr_arb_get_ui(ulong * res, const arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!arb_is_int(x)) { @@ -399,14 +405,14 @@ _gr_arb_get_ui(ulong * res, const arb_t x, const gr_ctx_t ctx) } int -_gr_arb_get_d(double * res, const arb_t x, const gr_ctx_t ctx) +_gr_arb_get_d(double * res, const arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = arf_get_d(arb_midref(x), ARF_RND_NEAR); return GR_SUCCESS; } truth_t -_gr_arb_is_zero(const arb_t x, const gr_ctx_t ctx) +_gr_arb_is_zero(const arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (arb_is_zero(x)) return T_TRUE; @@ -418,7 +424,7 @@ _gr_arb_is_zero(const arb_t x, const gr_ctx_t ctx) } truth_t -_gr_arb_is_one(const arb_t x, const gr_ctx_t ctx) +_gr_arb_is_one(const arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (arb_is_one(x)) return T_TRUE; @@ -433,7 +439,7 @@ _gr_arb_is_one(const arb_t x, const gr_ctx_t ctx) } truth_t -_gr_arb_is_neg_one(const arb_t x, const gr_ctx_t ctx) +_gr_arb_is_neg_one(const arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (arb_equal_si(x, -1)) return T_TRUE; @@ -445,7 +451,7 @@ _gr_arb_is_neg_one(const arb_t x, const gr_ctx_t ctx) } truth_t -_gr_arb_equal(const arb_t x, const arb_t y, const gr_ctx_t ctx) +_gr_arb_equal(const arb_t x, const arb_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (arb_is_exact(x) && arb_equal(x, y)) return T_TRUE; @@ -535,35 +541,35 @@ _gr_arb_mul_fmpz(arb_t res, const arb_t x, const fmpz_t y, const gr_ctx_t ctx) } int -_gr_arb_mul_two(arb_t res, const arb_t x, const gr_ctx_t ctx) +_gr_arb_mul_two(arb_t res, const arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arb_mul_2exp_si(res, x, 1); return GR_SUCCESS; } int -_gr_arb_mul_2exp_si(arb_t res, const arb_t x, slong y, const gr_ctx_t ctx) +_gr_arb_mul_2exp_si(arb_t res, const arb_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { arb_mul_2exp_si(res, x, y); return GR_SUCCESS; } int -_gr_arb_mul_2exp_fmpz(arb_t res, const arb_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_arb_mul_2exp_fmpz(arb_t res, const arb_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { arb_mul_2exp_fmpz(res, x, y); return GR_SUCCESS; } int -_gr_arb_set_fmpz_2exp_fmpz(arb_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_arb_set_fmpz_2exp_fmpz(arb_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { arb_set_fmpz_2exp(res, x, y); return GR_SUCCESS; } int -_gr_arb_get_fmpz_2exp_fmpz(fmpz_t res1, fmpz_t res2, const arb_t x, const gr_ctx_t ctx) +_gr_arb_get_fmpz_2exp_fmpz(fmpz_t res1, fmpz_t res2, const arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!arb_is_exact(x)) return GR_UNABLE; @@ -654,7 +660,7 @@ _gr_arb_div_fmpz(arb_t res, const arb_t x, const fmpz_t y, const gr_ctx_t ctx) } truth_t -_gr_arb_is_invertible(const arb_t x, const gr_ctx_t ctx) +_gr_arb_is_invertible(const arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (arb_is_zero(x)) return T_FALSE; @@ -777,7 +783,7 @@ _gr_arb_pow(arb_t res, const arb_t x, const arb_t exp, const gr_ctx_t ctx) } truth_t -_gr_arb_is_square(const arb_t x, const gr_ctx_t ctx) +_gr_arb_is_square(const arb_t FLINT_UNUSED(x), const gr_ctx_t FLINT_UNUSED(ctx)) { return T_TRUE; } @@ -826,14 +832,14 @@ DEF_FUNC_NOPREC(abs) DEF_FUNC_NOPREC(sgn) int -_gr_arb_conj(arb_t res, const arb_t x, const gr_ctx_t ctx) +_gr_arb_conj(arb_t res, const arb_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arb_set(res, x); return GR_SUCCESS; } int -_gr_arb_im(arb_t res, const arb_t x, const gr_ctx_t ctx) +_gr_arb_im(arb_t res, const arb_t FLINT_UNUSED(x), const gr_ctx_t FLINT_UNUSED(ctx)) { arb_zero(res); return GR_SUCCESS; @@ -863,7 +869,7 @@ _gr_arb_arg(arb_t res, const arb_t x, const gr_ctx_t ctx) } int -_gr_arb_cmp(int * res, const arb_t x, const arb_t y, const gr_ctx_t ctx) +_gr_arb_cmp(int * res, const arb_t x, const arb_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if ((arb_is_exact(x) && arb_is_exact(y)) || !arb_overlaps(x, y)) { @@ -1439,8 +1445,8 @@ int _gr_arb_coulomb(arb_t res1, arb_t res2, arb_t res3, arb_t res4, const arb_t int _gr_arb_coulomb_f(arb_t res, const arb_t x, const arb_t y, const arb_t z, const gr_ctx_t ctx) { arb_hypgeom_coulomb(res, NULL, x, y, z, ARB_CTX_PREC(ctx)); return arb_is_finite(res) ? GR_SUCCESS : GR_UNABLE; } int _gr_arb_coulomb_g(arb_t res, const arb_t x, const arb_t y, const arb_t z, const gr_ctx_t ctx) { arb_hypgeom_coulomb(NULL, res, x, y, z, ARB_CTX_PREC(ctx)); return arb_is_finite(res) ? GR_SUCCESS : GR_UNABLE; } -int _gr_arb_coulomb_hpos(arb_t res, const arb_t x, const arb_t y, const arb_t z, const gr_ctx_t ctx) { return GR_UNABLE; } -int _gr_arb_coulomb_hneg(arb_t res, const arb_t x, const arb_t y, const arb_t z, const gr_ctx_t ctx) { return GR_UNABLE; } +int _gr_arb_coulomb_hpos(arb_t FLINT_UNUSED(res), const arb_t FLINT_UNUSED(x), const arb_t FLINT_UNUSED(y), const arb_t FLINT_UNUSED(z), const gr_ctx_t FLINT_UNUSED(ctx)) { return GR_UNABLE; } +int _gr_arb_coulomb_hneg(arb_t FLINT_UNUSED(res), const arb_t FLINT_UNUSED(x), const arb_t FLINT_UNUSED(y), const arb_t FLINT_UNUSED(z), const gr_ctx_t FLINT_UNUSED(ctx)) { return GR_UNABLE; } int _gr_arb_chebyshev_t(arb_t res, const arb_t n, const arb_t x, const gr_ctx_t ctx) { @@ -1511,7 +1517,7 @@ int _gr_arb_hypgeom_1f1(arb_t res, const arb_t a, const arb_t b, const arb_t x, return arb_is_finite(res) ? GR_SUCCESS : GR_UNABLE; } -int _gr_arb_hypgeom_u(arb_t res, const arb_t a, const arb_t b, const arb_t x, int flags, const gr_ctx_t ctx) +int _gr_arb_hypgeom_u(arb_t res, const arb_t a, const arb_t b, const arb_t x, int FLINT_UNUSED(flags), const gr_ctx_t ctx) { arb_hypgeom_u(res, a, b, x, ARB_CTX_PREC(ctx)); return arb_is_finite(res) ? GR_SUCCESS : GR_UNABLE; diff --git a/src/gr/arf.c b/src/gr/arf.c index babd8199ec..516c8f4f25 100644 --- a/src/gr/arf.c +++ b/src/gr/arf.c @@ -20,6 +20,12 @@ #include "gr_generic.h" #include "nfloat.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + typedef struct { slong prec; @@ -55,19 +61,19 @@ _gr_arf_ctx_write(gr_stream_t out, gr_ctx_t ctx) } void -_gr_arf_init(arf_t x, const gr_ctx_t ctx) +_gr_arf_init(arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_init(x); } void -_gr_arf_clear(arf_t x, const gr_ctx_t ctx) +_gr_arf_clear(arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_clear(x); } void -_gr_arf_swap(arf_t x, arf_t y, const gr_ctx_t ctx) +_gr_arf_swap(arf_t x, arf_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_t t; *t = *x; @@ -76,7 +82,7 @@ _gr_arf_swap(arf_t x, arf_t y, const gr_ctx_t ctx) } void -_gr_arf_set_shallow(arf_t res, const arf_t x, const gr_ctx_t ctx) +_gr_arf_set_shallow(arf_t res, const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } @@ -98,14 +104,14 @@ _gr_arf_write(gr_stream_t out, const arf_t x, const gr_ctx_t ctx) } int -_gr_arf_zero(arf_t x, const gr_ctx_t ctx) +_gr_arf_zero(arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_zero(x); return GR_SUCCESS; } int -_gr_arf_one(arf_t x, const gr_ctx_t ctx) +_gr_arf_one(arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_one(x); return GR_SUCCESS; @@ -140,7 +146,7 @@ _gr_arf_set_fmpq(arf_t res, const fmpq_t v, const gr_ctx_t ctx) } int -_gr_arf_set_d(arf_t res, double x, const gr_ctx_t ctx) +_gr_arf_set_d(arf_t res, double x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_set_d(res, x); return GR_SUCCESS; @@ -148,7 +154,7 @@ _gr_arf_set_d(arf_t res, double x, const gr_ctx_t ctx) /* todo: set_round? */ int -_gr_arf_set(arf_t res, const arf_t x, const gr_ctx_t ctx) +_gr_arf_set(arf_t res, const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_set(res, x); return GR_SUCCESS; @@ -227,7 +233,7 @@ _gr_arf_set_other(arf_t res, gr_srcptr x, gr_ctx_t x_ctx, const gr_ctx_t ctx) } int -_gr_arf_get_fmpz(fmpz_t res, const arf_t x, const gr_ctx_t ctx) +_gr_arf_get_fmpz(fmpz_t res, const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!arf_is_int(x)) return GR_DOMAIN; @@ -241,7 +247,7 @@ _gr_arf_get_fmpz(fmpz_t res, const arf_t x, const gr_ctx_t ctx) } int -_gr_arf_get_si(slong * res, const arf_t x, const gr_ctx_t ctx) +_gr_arf_get_si(slong * res, const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_t t; if (!arf_is_int(x)) @@ -258,7 +264,7 @@ _gr_arf_get_si(slong * res, const arf_t x, const gr_ctx_t ctx) } int -_gr_arf_get_ui(ulong * res, const arf_t x, const gr_ctx_t ctx) +_gr_arf_get_ui(ulong * res, const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_t t; @@ -284,7 +290,7 @@ _gr_arf_get_d(double * res, const arf_t x, const gr_ctx_t ctx) } int -_gr_arf_get_fmpq(fmpq_t res, const arf_t x, const gr_ctx_t ctx) +_gr_arf_get_fmpq(fmpq_t res, const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!arf_is_finite(x)) return GR_DOMAIN; @@ -298,25 +304,25 @@ _gr_arf_get_fmpq(fmpq_t res, const arf_t x, const gr_ctx_t ctx) truth_t -_gr_arf_is_zero(const arf_t x, const gr_ctx_t ctx) +_gr_arf_is_zero(const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return arf_is_zero(x) ? T_TRUE : T_FALSE; } truth_t -_gr_arf_is_one(const arf_t x, const gr_ctx_t ctx) +_gr_arf_is_one(const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return arf_is_one(x) ? T_TRUE : T_FALSE; } truth_t -_gr_arf_is_neg_one(const arf_t x, const gr_ctx_t ctx) +_gr_arf_is_neg_one(const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return arf_equal_si(x, -1) ? T_TRUE : T_FALSE; } truth_t -_gr_arf_equal(const arf_t x, const arf_t y, const gr_ctx_t ctx) +_gr_arf_equal(const arf_t x, const arf_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (arf_is_nan(x) || arf_is_nan(y)) return T_UNKNOWN; @@ -326,7 +332,7 @@ _gr_arf_equal(const arf_t x, const arf_t y, const gr_ctx_t ctx) /* todo: neg_round? */ int -_gr_arf_neg(arf_t res, const arf_t x, const gr_ctx_t ctx) +_gr_arf_neg(arf_t res, const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_neg(res, x); return GR_SUCCESS; @@ -431,7 +437,7 @@ _gr_arf_submul(arf_t res, const arf_t x, const arf_t y, const gr_ctx_t ctx) } int -_gr_arf_mul_two(arf_t res, const arf_t x, const gr_ctx_t ctx) +_gr_arf_mul_two(arf_t res, const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_mul_2exp_si(res, x, 1); return GR_SUCCESS; @@ -445,28 +451,28 @@ _gr_arf_sqr(arf_t res, const arf_t x, const gr_ctx_t ctx) } int -_gr_arf_mul_2exp_si(arf_t res, const arf_t x, slong y, const gr_ctx_t ctx) +_gr_arf_mul_2exp_si(arf_t res, const arf_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_mul_2exp_si(res, x, y); return GR_SUCCESS; } int -_gr_arf_mul_2exp_fmpz(arf_t res, const arf_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_arf_mul_2exp_fmpz(arf_t res, const arf_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_mul_2exp_fmpz(res, x, y); return GR_SUCCESS; } int -_gr_arf_set_fmpz_2exp_fmpz(arf_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_arf_set_fmpz_2exp_fmpz(arf_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_set_fmpz_2exp(res, x, y); return GR_SUCCESS; } int -_gr_arf_get_fmpz_2exp_fmpz(fmpz_t res1, fmpz_t res2, const arf_t x, const gr_ctx_t ctx) +_gr_arf_get_fmpz_2exp_fmpz(fmpz_t res1, fmpz_t res2, const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!arf_is_finite(x)) return GR_DOMAIN; @@ -519,42 +525,42 @@ _gr_arf_sqrt(arf_t res, const arf_t x, const gr_ctx_t ctx) } int -_gr_arf_pos_inf(arf_t res, const gr_ctx_t ctx) +_gr_arf_pos_inf(arf_t res, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_pos_inf(res); return GR_SUCCESS; } int -_gr_arf_neg_inf(arf_t res, const gr_ctx_t ctx) +_gr_arf_neg_inf(arf_t res, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_neg_inf(res); return GR_SUCCESS; } int -_gr_arf_nan(arf_t res, const gr_ctx_t ctx) +_gr_arf_nan(arf_t res, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_nan(res); return GR_SUCCESS; } int -_gr_arf_abs(arf_t res, const arf_t x, const gr_ctx_t ctx) +_gr_arf_abs(arf_t res, const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_abs(res, x); return GR_SUCCESS; } int -_gr_arf_conj(arf_t res, const arf_t x, const gr_ctx_t ctx) +_gr_arf_conj(arf_t res, const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_set(res, x); return GR_SUCCESS; } int -_gr_arf_im(arf_t res, const arf_t x, const gr_ctx_t ctx) +_gr_arf_im(arf_t res, const arf_t FLINT_UNUSED(x), const gr_ctx_t FLINT_UNUSED(ctx)) { arf_zero(res); return GR_SUCCESS; @@ -562,7 +568,7 @@ _gr_arf_im(arf_t res, const arf_t x, const gr_ctx_t ctx) /* todo: sign of nan? */ int -_gr_arf_sgn(arf_t res, const arf_t x, const gr_ctx_t ctx) +_gr_arf_sgn(arf_t res, const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_set_si(res, arf_sgn(x)); return GR_SUCCESS; @@ -576,21 +582,21 @@ _gr_arf_rsqrt(arf_t res, const arf_t x, const gr_ctx_t ctx) } int -_gr_arf_floor(arf_t res, const arf_t x, const gr_ctx_t ctx) +_gr_arf_floor(arf_t res, const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_floor(res, x); return GR_SUCCESS; } int -_gr_arf_ceil(arf_t res, const arf_t x, const gr_ctx_t ctx) +_gr_arf_ceil(arf_t res, const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_ceil(res, x); return GR_SUCCESS; } int -_gr_arf_trunc(arf_t res, const arf_t x, const gr_ctx_t ctx) +_gr_arf_trunc(arf_t res, const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (arf_is_int(x) || arf_is_special(x)) { @@ -609,7 +615,7 @@ _gr_arf_trunc(arf_t res, const arf_t x, const gr_ctx_t ctx) } int -_gr_arf_nint(arf_t res, const arf_t x, const gr_ctx_t ctx) +_gr_arf_nint(arf_t res, const arf_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (arf_is_int(x) || arf_is_special(x)) { @@ -629,14 +635,14 @@ _gr_arf_nint(arf_t res, const arf_t x, const gr_ctx_t ctx) /* todo: handling nan */ int -_gr_arf_cmp(int * res, const arf_t x, const arf_t y, const gr_ctx_t ctx) +_gr_arf_cmp(int * res, const arf_t x, const arf_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = arf_cmp(x, y); return GR_SUCCESS; } int -_gr_arf_cmpabs(int * res, const arf_t x, const arf_t y, const gr_ctx_t ctx) +_gr_arf_cmpabs(int * res, const arf_t x, const arf_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = arf_cmpabs(x, y); return GR_SUCCESS; @@ -1135,7 +1141,7 @@ _gr_arf_poly_mullow(arf_ptr res, /* todo: real-only roots in arb */ int -_gr_arf_poly_roots_other(gr_vec_t roots, gr_vec_t mult, const gr_poly_t poly, gr_ctx_t other_ctx, int flags, gr_ctx_t ctx) +_gr_arf_poly_roots_other(gr_vec_t roots, gr_vec_t mult, const gr_poly_t poly, gr_ctx_t other_ctx, int FLINT_UNUSED(flags), gr_ctx_t ctx) { if (poly->length == 0) return GR_DOMAIN; diff --git a/src/gr/ca.c b/src/gr/ca.c index 1efb1da367..8d9d6ae128 100644 --- a/src/gr/ca.c +++ b/src/gr/ca.c @@ -20,6 +20,12 @@ #include "gr_poly.h" #include "gr_special.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define GR_CA_CTX(ring_ctx) ((ca_ctx_struct *)(GR_CTX_DATA_AS_PTR(ring_ctx))) int @@ -63,7 +69,7 @@ _gr_ca_clear(ca_t x, gr_ctx_t ctx) } void -_gr_ca_swap(ca_t x, ca_t y, gr_ctx_t ctx) +_gr_ca_swap(ca_t x, ca_t y, gr_ctx_t FLINT_UNUSED(ctx)) { ca_t t; *t = *x; @@ -72,7 +78,7 @@ _gr_ca_swap(ca_t x, ca_t y, gr_ctx_t ctx) } void -_gr_ca_set_shallow(ca_t res, const ca_t x, const gr_ctx_t ctx) +_gr_ca_set_shallow(ca_t res, const ca_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } @@ -1484,7 +1490,7 @@ _gr_ca_poly_mullow(ca_ptr res, } int -_gr_ca_poly_roots(gr_vec_t roots, gr_vec_t mult, const gr_poly_t poly, int flags, gr_ctx_t ctx) +_gr_ca_poly_roots(gr_vec_t roots, gr_vec_t mult, const gr_poly_t poly, int FLINT_UNUSED(flags), gr_ctx_t ctx) { int status = GR_SUCCESS; ca_vec_t ca_roots; diff --git a/src/gr/dirichlet.c b/src/gr/dirichlet.c index 73a0aec0e8..6d67812208 100644 --- a/src/gr/dirichlet.c +++ b/src/gr/dirichlet.c @@ -12,6 +12,13 @@ #include "fmpz.h" #include "dirichlet.h" #include "gr.h" +#include "gr_generic.h" + +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif #define DIRICHLET_CTX(ctx) ((dirichlet_group_struct *) (GR_CTX_DATA_AS_PTR(ctx))) @@ -41,14 +48,14 @@ _gr_dirichlet_init(dirichlet_char_t res, gr_ctx_t ctx) } int -_gr_dirichlet_clear(dirichlet_char_t res, gr_ctx_t ctx) +_gr_dirichlet_clear(dirichlet_char_t res, gr_ctx_t FLINT_UNUSED(ctx)) { dirichlet_char_clear(res); return GR_SUCCESS; } void -_gr_dirichlet_swap(dirichlet_char_t x, dirichlet_char_t y, gr_ctx_t ctx) +_gr_dirichlet_swap(dirichlet_char_t x, dirichlet_char_t y, gr_ctx_t FLINT_UNUSED(ctx)) { dirichlet_char_struct t = *x; *x = *y; @@ -144,7 +151,7 @@ _gr_dirichlet_pow_ui(dirichlet_char_t res, const dirichlet_char_t x, ulong exp, void _dirichlet_char_pow_fmpz(dirichlet_char_t c, const dirichlet_group_t G, const dirichlet_char_t a, const fmpz_t n) { - ulong k; + slong k; ulong nred; for (k = 0; k < G->num ; k++) diff --git a/src/gr/fexpr.c b/src/gr/fexpr.c index c2ed3381af..7bfdf9a5b0 100644 --- a/src/gr/fexpr.c +++ b/src/gr/fexpr.c @@ -12,28 +12,35 @@ #include "fexpr.h" #include "fexpr_builtin.h" #include "gr.h" +#include "gr_generic.h" + +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif int -_gr_fexpr_ctx_write(gr_stream_t out, gr_ctx_t ctx) +_gr_fexpr_ctx_write(gr_stream_t out, gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write(out, "Symbolic expressions (fexpr)"); return GR_SUCCESS; } void -_gr_fexpr_init(fexpr_t x, const gr_ctx_t ctx) +_gr_fexpr_init(fexpr_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_init(x); } void -_gr_fexpr_clear(fexpr_t x, const gr_ctx_t ctx) +_gr_fexpr_clear(fexpr_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_clear(x); } void -_gr_fexpr_swap(fexpr_t x, fexpr_t y, const gr_ctx_t ctx) +_gr_fexpr_swap(fexpr_t x, fexpr_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_t t; *t = *x; @@ -42,90 +49,90 @@ _gr_fexpr_swap(fexpr_t x, fexpr_t y, const gr_ctx_t ctx) } void -_gr_fexpr_set_shallow(fexpr_t res, const fexpr_t x, const gr_ctx_t ctx) +_gr_fexpr_set_shallow(fexpr_t res, const fexpr_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } /* todo */ int -_gr_fexpr_randtest(fexpr_t res, flint_rand_t state, const gr_ctx_t ctx) +_gr_fexpr_randtest(fexpr_t res, flint_rand_t state, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_set_si(res, -5 + (slong) n_randint(state, 10)); return GR_SUCCESS; } int -_gr_fexpr_write(gr_stream_t out, const fexpr_t x, const gr_ctx_t ctx) +_gr_fexpr_write(gr_stream_t out, const fexpr_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write_free(out, fexpr_get_str(x)); return GR_SUCCESS; } int -_gr_fexpr_zero(fexpr_t x, const gr_ctx_t ctx) +_gr_fexpr_zero(fexpr_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_zero(x); return GR_SUCCESS; } int -_gr_fexpr_one(fexpr_t x, const gr_ctx_t ctx) +_gr_fexpr_one(fexpr_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_set_si(x, 1); return GR_SUCCESS; } int -_gr_fexpr_set_si(fexpr_t res, slong v, const gr_ctx_t ctx) +_gr_fexpr_set_si(fexpr_t res, slong v, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_set_si(res, v); return GR_SUCCESS; } int -_gr_fexpr_set_ui(fexpr_t res, ulong v, const gr_ctx_t ctx) +_gr_fexpr_set_ui(fexpr_t res, ulong v, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_set_ui(res, v); return GR_SUCCESS; } int -_gr_fexpr_set_fmpz(fexpr_t res, const fmpz_t v, const gr_ctx_t ctx) +_gr_fexpr_set_fmpz(fexpr_t res, const fmpz_t v, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_set_fmpz(res, v); return GR_SUCCESS; } int -_gr_fexpr_set_fmpq(fexpr_t res, const fmpq_t v, const gr_ctx_t ctx) +_gr_fexpr_set_fmpq(fexpr_t res, const fmpq_t v, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_set_fmpq(res, v); return GR_SUCCESS; } int -_gr_fexpr_set_other(fexpr_t res, gr_srcptr x, gr_ctx_t x_ctx, const gr_ctx_t ctx) +_gr_fexpr_set_other(fexpr_t res, gr_srcptr x, gr_ctx_t x_ctx, const gr_ctx_t FLINT_UNUSED(ctx)) { return gr_get_fexpr(res, x, x_ctx); } int -_gr_fexpr_set(fexpr_t res, const fexpr_t x, const gr_ctx_t ctx) +_gr_fexpr_set(fexpr_t res, const fexpr_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_set(res, x); return GR_SUCCESS; } int -_gr_fexpr_set_d(fexpr_t res, double x, const gr_ctx_t ctx) +_gr_fexpr_set_d(fexpr_t res, double x, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_set_d(res, x); return GR_SUCCESS; } int -_gr_fexpr_get_fmpz(fmpz_t res, const fexpr_t x, const gr_ctx_t ctx) +_gr_fexpr_get_fmpz(fmpz_t res, const fexpr_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fexpr_get_fmpz(res, x)) return GR_SUCCESS; @@ -134,59 +141,59 @@ _gr_fexpr_get_fmpz(fmpz_t res, const fexpr_t x, const gr_ctx_t ctx) } truth_t -_gr_fexpr_is_zero(const fexpr_t x, const gr_ctx_t ctx) +_gr_fexpr_is_zero(const fexpr_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fexpr_is_zero(x) ? T_TRUE : T_FALSE; } truth_t -_gr_fexpr_is_one(const fexpr_t x, const gr_ctx_t ctx) +_gr_fexpr_is_one(const fexpr_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fexpr_equal_ui(x, 1) ? T_TRUE : T_FALSE; } truth_t -_gr_fexpr_is_neg_one(const fexpr_t x, const gr_ctx_t ctx) +_gr_fexpr_is_neg_one(const fexpr_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fexpr_equal_si(x, -1) ? T_TRUE : T_FALSE; } truth_t -_gr_fexpr_equal(const fexpr_t x, const fexpr_t y, const gr_ctx_t ctx) +_gr_fexpr_equal(const fexpr_t x, const fexpr_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { return fexpr_equal(x, y) ? T_TRUE : T_FALSE; } int -_gr_fexpr_neg(fexpr_t res, const fexpr_t x, const gr_ctx_t ctx) +_gr_fexpr_neg(fexpr_t res, const fexpr_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_neg(res, x); return GR_SUCCESS; } int -_gr_fexpr_add(fexpr_t res, const fexpr_t x, const fexpr_t y, const gr_ctx_t ctx) +_gr_fexpr_add(fexpr_t res, const fexpr_t x, const fexpr_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_add(res, x, y); return GR_SUCCESS; } int -_gr_fexpr_sub(fexpr_t res, const fexpr_t x, const fexpr_t y, const gr_ctx_t ctx) +_gr_fexpr_sub(fexpr_t res, const fexpr_t x, const fexpr_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_sub(res, x, y); return GR_SUCCESS; } int -_gr_fexpr_mul(fexpr_t res, const fexpr_t x, const fexpr_t y, const gr_ctx_t ctx) +_gr_fexpr_mul(fexpr_t res, const fexpr_t x, const fexpr_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_mul(res, x, y); return GR_SUCCESS; } int -_gr_fexpr_inv(fexpr_t res, const fexpr_t x, const gr_ctx_t ctx) +_gr_fexpr_inv(fexpr_t res, const fexpr_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_t b; fexpr_init(b); @@ -197,21 +204,21 @@ _gr_fexpr_inv(fexpr_t res, const fexpr_t x, const gr_ctx_t ctx) } int -_gr_fexpr_div(fexpr_t res, const fexpr_t x, const fexpr_t y, const gr_ctx_t ctx) +_gr_fexpr_div(fexpr_t res, const fexpr_t x, const fexpr_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_div(res, x, y); return GR_SUCCESS; } int -_gr_fexpr_pow(fexpr_t res, const fexpr_t x, const fexpr_t y, const gr_ctx_t ctx) +_gr_fexpr_pow(fexpr_t res, const fexpr_t x, const fexpr_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_pow(res, x, y); return GR_SUCCESS; } int -_gr_fexpr_pow_ui(fexpr_t res, const fexpr_t x, ulong exp, const gr_ctx_t ctx) +_gr_fexpr_pow_ui(fexpr_t res, const fexpr_t x, ulong exp, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_t b; fexpr_init(b); @@ -222,7 +229,7 @@ _gr_fexpr_pow_ui(fexpr_t res, const fexpr_t x, ulong exp, const gr_ctx_t ctx) } int -_gr_fexpr_pow_si(fexpr_t res, const fexpr_t x, slong exp, const gr_ctx_t ctx) +_gr_fexpr_pow_si(fexpr_t res, const fexpr_t x, slong exp, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_t b; fexpr_init(b); @@ -233,7 +240,7 @@ _gr_fexpr_pow_si(fexpr_t res, const fexpr_t x, slong exp, const gr_ctx_t ctx) } int -_gr_fexpr_pow_fmpz(fexpr_t res, const fexpr_t x, const fmpz_t exp, const gr_ctx_t ctx) +_gr_fexpr_pow_fmpz(fexpr_t res, const fexpr_t x, const fmpz_t exp, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_t b; fexpr_init(b); @@ -244,7 +251,7 @@ _gr_fexpr_pow_fmpz(fexpr_t res, const fexpr_t x, const fmpz_t exp, const gr_ctx_ } int -_gr_fexpr_pow_fmpq(fexpr_t res, const fexpr_t x, const fmpq_t exp, const gr_ctx_t ctx) +_gr_fexpr_pow_fmpq(fexpr_t res, const fexpr_t x, const fmpq_t exp, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_t b; fexpr_init(b); @@ -255,14 +262,14 @@ _gr_fexpr_pow_fmpq(fexpr_t res, const fexpr_t x, const fmpq_t exp, const gr_ctx_ } int -_gr_fexpr_pi(fexpr_t res, const gr_ctx_t ctx) +_gr_fexpr_pi(fexpr_t res, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_set_symbol_builtin(res, FEXPR_Pi); return GR_SUCCESS; } int -_gr_fexpr_i(fexpr_t res, const gr_ctx_t ctx) +_gr_fexpr_i(fexpr_t res, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_set_symbol_builtin(res, FEXPR_NumberI); return GR_SUCCESS; diff --git a/src/gr/fmpq.c b/src/gr/fmpq.c index d54fa99b42..909ad856b8 100644 --- a/src/gr/fmpq.c +++ b/src/gr/fmpq.c @@ -24,27 +24,33 @@ #include "gr_vec.h" #include "gr_poly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + int -_gr_fmpq_ctx_write(gr_stream_t out, gr_ctx_t ctx) +_gr_fmpq_ctx_write(gr_stream_t out, gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write(out, "Rational field (fmpq)"); return GR_SUCCESS; } void -_gr_fmpq_init(fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_init(fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_init(x); } void -_gr_fmpq_clear(fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_clear(fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_clear(x); } void -_gr_fmpq_swap(fmpq_t x, fmpq_t y, const gr_ctx_t ctx) +_gr_fmpq_swap(fmpq_t x, fmpq_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_t t; *t = *x; @@ -53,14 +59,14 @@ _gr_fmpq_swap(fmpq_t x, fmpq_t y, const gr_ctx_t ctx) } void -_gr_fmpq_set_shallow(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_set_shallow(fmpq_t res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } /* todo: limits */ int -_gr_fmpq_randtest(fmpq_t res, flint_rand_t state, const gr_ctx_t ctx) +_gr_fmpq_randtest(fmpq_t res, flint_rand_t state, const gr_ctx_t FLINT_UNUSED(ctx)) { switch (n_randint(state, 4)) { @@ -75,7 +81,7 @@ _gr_fmpq_randtest(fmpq_t res, flint_rand_t state, const gr_ctx_t ctx) } int -_gr_fmpq_write(gr_stream_t out, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_write(gr_stream_t out, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write_fmpz(out, fmpq_numref(x)); @@ -89,35 +95,35 @@ _gr_fmpq_write(gr_stream_t out, const fmpq_t x, const gr_ctx_t ctx) } int -_gr_fmpq_zero(fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_zero(fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_zero(x); return GR_SUCCESS; } int -_gr_fmpq_one(fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_one(fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_one(x); return GR_SUCCESS; } int -_gr_fmpq_set_si(fmpq_t res, slong v, const gr_ctx_t ctx) +_gr_fmpq_set_si(fmpq_t res, slong v, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_set_si(res, v, 1); return GR_SUCCESS; } int -_gr_fmpq_set_ui(fmpq_t res, ulong v, const gr_ctx_t ctx) +_gr_fmpq_set_ui(fmpq_t res, ulong v, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_set_ui(res, v, 1); return GR_SUCCESS; } int -_gr_fmpq_set_fmpz(fmpq_t res, const fmpz_t v, const gr_ctx_t ctx) +_gr_fmpq_set_fmpz(fmpq_t res, const fmpz_t v, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set(fmpq_numref(res), v); fmpz_one(fmpq_denref(res)); @@ -127,7 +133,7 @@ _gr_fmpq_set_fmpz(fmpq_t res, const fmpz_t v, const gr_ctx_t ctx) #include "arf.h" int -_gr_fmpq_set_d(fmpq_t res, double x, const gr_ctx_t ctx) +_gr_fmpq_set_d(fmpq_t res, double x, const gr_ctx_t FLINT_UNUSED(ctx)) { arf_t t; @@ -173,7 +179,7 @@ _gr_fmpq_set_other(fmpq_t res, gr_srcptr x, gr_ctx_t x_ctx, gr_ctx_t ctx) } int -_gr_fmpq_get_ui(ulong * res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_get_ui(ulong * res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!fmpz_is_one(fmpq_denref(x))) return GR_DOMAIN; @@ -186,7 +192,7 @@ _gr_fmpq_get_ui(ulong * res, const fmpq_t x, const gr_ctx_t ctx) } int -_gr_fmpq_get_si(slong * res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_get_si(slong * res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!fmpz_is_one(fmpq_denref(x))) return GR_DOMAIN; @@ -199,7 +205,7 @@ _gr_fmpq_get_si(slong * res, const fmpq_t x, const gr_ctx_t ctx) } int -_gr_fmpq_get_fmpz(fmpz_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_get_fmpz(fmpz_t res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!fmpz_is_one(fmpq_denref(x))) return GR_DOMAIN; @@ -209,101 +215,101 @@ _gr_fmpq_get_fmpz(fmpz_t res, const fmpq_t x, const gr_ctx_t ctx) } int -_gr_fmpq_get_d(double * res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_get_d(double * res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = fmpq_get_d(x); return GR_SUCCESS; } int -_gr_fmpq_get_fexpr(fexpr_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_get_fexpr(fexpr_t res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_set_fmpq(res, x); return GR_SUCCESS; } truth_t -_gr_fmpq_is_zero(const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_is_zero(const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpq_is_zero(x) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpq_is_one(const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_is_one(const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpq_is_one(x) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpq_is_neg_one(const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_is_neg_one(const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return ((*fmpq_numref(x) == -1) && fmpz_is_one(fmpq_denref(x))) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpq_equal(const fmpq_t x, const fmpq_t y, const gr_ctx_t ctx) +_gr_fmpq_equal(const fmpq_t x, const fmpq_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpq_equal(x, y) ? T_TRUE : T_FALSE; } int -_gr_fmpq_set(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_set(fmpq_t res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_set(res, x); return GR_SUCCESS; } int -_gr_fmpq_neg(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_neg(fmpq_t res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_neg(res, x); return GR_SUCCESS; } int -_gr_fmpq_add(fmpq_t res, const fmpq_t x, const fmpq_t y, const gr_ctx_t ctx) +_gr_fmpq_add(fmpq_t res, const fmpq_t x, const fmpq_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_add(res, x, y); return GR_SUCCESS; } int -_gr_fmpq_add_si(fmpq_t res, const fmpq_t x, slong y, const gr_ctx_t ctx) +_gr_fmpq_add_si(fmpq_t res, const fmpq_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_add_si(res, x, y); return GR_SUCCESS; } int -_gr_fmpq_add_ui(fmpq_t res, const fmpq_t x, ulong y, const gr_ctx_t ctx) +_gr_fmpq_add_ui(fmpq_t res, const fmpq_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_add_ui(res, x, y); return GR_SUCCESS; } int -_gr_fmpq_sub(fmpq_t res, const fmpq_t x, const fmpq_t y, const gr_ctx_t ctx) +_gr_fmpq_sub(fmpq_t res, const fmpq_t x, const fmpq_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_sub(res, x, y); return GR_SUCCESS; } int -_gr_fmpq_mul(fmpq_t res, const fmpq_t x, const fmpq_t y, const gr_ctx_t ctx) +_gr_fmpq_mul(fmpq_t res, const fmpq_t x, const fmpq_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_mul(res, x, y); return GR_SUCCESS; } int -_gr_fmpq_mul_si(fmpq_t res, const fmpq_t x, slong y, const gr_ctx_t ctx) +_gr_fmpq_mul_si(fmpq_t res, const fmpq_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_mul_si(res, x, y); return GR_SUCCESS; } int -_gr_fmpq_inv(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_inv(fmpq_t res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpq_is_zero(x)) { @@ -317,7 +323,7 @@ _gr_fmpq_inv(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) } int -_gr_fmpq_div(fmpq_t res, const fmpq_t x, const fmpq_t y, const gr_ctx_t ctx) +_gr_fmpq_div(fmpq_t res, const fmpq_t x, const fmpq_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpq_is_zero(y)) { @@ -331,20 +337,20 @@ _gr_fmpq_div(fmpq_t res, const fmpq_t x, const fmpq_t y, const gr_ctx_t ctx) } truth_t -_gr_fmpq_is_invertible(const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_is_invertible(const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return (!fmpq_is_zero(x)) ? T_TRUE : T_FALSE; } int -_gr_fmpq_pow_ui(fmpq_t res, const fmpq_t x, ulong exp, const gr_ctx_t ctx) +_gr_fmpq_pow_ui(fmpq_t res, const fmpq_t x, ulong exp, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_pow_si(res, x, exp); return GR_SUCCESS; } int -_gr_fmpq_pow_si(fmpq_t res, const fmpq_t x, slong exp, const gr_ctx_t ctx) +_gr_fmpq_pow_si(fmpq_t res, const fmpq_t x, slong exp, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpq_is_one(x)) { @@ -465,13 +471,13 @@ _gr_fmpq_pow_fmpq(fmpq_t res, const fmpq_t x, const fmpq_t exp, const gr_ctx_t c truth_t -_gr_fmpq_is_square(const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_is_square(const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return (fmpz_is_square(fmpq_numref(x)) && fmpz_is_square(fmpq_denref(x))) ? T_TRUE : T_FALSE; } int -_gr_fmpq_sqrt(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_sqrt(fmpq_t res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpq_sgn(x) < 0) return GR_DOMAIN; @@ -489,7 +495,7 @@ _gr_fmpq_sqrt(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) } int -_gr_fmpq_rsqrt(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_rsqrt(fmpq_t res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpq_sgn(x) <= 0) return GR_DOMAIN; @@ -506,7 +512,7 @@ _gr_fmpq_rsqrt(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) } } -int _gr_fmpq_factor(gr_ptr c, gr_vec_t factors, gr_vec_t exponents, const fmpq_t x, int flags, gr_ctx_t ctx) +int _gr_fmpq_factor(gr_ptr c, gr_vec_t factors, gr_vec_t exponents, const fmpq_t x, int FLINT_UNUSED(flags), gr_ctx_t ctx) { fmpz_factor_t nfac, dfac; slong i, n, num_num, num_den; @@ -553,7 +559,7 @@ int _gr_fmpq_factor(gr_ptr c, gr_vec_t factors, gr_vec_t exponents, const fmpq_t } int -_gr_fmpq_numerator(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_numerator(fmpq_t res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set(fmpq_numref(res), fmpq_numref(x)); fmpz_one(fmpq_denref(res)); @@ -561,7 +567,7 @@ _gr_fmpq_numerator(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) } int -_gr_fmpq_denominator(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_denominator(fmpq_t res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set(fmpq_numref(res), fmpq_denref(x)); fmpz_one(fmpq_denref(res)); @@ -569,7 +575,7 @@ _gr_fmpq_denominator(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) } int -_gr_fmpq_floor(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_floor(fmpq_t res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_fdiv_q(fmpq_numref(res), fmpq_numref(x), fmpq_denref(x)); fmpz_one(fmpq_denref(res)); @@ -577,7 +583,7 @@ _gr_fmpq_floor(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) } int -_gr_fmpq_ceil(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_ceil(fmpq_t res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_cdiv_q(fmpq_numref(res), fmpq_numref(x), fmpq_denref(x)); fmpz_one(fmpq_denref(res)); @@ -585,7 +591,7 @@ _gr_fmpq_ceil(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) } int -_gr_fmpq_trunc(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_trunc(fmpq_t res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_tdiv_q(fmpq_numref(res), fmpq_numref(x), fmpq_denref(x)); fmpz_one(fmpq_denref(res)); @@ -593,7 +599,7 @@ _gr_fmpq_trunc(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) } int -_gr_fmpq_nint(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_nint(fmpq_t res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_is_one(fmpq_denref(x))) { @@ -618,28 +624,28 @@ _gr_fmpq_nint(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) } int -_gr_fmpq_abs(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_abs(fmpq_t res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_abs(res, x); return GR_SUCCESS; } int -_gr_fmpq_im(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_im(fmpq_t res, const fmpq_t FLINT_UNUSED(x), const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_zero(res); return GR_SUCCESS; } int -_gr_fmpq_sgn(fmpq_t res, const fmpq_t x, const gr_ctx_t ctx) +_gr_fmpq_sgn(fmpq_t res, const fmpq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_set_si(res, fmpq_sgn(x), 1); return GR_SUCCESS; } int -_gr_fmpq_cmp(int * res, const fmpq_t x, const fmpq_t y, const gr_ctx_t ctx) +_gr_fmpq_cmp(int * res, const fmpq_t x, const fmpq_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { int cmp = fmpq_cmp(x, y); @@ -651,7 +657,7 @@ _gr_fmpq_cmp(int * res, const fmpq_t x, const fmpq_t y, const gr_ctx_t ctx) /* todo: fast flint code */ int -_gr_fmpq_cmpabs(int * res, const fmpq_t x, const fmpq_t y, const gr_ctx_t ctx) +_gr_fmpq_cmpabs(int * res, const fmpq_t x, const fmpq_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_t t, u; int cmp; @@ -674,7 +680,7 @@ _gr_fmpq_cmpabs(int * res, const fmpq_t x, const fmpq_t y, const gr_ctx_t ctx) } int -_gr_fmpq_vec_is_zero(const fmpq * vec, slong len, gr_ctx_t ctx) +_gr_fmpq_vec_is_zero(const fmpq * vec, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { slong i; @@ -686,7 +692,7 @@ _gr_fmpq_vec_is_zero(const fmpq * vec, slong len, gr_ctx_t ctx) } int -_gr_fmpq_vec_equal(const fmpq * vec1, const fmpq * vec2, slong len, gr_ctx_t ctx) +_gr_fmpq_vec_equal(const fmpq * vec1, const fmpq * vec2, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { slong i; @@ -837,7 +843,7 @@ _fmpq_vec_set_fmpz_vec_div_fmpz(fmpq * res, const fmpz * v, const fmpz_t den, sl int _gr_fmpq_poly_mullow(fmpq * res, const fmpq * poly1, slong len1, - const fmpq * poly2, slong len2, slong n, gr_ctx_t ctx) + const fmpq * poly2, slong len2, slong n, gr_ctx_t FLINT_UNUSED(ctx)) { fmpz *z1, *z2, *z3; fmpz_t den1, den2; @@ -1001,14 +1007,14 @@ _gr_fmpq_poly_roots_other(gr_vec_t roots, gr_vec_t mult, const gr_poly_t poly, g } int -_gr_fmpq_mat_mul(fmpq_mat_t res, const fmpq_mat_t x, const fmpq_mat_t y, gr_ctx_t ctx) +_gr_fmpq_mat_mul(fmpq_mat_t res, const fmpq_mat_t x, const fmpq_mat_t y, gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_mat_mul(res, x, y); return GR_SUCCESS; } int -_gr_fmpq_mat_det(fmpq_t res, const fmpq_mat_t x, const gr_ctx_t ctx) +_gr_fmpq_mat_det(fmpq_t res, const fmpq_mat_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_mat_det(res, x); return GR_SUCCESS; diff --git a/src/gr/fmpq_poly.c b/src/gr/fmpq_poly.c index 62ba77aec9..556b311218 100644 --- a/src/gr/fmpq_poly.c +++ b/src/gr/fmpq_poly.c @@ -20,6 +20,12 @@ #include "gr_vec.h" #include "gr_generic.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define FMPQ_POLY_CTX(ctx) POLYNOMIAL_CTX(ctx) #define FMPQ_POLY_CTX_VAR(ctx) (FMPQ_POLY_CTX(ctx)->var) @@ -52,26 +58,26 @@ int _gr_fmpq_poly_ctx_set_gen_names(gr_ctx_t ctx, const char ** s) int -_gr_fmpq_poly_ctx_write(gr_stream_t out, gr_ctx_t ctx) +_gr_fmpq_poly_ctx_write(gr_stream_t out, gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write(out, "Polynomials over rationals (fmpq_poly)"); return GR_SUCCESS; } void -_gr_fmpq_poly_init(fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_init(fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_init(x); } void -_gr_fmpq_poly_clear(fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_clear(fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_clear(x); } void -_gr_fmpq_poly_swap(fmpq_poly_t x, fmpq_poly_t y, const gr_ctx_t ctx) +_gr_fmpq_poly_swap(fmpq_poly_t x, fmpq_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_t t; *t = *x; @@ -80,14 +86,14 @@ _gr_fmpq_poly_swap(fmpq_poly_t x, fmpq_poly_t y, const gr_ctx_t ctx) } void -_gr_fmpq_poly_set_shallow(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_set_shallow(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } /* todo: limits */ int -_gr_fmpq_poly_randtest(fmpq_poly_t res, flint_rand_t state, const gr_ctx_t ctx) +_gr_fmpq_poly_randtest(fmpq_poly_t res, flint_rand_t state, const gr_ctx_t FLINT_UNUSED(ctx)) { if (n_randint(state, 10) == 0) fmpq_poly_randtest(res, state, 4, 100); @@ -105,21 +111,21 @@ _gr_fmpq_poly_write(gr_stream_t out, const fmpq_poly_t x, const gr_ctx_t ctx) } int -_gr_fmpq_poly_zero(fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_zero(fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_zero(x); return GR_SUCCESS; } int -_gr_fmpq_poly_one(fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_one(fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_one(x); return GR_SUCCESS; } int -_gr_fmpq_poly_gen(fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_gen(fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_zero(x); fmpq_poly_set_coeff_ui(x, 1, 1); @@ -127,28 +133,28 @@ _gr_fmpq_poly_gen(fmpq_poly_t x, const gr_ctx_t ctx) } int -_gr_fmpq_poly_set_si(fmpq_poly_t res, slong v, const gr_ctx_t ctx) +_gr_fmpq_poly_set_si(fmpq_poly_t res, slong v, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_set_si(res, v); return GR_SUCCESS; } int -_gr_fmpq_poly_set_ui(fmpq_poly_t res, ulong v, const gr_ctx_t ctx) +_gr_fmpq_poly_set_ui(fmpq_poly_t res, ulong v, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_set_ui(res, v); return GR_SUCCESS; } int -_gr_fmpq_poly_set_fmpz(fmpq_poly_t res, const fmpz_t v, const gr_ctx_t ctx) +_gr_fmpq_poly_set_fmpz(fmpq_poly_t res, const fmpz_t v, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_set_fmpz(res, v); return GR_SUCCESS; } int -_gr_fmpq_poly_set_other(fmpq_poly_t res, gr_srcptr x, gr_ctx_t x_ctx, const gr_ctx_t ctx) +_gr_fmpq_poly_set_other(fmpq_poly_t res, gr_srcptr x, gr_ctx_t x_ctx, const gr_ctx_t FLINT_UNUSED(ctx)) { if (x_ctx->which_ring == GR_CTX_FMPZ) { @@ -235,7 +241,7 @@ _gr_fmpq_poly_set_other(fmpq_poly_t res, gr_srcptr x, gr_ctx_t x_ctx, const gr_c } int -_gr_fmpq_poly_get_ui(ulong * res, const fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_get_ui(ulong * res, const fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpq_poly_length(x) == 0) { @@ -260,7 +266,7 @@ _gr_fmpq_poly_get_ui(ulong * res, const fmpq_poly_t x, const gr_ctx_t ctx) } int -_gr_fmpq_poly_get_si(slong * res, const fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_get_si(slong * res, const fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpq_poly_length(x) == 0) { @@ -285,7 +291,7 @@ _gr_fmpq_poly_get_si(slong * res, const fmpq_poly_t x, const gr_ctx_t ctx) } int -_gr_fmpq_poly_get_fmpz(fmpz_t res, const fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_get_fmpz(fmpz_t res, const fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpq_poly_length(x) == 0) { @@ -303,7 +309,7 @@ _gr_fmpq_poly_get_fmpz(fmpz_t res, const fmpq_poly_t x, const gr_ctx_t ctx) } int -_gr_fmpq_poly_get_fmpq(fmpq_t res, const fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_get_fmpq(fmpq_t res, const fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpq_poly_length(x) == 0) { @@ -323,87 +329,87 @@ _gr_fmpq_poly_get_fmpq(fmpq_t res, const fmpq_poly_t x, const gr_ctx_t ctx) truth_t -_gr_fmpq_poly_is_zero(const fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_is_zero(const fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpq_poly_is_zero(x) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpq_poly_is_one(const fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_is_one(const fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpq_poly_is_one(x) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpq_poly_is_neg_one(const fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_is_neg_one(const fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return (x->length == 1 && x->coeffs[0] == -1 && fmpz_is_one(x->den)) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpq_poly_equal(const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t ctx) +_gr_fmpq_poly_equal(const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpq_poly_equal(x, y) ? T_TRUE : T_FALSE; } int -_gr_fmpq_poly_set(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_set(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_set(res, x); return GR_SUCCESS; } int -_gr_fmpq_poly_neg(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_neg(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_neg(res, x); return GR_SUCCESS; } int -_gr_fmpq_poly_add(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t ctx) +_gr_fmpq_poly_add(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_add(res, x, y); return GR_SUCCESS; } int -_gr_fmpq_poly_sub(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t ctx) +_gr_fmpq_poly_sub(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_sub(res, x, y); return GR_SUCCESS; } int -_gr_fmpq_poly_mul(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t ctx) +_gr_fmpq_poly_mul(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_mul(res, x, y); return GR_SUCCESS; } int -_gr_fmpq_poly_mul_ui(fmpq_poly_t res, const fmpq_poly_t x, ulong y, const gr_ctx_t ctx) +_gr_fmpq_poly_mul_ui(fmpq_poly_t res, const fmpq_poly_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_scalar_mul_ui(res, x, y); return GR_SUCCESS; } int -_gr_fmpq_poly_mul_si(fmpq_poly_t res, const fmpq_poly_t x, slong y, const gr_ctx_t ctx) +_gr_fmpq_poly_mul_si(fmpq_poly_t res, const fmpq_poly_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_scalar_mul_si(res, x, y); return GR_SUCCESS; } int -_gr_fmpq_poly_mul_fmpz(fmpq_poly_t res, const fmpq_poly_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpq_poly_mul_fmpz(fmpq_poly_t res, const fmpq_poly_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_scalar_mul_fmpz(res, x, y); return GR_SUCCESS; } int -_gr_fmpq_poly_mul_two(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_mul_two(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { /* fmpq_poly_scalar_mul_2exp(res, x, 1); */ fmpq_poly_scalar_mul_ui(res, x, 2); @@ -411,14 +417,14 @@ _gr_fmpq_poly_mul_two(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t ctx) } int -_gr_fmpq_poly_sqr(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_sqr(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_mul(res, x, x); return GR_SUCCESS; } int -_gr_fmpq_poly_inv(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_inv(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (x->length == 1) { @@ -432,7 +438,7 @@ _gr_fmpq_poly_inv(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t ctx) } int -_gr_fmpq_poly_div(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t ctx) +_gr_fmpq_poly_div(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpq_poly_is_zero(y)) { @@ -448,7 +454,7 @@ _gr_fmpq_poly_div(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, con } int -_gr_fmpq_poly_divexact(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t ctx) +_gr_fmpq_poly_divexact(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpq_poly_is_zero(y)) { @@ -462,7 +468,7 @@ _gr_fmpq_poly_divexact(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y } int -_gr_fmpq_poly_divexact_ui(fmpq_poly_t res, const fmpq_poly_t x, ulong y, const gr_ctx_t ctx) +_gr_fmpq_poly_divexact_ui(fmpq_poly_t res, const fmpq_poly_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (y == 0) { @@ -476,7 +482,7 @@ _gr_fmpq_poly_divexact_ui(fmpq_poly_t res, const fmpq_poly_t x, ulong y, const g } int -_gr_fmpq_poly_divexact_si(fmpq_poly_t res, const fmpq_poly_t x, slong y, const gr_ctx_t ctx) +_gr_fmpq_poly_divexact_si(fmpq_poly_t res, const fmpq_poly_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (y == 0) { @@ -490,7 +496,7 @@ _gr_fmpq_poly_divexact_si(fmpq_poly_t res, const fmpq_poly_t x, slong y, const g } int -_gr_fmpq_poly_divexact_fmpz(fmpq_poly_t res, const fmpq_poly_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpq_poly_divexact_fmpz(fmpq_poly_t res, const fmpq_poly_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_is_zero(y)) { @@ -505,14 +511,14 @@ _gr_fmpq_poly_divexact_fmpz(fmpq_poly_t res, const fmpq_poly_t x, const fmpz_t y truth_t -_gr_fmpq_poly_is_invertible(const fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_is_invertible(const fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return (x->length == 1) ? T_TRUE : T_FALSE; } /* todo: efficient algo */ truth_t -_gr_fmpq_poly_divides(const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t ctx) +_gr_fmpq_poly_divides(const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { truth_t res; fmpq_poly_t tmp; @@ -525,7 +531,7 @@ _gr_fmpq_poly_divides(const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t c } int -_gr_fmpq_poly_euclidean_div(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t ctx) +_gr_fmpq_poly_euclidean_div(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpq_poly_is_zero(y)) { @@ -539,7 +545,7 @@ _gr_fmpq_poly_euclidean_div(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_pol } int -_gr_fmpq_poly_euclidean_rem(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t ctx) +_gr_fmpq_poly_euclidean_rem(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpq_poly_is_zero(y)) { @@ -553,7 +559,7 @@ _gr_fmpq_poly_euclidean_rem(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_pol } int -_gr_fmpq_poly_euclidean_divrem(fmpq_poly_t res1, fmpq_poly_t res2, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t ctx) +_gr_fmpq_poly_euclidean_divrem(fmpq_poly_t res1, fmpq_poly_t res2, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpq_poly_is_zero(y)) { @@ -567,21 +573,21 @@ _gr_fmpq_poly_euclidean_divrem(fmpq_poly_t res1, fmpq_poly_t res2, const fmpq_po } int -_gr_fmpq_poly_gcd(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t ctx) +_gr_fmpq_poly_gcd(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_gcd(res, x, y); return GR_SUCCESS; } int -_gr_fmpq_poly_lcm(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t ctx) +_gr_fmpq_poly_lcm(fmpq_poly_t res, const fmpq_poly_t x, const fmpq_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_lcm(res, x, y); return GR_SUCCESS; } int -_gr_fmpq_poly_pow_ui(fmpq_poly_t res, const fmpq_poly_t x, ulong exp, const gr_ctx_t ctx) +_gr_fmpq_poly_pow_ui(fmpq_poly_t res, const fmpq_poly_t x, ulong exp, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_pow(res, x, exp); return GR_SUCCESS; @@ -638,7 +644,7 @@ _gr_fmpq_poly_pow_fmpz(fmpq_poly_t res, const fmpq_poly_t x, const fmpz_t exp, g } int -_gr_fmpq_poly_numerator(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_numerator(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_set(res, x); fmpz_one(fmpq_poly_denref(res)); @@ -646,7 +652,7 @@ _gr_fmpq_poly_numerator(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t ctx } int -_gr_fmpq_poly_denominator(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t ctx) +_gr_fmpq_poly_denominator(fmpq_poly_t res, const fmpq_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_set_fmpz(res, fmpq_poly_denref(x)); return GR_SUCCESS; diff --git a/src/gr/fmpz.c b/src/gr/fmpz.c index 0046abfafa..31090cd3b5 100644 --- a/src/gr/fmpz.c +++ b/src/gr/fmpz.c @@ -25,27 +25,33 @@ #include "gr_special.h" #include "gmpcompat.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + int -_gr_fmpz_ctx_write(gr_stream_t out, gr_ctx_t ctx) +_gr_fmpz_ctx_write(gr_stream_t out, gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write(out, "Integer ring (fmpz)"); return GR_SUCCESS; } void -_gr_fmpz_init(fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_init(fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_init(x); } void -_gr_fmpz_clear(fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_clear(fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_clear(x); } void -_gr_fmpz_swap(fmpz_t x, fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_swap(fmpz_t x, fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_t t; *t = *x; @@ -54,14 +60,14 @@ _gr_fmpz_swap(fmpz_t x, fmpz_t y, const gr_ctx_t ctx) } void -_gr_fmpz_set_shallow(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_set_shallow(fmpz_t res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } /* todo: limits */ int -_gr_fmpz_randtest(fmpz_t res, flint_rand_t state, const gr_ctx_t ctx) +_gr_fmpz_randtest(fmpz_t res, flint_rand_t state, const gr_ctx_t FLINT_UNUSED(ctx)) { switch (n_randint(state, 4)) { @@ -76,49 +82,49 @@ _gr_fmpz_randtest(fmpz_t res, flint_rand_t state, const gr_ctx_t ctx) } int -_gr_fmpz_write(gr_stream_t out, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_write(gr_stream_t out, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write_fmpz(out, x); return GR_SUCCESS; } int -_gr_fmpz_zero(fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_zero(fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_zero(x); return GR_SUCCESS; } int -_gr_fmpz_one(fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_one(fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_one(x); return GR_SUCCESS; } int -_gr_fmpz_set_si(fmpz_t res, slong v, const gr_ctx_t ctx) +_gr_fmpz_set_si(fmpz_t res, slong v, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set_si(res, v); return GR_SUCCESS; } int -_gr_fmpz_set_ui(fmpz_t res, ulong v, const gr_ctx_t ctx) +_gr_fmpz_set_ui(fmpz_t res, ulong v, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set_ui(res, v); return GR_SUCCESS; } int -_gr_fmpz_set_fmpz(fmpz_t res, const fmpz_t v, const gr_ctx_t ctx) +_gr_fmpz_set_fmpz(fmpz_t res, const fmpz_t v, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set(res, v); return GR_SUCCESS; } int -_gr_fmpz_set_fmpq(fmpz_t res, const fmpq_t v, const gr_ctx_t ctx) +_gr_fmpz_set_fmpq(fmpz_t res, const fmpq_t v, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_is_one(fmpq_denref(v))) { @@ -132,7 +138,7 @@ _gr_fmpz_set_fmpq(fmpz_t res, const fmpq_t v, const gr_ctx_t ctx) } int -_gr_fmpz_set_d(fmpz_t res, double x, const gr_ctx_t ctx) +_gr_fmpz_set_d(fmpz_t res, double x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (x != x || x == HUGE_VAL || x == -HUGE_VAL) return GR_DOMAIN; @@ -180,7 +186,7 @@ _gr_fmpz_set_str(fmpz_t res, const char * x, gr_ctx_t ctx) } int -_gr_fmpz_get_ui(ulong * res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_get_ui(ulong * res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_sgn(x) < 0 || fmpz_cmp_ui(x, UWORD_MAX) > 0) return GR_DOMAIN; @@ -190,7 +196,7 @@ _gr_fmpz_get_ui(ulong * res, const fmpz_t x, const gr_ctx_t ctx) } int -_gr_fmpz_get_si(slong * res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_get_si(slong * res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!fmpz_fits_si(x)) return GR_DOMAIN; @@ -200,185 +206,185 @@ _gr_fmpz_get_si(slong * res, const fmpz_t x, const gr_ctx_t ctx) } int -_gr_fmpz_get_d(double * res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_get_d(double * res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = fmpz_get_d(x); return GR_SUCCESS; } int -_gr_fmpz_get_fmpq(fmpq_t res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_get_fmpq(fmpq_t res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpq_set_fmpz(res, x); return GR_SUCCESS; } int -_gr_fmpz_get_fexpr(fexpr_t res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_get_fexpr(fexpr_t res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fexpr_set_fmpz(res, x); return GR_SUCCESS; } truth_t -_gr_fmpz_is_zero(const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_is_zero(const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpz_is_zero(x) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpz_is_one(const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_is_one(const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpz_is_one(x) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpz_is_neg_one(const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_is_neg_one(const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return (*x == -1) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpz_equal(const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_equal(const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpz_equal(x, y) ? T_TRUE : T_FALSE; } int -_gr_fmpz_set(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_set(fmpz_t res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set(res, x); return GR_SUCCESS; } int -_gr_fmpz_neg(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_neg(fmpz_t res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_neg(res, x); return GR_SUCCESS; } int -_gr_fmpz_add(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_add(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_add(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_add_si(fmpz_t res, const fmpz_t x, slong y, const gr_ctx_t ctx) +_gr_fmpz_add_si(fmpz_t res, const fmpz_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_add_si(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_add_ui(fmpz_t res, const fmpz_t x, ulong y, const gr_ctx_t ctx) +_gr_fmpz_add_ui(fmpz_t res, const fmpz_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_add_ui(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_sub(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_sub(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_sub(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_sub_si(fmpz_t res, const fmpz_t x, slong y, const gr_ctx_t ctx) +_gr_fmpz_sub_si(fmpz_t res, const fmpz_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_sub_si(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_sub_ui(fmpz_t res, const fmpz_t x, ulong y, const gr_ctx_t ctx) +_gr_fmpz_sub_ui(fmpz_t res, const fmpz_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_sub_ui(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_mul(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_mul(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_mul(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_mul_ui(fmpz_t res, const fmpz_t x, ulong y, const gr_ctx_t ctx) +_gr_fmpz_mul_ui(fmpz_t res, const fmpz_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_mul_ui(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_mul_si(fmpz_t res, const fmpz_t x, slong y, const gr_ctx_t ctx) +_gr_fmpz_mul_si(fmpz_t res, const fmpz_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_mul_si(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_addmul(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_addmul(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_addmul(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_addmul_ui(fmpz_t res, const fmpz_t x, ulong y, const gr_ctx_t ctx) +_gr_fmpz_addmul_ui(fmpz_t res, const fmpz_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_addmul_ui(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_addmul_si(fmpz_t res, const fmpz_t x, slong y, const gr_ctx_t ctx) +_gr_fmpz_addmul_si(fmpz_t res, const fmpz_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_addmul_si(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_submul(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_submul(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_submul(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_submul_ui(fmpz_t res, const fmpz_t x, ulong y, const gr_ctx_t ctx) +_gr_fmpz_submul_ui(fmpz_t res, const fmpz_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_submul_ui(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_submul_si(fmpz_t res, const fmpz_t x, slong y, const gr_ctx_t ctx) +_gr_fmpz_submul_si(fmpz_t res, const fmpz_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_submul_si(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_mul_two(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_mul_two(fmpz_t res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_mul_2exp(res, x, 1); return GR_SUCCESS; } int -_gr_fmpz_sqr(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_sqr(fmpz_t res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_mul(res, x, x); return GR_SUCCESS; } int -_gr_fmpz_mul_2exp_si(fmpz_t res, const fmpz_t x, slong y, const gr_ctx_t ctx) +_gr_fmpz_mul_2exp_si(fmpz_t res, const fmpz_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (y >= 0) { @@ -425,7 +431,7 @@ _gr_fmpz_mul_2exp_fmpz(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_ } int -_gr_fmpz_inv(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_inv(fmpz_t res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_is_pm1(x)) { @@ -439,7 +445,7 @@ _gr_fmpz_inv(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) } int -_gr_fmpz_div(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_div(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_is_zero(y)) { @@ -455,7 +461,7 @@ _gr_fmpz_div(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) } int -_gr_fmpz_divexact(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_divexact(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_is_zero(y)) { @@ -469,7 +475,7 @@ _gr_fmpz_divexact(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx } int -_gr_fmpz_divexact_ui(fmpz_t res, const fmpz_t x, ulong y, const gr_ctx_t ctx) +_gr_fmpz_divexact_ui(fmpz_t res, const fmpz_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (y == 0) { @@ -483,7 +489,7 @@ _gr_fmpz_divexact_ui(fmpz_t res, const fmpz_t x, ulong y, const gr_ctx_t ctx) } int -_gr_fmpz_divexact_si(fmpz_t res, const fmpz_t x, slong y, const gr_ctx_t ctx) +_gr_fmpz_divexact_si(fmpz_t res, const fmpz_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (y == 0) { @@ -497,19 +503,19 @@ _gr_fmpz_divexact_si(fmpz_t res, const fmpz_t x, slong y, const gr_ctx_t ctx) } truth_t -_gr_fmpz_is_invertible(const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_is_invertible(const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpz_is_pm1(x) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpz_divides(const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_divides(const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpz_divisible(y, x) ? T_TRUE : T_FALSE; } int -_gr_fmpz_euclidean_div(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_euclidean_div(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_is_zero(y)) { @@ -523,7 +529,7 @@ _gr_fmpz_euclidean_div(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_ } int -_gr_fmpz_euclidean_rem(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_euclidean_rem(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_is_zero(y)) { @@ -537,7 +543,7 @@ _gr_fmpz_euclidean_rem(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_ } int -_gr_fmpz_euclidean_divrem(fmpz_t res1, fmpz_t res2, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_euclidean_divrem(fmpz_t res1, fmpz_t res2, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_is_zero(y)) { @@ -551,20 +557,20 @@ _gr_fmpz_euclidean_divrem(fmpz_t res1, fmpz_t res2, const fmpz_t x, const fmpz_t } int -_gr_fmpz_gcd(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_gcd(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_gcd(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_lcm(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_lcm(fmpz_t res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_lcm(res, x, y); return GR_SUCCESS; } -int _gr_fmpz_factor(gr_ptr c, gr_vec_t factors, gr_vec_t exponents, gr_srcptr x, int flags, gr_ctx_t ctx) +int _gr_fmpz_factor(gr_ptr c, gr_vec_t factors, gr_vec_t exponents, gr_srcptr x, int FLINT_UNUSED(flags), gr_ctx_t ctx) { fmpz_factor_t fac; slong i; @@ -589,7 +595,7 @@ int _gr_fmpz_factor(gr_ptr c, gr_vec_t factors, gr_vec_t exponents, gr_srcptr x, } int -_gr_fmpz_pow_ui(fmpz_t res, const fmpz_t x, ulong exp, const gr_ctx_t ctx) +_gr_fmpz_pow_ui(fmpz_t res, const fmpz_t x, ulong exp, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_pow_ui(res, x, exp); return GR_SUCCESS; @@ -649,13 +655,13 @@ _gr_fmpz_pow_fmpz(fmpz_t res, const fmpz_t x, const fmpz_t exp, const gr_ctx_t c } truth_t -_gr_fmpz_is_square(const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_is_square(const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpz_is_square(x) ? T_TRUE : T_FALSE; } int -_gr_fmpz_sqrt(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_sqrt(fmpz_t res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_sgn(x) < 0) return GR_DOMAIN; @@ -671,7 +677,7 @@ _gr_fmpz_sqrt(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) } int -_gr_fmpz_rsqrt(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_rsqrt(fmpz_t res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_is_one(x)) { @@ -685,28 +691,28 @@ _gr_fmpz_rsqrt(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) } int -_gr_fmpz_abs(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_abs(fmpz_t res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_abs(res, x); return GR_SUCCESS; } int -_gr_fmpz_im(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_im(fmpz_t res, const fmpz_t FLINT_UNUSED(x), const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_zero(res); return GR_SUCCESS; } int -_gr_fmpz_sgn(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_sgn(fmpz_t res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set_si(res, fmpz_sgn(x)); return GR_SUCCESS; } int -_gr_fmpz_cmp(int * res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_cmp(int * res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { int cmp = fmpz_cmp(x, y); @@ -717,7 +723,7 @@ _gr_fmpz_cmp(int * res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) } int -_gr_fmpz_cmpabs(int * res, const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_cmpabs(int * res, const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { int cmp = fmpz_cmpabs(x, y); @@ -796,7 +802,7 @@ _fmpz_sub_inline(fmpz_t z, const fmpz_t x, const fmpz_t y) } int -_gr_fmpz_vec_is_zero(const fmpz * vec, slong len, gr_ctx_t ctx) +_gr_fmpz_vec_is_zero(const fmpz * vec, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { slong i; @@ -808,7 +814,7 @@ _gr_fmpz_vec_is_zero(const fmpz * vec, slong len, gr_ctx_t ctx) } int -_gr_fmpz_vec_equal(const fmpz * vec1, const fmpz * vec2, slong len, gr_ctx_t ctx) +_gr_fmpz_vec_equal(const fmpz * vec1, const fmpz * vec2, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { slong i; @@ -830,7 +836,7 @@ _gr_fmpz_vec_equal(const fmpz * vec1, const fmpz * vec2, slong len, gr_ctx_t ctx } int -_gr_fmpz_vec_add(fmpz * res, const fmpz * vec1, const fmpz * vec2, slong len, gr_ctx_t ctx) +_gr_fmpz_vec_add(fmpz * res, const fmpz * vec1, const fmpz * vec2, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { slong i; @@ -841,7 +847,7 @@ _gr_fmpz_vec_add(fmpz * res, const fmpz * vec1, const fmpz * vec2, slong len, gr } int -_gr_fmpz_vec_sub(fmpz * res, const fmpz * vec1, const fmpz * vec2, slong len, gr_ctx_t ctx) +_gr_fmpz_vec_sub(fmpz * res, const fmpz * vec1, const fmpz * vec2, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { slong i; @@ -852,7 +858,7 @@ _gr_fmpz_vec_sub(fmpz * res, const fmpz * vec1, const fmpz * vec2, slong len, gr } int -_gr_fmpz_vec_sum(fmpz_t res, const fmpz * vec, slong len, gr_ctx_t ctx) +_gr_fmpz_vec_sum(fmpz_t res, const fmpz * vec, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { if (len <= 2) { @@ -917,14 +923,14 @@ _gr_fmpz_vec_sum(fmpz_t res, const fmpz * vec, slong len, gr_ctx_t ctx) } int -_gr_fmpz_vec_dot(fmpz_t res, const fmpz_t initial, int subtract, const fmpz * vec1, const fmpz * vec2, slong len, gr_ctx_t ctx) +_gr_fmpz_vec_dot(fmpz_t res, const fmpz_t initial, int subtract, const fmpz * vec1, const fmpz * vec2, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { _fmpz_vec_dot_general(res, initial, subtract, vec1, vec2, 0, len); return GR_SUCCESS; } int -_gr_fmpz_vec_dot_rev(fmpz_t res, const fmpz_t initial, int subtract, const fmpz * vec1, const fmpz * vec2, slong len, gr_ctx_t ctx) +_gr_fmpz_vec_dot_rev(fmpz_t res, const fmpz_t initial, int subtract, const fmpz * vec1, const fmpz * vec2, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { _fmpz_vec_dot_general(res, initial, subtract, vec1, vec2, 1, len); return GR_SUCCESS; @@ -933,7 +939,7 @@ _gr_fmpz_vec_dot_rev(fmpz_t res, const fmpz_t initial, int subtract, const fmpz int _gr_fmpz_poly_mullow(fmpz * res, const fmpz * poly1, slong len1, - const fmpz * poly2, slong len2, slong n, gr_ctx_t ctx) + const fmpz * poly2, slong len2, slong n, gr_ctx_t FLINT_UNUSED(ctx)) { if (len1 >= len2) _fmpz_poly_mullow(res, poly1, len1, poly2, len2, n); @@ -945,7 +951,7 @@ _gr_fmpz_poly_mullow(fmpz * res, /* integer roots of integer polynomial */ int -_gr_fmpz_roots_gr_poly(gr_vec_t roots, gr_vec_t mult, const fmpz_poly_t poly, int flags, gr_ctx_t ctx) +_gr_fmpz_roots_gr_poly(gr_vec_t roots, gr_vec_t mult, const fmpz_poly_t poly, int FLINT_UNUSED(flags), gr_ctx_t ctx) { if (poly->length == 0) return GR_DOMAIN; @@ -1020,14 +1026,14 @@ _gr_fmpz_roots_gr_poly_other(gr_vec_t roots, gr_vec_t mult, /* const gr_poly_t * } int -_gr_fmpz_mat_mul(fmpz_mat_t res, const fmpz_mat_t x, const fmpz_mat_t y, gr_ctx_t ctx) +_gr_fmpz_mat_mul(fmpz_mat_t res, const fmpz_mat_t x, const fmpz_mat_t y, gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_mat_mul(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_mat_det(fmpz_t res, const fmpz_mat_t x, const gr_ctx_t ctx) +_gr_fmpz_mat_det(fmpz_t res, const fmpz_mat_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_mat_det(res, x); return GR_SUCCESS; diff --git a/src/gr/fmpz_mod.c b/src/gr/fmpz_mod.c index 61aaa4c38a..b558a4ffb0 100644 --- a/src/gr/fmpz_mod.c +++ b/src/gr/fmpz_mod.c @@ -21,6 +21,13 @@ #include "gr_vec.h" #include "gr_poly.h" #include "gr_mat.h" +#include "gr_generic.h" + +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif typedef struct { @@ -70,19 +77,19 @@ _gr_fmpz_mod_ctx_is_field(gr_ctx_t ctx) } void -_gr_fmpz_mod_init(fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_mod_init(fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_init(x); } void -_gr_fmpz_mod_clear(fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_mod_clear(fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_clear(x); } void -_gr_fmpz_mod_swap(fmpz_t x, fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_mod_swap(fmpz_t x, fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_t t; *t = *x; @@ -91,7 +98,7 @@ _gr_fmpz_mod_swap(fmpz_t x, fmpz_t y, const gr_ctx_t ctx) } void -_gr_fmpz_mod_set_shallow(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_mod_set_shallow(fmpz_t res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } @@ -104,14 +111,14 @@ _gr_fmpz_mod_randtest(fmpz_t res, flint_rand_t state, const gr_ctx_t ctx) } int -_gr_fmpz_mod_write(gr_stream_t out, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_mod_write(gr_stream_t out, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write_fmpz(out, x); return GR_SUCCESS; } int -_gr_fmpz_mod_zero(fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_mod_zero(fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_zero(x); return GR_SUCCESS; @@ -142,7 +149,7 @@ _gr_fmpz_mod_set_ui(fmpz_t res, ulong v, const gr_ctx_t ctx) } int -_gr_fmpz_mod_get_fmpz(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_mod_get_fmpz(fmpz_t res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set(res, x); return GR_SUCCESS; @@ -185,7 +192,7 @@ _gr_fmpz_mod_set_fmpz(fmpz_t res, const fmpz_t v, const gr_ctx_t ctx) } truth_t -_gr_fmpz_mod_is_zero(const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_mod_is_zero(const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpz_is_zero(x) ? T_TRUE : T_FALSE; } @@ -209,13 +216,13 @@ _gr_fmpz_mod_is_neg_one(const fmpz_t x, const gr_ctx_t ctx) } truth_t -_gr_fmpz_mod_equal(const fmpz_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_mod_equal(const fmpz_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpz_equal(x, y) ? T_TRUE : T_FALSE; } int -_gr_fmpz_mod_set(fmpz_t res, const fmpz_t x, const gr_ctx_t ctx) +_gr_fmpz_mod_set(fmpz_t res, const fmpz_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set(res, x); return GR_SUCCESS; @@ -584,7 +591,7 @@ static const int tuning_bit_steps[TUNE_TAB_SIZE] = { 32, 45, 64, 91, 128, 181, 2 static const short inv_series_cutoff_tab[TUNE_TAB_SIZE] = {21, 14, 40, 39, 48, 60, 89, 72, 72, 54, 48, 39, 32, 24, 24, 20, 17, 18, 16, 15, 13, 12, 14, }; static const short div_series_cutoff_tab[TUNE_TAB_SIZE] = {23, 21, 52, 50, 66, 101, 106, 97, 106, 72, 60, 50, 44, 35, 38, 30, 26, 22, 20, 18, 16, 14, 22, }; -static const slong find_cutoff(const short * tab, slong b) +static slong find_cutoff(const short * tab, slong b) { slong i; @@ -647,7 +654,7 @@ int _gr_fmpz_mod_poly_gcd(nn_ptr G, slong * lenG, nn_srcptr A, slong lenA, nn_sr /* todo: implement generically */ int -_gr_fmpz_mod_roots_gr_poly(gr_vec_t roots, gr_vec_t mult, const fmpz_mod_poly_t poly, int flags, gr_ctx_t ctx) +_gr_fmpz_mod_roots_gr_poly(gr_vec_t roots, gr_vec_t mult, const fmpz_mod_poly_t poly, int FLINT_UNUSED(flags), gr_ctx_t ctx) { if (poly->length == 0) return GR_DOMAIN; diff --git a/src/gr/fmpz_mpoly.c b/src/gr/fmpz_mpoly.c index ecddff1aa6..cc24bc914e 100644 --- a/src/gr/fmpz_mpoly.c +++ b/src/gr/fmpz_mpoly.c @@ -16,6 +16,12 @@ #include "gr_vec.h" #include "gr_generic.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + typedef struct { fmpz_mpoly_ctx_t mctx; @@ -104,7 +110,7 @@ _gr_fmpz_mpoly_swap(fmpz_mpoly_t poly1, fmpz_mpoly_t poly2, gr_ctx_t ctx) } void -_gr_fmpz_mpoly_set_shallow(fmpz_mpoly_t res, const fmpz_mpoly_t poly, gr_ctx_t ctx) +_gr_fmpz_mpoly_set_shallow(fmpz_mpoly_t res, const fmpz_mpoly_t poly, gr_ctx_t FLINT_UNUSED(ctx)) { *res = *poly; } @@ -131,7 +137,7 @@ _gr_fmpz_mpoly_randtest_small(fmpz_mpoly_t res, flint_rand_t state, gr_ctx_t ctx } slong -_gr_fmpz_mpoly_length(const fmpz_mpoly_t x, gr_ctx_t ctx) +_gr_fmpz_mpoly_length(const fmpz_mpoly_t x, gr_ctx_t FLINT_UNUSED(ctx)) { return x->length; } @@ -254,7 +260,7 @@ _gr_fmpz_mpoly_neg(fmpz_mpoly_t res, const fmpz_mpoly_t mat, gr_ctx_t ctx) int _gr_fmpz_mpoly_add(fmpz_mpoly_t res, const fmpz_mpoly_t poly1, const fmpz_mpoly_t poly2, gr_ctx_t ctx) { - if (poly1->length + poly2->length > ctx->size_limit) + if ((ulong) (poly1->length + poly2->length) > ctx->size_limit) { fmpz_mpoly_zero(res, MPOLYNOMIAL_MCTX(ctx)); return GR_UNABLE; @@ -288,7 +294,7 @@ _gr_fmpz_mpoly_add_fmpz(fmpz_mpoly_t res, const fmpz_mpoly_t poly1, const fmpz_t int _gr_fmpz_mpoly_sub(fmpz_mpoly_t res, const fmpz_mpoly_t poly1, const fmpz_mpoly_t poly2, gr_ctx_t ctx) { - if (poly1->length + poly2->length > ctx->size_limit) + if ((ulong) (poly1->length + poly2->length) > ctx->size_limit) { fmpz_mpoly_zero(res, MPOLYNOMIAL_MCTX(ctx)); return GR_UNABLE; @@ -322,7 +328,7 @@ _gr_fmpz_mpoly_sub_fmpz(fmpz_mpoly_t res, const fmpz_mpoly_t poly1, const fmpz_t int _gr_fmpz_mpoly_mul(fmpz_mpoly_t res, const fmpz_mpoly_t poly1, const fmpz_mpoly_t poly2, gr_ctx_t ctx) { - if (poly1->length * poly2->length > ctx->size_limit) /* todo: * can overflow */ + if ((ulong) (poly1->length * poly2->length) > ctx->size_limit) /* todo: * can overflow */ { fmpz_mpoly_zero(res, MPOLYNOMIAL_MCTX(ctx)); return GR_UNABLE; @@ -491,7 +497,7 @@ _gr_fmpz_mpoly_gcd(fmpz_mpoly_t res, const fmpz_mpoly_t poly1, const fmpz_mpoly_ } int -_gr_fmpz_mpoly_factor(fmpz_mpoly_t c, gr_vec_t factors, gr_vec_t exponents, gr_srcptr x, int flags, gr_ctx_t ctx) +_gr_fmpz_mpoly_factor(fmpz_mpoly_t c, gr_vec_t factors, gr_vec_t exponents, gr_srcptr x, int FLINT_UNUSED(flags), gr_ctx_t ctx) { fmpz_mpoly_factor_t fac; gr_ctx_t ZZ; diff --git a/src/gr/fmpz_mpoly_q.c b/src/gr/fmpz_mpoly_q.c index 1edf4979c2..fb715acfde 100644 --- a/src/gr/fmpz_mpoly_q.c +++ b/src/gr/fmpz_mpoly_q.c @@ -15,6 +15,12 @@ #include "gr_vec.h" #include "gr_generic.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + typedef struct { fmpz_mpoly_ctx_t mctx; @@ -66,7 +72,7 @@ _gr_fmpz_mpoly_q_swap(fmpz_mpoly_q_t poly1, fmpz_mpoly_q_t poly2, gr_ctx_t ctx) } void -_gr_fmpz_mpoly_q_set_shallow(fmpz_mpoly_q_t res, const fmpz_mpoly_q_t poly, gr_ctx_t ctx) +_gr_fmpz_mpoly_q_set_shallow(fmpz_mpoly_q_t res, const fmpz_mpoly_q_t poly, gr_ctx_t FLINT_UNUSED(ctx)) { *res = *poly; } @@ -93,7 +99,7 @@ _gr_fmpz_mpoly_q_randtest_small(fmpz_mpoly_q_t res, flint_rand_t state, gr_ctx_t } slong -_gr_fmpz_mpoly_q_length(const fmpz_mpoly_q_t x, gr_ctx_t ctx) +_gr_fmpz_mpoly_q_length(const fmpz_mpoly_q_t x, gr_ctx_t FLINT_UNUSED(ctx)) { return fmpz_mpoly_q_numref(x)->length + fmpz_mpoly_q_denref(x)->length; } diff --git a/src/gr/fmpz_poly.c b/src/gr/fmpz_poly.c index 0f9f9aa8ba..34a88c05dd 100644 --- a/src/gr/fmpz_poly.c +++ b/src/gr/fmpz_poly.c @@ -23,6 +23,12 @@ #include "fmpz_poly_factor.h" #include "fmpz_mpoly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define FMPZ_POLY_CTX(ctx) POLYNOMIAL_CTX(ctx) #define FMPZ_POLY_CTX_VAR(ctx) (FMPZ_POLY_CTX(ctx)->var) @@ -54,26 +60,26 @@ int _gr_fmpz_poly_ctx_set_gen_names(gr_ctx_t ctx, const char ** s) } int -_gr_fmpz_poly_ctx_write(gr_stream_t out, gr_ctx_t ctx) +_gr_fmpz_poly_ctx_write(gr_stream_t out, gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write(out, "Polynomials over integers (fmpz_poly)"); return GR_SUCCESS; } void -_gr_fmpz_poly_init(fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_init(fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_init(x); } void -_gr_fmpz_poly_clear(fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_clear(fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_clear(x); } void -_gr_fmpz_poly_swap(fmpz_poly_t x, fmpz_poly_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_swap(fmpz_poly_t x, fmpz_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_t t; *t = *x; @@ -82,14 +88,14 @@ _gr_fmpz_poly_swap(fmpz_poly_t x, fmpz_poly_t y, const gr_ctx_t ctx) } void -_gr_fmpz_poly_set_shallow(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_set_shallow(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } /* todo: limits */ int -_gr_fmpz_poly_randtest(fmpz_poly_t res, flint_rand_t state, const gr_ctx_t ctx) +_gr_fmpz_poly_randtest(fmpz_poly_t res, flint_rand_t state, const gr_ctx_t FLINT_UNUSED(ctx)) { if (n_randint(state, 10) == 0) fmpz_poly_randtest(res, state, 4, 100); @@ -112,21 +118,21 @@ _gr_fmpz_poly_write(gr_stream_t out, const fmpz_poly_t x, const gr_ctx_t ctx) } int -_gr_fmpz_poly_zero(fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_zero(fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_zero(x); return GR_SUCCESS; } int -_gr_fmpz_poly_one(fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_one(fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_one(x); return GR_SUCCESS; } int -_gr_fmpz_poly_gen(fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_gen(fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_zero(x); fmpz_poly_set_coeff_ui(x, 1, 1); @@ -134,28 +140,28 @@ _gr_fmpz_poly_gen(fmpz_poly_t x, const gr_ctx_t ctx) } int -_gr_fmpz_poly_set_si(fmpz_poly_t res, slong v, const gr_ctx_t ctx) +_gr_fmpz_poly_set_si(fmpz_poly_t res, slong v, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_set_si(res, v); return GR_SUCCESS; } int -_gr_fmpz_poly_set_ui(fmpz_poly_t res, ulong v, const gr_ctx_t ctx) +_gr_fmpz_poly_set_ui(fmpz_poly_t res, ulong v, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_set_ui(res, v); return GR_SUCCESS; } int -_gr_fmpz_poly_set_fmpz(fmpz_poly_t res, const fmpz_t v, const gr_ctx_t ctx) +_gr_fmpz_poly_set_fmpz(fmpz_poly_t res, const fmpz_t v, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_set_fmpz(res, v); return GR_SUCCESS; } int -_gr_fmpz_poly_set_other(fmpz_poly_t res, gr_srcptr x, gr_ctx_t x_ctx, const gr_ctx_t ctx) +_gr_fmpz_poly_set_other(fmpz_poly_t res, gr_srcptr x, gr_ctx_t x_ctx, const gr_ctx_t FLINT_UNUSED(ctx)) { if (x_ctx->which_ring == GR_CTX_FMPZ) { @@ -221,7 +227,7 @@ _gr_fmpz_poly_set_other(fmpz_poly_t res, gr_srcptr x, gr_ctx_t x_ctx, const gr_c } int -_gr_fmpz_poly_set_str(fmpz_poly_t res, const char * x, const gr_ctx_t ctx) +_gr_fmpz_poly_set_str(fmpz_poly_t res, const char * x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_mpoly_ctx_t fctx; fmpz_mpoly_t f; @@ -246,7 +252,7 @@ _gr_fmpz_poly_set_str(fmpz_poly_t res, const char * x, const gr_ctx_t ctx) } int -_gr_fmpz_poly_get_ui(ulong * res, const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_get_ui(ulong * res, const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_poly_length(x) == 0) { @@ -271,7 +277,7 @@ _gr_fmpz_poly_get_ui(ulong * res, const fmpz_poly_t x, const gr_ctx_t ctx) } int -_gr_fmpz_poly_get_si(slong * res, const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_get_si(slong * res, const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_poly_length(x) == 0) { @@ -296,7 +302,7 @@ _gr_fmpz_poly_get_si(slong * res, const fmpz_poly_t x, const gr_ctx_t ctx) } int -_gr_fmpz_poly_get_fmpz(fmpz_t res, const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_get_fmpz(fmpz_t res, const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_poly_length(x) == 0) { @@ -314,7 +320,7 @@ _gr_fmpz_poly_get_fmpz(fmpz_t res, const fmpz_poly_t x, const gr_ctx_t ctx) } int -_gr_fmpz_poly_get_fmpq(fmpq_t res, const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_get_fmpq(fmpq_t res, const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_poly_length(x) == 0) { @@ -333,101 +339,101 @@ _gr_fmpz_poly_get_fmpq(fmpq_t res, const fmpz_poly_t x, const gr_ctx_t ctx) truth_t -_gr_fmpz_poly_is_zero(const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_is_zero(const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpz_poly_is_zero(x) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpz_poly_is_one(const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_is_one(const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpz_poly_is_one(x) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpz_poly_is_neg_one(const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_is_neg_one(const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return (x->length == 1 && x->coeffs[0] == -1) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpz_poly_equal(const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_equal(const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpz_poly_equal(x, y) ? T_TRUE : T_FALSE; } int -_gr_fmpz_poly_set(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_set(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_set(res, x); return GR_SUCCESS; } int -_gr_fmpz_poly_neg(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_neg(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_neg(res, x); return GR_SUCCESS; } int -_gr_fmpz_poly_add(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_add(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_add(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_poly_sub(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_sub(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_sub(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_poly_mul(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_mul(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_mul(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_poly_mul_ui(fmpz_poly_t res, const fmpz_poly_t x, ulong y, const gr_ctx_t ctx) +_gr_fmpz_poly_mul_ui(fmpz_poly_t res, const fmpz_poly_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_scalar_mul_ui(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_poly_mul_si(fmpz_poly_t res, const fmpz_poly_t x, slong y, const gr_ctx_t ctx) +_gr_fmpz_poly_mul_si(fmpz_poly_t res, const fmpz_poly_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_scalar_mul_si(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_poly_mul_fmpz(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_mul_fmpz(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_scalar_mul_fmpz(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_poly_addmul_ui(fmpz_poly_t res, const fmpz_poly_t x, ulong y, const gr_ctx_t ctx) +_gr_fmpz_poly_addmul_ui(fmpz_poly_t res, const fmpz_poly_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_scalar_addmul_ui(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_poly_addmul_si(fmpz_poly_t res, const fmpz_poly_t x, slong y, const gr_ctx_t ctx) +_gr_fmpz_poly_addmul_si(fmpz_poly_t res, const fmpz_poly_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_scalar_addmul_si(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_poly_addmul_fmpz(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_addmul_fmpz(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_scalar_addmul_fmpz(res, x, y); return GR_SUCCESS; @@ -455,28 +461,28 @@ _gr_fmpz_poly_submul_si(fmpz_poly_t res, const fmpz_poly_t x, slong y, const gr_ */ int -_gr_fmpz_poly_submul_fmpz(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_submul_fmpz(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_scalar_submul_fmpz(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_poly_mul_two(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_mul_two(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_scalar_mul_2exp(res, x, 1); return GR_SUCCESS; } int -_gr_fmpz_poly_sqr(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_sqr(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_sqr(res, x); return GR_SUCCESS; } int -_gr_fmpz_poly_inv(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_inv(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_poly_is_unit(x)) { @@ -490,7 +496,7 @@ _gr_fmpz_poly_inv(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t ctx) } int -_gr_fmpz_poly_div(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_div(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_poly_is_zero(y)) { @@ -506,7 +512,7 @@ _gr_fmpz_poly_div(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, con } int -_gr_fmpz_poly_divexact(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_divexact(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_poly_is_zero(y)) { @@ -520,7 +526,7 @@ _gr_fmpz_poly_divexact(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y } int -_gr_fmpz_poly_divexact_ui(fmpz_poly_t res, const fmpz_poly_t x, ulong y, const gr_ctx_t ctx) +_gr_fmpz_poly_divexact_ui(fmpz_poly_t res, const fmpz_poly_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (y == 0) { @@ -534,7 +540,7 @@ _gr_fmpz_poly_divexact_ui(fmpz_poly_t res, const fmpz_poly_t x, ulong y, const g } int -_gr_fmpz_poly_divexact_si(fmpz_poly_t res, const fmpz_poly_t x, slong y, const gr_ctx_t ctx) +_gr_fmpz_poly_divexact_si(fmpz_poly_t res, const fmpz_poly_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (y == 0) { @@ -548,7 +554,7 @@ _gr_fmpz_poly_divexact_si(fmpz_poly_t res, const fmpz_poly_t x, slong y, const g } int -_gr_fmpz_poly_divexact_fmpz(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_divexact_fmpz(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_is_zero(y)) { @@ -563,14 +569,14 @@ _gr_fmpz_poly_divexact_fmpz(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_t y truth_t -_gr_fmpz_poly_is_invertible(const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_is_invertible(const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpz_poly_is_unit(x) ? T_TRUE : T_FALSE; } /* todo: efficient algo */ truth_t -_gr_fmpz_poly_divides(const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_divides(const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { truth_t res; fmpz_poly_t tmp; @@ -589,7 +595,7 @@ _gr_fmpz_poly_divides(const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t c } int -_gr_fmpz_poly_euclidean_div(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_euclidean_div(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_poly_is_zero(y)) { @@ -603,7 +609,7 @@ _gr_fmpz_poly_euclidean_div(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_pol } int -_gr_fmpz_poly_euclidean_rem(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_euclidean_rem(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_poly_is_zero(y)) { @@ -617,7 +623,7 @@ _gr_fmpz_poly_euclidean_rem(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_pol } int -_gr_fmpz_poly_euclidean_divrem(fmpz_poly_t res1, fmpz_poly_t res2, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_euclidean_divrem(fmpz_poly_t res1, fmpz_poly_t res2, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_poly_is_zero(y)) { @@ -631,21 +637,21 @@ _gr_fmpz_poly_euclidean_divrem(fmpz_poly_t res1, fmpz_poly_t res2, const fmpz_po } int -_gr_fmpz_poly_gcd(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_gcd(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_gcd(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_poly_lcm(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t ctx) +_gr_fmpz_poly_lcm(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_poly_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_lcm(res, x, y); return GR_SUCCESS; } int -_gr_fmpz_poly_pow_ui(fmpz_poly_t res, const fmpz_poly_t x, ulong exp, const gr_ctx_t ctx) +_gr_fmpz_poly_pow_ui(fmpz_poly_t res, const fmpz_poly_t x, ulong exp, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_poly_pow(res, x, exp); return GR_SUCCESS; @@ -705,7 +711,7 @@ _gr_fmpz_poly_pow_fmpz(fmpz_poly_t res, const fmpz_poly_t x, const fmpz_t exp, c } truth_t -_gr_fmpz_poly_is_square(const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_is_square(const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { /* todo: fmpz_poly_is_square */ truth_t res; @@ -717,7 +723,7 @@ _gr_fmpz_poly_is_square(const fmpz_poly_t x, const gr_ctx_t ctx) } int -_gr_fmpz_poly_sqrt(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_sqrt(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_poly_sqrt(res, x)) { @@ -730,7 +736,7 @@ _gr_fmpz_poly_sqrt(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t ctx) } int -_gr_fmpz_poly_rsqrt(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t ctx) +_gr_fmpz_poly_rsqrt(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_poly_is_one(x)) { @@ -744,7 +750,7 @@ _gr_fmpz_poly_rsqrt(fmpz_poly_t res, const fmpz_poly_t x, const gr_ctx_t ctx) } int -_gr_fmpz_poly_factor(fmpz_poly_t c, gr_vec_t factors, gr_vec_t exponents, gr_srcptr x, int flags, gr_ctx_t ctx) +_gr_fmpz_poly_factor(fmpz_poly_t c, gr_vec_t factors, gr_vec_t exponents, gr_srcptr x, int FLINT_UNUSED(flags), gr_ctx_t ctx) { fmpz_poly_factor_t fac; gr_ctx_t ZZ; diff --git a/src/gr/fmpzi.c b/src/gr/fmpzi.c index 3c58ebe2f3..115c5c4b74 100644 --- a/src/gr/fmpzi.c +++ b/src/gr/fmpzi.c @@ -17,27 +17,33 @@ #include "gr.h" #include "gr_generic.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + int -_gr_fmpzi_ctx_write(gr_stream_t out, gr_ctx_t ctx) +_gr_fmpzi_ctx_write(gr_stream_t out, gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write(out, "Gaussian integer ring (fmpzi)"); return GR_SUCCESS; } void -_gr_fmpzi_init(fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_init(fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpzi_init(x); } void -_gr_fmpzi_clear(fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_clear(fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpzi_clear(x); } void -_gr_fmpzi_swap(fmpzi_t x, fmpzi_t y, const gr_ctx_t ctx) +_gr_fmpzi_swap(fmpzi_t x, fmpzi_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpzi_t t; *t = *x; @@ -46,14 +52,14 @@ _gr_fmpzi_swap(fmpzi_t x, fmpzi_t y, const gr_ctx_t ctx) } void -_gr_fmpzi_set_shallow(fmpzi_t res, const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_set_shallow(fmpzi_t res, const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } /* todo: limits */ int -_gr_fmpzi_randtest(fmpzi_t res, flint_rand_t state, const gr_ctx_t ctx) +_gr_fmpzi_randtest(fmpzi_t res, flint_rand_t state, const gr_ctx_t FLINT_UNUSED(ctx)) { switch (n_randint(state, 4)) { @@ -68,7 +74,7 @@ _gr_fmpzi_randtest(fmpzi_t res, flint_rand_t state, const gr_ctx_t ctx) } int -_gr_fmpzi_write(gr_stream_t out, const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_write(gr_stream_t out, const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_is_zero(fmpzi_imagref(x))) { @@ -108,21 +114,21 @@ _gr_fmpzi_write(gr_stream_t out, const fmpzi_t x, const gr_ctx_t ctx) } int -_gr_fmpzi_zero(fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_zero(fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpzi_zero(x); return GR_SUCCESS; } int -_gr_fmpzi_one(fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_one(fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpzi_one(x); return GR_SUCCESS; } int -_gr_fmpzi_set_si(fmpzi_t res, slong v, const gr_ctx_t ctx) +_gr_fmpzi_set_si(fmpzi_t res, slong v, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set_si(fmpzi_realref(res), v); fmpz_zero(fmpzi_imagref(res)); @@ -130,7 +136,7 @@ _gr_fmpzi_set_si(fmpzi_t res, slong v, const gr_ctx_t ctx) } int -_gr_fmpzi_set_ui(fmpzi_t res, ulong v, const gr_ctx_t ctx) +_gr_fmpzi_set_ui(fmpzi_t res, ulong v, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set_ui(fmpzi_realref(res), v); fmpz_zero(fmpzi_imagref(res)); @@ -138,7 +144,7 @@ _gr_fmpzi_set_ui(fmpzi_t res, ulong v, const gr_ctx_t ctx) } int -_gr_fmpzi_set_fmpz(fmpzi_t res, const fmpz_t v, const gr_ctx_t ctx) +_gr_fmpzi_set_fmpz(fmpzi_t res, const fmpz_t v, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set(fmpzi_realref(res), v); fmpz_zero(fmpzi_imagref(res)); @@ -146,7 +152,7 @@ _gr_fmpzi_set_fmpz(fmpzi_t res, const fmpz_t v, const gr_ctx_t ctx) } int -_gr_fmpzi_set_fmpq(fmpzi_t res, const fmpq_t v, const gr_ctx_t ctx) +_gr_fmpzi_set_fmpq(fmpzi_t res, const fmpq_t v, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_is_one(fmpq_denref(v))) { @@ -161,7 +167,7 @@ _gr_fmpzi_set_fmpq(fmpzi_t res, const fmpq_t v, const gr_ctx_t ctx) } int -_gr_fmpzi_set(fmpzi_t res, const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_set(fmpzi_t res, const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpzi_set(res, x); return GR_SUCCESS; @@ -205,7 +211,7 @@ fmpzi_set_qqbar(fmpzi_t res, const qqbar_t x) } int -_gr_fmpzi_set_d(fmpzi_t res, double x, const gr_ctx_t ctx) +_gr_fmpzi_set_d(fmpzi_t res, double x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (x != x || x == HUGE_VAL || x == -HUGE_VAL) return GR_DOMAIN; @@ -241,7 +247,7 @@ _gr_fmpzi_set_other(fmpzi_t res, gr_srcptr x, gr_ctx_t x_ctx, const gr_ctx_t ctx } int -_gr_fmpzi_get_fmpz(fmpz_t res, const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_get_fmpz(fmpz_t res, const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!fmpz_is_zero(fmpzi_imagref(x))) return GR_DOMAIN; @@ -251,7 +257,7 @@ _gr_fmpzi_get_fmpz(fmpz_t res, const fmpzi_t x, const gr_ctx_t ctx) } int -_gr_fmpzi_get_fmpq(fmpq_t res, const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_get_fmpq(fmpq_t res, const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!fmpz_is_zero(fmpzi_imagref(x))) return GR_DOMAIN; @@ -264,7 +270,7 @@ _gr_fmpzi_get_fmpq(fmpq_t res, const fmpzi_t x, const gr_ctx_t ctx) void qqbar_set_fmpzi(qqbar_t res, const fmpzi_t x); int -_gr_fmpzi_get_fexpr(fexpr_t res, const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_get_fexpr(fexpr_t res, const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_t t; int status; @@ -276,7 +282,7 @@ _gr_fmpzi_get_fexpr(fexpr_t res, const fmpzi_t x, const gr_ctx_t ctx) } int -_gr_fmpzi_get_ui(ulong * res, const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_get_ui(ulong * res, const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!fmpz_is_zero(fmpzi_imagref(x))) return GR_DOMAIN; @@ -289,7 +295,7 @@ _gr_fmpzi_get_ui(ulong * res, const fmpzi_t x, const gr_ctx_t ctx) } int -_gr_fmpzi_get_si(slong * res, const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_get_si(slong * res, const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!fmpz_is_zero(fmpzi_imagref(x))) return GR_DOMAIN; @@ -302,7 +308,7 @@ _gr_fmpzi_get_si(slong * res, const fmpzi_t x, const gr_ctx_t ctx) } int -_gr_fmpzi_get_d(double * res, const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_get_d(double * res, const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!fmpz_is_zero(fmpzi_imagref(x))) return GR_DOMAIN; @@ -312,45 +318,45 @@ _gr_fmpzi_get_d(double * res, const fmpzi_t x, const gr_ctx_t ctx) } truth_t -_gr_fmpzi_is_zero(const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_is_zero(const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpzi_is_zero(x) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpzi_is_one(const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_is_one(const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpzi_is_one(x) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpzi_is_neg_one(const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_is_neg_one(const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return (fmpz_is_zero(fmpzi_imagref(x)) && *fmpzi_realref(x) == -1) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpzi_equal(const fmpzi_t x, const fmpzi_t y, const gr_ctx_t ctx) +_gr_fmpzi_equal(const fmpzi_t x, const fmpzi_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpzi_equal(x, y) ? T_TRUE : T_FALSE; } int -_gr_fmpzi_neg(fmpzi_t res, const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_neg(fmpzi_t res, const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpzi_neg(res, x); return GR_SUCCESS; } int -_gr_fmpzi_add(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t ctx) +_gr_fmpzi_add(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpzi_add(res, x, y); return GR_SUCCESS; } int -_gr_fmpzi_add_si(fmpzi_t res, const fmpzi_t x, slong y, const gr_ctx_t ctx) +_gr_fmpzi_add_si(fmpzi_t res, const fmpzi_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_add_si(fmpzi_realref(res), fmpzi_realref(x), y); fmpz_set(fmpzi_imagref(res), fmpzi_imagref(x)); @@ -358,7 +364,7 @@ _gr_fmpzi_add_si(fmpzi_t res, const fmpzi_t x, slong y, const gr_ctx_t ctx) } int -_gr_fmpzi_add_ui(fmpzi_t res, const fmpzi_t x, ulong y, const gr_ctx_t ctx) +_gr_fmpzi_add_ui(fmpzi_t res, const fmpzi_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_add_ui(fmpzi_realref(res), fmpzi_realref(x), y); fmpz_set(fmpzi_imagref(res), fmpzi_imagref(x)); @@ -366,7 +372,7 @@ _gr_fmpzi_add_ui(fmpzi_t res, const fmpzi_t x, ulong y, const gr_ctx_t ctx) } int -_gr_fmpzi_add_fmpz(fmpzi_t res, const fmpzi_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpzi_add_fmpz(fmpzi_t res, const fmpzi_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_add(fmpzi_realref(res), fmpzi_realref(x), y); fmpz_set(fmpzi_imagref(res), fmpzi_imagref(x)); @@ -374,14 +380,14 @@ _gr_fmpzi_add_fmpz(fmpzi_t res, const fmpzi_t x, const fmpz_t y, const gr_ctx_t } int -_gr_fmpzi_sub(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t ctx) +_gr_fmpzi_sub(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpzi_sub(res, x, y); return GR_SUCCESS; } int -_gr_fmpzi_sub_si(fmpzi_t res, const fmpzi_t x, slong y, const gr_ctx_t ctx) +_gr_fmpzi_sub_si(fmpzi_t res, const fmpzi_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_sub_si(fmpzi_realref(res), fmpzi_realref(x), y); fmpz_set(fmpzi_imagref(res), fmpzi_imagref(x)); @@ -389,7 +395,7 @@ _gr_fmpzi_sub_si(fmpzi_t res, const fmpzi_t x, slong y, const gr_ctx_t ctx) } int -_gr_fmpzi_sub_ui(fmpzi_t res, const fmpzi_t x, ulong y, const gr_ctx_t ctx) +_gr_fmpzi_sub_ui(fmpzi_t res, const fmpzi_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_sub_ui(fmpzi_realref(res), fmpzi_realref(x), y); fmpz_set(fmpzi_imagref(res), fmpzi_imagref(x)); @@ -397,7 +403,7 @@ _gr_fmpzi_sub_ui(fmpzi_t res, const fmpzi_t x, ulong y, const gr_ctx_t ctx) } int -_gr_fmpzi_sub_fmpz(fmpzi_t res, const fmpzi_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpzi_sub_fmpz(fmpzi_t res, const fmpzi_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_sub(fmpzi_realref(res), fmpzi_realref(x), y); fmpz_set(fmpzi_imagref(res), fmpzi_imagref(x)); @@ -405,14 +411,14 @@ _gr_fmpzi_sub_fmpz(fmpzi_t res, const fmpzi_t x, const fmpz_t y, const gr_ctx_t } int -_gr_fmpzi_mul(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t ctx) +_gr_fmpzi_mul(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpzi_mul(res, x, y); return GR_SUCCESS; } int -_gr_fmpzi_mul_ui(fmpzi_t res, const fmpzi_t x, ulong y, const gr_ctx_t ctx) +_gr_fmpzi_mul_ui(fmpzi_t res, const fmpzi_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_mul_ui(fmpzi_realref(res), fmpzi_realref(x), y); fmpz_mul_ui(fmpzi_imagref(res), fmpzi_imagref(x), y); @@ -420,7 +426,7 @@ _gr_fmpzi_mul_ui(fmpzi_t res, const fmpzi_t x, ulong y, const gr_ctx_t ctx) } int -_gr_fmpzi_mul_si(fmpzi_t res, const fmpzi_t x, slong y, const gr_ctx_t ctx) +_gr_fmpzi_mul_si(fmpzi_t res, const fmpzi_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_mul_si(fmpzi_realref(res), fmpzi_realref(x), y); fmpz_mul_si(fmpzi_imagref(res), fmpzi_imagref(x), y); @@ -428,7 +434,7 @@ _gr_fmpzi_mul_si(fmpzi_t res, const fmpzi_t x, slong y, const gr_ctx_t ctx) } int -_gr_fmpzi_mul_fmpz(fmpzi_t res, const fmpzi_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpzi_mul_fmpz(fmpzi_t res, const fmpzi_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_mul(fmpzi_realref(res), fmpzi_realref(x), y); fmpz_mul(fmpzi_imagref(res), fmpzi_imagref(x), y); @@ -439,7 +445,7 @@ _gr_fmpzi_mul_fmpz(fmpzi_t res, const fmpzi_t x, const fmpz_t y, const gr_ctx_t /* todo: addmul, submul */ int -_gr_fmpzi_mul_two(fmpzi_t res, const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_mul_two(fmpzi_t res, const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_mul_2exp(fmpzi_realref(res), fmpzi_realref(x), 1); fmpz_mul_2exp(fmpzi_imagref(res), fmpzi_imagref(x), 1); @@ -447,14 +453,14 @@ _gr_fmpzi_mul_two(fmpzi_t res, const fmpzi_t x, const gr_ctx_t ctx) } int -_gr_fmpzi_sqr(fmpzi_t res, const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_sqr(fmpzi_t res, const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpzi_mul(res, x, x); return GR_SUCCESS; } int -_gr_fmpzi_mul_2exp_si(fmpzi_t res, const fmpzi_t x, slong y, const gr_ctx_t ctx) +_gr_fmpzi_mul_2exp_si(fmpzi_t res, const fmpzi_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (y >= 0) { @@ -508,7 +514,7 @@ _gr_fmpzi_mul_2exp_fmpz(fmpzi_t res, const fmpzi_t x, const fmpz_t y, const gr_c } int -_gr_fmpzi_inv(fmpzi_t res, const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_inv(fmpzi_t res, const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpzi_is_unit(x)) { @@ -528,7 +534,7 @@ _gr_fmpzi_inv(fmpzi_t res, const fmpzi_t x, const gr_ctx_t ctx) /* todo: division optimizations (real/imag values, divexact, divisibility checking...) */ int -_gr_fmpzi_div(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t ctx) +_gr_fmpzi_div(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpzi_is_zero(y)) { @@ -549,7 +555,7 @@ _gr_fmpzi_div(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t ctx) } int -_gr_fmpzi_divexact(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t ctx) +_gr_fmpzi_divexact(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpzi_is_zero(y)) { @@ -563,7 +569,7 @@ _gr_fmpzi_divexact(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t } int -_gr_fmpzi_divexact_ui(fmpzi_t res, const fmpzi_t x, ulong y, const gr_ctx_t ctx) +_gr_fmpzi_divexact_ui(fmpzi_t res, const fmpzi_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (y == 0) { @@ -578,7 +584,7 @@ _gr_fmpzi_divexact_ui(fmpzi_t res, const fmpzi_t x, ulong y, const gr_ctx_t ctx) } int -_gr_fmpzi_divexact_si(fmpzi_t res, const fmpzi_t x, slong y, const gr_ctx_t ctx) +_gr_fmpzi_divexact_si(fmpzi_t res, const fmpzi_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (y == 0) { @@ -593,7 +599,7 @@ _gr_fmpzi_divexact_si(fmpzi_t res, const fmpzi_t x, slong y, const gr_ctx_t ctx) } int -_gr_fmpzi_divexact_fmpz(fmpzi_t res, const fmpzi_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_fmpzi_divexact_fmpz(fmpzi_t res, const fmpzi_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_is_zero(y)) { @@ -608,13 +614,13 @@ _gr_fmpzi_divexact_fmpz(fmpzi_t res, const fmpzi_t x, const fmpz_t y, const gr_c } truth_t -_gr_fmpzi_is_invertible(const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_is_invertible(const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return fmpzi_is_unit(x) ? T_TRUE : T_FALSE; } truth_t -_gr_fmpzi_divides(const fmpzi_t x, const fmpzi_t y, const gr_ctx_t ctx) +_gr_fmpzi_divides(const fmpzi_t x, const fmpzi_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpzi_t q, r; truth_t result; @@ -637,7 +643,7 @@ _gr_fmpzi_divides(const fmpzi_t x, const fmpzi_t y, const gr_ctx_t ctx) } int -_gr_fmpzi_euclidean_div(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t ctx) +_gr_fmpzi_euclidean_div(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpzi_is_zero(y)) { @@ -654,7 +660,7 @@ _gr_fmpzi_euclidean_div(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ } int -_gr_fmpzi_euclidean_rem(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t ctx) +_gr_fmpzi_euclidean_rem(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpzi_is_zero(y)) { @@ -671,7 +677,7 @@ _gr_fmpzi_euclidean_rem(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ } int -_gr_fmpzi_euclidean_divrem(fmpzi_t res1, fmpzi_t res2, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t ctx) +_gr_fmpzi_euclidean_divrem(fmpzi_t res1, fmpzi_t res2, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpzi_is_zero(y)) { @@ -685,14 +691,14 @@ _gr_fmpzi_euclidean_divrem(fmpzi_t res1, fmpzi_t res2, const fmpzi_t x, const fm } int -_gr_fmpzi_gcd(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t ctx) +_gr_fmpzi_gcd(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpzi_gcd(res, x, y); return GR_SUCCESS; } int -_gr_fmpzi_lcm(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t ctx) +_gr_fmpzi_lcm(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpzi_is_zero(x) || fmpzi_is_zero(y)) { @@ -719,7 +725,7 @@ _gr_fmpzi_lcm(fmpzi_t res, const fmpzi_t x, const fmpzi_t y, const gr_ctx_t ctx) } int -_gr_fmpzi_pow_ui(fmpzi_t res, const fmpzi_t x, ulong exp, const gr_ctx_t ctx) +_gr_fmpzi_pow_ui(fmpzi_t res, const fmpzi_t x, ulong exp, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpzi_pow_ui(res, x, exp); return GR_SUCCESS; @@ -850,7 +856,7 @@ _gr_fmpzi_abs(fmpzi_t res, const fmpzi_t x, const gr_ctx_t ctx) */ int -_gr_fmpzi_i(fmpzi_t res, const gr_ctx_t ctx) +_gr_fmpzi_i(fmpzi_t res, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_zero(fmpzi_realref(res)); fmpz_one(fmpzi_imagref(res)); @@ -858,7 +864,7 @@ _gr_fmpzi_i(fmpzi_t res, const gr_ctx_t ctx) } int -_gr_fmpzi_conj(fmpzi_t res, const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_conj(fmpzi_t res, const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set(fmpzi_realref(res), fmpzi_realref(x)); fmpz_neg(fmpzi_imagref(res), fmpzi_imagref(x)); @@ -866,7 +872,7 @@ _gr_fmpzi_conj(fmpzi_t res, const fmpzi_t x, const gr_ctx_t ctx) } int -_gr_fmpzi_re(fmpzi_t res, const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_re(fmpzi_t res, const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set(fmpzi_realref(res), fmpzi_realref(x)); fmpz_zero(fmpzi_imagref(res)); @@ -874,7 +880,7 @@ _gr_fmpzi_re(fmpzi_t res, const fmpzi_t x, const gr_ctx_t ctx) } int -_gr_fmpzi_im(fmpzi_t res, const fmpzi_t x, const gr_ctx_t ctx) +_gr_fmpzi_im(fmpzi_t res, const fmpzi_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set(fmpzi_realref(res), fmpzi_imagref(x)); fmpz_zero(fmpzi_imagref(res)); diff --git a/src/gr/fq.c b/src/gr/fq.c index d3eb4eaaea..5a040fe17d 100644 --- a/src/gr/fq.c +++ b/src/gr/fq.c @@ -24,6 +24,12 @@ #include "gr_vec.h" #include "gr_generic.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define FQ_CTX(ring_ctx) ((fq_ctx_struct *)(GR_CTX_DATA_AS_PTR(ring_ctx))) static const char * default_var = "a"; @@ -36,7 +42,7 @@ _gr_fq_ctx_clear(gr_ctx_t ctx) } int -_gr_fq_ctx_write(gr_stream_t out, gr_ctx_t ctx) +_gr_fq_ctx_write(gr_stream_t out, gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write(out, "Finite field (fq)"); return GR_SUCCESS; @@ -70,7 +76,7 @@ _gr_fq_clear(fq_t x, const gr_ctx_t ctx) } void -_gr_fq_swap(fq_t x, fq_t y, const gr_ctx_t ctx) +_gr_fq_swap(fq_t x, fq_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fq_t t; *t = *x; @@ -79,7 +85,7 @@ _gr_fq_swap(fq_t x, fq_t y, const gr_ctx_t ctx) } void -_gr_fq_set_shallow(fq_t res, const fq_t x, const gr_ctx_t ctx) +_gr_fq_set_shallow(fq_t res, const fq_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } @@ -625,7 +631,7 @@ _gr_fq_poly_mullow(fq_struct * res, /* todo: implement generically */ int -_gr_fq_roots_gr_poly(gr_vec_t roots, gr_vec_t mult, const fq_poly_t poly, int flags, gr_ctx_t ctx) +_gr_fq_roots_gr_poly(gr_vec_t roots, gr_vec_t mult, const fq_poly_t poly, int FLINT_UNUSED(flags), gr_ctx_t ctx) { if (poly->length == 0) return GR_DOMAIN; diff --git a/src/gr/fq_nmod.c b/src/gr/fq_nmod.c index 14c4fcfd27..224e802264 100644 --- a/src/gr/fq_nmod.c +++ b/src/gr/fq_nmod.c @@ -25,6 +25,12 @@ #include "gr_poly.h" #include "gr_generic.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define FQ_CTX(ring_ctx) ((fq_nmod_ctx_struct *)(GR_CTX_DATA_AS_PTR(ring_ctx))) static const char * default_var = "a"; @@ -37,7 +43,7 @@ _gr_fq_nmod_ctx_clear(gr_ctx_t ctx) } int -_gr_fq_nmod_ctx_write(gr_stream_t out, gr_ctx_t ctx) +_gr_fq_nmod_ctx_write(gr_stream_t out, gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write(out, "Finite field (fq_nmod)"); return GR_SUCCESS; @@ -71,7 +77,7 @@ _gr_fq_nmod_clear(fq_nmod_t x, const gr_ctx_t ctx) } void -_gr_fq_nmod_swap(fq_nmod_t x, fq_nmod_t y, const gr_ctx_t ctx) +_gr_fq_nmod_swap(fq_nmod_t x, fq_nmod_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fq_nmod_t t; *t = *x; @@ -80,7 +86,7 @@ _gr_fq_nmod_swap(fq_nmod_t x, fq_nmod_t y, const gr_ctx_t ctx) } void -_gr_fq_nmod_set_shallow(fq_nmod_t res, const fq_nmod_t x, const gr_ctx_t ctx) +_gr_fq_nmod_set_shallow(fq_nmod_t res, const fq_nmod_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } @@ -588,7 +594,7 @@ _gr_fq_nmod_poly_mullow(fq_nmod_struct * res, /* todo: implement generically */ int -_gr_fq_nmod_roots_gr_poly(gr_vec_t roots, gr_vec_t mult, const fq_nmod_poly_t poly, int flags, gr_ctx_t ctx) +_gr_fq_nmod_roots_gr_poly(gr_vec_t roots, gr_vec_t mult, const fq_nmod_poly_t poly, int FLINT_UNUSED(flags), gr_ctx_t ctx) { if (poly->length == 0) return GR_DOMAIN; diff --git a/src/gr/fq_zech.c b/src/gr/fq_zech.c index 089fe48136..baa471b61e 100644 --- a/src/gr/fq_zech.c +++ b/src/gr/fq_zech.c @@ -24,6 +24,12 @@ #include "gr_vec.h" #include "gr_generic.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define FQ_CTX(ring_ctx) ((fq_zech_ctx_struct *)(GR_CTX_DATA_AS_PTR(ring_ctx))) static const char * default_var = "a"; @@ -38,7 +44,7 @@ _gr_fq_zech_ctx_clear(gr_ctx_t ctx) } int -_gr_fq_zech_ctx_write(gr_stream_t out, gr_ctx_t ctx) +_gr_fq_zech_ctx_write(gr_stream_t out, gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write(out, "Finite field (fq_zech)"); return GR_SUCCESS; @@ -72,7 +78,7 @@ _gr_fq_zech_clear(fq_zech_t x, const gr_ctx_t ctx) } void -_gr_fq_zech_swap(fq_zech_t x, fq_zech_t y, const gr_ctx_t ctx) +_gr_fq_zech_swap(fq_zech_t x, fq_zech_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { fq_zech_t t; *t = *x; @@ -81,7 +87,7 @@ _gr_fq_zech_swap(fq_zech_t x, fq_zech_t y, const gr_ctx_t ctx) } void -_gr_fq_zech_set_shallow(fq_zech_t res, const fq_zech_t x, const gr_ctx_t ctx) +_gr_fq_zech_set_shallow(fq_zech_t res, const fq_zech_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } @@ -379,7 +385,7 @@ _gr_fq_zech_vec_init(fq_zech_struct * vec, slong len, gr_ctx_t ctx) } void -_gr_fq_zech_vec_clear(fq_zech_struct * vec, slong len, gr_ctx_t ctx) +_gr_fq_zech_vec_clear(fq_zech_struct * FLINT_UNUSED(vec), slong FLINT_UNUSED(len), gr_ctx_t FLINT_UNUSED(ctx)) { } @@ -393,7 +399,7 @@ _gr_fq_zech_vec_swap(fq_zech_struct * vec1, fq_zech_struct * vec2, slong len, gr } int -_gr_fq_zech_vec_set(fq_zech_struct * res, const fq_zech_struct * vec, slong len, gr_ctx_t ctx) +_gr_fq_zech_vec_set(fq_zech_struct * res, const fq_zech_struct * vec, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { slong i; @@ -476,7 +482,7 @@ _gr_fq_zech_poly_mullow(fq_zech_struct * res, /* todo: implement generically */ int -_gr_fq_zech_roots_gr_poly(gr_vec_t roots, gr_vec_t mult, const fq_zech_poly_t poly, int flags, gr_ctx_t ctx) +_gr_fq_zech_roots_gr_poly(gr_vec_t roots, gr_vec_t mult, const fq_zech_poly_t poly, int FLINT_UNUSED(flags), gr_ctx_t ctx) { if (poly->length == 0) return GR_DOMAIN; diff --git a/src/gr/init_random.c b/src/gr/init_random.c index f056ba1adb..cb859aa5a2 100644 --- a/src/gr/init_random.c +++ b/src/gr/init_random.c @@ -39,7 +39,7 @@ _gr_random_base_ring(flint_rand_t state) return _gr_some_base_rings + n_randint(state, sizeof(_gr_some_base_rings) / sizeof(gr_ctx_struct)); } -void +static void gr_ctx_init_random_ring_composite(gr_ctx_t ctx, flint_rand_t state) { gr_ctx_struct * base_ring = _gr_random_base_ring(state); @@ -75,7 +75,7 @@ gr_ctx_init_random_ring_composite(gr_ctx_t ctx, flint_rand_t state) } } -void +static void gr_ctx_init_random_ring_integers_mod(gr_ctx_t ctx, flint_rand_t state) { fmpz_t t; @@ -101,7 +101,7 @@ gr_ctx_init_random_ring_integers_mod(gr_ctx_t ctx, flint_rand_t state) } } -void +static void gr_ctx_init_random_ring_finite_field(gr_ctx_t ctx, flint_rand_t state) { fmpz_t t; @@ -126,7 +126,7 @@ gr_ctx_init_random_ring_finite_field(gr_ctx_t ctx, flint_rand_t state) fmpz_clear(t); } -void +static void gr_ctx_init_random_ring_number_field(gr_ctx_t ctx, flint_rand_t state) { fmpz_poly_t g; @@ -149,7 +149,7 @@ gr_ctx_init_random_ring_number_field(gr_ctx_t ctx, flint_rand_t state) fmpq_poly_clear(f); } -void +static void gr_ctx_init_random_ring_real_complex_ball(gr_ctx_t ctx, flint_rand_t state) { if (n_randint(state, 2)) @@ -158,7 +158,7 @@ gr_ctx_init_random_ring_real_complex_ball(gr_ctx_t ctx, flint_rand_t state) gr_ctx_init_complex_acb(ctx, 2 + n_randint(state, 200)); } -void +static void gr_ctx_init_random_ring_real_complex_exact(gr_ctx_t ctx, flint_rand_t state) { switch (n_randint(state, 4)) diff --git a/src/gr/matrix.c b/src/gr/matrix.c index ba1af2ad0a..12bee57e6c 100644 --- a/src/gr/matrix.c +++ b/src/gr/matrix.c @@ -16,6 +16,14 @@ #include "gr.h" #include "gr_mat.h" +/* FIXME: Should these functions be static or not? */ + +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + /* todo: for matrix "ring", verify that element domain is a ring */ /* todo: recycle storage? */ @@ -133,7 +141,7 @@ matrix_swap(gr_mat_t mat1, gr_mat_t mat2, gr_ctx_t ctx) } void -matrix_set_shallow(gr_mat_t res, const gr_mat_t mat, gr_ctx_t ctx) +matrix_set_shallow(gr_mat_t res, const gr_mat_t mat, gr_ctx_t FLINT_UNUSED(ctx)) { *res = *mat; } diff --git a/src/gr/mpoly.c b/src/gr/mpoly.c index 351aedb339..e06d2e9476 100644 --- a/src/gr/mpoly.c +++ b/src/gr/mpoly.c @@ -17,6 +17,14 @@ #include "gr_mpoly.h" #include "gr_generic.h" +/* FIXME: Should these functions be static or not? */ + +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + typedef struct { gr_ctx_struct * base_ring; @@ -142,7 +150,7 @@ _gr_gr_mpoly_swap(gr_mpoly_t poly1, gr_mpoly_t poly2, gr_ctx_t ctx) } void -_gr_gr_mpoly_set_shallow(gr_mpoly_t res, const gr_mpoly_t poly, gr_ctx_t ctx) +_gr_gr_mpoly_set_shallow(gr_mpoly_t res, const gr_mpoly_t poly, gr_ctx_t FLINT_UNUSED(ctx)) { *res = *poly; } @@ -154,7 +162,7 @@ _gr_gr_mpoly_randtest(gr_mpoly_t res, flint_rand_t state, gr_ctx_t ctx) } slong -_gr_gr_mpoly_length(const gr_mpoly_t x, gr_ctx_t ctx) +_gr_gr_mpoly_length(const gr_mpoly_t x, gr_ctx_t FLINT_UNUSED(ctx)) { return x->length; } @@ -284,7 +292,7 @@ _gr_gr_mpoly_neg(gr_mpoly_t res, const gr_mpoly_t mat, gr_ctx_t ctx) int _gr_gr_mpoly_add(gr_mpoly_t res, const gr_mpoly_t poly1, const gr_mpoly_t poly2, gr_ctx_t ctx) { - if (poly1->length + poly2->length > ctx->size_limit) + if ((ulong) (poly1->length + poly2->length) > ctx->size_limit) return GR_UNABLE | gr_mpoly_zero(res, MPOLYNOMIAL_MCTX(ctx), MPOLYNOMIAL_ELEM_CTX(ctx)); return gr_mpoly_add(res, poly1, poly2, MPOLYNOMIAL_MCTX(ctx), MPOLYNOMIAL_ELEM_CTX(ctx)); @@ -293,7 +301,7 @@ _gr_gr_mpoly_add(gr_mpoly_t res, const gr_mpoly_t poly1, const gr_mpoly_t poly2, int _gr_gr_mpoly_sub(gr_mpoly_t res, const gr_mpoly_t poly1, const gr_mpoly_t poly2, gr_ctx_t ctx) { - if (poly1->length + poly2->length > ctx->size_limit) + if ((ulong) (poly1->length + poly2->length) > ctx->size_limit) return GR_UNABLE | gr_mpoly_zero(res, MPOLYNOMIAL_MCTX(ctx), MPOLYNOMIAL_ELEM_CTX(ctx)); return gr_mpoly_sub(res, poly1, poly2, MPOLYNOMIAL_MCTX(ctx), MPOLYNOMIAL_ELEM_CTX(ctx)); @@ -302,7 +310,7 @@ _gr_gr_mpoly_sub(gr_mpoly_t res, const gr_mpoly_t poly1, const gr_mpoly_t poly2, int _gr_gr_mpoly_mul(gr_mpoly_t res, const gr_mpoly_t poly1, const gr_mpoly_t poly2, gr_ctx_t ctx) { - if (poly1->length * poly2->length > ctx->size_limit) + if ((ulong) (poly1->length * poly2->length) > ctx->size_limit) return GR_UNABLE | gr_mpoly_zero(res, MPOLYNOMIAL_MCTX(ctx), MPOLYNOMIAL_ELEM_CTX(ctx)); return gr_mpoly_mul(res, poly1, poly2, MPOLYNOMIAL_MCTX(ctx), MPOLYNOMIAL_ELEM_CTX(ctx)); diff --git a/src/gr/nf.c b/src/gr/nf.c index 9b677e4d97..1a9bd87a45 100644 --- a/src/gr/nf.c +++ b/src/gr/nf.c @@ -21,6 +21,12 @@ #include "gr_poly.h" #include "gr_generic.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + typedef struct { nf_struct * nf; @@ -81,7 +87,7 @@ _gr_nf_clear(nf_elem_t x, const gr_ctx_t ctx) } void -_gr_nf_swap(nf_elem_t x, nf_elem_t y, const gr_ctx_t ctx) +_gr_nf_swap(nf_elem_t x, nf_elem_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { nf_elem_t t; *t = *x; @@ -90,7 +96,7 @@ _gr_nf_swap(nf_elem_t x, nf_elem_t y, const gr_ctx_t ctx) } void -_gr_nf_set_shallow(nf_elem_t res, const nf_elem_t x, const gr_ctx_t ctx) +_gr_nf_set_shallow(nf_elem_t res, const nf_elem_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } @@ -166,8 +172,6 @@ _gr_nf_set_fmpq(nf_elem_t res, const fmpq_t v, const gr_ctx_t ctx) return GR_SUCCESS; } -int gr_generic_set_other(gr_ptr res, gr_srcptr x, gr_ctx_t xctx, gr_ctx_t ctx); - int _gr_nf_set_other(nf_elem_t res, gr_ptr v, gr_ctx_t v_ctx, gr_ctx_t ctx) { diff --git a/src/gr/nmod.c b/src/gr/nmod.c index 6e85aa80c1..793ea91cce 100644 --- a/src/gr/nmod.c +++ b/src/gr/nmod.c @@ -20,6 +20,12 @@ #include "gr_poly.h" #include "gr_generic.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + typedef struct { nmod_t nmod; @@ -35,7 +41,6 @@ _gr_nmod_ctx_struct; /* when used as finite field when defining polynomial x - a, allow storing the coefficient a */ #define NMOD_CTX_A(ring_ctx) (&((((_gr_nmod_ctx_struct *)(ring_ctx))->a))) - void _gr_nmod_ctx_write(gr_stream_t out, gr_ctx_t ctx) { @@ -61,18 +66,18 @@ _gr_nmod_ctx_set_is_field(gr_ctx_t ctx, truth_t is_field) } void -_gr_nmod_init(ulong * x, const gr_ctx_t ctx) +_gr_nmod_init(ulong * x, const gr_ctx_t FLINT_UNUSED(ctx)) { x[0] = 0; } void -_gr_nmod_clear(ulong * x, const gr_ctx_t ctx) +_gr_nmod_clear(ulong * FLINT_UNUSED(x), const gr_ctx_t FLINT_UNUSED(ctx)) { } void -_gr_nmod_swap(ulong * x, ulong * y, const gr_ctx_t ctx) +_gr_nmod_swap(ulong * x, ulong * y, const gr_ctx_t FLINT_UNUSED(ctx)) { ulong t; t = *x; @@ -81,7 +86,7 @@ _gr_nmod_swap(ulong * x, ulong * y, const gr_ctx_t ctx) } void -_gr_nmod_set_shallow(ulong * res, const ulong * x, const gr_ctx_t ctx) +_gr_nmod_set_shallow(ulong * res, const ulong * x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } @@ -94,14 +99,14 @@ _gr_nmod_randtest(ulong * res, flint_rand_t state, const gr_ctx_t ctx) } int -_gr_nmod_write(gr_stream_t out, const ulong * x, const gr_ctx_t ctx) +_gr_nmod_write(gr_stream_t out, const ulong * x, const gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write_ui(out, x[0]); return GR_SUCCESS; } int -_gr_nmod_zero(ulong * x, const gr_ctx_t ctx) +_gr_nmod_zero(ulong * x, const gr_ctx_t FLINT_UNUSED(ctx)) { x[0] = 0; return GR_SUCCESS; @@ -137,7 +142,7 @@ _gr_nmod_set_fmpz(ulong * res, const fmpz_t v, const gr_ctx_t ctx) } int -_gr_nmod_get_fmpz(fmpz_t res, const ulong * x, const gr_ctx_t ctx) +_gr_nmod_get_fmpz(fmpz_t res, const ulong * x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_set_ui(res, x[0]); return GR_SUCCESS; @@ -237,7 +242,7 @@ _gr_nmod_set_other(ulong * res, gr_ptr v, gr_ctx_t v_ctx, const gr_ctx_t ctx) } truth_t -_gr_nmod_is_zero(const ulong * x, const gr_ctx_t ctx) +_gr_nmod_is_zero(const ulong * x, const gr_ctx_t FLINT_UNUSED(ctx)) { return (x[0] == 0) ? T_TRUE : T_FALSE; } @@ -255,13 +260,13 @@ _gr_nmod_is_neg_one(const ulong * x, const gr_ctx_t ctx) } truth_t -_gr_nmod_equal(const ulong * x, const ulong * y, const gr_ctx_t ctx) +_gr_nmod_equal(const ulong * x, const ulong * y, const gr_ctx_t FLINT_UNUSED(ctx)) { return (x[0] == y[0]) ? T_TRUE : T_FALSE; } int -_gr_nmod_set(ulong * res, const ulong * x, const gr_ctx_t ctx) +_gr_nmod_set(ulong * res, const ulong * x, const gr_ctx_t FLINT_UNUSED(ctx)) { res[0] = x[0]; return GR_SUCCESS; @@ -575,7 +580,7 @@ _gr_nmod_pow_fmpz(ulong * res, const ulong * x, const fmpz_t y, gr_ctx_t ctx) void -_gr_nmod_vec_init(ulong * res, slong len, gr_ctx_t ctx) +_gr_nmod_vec_init(ulong * res, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { slong i; @@ -584,12 +589,12 @@ _gr_nmod_vec_init(ulong * res, slong len, gr_ctx_t ctx) } void -_gr_nmod_vec_clear(ulong * res, slong len, gr_ctx_t ctx) +_gr_nmod_vec_clear(ulong * FLINT_UNUSED(res), slong FLINT_UNUSED(len), gr_ctx_t FLINT_UNUSED(ctx)) { } int -_gr_nmod_vec_set(ulong * res, const ulong * vec, slong len, gr_ctx_t ctx) +_gr_nmod_vec_set(ulong * res, const ulong * vec, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { slong i; @@ -600,7 +605,7 @@ _gr_nmod_vec_set(ulong * res, const ulong * vec, slong len, gr_ctx_t ctx) } int -_gr_nmod_vec_normalise(slong * res, const ulong * vec, slong len, gr_ctx_t ctx) +_gr_nmod_vec_normalise(slong * res, const ulong * vec, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { while (len > 0 && vec[len - 1] == 0) len--; @@ -610,7 +615,7 @@ _gr_nmod_vec_normalise(slong * res, const ulong * vec, slong len, gr_ctx_t ctx) } slong -_gr_nmod_vec_normalise_weak(const ulong * vec, slong len, gr_ctx_t ctx) +_gr_nmod_vec_normalise_weak(const ulong * vec, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { while (len > 0 && vec[len - 1] == 0) len--; @@ -943,7 +948,7 @@ _gr_nmod_vec_reciprocals(ulong * res, slong len, gr_ctx_t ctx) return GR_SUCCESS; } - if (mod.n <= len || mod.n % 2 == 0) + if (mod.n <= (ulong) len || mod.n % 2 == 0) return GR_DOMAIN; res[0] = 1; diff --git a/src/gr/nmod32.c b/src/gr/nmod32.c index a5c88b7c04..e104af7e6e 100644 --- a/src/gr/nmod32.c +++ b/src/gr/nmod32.c @@ -10,11 +10,17 @@ */ #include "fmpz.h" -//#include "fmpq.h" #include "nmod.h" #include "nmod_vec.h" #include "gr.h" #include "gr_mat.h" +#include "gr_generic.h" + +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif #define NMOD32_CTX_REF(ring_ctx) (((nmod_t *)((ring_ctx)))) #define NMOD32_CTX(ring_ctx) (*NMOD32_CTX_REF(ring_ctx)) @@ -33,24 +39,24 @@ nmod32_ctx_write(gr_stream_t out, gr_ctx_t ctx) /* we don't want to call n_is_prime because this predicate should be fast. allow storing a flag in the context object? */ truth_t -nmod32_ctx_is_field(const gr_ctx_t ctx) +nmod32_ctx_is_field(const gr_ctx_t FLINT_UNUSED(ctx)) { return T_UNKNOWN; } void -nmod32_init(nmod32_t x, const gr_ctx_t ctx) +nmod32_init(nmod32_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { x[0] = 0; } void -nmod32_clear(nmod32_t x, const gr_ctx_t ctx) +nmod32_clear(nmod32_t FLINT_UNUSED(x), const gr_ctx_t FLINT_UNUSED(ctx)) { } void -nmod32_swap(nmod32_t x, nmod32_t y, const gr_ctx_t ctx) +nmod32_swap(nmod32_t x, nmod32_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { nmod32_t t; *t = *x; @@ -59,7 +65,7 @@ nmod32_swap(nmod32_t x, nmod32_t y, const gr_ctx_t ctx) } void -nmod32_set_shallow(nmod32_t res, const nmod32_t x, const gr_ctx_t ctx) +nmod32_set_shallow(nmod32_t res, const nmod32_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } @@ -72,14 +78,14 @@ nmod32_randtest(nmod32_t res, flint_rand_t state, const gr_ctx_t ctx) } int -nmod32_write(gr_stream_t out, const nmod32_t x, const gr_ctx_t ctx) +nmod32_write(gr_stream_t out, const nmod32_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write_ui(out, x[0]); return GR_SUCCESS; } int -nmod32_zero(nmod32_t x, const gr_ctx_t ctx) +nmod32_zero(nmod32_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { x[0] = 0; return GR_SUCCESS; @@ -124,7 +130,7 @@ nmod32_set_fmpz(nmod32_t res, const fmpz_t v, const gr_ctx_t ctx) } truth_t -nmod32_is_zero(const nmod32_t x, const gr_ctx_t ctx) +nmod32_is_zero(const nmod32_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return (x[0] == 0) ? T_TRUE : T_FALSE; } @@ -142,13 +148,13 @@ nmod32_is_neg_one(const nmod32_t x, const gr_ctx_t ctx) } truth_t -nmod32_equal(const nmod32_t x, const nmod32_t y, const gr_ctx_t ctx) +nmod32_equal(const nmod32_t x, const nmod32_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { return (x[0] == y[0]) ? T_TRUE : T_FALSE; } int -nmod32_set(nmod32_t res, const nmod32_t x, const gr_ctx_t ctx) +nmod32_set(nmod32_t res, const nmod32_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { res[0] = x[0]; return GR_SUCCESS; @@ -330,7 +336,7 @@ nmod32_div_nonunique(nmod32_t res, const nmod32_t x, const nmod32_t y, const gr_ } void -_nmod32_vec_init(nmod32_struct * res, slong len, gr_ctx_t ctx) +_nmod32_vec_init(nmod32_struct * res, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { slong i; @@ -339,12 +345,12 @@ _nmod32_vec_init(nmod32_struct * res, slong len, gr_ctx_t ctx) } void -_nmod32_vec_clear(nmod32_struct * res, slong len, gr_ctx_t ctx) +_nmod32_vec_clear(nmod32_struct * FLINT_UNUSED(res), slong FLINT_UNUSED(len), gr_ctx_t FLINT_UNUSED(ctx)) { } int -_nmod32_vec_set(nmod32_struct * res, const nmod32_struct * vec, slong len, gr_ctx_t ctx) +_nmod32_vec_set(nmod32_struct * res, const nmod32_struct * vec, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { slong i; diff --git a/src/gr/nmod8.c b/src/gr/nmod8.c index 1c1622bbf1..bb0eae7658 100644 --- a/src/gr/nmod8.c +++ b/src/gr/nmod8.c @@ -10,11 +10,17 @@ */ #include "fmpz.h" -//#include "fmpq.h" #include "nmod.h" #include "nmod_vec.h" #include "gr.h" #include "gr_mat.h" +#include "gr_generic.h" + +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif #define NMOD8_CTX_REF(ring_ctx) (((nmod_t *)((ring_ctx)))) #define NMOD8_CTX(ring_ctx) (*NMOD8_CTX_REF(ring_ctx)) @@ -39,18 +45,18 @@ nmod8_ctx_is_field(const gr_ctx_t ctx) } void -nmod8_init(nmod8_t x, const gr_ctx_t ctx) +nmod8_init(nmod8_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { x[0] = 0; } void -nmod8_clear(nmod8_t x, const gr_ctx_t ctx) +nmod8_clear(nmod8_t FLINT_UNUSED(x), const gr_ctx_t FLINT_UNUSED(ctx)) { } void -nmod8_swap(nmod8_t x, nmod8_t y, const gr_ctx_t ctx) +nmod8_swap(nmod8_t x, nmod8_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { nmod8_t t; *t = *x; @@ -59,7 +65,7 @@ nmod8_swap(nmod8_t x, nmod8_t y, const gr_ctx_t ctx) } void -nmod8_set_shallow(nmod8_t res, const nmod8_t x, const gr_ctx_t ctx) +nmod8_set_shallow(nmod8_t res, const nmod8_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } @@ -72,14 +78,14 @@ nmod8_randtest(nmod8_t res, flint_rand_t state, const gr_ctx_t ctx) } int -nmod8_write(gr_stream_t out, const nmod8_t x, const gr_ctx_t ctx) +nmod8_write(gr_stream_t out, const nmod8_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write_ui(out, x[0]); return GR_SUCCESS; } int -nmod8_zero(nmod8_t x, const gr_ctx_t ctx) +nmod8_zero(nmod8_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { x[0] = 0; return GR_SUCCESS; @@ -124,7 +130,7 @@ nmod8_set_fmpz(nmod8_t res, const fmpz_t v, const gr_ctx_t ctx) } truth_t -nmod8_is_zero(const nmod8_t x, const gr_ctx_t ctx) +nmod8_is_zero(const nmod8_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return (x[0] == 0) ? T_TRUE : T_FALSE; } @@ -142,13 +148,13 @@ nmod8_is_neg_one(const nmod8_t x, const gr_ctx_t ctx) } truth_t -nmod8_equal(const nmod8_t x, const nmod8_t y, const gr_ctx_t ctx) +nmod8_equal(const nmod8_t x, const nmod8_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { return (x[0] == y[0]) ? T_TRUE : T_FALSE; } int -nmod8_set(nmod8_t res, const nmod8_t x, const gr_ctx_t ctx) +nmod8_set(nmod8_t res, const nmod8_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { res[0] = x[0]; return GR_SUCCESS; @@ -330,7 +336,7 @@ nmod8_div_nonunique(nmod8_t res, const nmod8_t x, const nmod8_t y, const gr_ctx_ } void -_nmod8_vec_init(nmod8_struct * res, slong len, gr_ctx_t ctx) +_nmod8_vec_init(nmod8_struct * res, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { slong i; @@ -339,12 +345,12 @@ _nmod8_vec_init(nmod8_struct * res, slong len, gr_ctx_t ctx) } void -_nmod8_vec_clear(nmod8_struct * res, slong len, gr_ctx_t ctx) +_nmod8_vec_clear(nmod8_struct * FLINT_UNUSED(res), slong FLINT_UNUSED(len), gr_ctx_t FLINT_UNUSED(ctx)) { } int -_nmod8_vec_set(nmod8_struct * res, const nmod8_struct * vec, slong len, gr_ctx_t ctx) +_nmod8_vec_set(nmod8_struct * res, const nmod8_struct * vec, slong len, gr_ctx_t FLINT_UNUSED(ctx)) { slong i; diff --git a/src/gr/perm.c b/src/gr/perm.c index fbdb87bf9d..6b15036097 100644 --- a/src/gr/perm.c +++ b/src/gr/perm.c @@ -13,6 +13,13 @@ #include "fmpz.h" #include "fmpz_mat.h" #include "gr.h" +#include "gr_generic.h" + +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif #define PERM_N(ctx) (*((ulong *) (ctx))) @@ -41,14 +48,14 @@ _gr_perm_init(perm_t res, gr_ctx_t ctx) } int -_gr_perm_clear(perm_t res, gr_ctx_t ctx) +_gr_perm_clear(perm_t res, gr_ctx_t FLINT_UNUSED(ctx)) { _perm_clear(res->entries); return GR_SUCCESS; } void -_gr_perm_swap(perm_t x, perm_t y, gr_ctx_t ctx) +_gr_perm_swap(perm_t x, perm_t y, gr_ctx_t FLINT_UNUSED(ctx)) { perm_struct t = *x; *x = *y; @@ -58,7 +65,7 @@ _gr_perm_swap(perm_t x, perm_t y, gr_ctx_t ctx) int _gr_perm_write(gr_stream_t out, perm_t x, gr_ctx_t ctx) { - slong i; + ulong i; gr_stream_write(out, "["); diff --git a/src/gr/polynomial.c b/src/gr/polynomial.c index 371675ea4c..76861d4ce4 100644 --- a/src/gr/polynomial.c +++ b/src/gr/polynomial.c @@ -25,6 +25,14 @@ # include #endif +/* FIXME: Should these functions be static or not? */ + +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + static const char * default_var = "x"; void @@ -105,7 +113,7 @@ polynomial_swap(gr_poly_t poly1, gr_poly_t poly2, gr_ctx_t ctx) } void -polynomial_set_shallow(gr_poly_t res, const gr_poly_t x, const gr_ctx_t ctx) +polynomial_set_shallow(gr_poly_t res, const gr_poly_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } diff --git a/src/gr/psl2z.c b/src/gr/psl2z.c index 725bda4b38..a18e030061 100644 --- a/src/gr/psl2z.c +++ b/src/gr/psl2z.c @@ -12,35 +12,42 @@ #include "fmpz_mat.h" #include "acb_modular.h" #include "gr.h" +#include "gr_generic.h" -int _gr_psl2z_ctx_write(gr_stream_t out, gr_ctx_t ctx) +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + +int _gr_psl2z_ctx_write(gr_stream_t out, gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write(out, "Modular group (psl2z)"); return GR_SUCCESS; } int -_gr_psl2z_init(psl2z_t res, gr_ctx_t ctx) +_gr_psl2z_init(psl2z_t res, gr_ctx_t FLINT_UNUSED(ctx)) { psl2z_init(res); return GR_SUCCESS; } int -_gr_psl2z_clear(psl2z_t res, gr_ctx_t ctx) +_gr_psl2z_clear(psl2z_t res, gr_ctx_t FLINT_UNUSED(ctx)) { psl2z_clear(res); return GR_SUCCESS; } void -_gr_psl2z_swap(psl2z_t x, psl2z_t y, gr_ctx_t ctx) +_gr_psl2z_swap(psl2z_t x, psl2z_t y, gr_ctx_t FLINT_UNUSED(ctx)) { psl2z_swap(x, y); } int -_gr_psl2z_write(gr_stream_t out, psl2z_t x, gr_ctx_t ctx) +_gr_psl2z_write(gr_stream_t out, psl2z_t x, gr_ctx_t FLINT_UNUSED(ctx)) { gr_stream_write(out, "[["); gr_stream_write_fmpz(out, &x->a); @@ -55,7 +62,7 @@ _gr_psl2z_write(gr_stream_t out, psl2z_t x, gr_ctx_t ctx) } int -_gr_psl2z_randtest(psl2z_t res, flint_rand_t state, gr_ctx_t ctx) +_gr_psl2z_randtest(psl2z_t res, flint_rand_t state, gr_ctx_t FLINT_UNUSED(ctx)) { if (n_randint(state, 4)) psl2z_randtest(res, state, 8); @@ -65,20 +72,20 @@ _gr_psl2z_randtest(psl2z_t res, flint_rand_t state, gr_ctx_t ctx) } truth_t -_gr_psl2z_equal(const psl2z_t x, const psl2z_t y, gr_ctx_t ctx) +_gr_psl2z_equal(const psl2z_t x, const psl2z_t y, gr_ctx_t FLINT_UNUSED(ctx)) { return psl2z_equal(x, y) ? T_TRUE : T_FALSE; } int -_gr_psl2z_set(psl2z_t res, const psl2z_t x, gr_ctx_t ctx) +_gr_psl2z_set(psl2z_t res, const psl2z_t x, gr_ctx_t FLINT_UNUSED(ctx)) { psl2z_set(res, x); return GR_SUCCESS; } int -_gr_psl2z_set_other(psl2z_t res, gr_srcptr x, gr_ctx_t x_ctx, gr_ctx_t ctx) +_gr_psl2z_set_other(psl2z_t res, gr_srcptr x, gr_ctx_t x_ctx, gr_ctx_t FLINT_UNUSED(ctx)) { if (x_ctx->which_ring == GR_CTX_PSL2Z) { @@ -124,20 +131,20 @@ _gr_psl2z_set_other(psl2z_t res, gr_srcptr x, gr_ctx_t x_ctx, gr_ctx_t ctx) } int -_gr_psl2z_one(psl2z_t res, gr_ctx_t ctx) +_gr_psl2z_one(psl2z_t res, gr_ctx_t FLINT_UNUSED(ctx)) { psl2z_one(res); return GR_SUCCESS; } truth_t -_gr_psl2z_is_one(const psl2z_t x, gr_ctx_t ctx) +_gr_psl2z_is_one(const psl2z_t x, gr_ctx_t FLINT_UNUSED(ctx)) { return psl2z_is_one(x) ? T_TRUE : T_FALSE; } int -_gr_psl2z_mul(psl2z_t res, const psl2z_t x, const psl2z_t y, gr_ctx_t ctx) +_gr_psl2z_mul(psl2z_t res, const psl2z_t x, const psl2z_t y, gr_ctx_t FLINT_UNUSED(ctx)) { psl2z_mul(res, x, y); return GR_SUCCESS; @@ -145,7 +152,7 @@ _gr_psl2z_mul(psl2z_t res, const psl2z_t x, const psl2z_t y, gr_ctx_t ctx) /* todo: should be generic. also want left division */ int -_gr_psl2z_div(psl2z_t res, const psl2z_t x, const psl2z_t y, gr_ctx_t ctx) +_gr_psl2z_div(psl2z_t res, const psl2z_t x, const psl2z_t y, gr_ctx_t FLINT_UNUSED(ctx)) { psl2z_t t; psl2z_init(t); @@ -156,7 +163,7 @@ _gr_psl2z_div(psl2z_t res, const psl2z_t x, const psl2z_t y, gr_ctx_t ctx) } int -_gr_psl2z_inv(psl2z_t res, const psl2z_t x, gr_ctx_t ctx) +_gr_psl2z_inv(psl2z_t res, const psl2z_t x, gr_ctx_t FLINT_UNUSED(ctx)) { psl2z_inv(res, x); return GR_SUCCESS; diff --git a/src/gr/qqbar.c b/src/gr/qqbar.c index 0630550d78..e4112dea69 100644 --- a/src/gr/qqbar.c +++ b/src/gr/qqbar.c @@ -22,6 +22,12 @@ #include "gr_poly.h" #include "ca.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + typedef struct { /* todo: use which_ring */ @@ -64,19 +70,19 @@ _gr_qqbar_ctx_write(gr_stream_t out, gr_ctx_t ctx) } void -_gr_qqbar_init(qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_init(qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_init(x); } void -_gr_qqbar_clear(qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_clear(qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_clear(x); } void -_gr_qqbar_swap(qqbar_t x, qqbar_t y, const gr_ctx_t ctx) +_gr_qqbar_swap(qqbar_t x, qqbar_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_t t; *t = *x; @@ -85,7 +91,7 @@ _gr_qqbar_swap(qqbar_t x, qqbar_t y, const gr_ctx_t ctx) } void -_gr_qqbar_set_shallow(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_set_shallow(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } @@ -130,7 +136,7 @@ void qqbar_get_decimal_root_nearest(char ** re_s, char ** im_s, const qqbar_t x, slong default_digits); int -_gr_qqbar_write(gr_stream_t out, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_write(gr_stream_t out, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { char *re_s, *im_s; @@ -189,49 +195,49 @@ _gr_qqbar_write(gr_stream_t out, const qqbar_t x, const gr_ctx_t ctx) } int -_gr_qqbar_zero(qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_zero(qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_zero(x); return GR_SUCCESS; } int -_gr_qqbar_one(qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_one(qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_one(x); return GR_SUCCESS; } int -_gr_qqbar_set_si(qqbar_t res, slong v, const gr_ctx_t ctx) +_gr_qqbar_set_si(qqbar_t res, slong v, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_set_si(res, v); return GR_SUCCESS; } int -_gr_qqbar_set_ui(qqbar_t res, ulong v, const gr_ctx_t ctx) +_gr_qqbar_set_ui(qqbar_t res, ulong v, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_set_ui(res, v); return GR_SUCCESS; } int -_gr_qqbar_set_fmpz(qqbar_t res, const fmpz_t v, const gr_ctx_t ctx) +_gr_qqbar_set_fmpz(qqbar_t res, const fmpz_t v, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_set_fmpz(res, v); return GR_SUCCESS; } int -_gr_qqbar_set_fmpq(qqbar_t res, const fmpq_t v, const gr_ctx_t ctx) +_gr_qqbar_set_fmpq(qqbar_t res, const fmpq_t v, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_set_fmpq(res, v); return GR_SUCCESS; } int -_gr_qqbar_set_d(qqbar_t res, double v, const gr_ctx_t ctx) +_gr_qqbar_set_d(qqbar_t res, double v, const gr_ctx_t FLINT_UNUSED(ctx)) { if (qqbar_set_d(res, v)) return GR_SUCCESS; @@ -240,31 +246,31 @@ _gr_qqbar_set_d(qqbar_t res, double v, const gr_ctx_t ctx) } truth_t -_gr_qqbar_is_zero(const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_is_zero(const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return qqbar_is_zero(x) ? T_TRUE : T_FALSE; } truth_t -_gr_qqbar_is_one(const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_is_one(const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return qqbar_is_one(x) ? T_TRUE : T_FALSE; } truth_t -_gr_qqbar_is_neg_one(const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_is_neg_one(const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return qqbar_is_neg_one(x) ? T_TRUE : T_FALSE; } truth_t -_gr_qqbar_equal(const qqbar_t x, const qqbar_t y, const gr_ctx_t ctx) +_gr_qqbar_equal(const qqbar_t x, const qqbar_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { return qqbar_equal(x, y) ? T_TRUE : T_FALSE; } int -_gr_qqbar_set(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_set(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_set(res, x); return GR_SUCCESS; @@ -345,7 +351,7 @@ _gr_qqbar_set_other(qqbar_t res, gr_srcptr x, gr_ctx_t x_ctx, gr_ctx_t ctx) } int -_gr_qqbar_get_fmpz(fmpz_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_get_fmpz(fmpz_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!qqbar_is_integer(x)) return GR_DOMAIN; @@ -355,7 +361,7 @@ _gr_qqbar_get_fmpz(fmpz_t res, const qqbar_t x, const gr_ctx_t ctx) } int -_gr_qqbar_get_ui(ulong * res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_get_ui(ulong * res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_t t; int status; @@ -381,7 +387,7 @@ _gr_qqbar_get_ui(ulong * res, const qqbar_t x, const gr_ctx_t ctx) } int -_gr_qqbar_get_si(slong * res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_get_si(slong * res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_t t; int status; @@ -407,7 +413,7 @@ _gr_qqbar_get_si(slong * res, const qqbar_t x, const gr_ctx_t ctx) } int -_gr_qqbar_get_fmpq(fmpq_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_get_fmpq(fmpq_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!qqbar_is_rational(x)) return GR_DOMAIN; @@ -417,7 +423,7 @@ _gr_qqbar_get_fmpq(fmpq_t res, const qqbar_t x, const gr_ctx_t ctx) } int -_gr_qqbar_get_d(double * res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_get_d(double * res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { arb_t t; @@ -432,7 +438,7 @@ _gr_qqbar_get_d(double * res, const qqbar_t x, const gr_ctx_t ctx) } int -_gr_qqbar_get_fexpr(fexpr_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_get_fexpr(fexpr_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!qqbar_get_fexpr_formula(res, x, QQBAR_FORMULA_GAUSSIANS | QQBAR_FORMULA_QUADRATICS)) qqbar_get_fexpr_root_nearest(res, x); @@ -440,7 +446,7 @@ _gr_qqbar_get_fexpr(fexpr_t res, const qqbar_t x, const gr_ctx_t ctx) } int -_gr_qqbar_get_fexpr_serialize(fexpr_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_get_fexpr_serialize(fexpr_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_get_fexpr_repr(res, x); return GR_SUCCESS; @@ -464,7 +470,7 @@ int _gr_qqbar_set_fexpr(gr_ptr res, fexpr_vec_t inputs, gr_vec_t outputs, const } int -_gr_qqbar_neg(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_neg(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_neg(res, x); return GR_SUCCESS; @@ -482,28 +488,28 @@ _gr_qqbar_add(qqbar_t res, const qqbar_t x, const qqbar_t y, const gr_ctx_t ctx) } int -_gr_qqbar_add_si(qqbar_t res, const qqbar_t x, slong y, const gr_ctx_t ctx) +_gr_qqbar_add_si(qqbar_t res, const qqbar_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_add_si(res, x, y); return GR_SUCCESS; } int -_gr_qqbar_add_ui(qqbar_t res, const qqbar_t x, ulong y, const gr_ctx_t ctx) +_gr_qqbar_add_ui(qqbar_t res, const qqbar_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_add_ui(res, x, y); return GR_SUCCESS; } int -_gr_qqbar_add_fmpz(qqbar_t res, const qqbar_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_qqbar_add_fmpz(qqbar_t res, const qqbar_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_add_fmpz(res, x, y); return GR_SUCCESS; } int -_gr_qqbar_add_fmpq(qqbar_t res, const qqbar_t x, const fmpq_t y, const gr_ctx_t ctx) +_gr_qqbar_add_fmpq(qqbar_t res, const qqbar_t x, const fmpq_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_add_fmpq(res, x, y); return GR_SUCCESS; @@ -521,28 +527,28 @@ _gr_qqbar_sub(qqbar_t res, const qqbar_t x, const qqbar_t y, const gr_ctx_t ctx) } int -_gr_qqbar_sub_si(qqbar_t res, const qqbar_t x, slong y, const gr_ctx_t ctx) +_gr_qqbar_sub_si(qqbar_t res, const qqbar_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_sub_si(res, x, y); return GR_SUCCESS; } int -_gr_qqbar_sub_ui(qqbar_t res, const qqbar_t x, ulong y, const gr_ctx_t ctx) +_gr_qqbar_sub_ui(qqbar_t res, const qqbar_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_sub_ui(res, x, y); return GR_SUCCESS; } int -_gr_qqbar_sub_fmpz(qqbar_t res, const qqbar_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_qqbar_sub_fmpz(qqbar_t res, const qqbar_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_sub_fmpz(res, x, y); return GR_SUCCESS; } int -_gr_qqbar_sub_fmpq(qqbar_t res, const qqbar_t x, const fmpq_t y, const gr_ctx_t ctx) +_gr_qqbar_sub_fmpq(qqbar_t res, const qqbar_t x, const fmpq_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_sub_fmpq(res, x, y); return GR_SUCCESS; @@ -560,35 +566,35 @@ _gr_qqbar_mul(qqbar_t res, const qqbar_t x, const qqbar_t y, const gr_ctx_t ctx) } int -_gr_qqbar_mul_si(qqbar_t res, const qqbar_t x, slong y, const gr_ctx_t ctx) +_gr_qqbar_mul_si(qqbar_t res, const qqbar_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_mul_si(res, x, y); return GR_SUCCESS; } int -_gr_qqbar_mul_ui(qqbar_t res, const qqbar_t x, ulong y, const gr_ctx_t ctx) +_gr_qqbar_mul_ui(qqbar_t res, const qqbar_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_mul_ui(res, x, y); return GR_SUCCESS; } int -_gr_qqbar_mul_fmpz(qqbar_t res, const qqbar_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_qqbar_mul_fmpz(qqbar_t res, const qqbar_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_mul_fmpz(res, x, y); return GR_SUCCESS; } int -_gr_qqbar_mul_fmpq(qqbar_t res, const qqbar_t x, const fmpq_t y, const gr_ctx_t ctx) +_gr_qqbar_mul_fmpq(qqbar_t res, const qqbar_t x, const fmpq_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_mul_fmpq(res, x, y); return GR_SUCCESS; } int -_gr_qqbar_inv(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_inv(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (qqbar_is_zero(x)) { @@ -620,7 +626,7 @@ _gr_qqbar_div(qqbar_t res, const qqbar_t x, const qqbar_t y, const gr_ctx_t ctx) } int -_gr_qqbar_div_si(qqbar_t res, const qqbar_t x, slong y, const gr_ctx_t ctx) +_gr_qqbar_div_si(qqbar_t res, const qqbar_t x, slong y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (y == 0) { @@ -634,7 +640,7 @@ _gr_qqbar_div_si(qqbar_t res, const qqbar_t x, slong y, const gr_ctx_t ctx) } int -_gr_qqbar_div_ui(qqbar_t res, const qqbar_t x, ulong y, const gr_ctx_t ctx) +_gr_qqbar_div_ui(qqbar_t res, const qqbar_t x, ulong y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (y == 0) { @@ -648,7 +654,7 @@ _gr_qqbar_div_ui(qqbar_t res, const qqbar_t x, ulong y, const gr_ctx_t ctx) } int -_gr_qqbar_div_fmpz(qqbar_t res, const qqbar_t x, const fmpz_t y, const gr_ctx_t ctx) +_gr_qqbar_div_fmpz(qqbar_t res, const qqbar_t x, const fmpz_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpz_is_zero(y)) { @@ -662,7 +668,7 @@ _gr_qqbar_div_fmpz(qqbar_t res, const qqbar_t x, const fmpz_t y, const gr_ctx_t } int -_gr_qqbar_div_fmpq(qqbar_t res, const qqbar_t x, const fmpq_t y, const gr_ctx_t ctx) +_gr_qqbar_div_fmpq(qqbar_t res, const qqbar_t x, const fmpq_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (fmpq_is_zero(y)) { @@ -676,7 +682,7 @@ _gr_qqbar_div_fmpq(qqbar_t res, const qqbar_t x, const fmpq_t y, const gr_ctx_t } truth_t -_gr_qqbar_is_invertible(const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_is_invertible(const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { return !qqbar_is_zero(x) ? T_TRUE : T_FALSE; } @@ -877,14 +883,14 @@ _gr_qqbar_rsqrt(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) } int -_gr_qqbar_numerator(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_numerator(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_numerator(res, x); return GR_SUCCESS; } int -_gr_qqbar_denominator(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_denominator(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { fmpz_t t; fmpz_init(t); @@ -896,7 +902,7 @@ _gr_qqbar_denominator(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) /* todo: could special-case rationals */ int -_gr_qqbar_floor(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_floor(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (qqbar_is_integer(x)) { @@ -915,7 +921,7 @@ _gr_qqbar_floor(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) } int -_gr_qqbar_ceil(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_ceil(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (qqbar_is_integer(x)) { @@ -934,7 +940,7 @@ _gr_qqbar_ceil(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) } int -_gr_qqbar_trunc(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_trunc(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (qqbar_is_integer(x)) { @@ -968,7 +974,7 @@ _gr_qqbar_trunc(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) /* todo: fast numerical path */ int -_gr_qqbar_nint(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_nint(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { if (qqbar_is_integer(x)) { @@ -1020,7 +1026,7 @@ _gr_qqbar_i(qqbar_t res, const gr_ctx_t ctx) } int -_gr_qqbar_abs(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_abs(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_abs(res, x); return GR_SUCCESS; @@ -1028,7 +1034,7 @@ _gr_qqbar_abs(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) /* todo: exploit when we know that the field is real */ int -_gr_qqbar_conj(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_conj(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_conj(res, x); return GR_SUCCESS; @@ -1036,7 +1042,7 @@ _gr_qqbar_conj(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) /* todo: exploit when we know that the field is real */ int -_gr_qqbar_re(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_re(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_re(res, x); return GR_SUCCESS; @@ -1044,28 +1050,28 @@ _gr_qqbar_re(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) /* todo: exploit when we know that the field is real */ int -_gr_qqbar_im(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_im(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_im(res, x); return GR_SUCCESS; } int -_gr_qqbar_sgn(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_sgn(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_sgn(res, x); return GR_SUCCESS; } int -_gr_qqbar_csgn(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) +_gr_qqbar_csgn(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) { qqbar_set_si(res, qqbar_csgn(x)); return GR_SUCCESS; } int -_gr_qqbar_cmp(int * res, const qqbar_t x, const qqbar_t y, const gr_ctx_t ctx) +_gr_qqbar_cmp(int * res, const qqbar_t x, const qqbar_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { if (!qqbar_is_real(x) || !qqbar_is_real(y)) return GR_DOMAIN; @@ -1075,7 +1081,7 @@ _gr_qqbar_cmp(int * res, const qqbar_t x, const qqbar_t y, const gr_ctx_t ctx) } int -_gr_qqbar_cmpabs(int * res, const qqbar_t x, const qqbar_t y, const gr_ctx_t ctx) +_gr_qqbar_cmpabs(int * res, const qqbar_t x, const qqbar_t y, const gr_ctx_t FLINT_UNUSED(ctx)) { *res = qqbar_cmpabs(x, y); return GR_SUCCESS; @@ -1130,7 +1136,7 @@ _gr_qqbar_ ## fn(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) \ #define TRIG3(fn) \ int \ -_gr_qqbar_ ## fn(qqbar_t res, const qqbar_t x, const gr_ctx_t ctx) \ +_gr_qqbar_ ## fn(qqbar_t res, const qqbar_t x, const gr_ctx_t FLINT_UNUSED(ctx)) \ { \ fmpq_t t; \ slong p; \ @@ -1165,7 +1171,7 @@ TRIG3(acsc_pi) /* todo: quickly skip nonreal roots over the real algebraic numbers */ int -_gr_qqbar_poly_roots(gr_vec_t roots, gr_vec_t mult, const gr_poly_t poly, int flags, gr_ctx_t ctx) +_gr_qqbar_poly_roots(gr_vec_t roots, gr_vec_t mult, const gr_poly_t poly, int FLINT_UNUSED(flags), gr_ctx_t ctx) { int status; gr_ctx_t ZZ, Rx; diff --git a/src/gr/series.c b/src/gr/series.c index 2075e84b8a..c6bd291615 100644 --- a/src/gr/series.c +++ b/src/gr/series.c @@ -21,6 +21,12 @@ # include #endif +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define SERIES_ERR_EXACT WORD_MAX #define SERIES_ERR_MAX WORD_MAX / 4 @@ -82,27 +88,27 @@ gr_poly_sub_series(gr_poly_t res, const gr_poly_t poly1, } void -gr_series_init(gr_series_t res, gr_series_ctx_t sctx, gr_ctx_t cctx) +gr_series_init(gr_series_t res, gr_series_ctx_t FLINT_UNUSED(sctx), gr_ctx_t cctx) { gr_poly_init(&res->poly, cctx); res->error = SERIES_ERR_EXACT; } void -gr_series_clear(gr_series_t res, gr_series_ctx_t sctx, gr_ctx_t cctx) +gr_series_clear(gr_series_t res, gr_series_ctx_t FLINT_UNUSED(sctx), gr_ctx_t cctx) { gr_poly_clear(&res->poly, cctx); } int -gr_series_zero(gr_series_t res, gr_series_ctx_t sctx, gr_ctx_t cctx) +gr_series_zero(gr_series_t res, gr_series_ctx_t FLINT_UNUSED(sctx), gr_ctx_t cctx) { res->error = SERIES_ERR_EXACT; return gr_poly_zero(&res->poly, cctx); } void -gr_series_swap(gr_series_t x, gr_series_t y, gr_series_ctx_t sctx, gr_ctx_t cctx) +gr_series_swap(gr_series_t x, gr_series_t y, gr_series_ctx_t FLINT_UNUSED(sctx), gr_ctx_t FLINT_UNUSED(cctx)) { gr_series_t tmp; *tmp = *x; @@ -111,7 +117,7 @@ gr_series_swap(gr_series_t x, gr_series_t y, gr_series_ctx_t sctx, gr_ctx_t cctx } int -gr_series_randtest(gr_series_t res, flint_rand_t state, slong len, gr_series_ctx_t sctx, gr_ctx_t cctx) +gr_series_randtest(gr_series_t res, flint_rand_t state, slong len, gr_series_ctx_t FLINT_UNUSED(sctx), gr_ctx_t cctx) { int status = gr_poly_randtest(&res->poly, state, len, cctx); @@ -127,7 +133,7 @@ gr_series_randtest(gr_series_t res, flint_rand_t state, slong len, gr_series_ctx } int -gr_series_write(gr_stream_t out, const gr_series_t x, const char * var, gr_series_ctx_t sctx, gr_ctx_t cctx) +gr_series_write(gr_stream_t out, const gr_series_t x, const char * var, gr_series_ctx_t FLINT_UNUSED(sctx), gr_ctx_t cctx) { gr_poly_write(out, &x->poly, var, cctx); @@ -327,7 +333,7 @@ gr_series_set_fmpq(gr_series_t res, const fmpq_t c, gr_series_ctx_t sctx, gr_ctx truth_t -gr_series_is_zero(const gr_series_t x, gr_series_ctx_t sctx, gr_ctx_t cctx) +gr_series_is_zero(const gr_series_t x, gr_series_ctx_t FLINT_UNUSED(sctx), gr_ctx_t cctx) { truth_t is_zero; @@ -344,7 +350,7 @@ gr_series_is_zero(const gr_series_t x, gr_series_ctx_t sctx, gr_ctx_t cctx) /* todo: recursive version */ int -gr_series_make_exact(gr_series_t x, gr_series_ctx_t sctx, gr_ctx_t cctx) +gr_series_make_exact(gr_series_t x, gr_series_ctx_t FLINT_UNUSED(sctx), gr_ctx_t FLINT_UNUSED(cctx)) { x->error = SERIES_ERR_EXACT; return GR_SUCCESS; @@ -369,7 +375,7 @@ _gr_poly_equal2(gr_srcptr poly1, slong len1, gr_srcptr poly2, slong len2, gr_ctx } truth_t -gr_series_is_one(const gr_series_t x, gr_series_ctx_t sctx, gr_ctx_t cctx) +gr_series_is_one(const gr_series_t x, gr_series_ctx_t FLINT_UNUSED(sctx), gr_ctx_t cctx) { truth_t is_zero, is_one; slong xlen = x->poly.length; @@ -404,7 +410,7 @@ gr_series_is_one(const gr_series_t x, gr_series_ctx_t sctx, gr_ctx_t cctx) truth_t -gr_series_equal(const gr_series_t x, const gr_series_t y, gr_series_ctx_t sctx, gr_ctx_t cctx) +gr_series_equal(const gr_series_t x, const gr_series_t y, gr_series_ctx_t FLINT_UNUSED(sctx), gr_ctx_t cctx) { truth_t equal; slong len, xlen, ylen, xerr, yerr, err; @@ -557,7 +563,7 @@ gr_series_inv(gr_series_t res, const gr_series_t x, gr_series_ctx_t sctx, gr_ctx } truth_t -gr_series_coeff_is_zero(const gr_series_t x, slong i, gr_series_ctx_t sctx, gr_ctx_t cctx) +gr_series_coeff_is_zero(const gr_series_t x, slong i, gr_series_ctx_t FLINT_UNUSED(sctx), gr_ctx_t cctx) { if (i >= x->error) return T_UNKNOWN; @@ -1812,7 +1818,7 @@ _gr_gr_series_gens_recursive(gr_vec_t vec, gr_ctx_t ctx) } static int _gr_gr_series_set(gr_series_t res, const gr_series_t x, gr_ctx_t ctx) { return gr_series_set(res, x, SERIES_SCTX(ctx), SERIES_ELEM_CTX(ctx)); } -static void _gr_gr_series_set_shallow(gr_series_t res, const gr_series_t x, gr_ctx_t ctx) { *res = *x; } +static void _gr_gr_series_set_shallow(gr_series_t res, const gr_series_t x, gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } static int _gr_gr_series_set_si(gr_series_t res, slong c, gr_ctx_t ctx) { return gr_series_set_si(res, c, SERIES_SCTX(ctx), SERIES_ELEM_CTX(ctx)); } static int _gr_gr_series_set_ui(gr_series_t res, ulong c, gr_ctx_t ctx) { return gr_series_set_ui(res, c, SERIES_SCTX(ctx), SERIES_ELEM_CTX(ctx)); } static int _gr_gr_series_set_fmpz(gr_series_t res, const fmpz_t c, gr_ctx_t ctx) { return gr_series_set_fmpz(res, c, SERIES_SCTX(ctx), SERIES_ELEM_CTX(ctx)); } @@ -1871,9 +1877,9 @@ static int _gr_gr_series_hypgeom_pfq(gr_series_t res, const gr_series_vec_t a, c static int _gr_gr_series_polylog(gr_series_t res, const gr_series_t s, const gr_series_t z, gr_ctx_t ctx) { return gr_series_polylog(res, s, z, SERIES_SCTX(ctx), SERIES_ELEM_CTX(ctx)); } static int _gr_gr_series_hurwitz_zeta(gr_series_t res, const gr_series_t s, const gr_series_t z, gr_ctx_t ctx) { return gr_series_hurwitz_zeta(res, s, z, SERIES_SCTX(ctx), SERIES_ELEM_CTX(ctx)); } -static int _gr_gr_series_dirichlet_l(gr_series_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const gr_series_t s, const gr_series_t z, gr_ctx_t ctx) { return gr_series_dirichlet_l(res, G, chi, s, SERIES_SCTX(ctx), SERIES_ELEM_CTX(ctx)); } -static int _gr_gr_series_dirichlet_hardy_theta(gr_series_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const gr_series_t s, const gr_series_t z, gr_ctx_t ctx) { return gr_series_dirichlet_hardy_theta(res, G, chi, s, SERIES_SCTX(ctx), SERIES_ELEM_CTX(ctx)); } -static int _gr_gr_series_dirichlet_hardy_z(gr_series_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const gr_series_t s, const gr_series_t z, gr_ctx_t ctx) { return gr_series_dirichlet_hardy_z(res, G, chi, s, SERIES_SCTX(ctx), SERIES_ELEM_CTX(ctx)); } +static int _gr_gr_series_dirichlet_l(gr_series_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const gr_series_t s, const gr_series_t FLINT_UNUSED(z), gr_ctx_t ctx) { return gr_series_dirichlet_l(res, G, chi, s, SERIES_SCTX(ctx), SERIES_ELEM_CTX(ctx)); } +static int _gr_gr_series_dirichlet_hardy_theta(gr_series_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const gr_series_t s, const gr_series_t FLINT_UNUSED(z), gr_ctx_t ctx) { return gr_series_dirichlet_hardy_theta(res, G, chi, s, SERIES_SCTX(ctx), SERIES_ELEM_CTX(ctx)); } +static int _gr_gr_series_dirichlet_hardy_z(gr_series_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const gr_series_t s, const gr_series_t FLINT_UNUSED(z), gr_ctx_t ctx) { return gr_series_dirichlet_hardy_z(res, G, chi, s, SERIES_SCTX(ctx), SERIES_ELEM_CTX(ctx)); } static int _gr_gr_series_jacobi_theta(gr_series_t res1, gr_series_t res2, gr_series_t res3, gr_series_t res4, const gr_series_t x, const gr_series_t tau, gr_ctx_t ctx) { return gr_series_jacobi_theta(res1, res2, res3, res4, x, tau, SERIES_SCTX(ctx), SERIES_ELEM_CTX(ctx)); } static int _gr_gr_series_jacobi_theta_1(gr_series_t res, const gr_series_t x, const gr_series_t tau, gr_ctx_t ctx) { return gr_series_jacobi_theta_1(res, x, tau, SERIES_SCTX(ctx), SERIES_ELEM_CTX(ctx)); } diff --git a/src/gr/series_mod.c b/src/gr/series_mod.c index 543b73e641..d1438cc0e5 100644 --- a/src/gr/series_mod.c +++ b/src/gr/series_mod.c @@ -21,6 +21,12 @@ # include #endif +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + static const char * default_var = "x"; static void _gr_gr_series_mod_ctx_clear(gr_ctx_t ctx) @@ -173,7 +179,7 @@ static int _gr_gr_series_mod_set(gr_poly_t res, const gr_poly_t x, gr_ctx_t ctx) return gr_poly_set(res, x, SERIES_MOD_ELEM_CTX(ctx)); } -static void _gr_gr_series_mod_set_shallow(gr_poly_t res, const gr_poly_t x, gr_ctx_t ctx) +static void _gr_gr_series_mod_set_shallow(gr_poly_t res, const gr_poly_t x, gr_ctx_t FLINT_UNUSED(ctx)) { *res = *x; } diff --git a/src/gr/test_ring.c b/src/gr/test_ring.c index d1a22be592..357611882b 100644 --- a/src/gr/test_ring.c +++ b/src/gr/test_ring.c @@ -20,6 +20,12 @@ #include "gr_mat.h" #include "gr_poly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + typedef int ((*gr_test_function)(gr_ctx_t, flint_rand_t, int)); int @@ -629,7 +635,7 @@ gr_test_get_set_fexpr(gr_ctx_t R, flint_rand_t state, int test_flags) } int -gr_test_ctx_get_str(gr_ctx_t R, flint_rand_t state, int test_flags) +gr_test_ctx_get_str(gr_ctx_t R, flint_rand_t FLINT_UNUSED(state), int FLINT_UNUSED(test_flags)) { int status = GR_SUCCESS; char * s; @@ -1388,7 +1394,7 @@ gr_test_zero_one(gr_ctx_t R, flint_rand_t state, int test_flags) } int -gr_test_randtest_not_zero(gr_ctx_t R, flint_rand_t state, int test_flags) +gr_test_randtest_not_zero(gr_ctx_t R, flint_rand_t state, int FLINT_UNUSED(test_flags)) { int status; gr_ptr a; @@ -4021,7 +4027,7 @@ gr_test_approx_binary_op_type_variants(gr_ctx_t R, } int -gr_test_approx_dot(gr_ctx_t R, gr_ctx_t R_ref, slong maxlen, gr_srcptr rel_tol, flint_rand_t state, int test_flags) +gr_test_approx_dot(gr_ctx_t R, gr_ctx_t R_ref, slong maxlen, gr_srcptr rel_tol, flint_rand_t state, int FLINT_UNUSED(test_flags)) { slong i, len; gr_ptr s0, vec1, vec2, res; diff --git a/src/gr/vector.c b/src/gr/vector.c index 4d5b98801b..07bdc0fef7 100644 --- a/src/gr/vector.c +++ b/src/gr/vector.c @@ -17,6 +17,14 @@ #include "gr_poly.h" #include "gr_special.h" +/* FIXME: Should these functions be static or not? */ + +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define ENTRY_CTX(ctx) (VECTOR_CTX(ctx)->base_ring) int From 090df2b593547186395533535e03122e5f7c693a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 15:44:56 +0200 Subject: [PATCH 096/114] ca --- src/ca.h | 8 ++++---- src/ca/asin.c | 2 +- src/ca/atan.c | 2 +- src/ca/can_evaluate_qqbar.c | 6 ++++++ src/ca/check_ge.c | 6 ++++++ src/ca/check_is_imaginary.c | 12 ++++++------ src/ca/check_is_negative_real.c | 10 +++++----- src/ca/check_is_real.c | 10 +++++----- src/ca/check_is_zero.c | 6 +++--- src/ca/clear.c | 6 ++++++ src/ca/conj.c | 10 ++++++++-- src/ca/exp.c | 4 ++-- src/ca/factor.c | 6 +++--- src/ca/factor_init.c | 2 +- src/ca/fmpz_mpoly_evaluate.c | 2 ++ src/ca/gamma.c | 6 ++++-- src/ca/get_fexpr.c | 24 +++++++++++++++--------- src/ca/get_qqbar.c | 2 +- src/ca/io.c | 18 ++++++++++++------ src/ca/log.c | 6 +++--- src/ca/merge_fields.c | 6 ++++++ src/ca/pow.c | 10 +++++----- src/ca/randtest.c | 2 +- src/ca/rewrite_complex_normal_form.c | 2 +- src/ca/set_fexpr.c | 2 +- src/ca/set_qqbar.c | 10 ++++++++-- src/ca/sin_cos.c | 4 ++-- src/ca/sqrt.c | 2 +- src/ca/sqrt_factor.c | 10 +++++----- src/ca/swap.c | 2 +- 30 files changed, 125 insertions(+), 73 deletions(-) diff --git a/src/ca.h b/src/ca.h index ee12508ee6..701a7341fc 100644 --- a/src/ca.h +++ b/src/ca.h @@ -252,12 +252,12 @@ void ca_randtest_special(ca_t res, flint_rand_t state, slong depth, slong bits, /* Representation properties */ -CA_INLINE int ca_is_special(const ca_t x, ca_ctx_t ctx) +CA_INLINE int ca_is_special(const ca_t x, ca_ctx_t FLINT_UNUSED(ctx)) { return CA_IS_SPECIAL(x); } -CA_INLINE int ca_is_unknown(const ca_t x, ca_ctx_t ctx) +CA_INLINE int ca_is_unknown(const ca_t x, ca_ctx_t FLINT_UNUSED(ctx)) { return CA_IS_UNKNOWN(x); } @@ -282,12 +282,12 @@ CA_INLINE int ca_is_qq_elem_integer(const ca_t x, ca_ctx_t ctx) return CA_IS_QQ(x, ctx) && fmpz_is_one(CA_FMPQ_DENREF(x)); } -CA_INLINE int ca_is_nf_elem(const ca_t x, ca_ctx_t ctx) +CA_INLINE int ca_is_nf_elem(const ca_t x, ca_ctx_t FLINT_UNUSED(ctx)) { return !CA_IS_SPECIAL(x) && CA_FIELD_IS_NF(CA_FIELD(x, ctx)); } -CA_INLINE int ca_is_generic_elem(const ca_t x, ca_ctx_t ctx) +CA_INLINE int ca_is_generic_elem(const ca_t x, ca_ctx_t FLINT_UNUSED(ctx)) { return !CA_IS_SPECIAL(x) && CA_FIELD_IS_GENERIC(CA_FIELD(x, ctx)); } diff --git a/src/ca/asin.c b/src/ca/asin.c index ac8f256a5a..71a1432592 100644 --- a/src/ca/asin.c +++ b/src/ca/asin.c @@ -11,7 +11,7 @@ #include "ca.h" -void +static void ca_asin_special(ca_t res, const ca_t x, ca_ctx_t ctx) { if (ca_check_is_signed_inf(x, ctx) == T_TRUE) diff --git a/src/ca/atan.c b/src/ca/atan.c index 9b80ede783..bfb985e825 100644 --- a/src/ca/atan.c +++ b/src/ca/atan.c @@ -11,7 +11,7 @@ #include "ca.h" -void +static void ca_atan_special(ca_t res, const ca_t x, ca_ctx_t ctx) { if (ca_check_is_signed_inf(x, ctx) == T_TRUE) diff --git a/src/ca/can_evaluate_qqbar.c b/src/ca/can_evaluate_qqbar.c index a5458608e9..883a04ade5 100644 --- a/src/ca/can_evaluate_qqbar.c +++ b/src/ca/can_evaluate_qqbar.c @@ -11,6 +11,12 @@ #include "ca.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + int ca_ext_can_evaluate_qqbar(const ca_ext_t x, ca_ctx_t ctx) { diff --git a/src/ca/check_ge.c b/src/ca/check_ge.c index 0a6cc77638..8fef3e754f 100644 --- a/src/ca/check_ge.c +++ b/src/ca/check_ge.c @@ -11,6 +11,12 @@ #include "ca.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define CMP_UNDEFINED -2 #define CMP_UNKNOWN -3 diff --git a/src/ca/check_is_imaginary.c b/src/ca/check_is_imaginary.c index f6e68dada3..855d17e0c8 100644 --- a/src/ca/check_is_imaginary.c +++ b/src/ca/check_is_imaginary.c @@ -72,12 +72,12 @@ ca_check_is_imaginary(const ca_t x, ca_ctx_t ctx) /* todo: precision to do this should depend on complexity of the polynomials, degree of the elements... */ if (prec == 64) { - ca_t t; - ca_init(t, ctx); - ca_conj_deep(t, x, ctx); - ca_neg(t, t, ctx); - res = ca_check_equal(t, x, ctx); - ca_clear(t, ctx); + ca_t tc; + ca_init(tc, ctx); + ca_conj_deep(tc, x, ctx); + ca_neg(tc, tc, ctx); + res = ca_check_equal(tc, x, ctx); + ca_clear(tc, ctx); if (res != T_UNKNOWN) break; } diff --git a/src/ca/check_is_negative_real.c b/src/ca/check_is_negative_real.c index eac49112cf..df6d90c4d6 100644 --- a/src/ca/check_is_negative_real.c +++ b/src/ca/check_is_negative_real.c @@ -77,11 +77,11 @@ ca_check_is_negative_real(const ca_t x, ca_ctx_t ctx) if (prec == 64 && is_real == T_UNKNOWN) { - ca_t t; - ca_init(t, ctx); - ca_conj_deep(t, x, ctx); - is_real = ca_check_equal(t, x, ctx); - ca_clear(t, ctx); + ca_t tc; + ca_init(tc, ctx); + ca_conj_deep(tc, x, ctx); + is_real = ca_check_equal(tc, x, ctx); + ca_clear(tc, ctx); if (is_real == T_FALSE) { res = T_FALSE; diff --git a/src/ca/check_is_real.c b/src/ca/check_is_real.c index 365c7f98f1..1e9530a8d0 100644 --- a/src/ca/check_is_real.c +++ b/src/ca/check_is_real.c @@ -69,11 +69,11 @@ ca_check_is_real(const ca_t x, ca_ctx_t ctx) /* todo: precision to do this should depend on complexity of the polynomials, degree of the elements... */ if (prec == 64) { - ca_t t; - ca_init(t, ctx); - ca_conj_deep(t, x, ctx); - res = ca_check_equal(t, x, ctx); - ca_clear(t, ctx); + ca_t tc; + ca_init(tc, ctx); + ca_conj_deep(tc, x, ctx); + res = ca_check_equal(tc, x, ctx); + ca_clear(tc, ctx); if (res != T_UNKNOWN) break; } diff --git a/src/ca/check_is_zero.c b/src/ca/check_is_zero.c index 6e23d3b8d7..76b32eedda 100644 --- a/src/ca/check_is_zero.c +++ b/src/ca/check_is_zero.c @@ -12,7 +12,7 @@ #include "calcium.h" #include "ca.h" -truth_t +static truth_t _ca_check_is_zero_qqbar(const ca_t x, ca_ctx_t ctx) { qqbar_t t; @@ -73,13 +73,13 @@ ca_is_zero_check_fast(const ca_t x, ca_ctx_t ctx) return T_UNKNOWN; } -int +static int _ca_generic_has_nontrivial_denominator(const ca_t x, ca_ctx_t ctx) { return !fmpz_mpoly_is_fmpz(fmpz_mpoly_q_denref(CA_MPOLY_Q(x)), CA_FIELD_MCTX(CA_FIELD(x, ctx), ctx)); } -truth_t +static truth_t ca_check_is_zero_no_factoring(const ca_t x, ca_ctx_t ctx) { acb_t v; diff --git a/src/ca/clear.c b/src/ca/clear.c index 5c2140460b..eac70b3fc4 100644 --- a/src/ca/clear.c +++ b/src/ca/clear.c @@ -13,6 +13,12 @@ #define CHECK_DATA 0 +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void ca_clear_unchecked(ca_t x, ca_ctx_t ctx) { diff --git a/src/ca/conj.c b/src/ca/conj.c index 5668ae8324..9be22d6dd2 100644 --- a/src/ca/conj.c +++ b/src/ca/conj.c @@ -14,6 +14,12 @@ #include "ca_field.h" #include "ca_vec.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void ca_conj_shallow(ca_t res, const ca_t x, ca_ctx_t ctx) { @@ -66,7 +72,7 @@ ca_set_ext(ca_t res, ca_ext_srcptr ext, ca_ctx_t ctx) } } -void +static void ca_conj_ext(ca_t res, ca_ext_ptr ext, ca_ctx_t ctx) { slong p; @@ -220,7 +226,7 @@ ca_conj_ext(ca_t res, ca_ext_ptr ext, ca_ctx_t ctx) } /* Complex conjugate assuming that the generator is pure imaginary. */ -void nf_elem_conj_imag(nf_elem_t a, const nf_elem_t b, const nf_t nf) +static void nf_elem_conj_imag(nf_elem_t a, const nf_elem_t b, const nf_t nf) { nf_elem_set(a, b, nf); diff --git a/src/ca/exp.c b/src/ca/exp.c index eee2cde456..6688268323 100644 --- a/src/ca/exp.c +++ b/src/ca/exp.c @@ -11,7 +11,7 @@ #include "ca.h" -int ca_as_fmpq_pi_i(fmpq_t res, const ca_t x, ca_ctx_t ctx) +static int ca_as_fmpq_pi_i(fmpq_t res, const ca_t x, ca_ctx_t ctx) { ca_field_ptr K; ca_t t; @@ -44,7 +44,7 @@ int ca_as_fmpq_pi_i(fmpq_t res, const ca_t x, ca_ctx_t ctx) return found; } -ca_ext_ptr +static ca_ext_ptr ca_is_fmpq_times_gen_as_ext(fmpq_t c, const ca_t x, ca_ctx_t ctx) { ca_field_ptr K; diff --git a/src/ca/factor.c b/src/ca/factor.c index 6a79c0ab99..15bfcb2ac8 100644 --- a/src/ca/factor.c +++ b/src/ca/factor.c @@ -15,7 +15,7 @@ #define HAVE_MPOLY_FAC 1 -void +static void _ca_factor_fmpz(ca_factor_t res, const fmpz_t x, int inv, ulong flags, ca_ctx_t ctx) { slong i; @@ -53,7 +53,7 @@ _ca_factor_fmpz(ca_factor_t res, const fmpz_t x, int inv, ulong flags, ca_ctx_t for (i = 0; i < fac->num; i++) { ca_set_fmpz(b, fac->p + i, ctx); - ca_set_si(e, inv ? -(slong)(fac->exp[i]) : (fac->exp[i]), ctx); + ca_set_si(e, inv ? -(fac->exp[i]) : (fac->exp[i]), ctx); ca_factor_insert(res, b, e, ctx); } @@ -62,7 +62,7 @@ _ca_factor_fmpz(ca_factor_t res, const fmpz_t x, int inv, ulong flags, ca_ctx_t ca_clear(e, ctx); } -void +static void _ca_factor_fmpq(ca_factor_t res, const fmpq_t x, ulong flags, ca_ctx_t ctx) { if (flags & (CA_FACTOR_ZZ_SMOOTH | CA_FACTOR_ZZ_FULL)) diff --git a/src/ca/factor_init.c b/src/ca/factor_init.c index 854ddae747..53fde60dcd 100644 --- a/src/ca/factor_init.c +++ b/src/ca/factor_init.c @@ -12,7 +12,7 @@ #include "ca.h" void -ca_factor_init(ca_factor_t fac, ca_ctx_t ctx) +ca_factor_init(ca_factor_t fac, ca_ctx_t FLINT_UNUSED(ctx)) { fac->base = NULL; fac->exp = NULL; diff --git a/src/ca/fmpz_mpoly_evaluate.c b/src/ca/fmpz_mpoly_evaluate.c index b14e8a50ad..c98a541e2b 100644 --- a/src/ca/fmpz_mpoly_evaluate.c +++ b/src/ca/fmpz_mpoly_evaluate.c @@ -372,6 +372,7 @@ ca_fmpz_mpoly_evaluate_horner(ca_t A, const fmpz_mpoly_t B, ca_srcptr C, const f TMP_END; } +#if 0 /* todo: accept fmpz exponents */ void ca_evaluate_fmpz_mpoly_iter(ca_t res, const fmpz_mpoly_t pol, ca_srcptr x, const fmpz_mpoly_ctx_t ctx, ca_ctx_t cactx) @@ -432,6 +433,7 @@ ca_evaluate_fmpz_mpoly_iter(ca_t res, const fmpz_mpoly_t pol, ca_srcptr x, const ca_clear(t, cactx); ca_clear(u, cactx); } +#endif void ca_fmpz_mpoly_evaluate(ca_t res, const fmpz_mpoly_t f, ca_srcptr x, const fmpz_mpoly_ctx_t ctx, ca_ctx_t cactx) diff --git a/src/ca/gamma.c b/src/ca/gamma.c index db4af926c6..47da4d6e7a 100644 --- a/src/ca/gamma.c +++ b/src/ca/gamma.c @@ -11,6 +11,7 @@ #include "ca.h" +#if 0 void ca_gamma_inert(ca_t res, const ca_t x, ca_ctx_t ctx) { @@ -23,8 +24,9 @@ ca_gamma_inert(ca_t res, const ca_t x, ca_ctx_t ctx) _ca_function_fx(res, CA_Gamma, x, ctx); } } +#endif -void +static void _ca_gamma_verbatim(ca_t res, const ca_t x, ca_ctx_t ctx) { ca_t y, tmp; @@ -39,7 +41,7 @@ _ca_gamma_verbatim(ca_t res, const ca_t x, ca_ctx_t ctx) ca_clear(tmp, ctx); } -truth_t +static truth_t ca_re_is_positive(const ca_t x, ca_ctx_t ctx) { ca_t t, u; diff --git a/src/ca/get_fexpr.c b/src/ca/get_fexpr.c index 2d33a6feed..e50311423c 100644 --- a/src/ca/get_fexpr.c +++ b/src/ca/get_fexpr.c @@ -16,7 +16,13 @@ #include "fexpr.h" #include "fexpr_builtin.h" -void +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + +static void _fexpr_set_fmpz_poly_decreasing(fexpr_t res, const fmpz * coeffs, slong len, const fexpr_t var) { slong i, j, num_terms; @@ -239,7 +245,7 @@ _ca_get_fexpr_given_ext(fexpr_t res, const ca_t x, ulong flags, else { fexpr_vec_t xvars; - slong i, j, nvars; + slong j, nvars; nvars = CA_FIELD_LENGTH(K); @@ -406,21 +412,21 @@ ca_get_fexpr(fexpr_t res, const ca_t x, ulong flags, ca_ctx_t ctx) if (CA_IS_SIGNED_INF(x)) { - ca_t t; - ca_init(t, ctx); - ca_sgn(t, x, ctx); + ca_t tc; + ca_init(tc, ctx); + ca_sgn(tc, x, ctx); - if (CA_IS_QQ(t, ctx)) + if (CA_IS_QQ(tc, ctx)) { fexpr_set_symbol_builtin(res, FEXPR_Infinity); - if (!fmpq_is_one(CA_FMPQ(t))) + if (!fmpq_is_one(CA_FMPQ(tc))) fexpr_neg(res, res); - ca_clear(t, ctx); + ca_clear(tc, ctx); return; } - ca_clear(t, ctx); + ca_clear(tc, ctx); } ca_all_extensions(&ext, &num_ext, x, ctx); diff --git a/src/ca/get_qqbar.c b/src/ca/get_qqbar.c index 25fd49032f..07bd243048 100644 --- a/src/ca/get_qqbar.c +++ b/src/ca/get_qqbar.c @@ -220,7 +220,7 @@ ca_get_qqbar(qqbar_t res, const ca_t x, ca_ctx_t ctx) if (fmpz_bits(fmpq_denref(CA_FMPQ(exp))) > 20 || fmpz_bits(fmpq_numref(CA_FMPQ(exp))) > 20 || *fmpq_denref(CA_FMPQ(exp)) * qqbar_degree(xs + i) > ctx->options[CA_OPT_QQBAR_DEG_LIMIT] || - (qqbar_height_bits(xs + i) + 1) * fmpz_bits(fmpq_numref(CA_FMPQ(exp))) > ctx->options[CA_OPT_PREC_LIMIT]) + (qqbar_height_bits(xs + i) + 1) * fmpz_bits(fmpq_numref(CA_FMPQ(exp))) > (ulong) ctx->options[CA_OPT_PREC_LIMIT]) goto cleanup; qqbar_root_ui(xs + i, xs + i, *fmpq_denref(CA_FMPQ(exp))); diff --git a/src/ca/io.c b/src/ca/io.c index 0bc5878090..d2fc4838b6 100644 --- a/src/ca/io.c +++ b/src/ca/io.c @@ -15,6 +15,12 @@ #include "ca_ext.h" #include "ca_field.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + typedef struct { ca_ext_ptr * ext; @@ -66,7 +72,7 @@ calcium_write_fmpz(calcium_stream_t out, const fmpz_t x) calcium_write_free(out, fmpz_get_str(NULL, 10, x)); } -void +static void qqbar_write_n(calcium_stream_t out, const qqbar_t x, slong n) { acb_t t; @@ -82,7 +88,7 @@ qqbar_write_n(calcium_stream_t out, const qqbar_t x, slong n) acb_clear(t); } -void +static void calcium_write_nf_elem(calcium_stream_t out, const nf_elem_t a, const char * var, const nf_t nf) { @@ -130,7 +136,7 @@ calcium_write_nf_elem(calcium_stream_t out, } } -void +static void fmpz_mpoly_q_write_pretty(calcium_stream_t out, const fmpz_mpoly_q_t f, const char ** x, const fmpz_mpoly_ctx_t ctx) { if (fmpz_mpoly_is_one(fmpz_mpoly_q_denref(f), ctx)) @@ -154,7 +160,7 @@ fmpz_mpoly_q_write_pretty(calcium_stream_t out, const fmpz_mpoly_q_t f, const ch } } -void +static void _ca_field_print(calcium_stream_t out, const ca_field_t K, ca_print_info_t * info, ca_ctx_t ctx) { slong i, j, len, ideal_len; @@ -447,7 +453,7 @@ _ca_print(calcium_stream_t out, const ca_t x, ca_print_info_t * info, ca_ctx_t c /* todo: something that doesn't run in quadratic time */ -void +static void _ca_ext_insert_extension(ca_ext_ptr ** extensions, slong * length, ca_ext_t x, ca_ctx_t ctx) { slong i, j; @@ -489,7 +495,7 @@ _ca_ext_insert_extension(ca_ext_ptr ** extensions, slong * length, ca_ext_t x, c } } -void +static void _ca_ext_all_extensions(ca_ext_ptr ** extensions, slong * length, ca_ext_t x, ca_ctx_t ctx) { slong i; diff --git a/src/ca/log.c b/src/ca/log.c index 4a94b4514f..00634cf1b3 100644 --- a/src/ca/log.c +++ b/src/ca/log.c @@ -11,7 +11,7 @@ #include "ca.h" -ca_ext_ptr +static ca_ext_ptr ca_is_gen_pow_fmpz_as_ext(fmpz_t exp, const ca_t x, ca_ctx_t ctx) { ca_field_ptr K; @@ -102,7 +102,7 @@ ca_is_gen_pow_fmpz_as_ext(fmpz_t exp, const ca_t x, ca_ctx_t ctx) /* log(exp(z)) -- https://fungrim.org/entry/a3a253/ */ -void +static void ca_log_exp(ca_t res, const ca_t z, ca_ctx_t ctx) { ca_t t, pi; @@ -145,7 +145,7 @@ ca_log_exp(ca_t res, const ca_t z, ca_ctx_t ctx) } /* log(z^a), assuming z != 0 */ -void +static void ca_log_pow(ca_t res, const ca_t z, const ca_t a, ca_ctx_t ctx) { ca_t t, u, pi; diff --git a/src/ca/merge_fields.c b/src/ca/merge_fields.c index c3aebc4d19..e42a08a4b8 100644 --- a/src/ca/merge_fields.c +++ b/src/ca/merge_fields.c @@ -14,6 +14,12 @@ #include "ca_field.h" #include "fmpz_mpoly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void _nf_elem_get_fmpz_poly_den_shallow(fmpz_poly_t pol, fmpz_t den, const nf_elem_t a, const nf_t nf) { diff --git a/src/ca/pow.c b/src/ca/pow.c index d97fa6f590..fc1ced2a8a 100644 --- a/src/ca/pow.c +++ b/src/ca/pow.c @@ -11,7 +11,7 @@ #include "ca.h" -slong +static slong nf_elem_bits(const nf_elem_t x, nf_t nf) { slong b, c; @@ -39,7 +39,7 @@ nf_elem_bits(const nf_elem_t x, nf_t nf) } } -void +static void _ca_pow_binexp(ca_t res, const ca_t x, slong n, ca_ctx_t ctx) { if (n == 0) @@ -164,7 +164,7 @@ ca_pow_si_arithmetic(ca_t res, const ca_t x, slong n, ca_ctx_t ctx) /* (z^a)^b, assuming z != 0 */ -void +static void ca_pow_pow(ca_t res, const ca_t z, const ca_t a, const ca_t b, ca_ctx_t ctx) { ca_t t, u, pi; @@ -220,7 +220,7 @@ ca_pow_pow(ca_t res, const ca_t z, const ca_t a, const ca_t b, ca_ctx_t ctx) } /* warning: must have already checked for special values */ -void +static void _ca_pow_inert(ca_t res, const ca_t x, const ca_t y, ca_ctx_t ctx) { _ca_function_fxy(res, CA_Pow, x, y, ctx); @@ -228,7 +228,7 @@ _ca_pow_inert(ca_t res, const ca_t x, const ca_t y, ca_ctx_t ctx) ca_condense_field(res, ctx); } -void +static void _ca_pow_general(ca_t res, const ca_t x, const ca_t y, ca_ctx_t ctx) { if (CA_IS_SPECIAL(x) || CA_IS_SPECIAL(y)) diff --git a/src/ca/randtest.c b/src/ca/randtest.c index ace9d3be34..34b946ff17 100644 --- a/src/ca/randtest.c +++ b/src/ca/randtest.c @@ -53,7 +53,7 @@ ca_randtest_rational(ca_t res, flint_rand_t state, slong bits, ca_ctx_t ctx) fmpq_clear(t); } -void +static void ca_randtest_qqbar(ca_t res, flint_rand_t state, slong deg, slong bits, ca_ctx_t ctx) { qqbar_t q; diff --git a/src/ca/rewrite_complex_normal_form.c b/src/ca/rewrite_complex_normal_form.c index 21e952c34b..a7174189da 100644 --- a/src/ca/rewrite_complex_normal_form.c +++ b/src/ca/rewrite_complex_normal_form.c @@ -23,7 +23,7 @@ ulong qqbar_try_as_cyclotomic(qqbar_t zeta, fmpq_poly_t poly, const qqbar_t x); /* todo: Re, Im, Abs, Sgn ... */ -void +static void ca_rewrite_ext_complex_normal_form(ca_t res, ca_ext_ptr ext, int deep, ca_ctx_t ctx) { switch (CA_EXT_HEAD(ext)) diff --git a/src/ca/set_fexpr.c b/src/ca/set_fexpr.c index 10a1d2ac44..5a4975e8da 100644 --- a/src/ca/set_fexpr.c +++ b/src/ca/set_fexpr.c @@ -44,7 +44,7 @@ } \ return 0; \ -int +static int _ca_set_fexpr(ca_t res, fexpr_vec_t inputs, ca_vec_t outputs, const fexpr_t expr, ca_ctx_t ctx) { if (fexpr_is_integer(expr)) diff --git a/src/ca/set_qqbar.c b/src/ca/set_qqbar.c index 00ea3730ed..1e7891abb7 100644 --- a/src/ca/set_qqbar.c +++ b/src/ca/set_qqbar.c @@ -14,6 +14,12 @@ #include "ca_ext.h" #include "ca_field.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define FACTOR_SMOOTH_BOUND 32 /* Write |n| = A * B^2 */ @@ -138,7 +144,7 @@ slong ca_ctx_get_quadratic_field(ca_ctx_t ctx, const fmpz_t A) #else -ca_field_srcptr ca_ctx_get_quadratic_field(ca_ctx_t ctx, const fmpz_t A) +static ca_field_srcptr ca_ctx_get_quadratic_field(ca_ctx_t ctx, const fmpz_t A) { ca_field_srcptr res; qqbar_t x; @@ -163,7 +169,7 @@ ca_field_srcptr ca_ctx_get_quadratic_field(ca_ctx_t ctx, const fmpz_t A) #endif -ca_field_srcptr ca_ctx_get_cyclotomic_field(ca_ctx_t ctx, ulong n) +static ca_field_srcptr ca_ctx_get_cyclotomic_field(ca_ctx_t ctx, ulong n) { ca_field_srcptr res; qqbar_t x; diff --git a/src/ca/sin_cos.c b/src/ca/sin_cos.c index 3435b8af93..783f4a0773 100644 --- a/src/ca/sin_cos.c +++ b/src/ca/sin_cos.c @@ -13,7 +13,7 @@ #include "ca_ext.h" #include "ca_vec.h" -void +static void ca_sin_cos_special(ca_t res1, ca_t res2, const ca_t x, ca_ctx_t ctx) { truth_t t1, t2; @@ -304,7 +304,7 @@ ca_cos(ca_t res, const ca_t x, ca_ctx_t ctx) ca_sin_cos(NULL, res, x, ctx); } -void +static void ca_tan_special(ca_t res, const ca_t x, ca_ctx_t ctx) { if (ca_check_is_signed_inf(x, ctx) == T_TRUE) diff --git a/src/ca/sqrt.c b/src/ca/sqrt.c index e8bee60e04..aff466a6b8 100644 --- a/src/ca/sqrt.c +++ b/src/ca/sqrt.c @@ -25,7 +25,7 @@ ca_sqrt_inert(ca_t res, const ca_t x, ca_ctx_t ctx) } } -void +static void _ca_sqrt_nofactor(ca_t res, const ca_t x, ca_ctx_t ctx) { ca_t y, tmp; diff --git a/src/ca/sqrt_factor.c b/src/ca/sqrt_factor.c index dc35881022..5dd382ca8d 100644 --- a/src/ca/sqrt_factor.c +++ b/src/ca/sqrt_factor.c @@ -36,11 +36,11 @@ ca_sqrt_factor(ca_t res, const ca_t x, ulong flags, ca_ctx_t ctx) if (CA_IS_QQ(x, ctx)) { - qqbar_t t; - qqbar_init(t); - qqbar_fmpq_root_ui(t, CA_FMPQ(x), 2); - ca_set_qqbar(res, t, ctx); - qqbar_clear(t); + qqbar_t tq; + qqbar_init(tq); + qqbar_fmpq_root_ui(tq, CA_FMPQ(x), 2); + ca_set_qqbar(res, tq, ctx); + qqbar_clear(tq); return; } diff --git a/src/ca/swap.c b/src/ca/swap.c index df33ad68ea..e8f1daed79 100644 --- a/src/ca/swap.c +++ b/src/ca/swap.c @@ -12,7 +12,7 @@ #include "ca.h" void -ca_swap(ca_t x, ca_t y, ca_ctx_t ctx) +ca_swap(ca_t x, ca_t y, ca_ctx_t FLINT_UNUSED(ctx)) { FLINT_SWAP(ca_struct, *x, *y); } From 81676fb33412ae1a9d1ab1fee893fcffd5bdd720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 15:45:03 +0200 Subject: [PATCH 097/114] ca_mat --- src/ca_mat.h | 4 ++-- src/ca_mat/adjugate_cofactor.c | 2 +- src/ca_mat/charpoly_danilevsky.c | 2 +- src/ca_mat/companion.c | 2 +- src/ca_mat/det.c | 6 +++--- src/ca_mat/diagonalization.c | 6 +++--- src/ca_mat/get_fexpr.c | 7 +++++++ src/ca_mat/mul.c | 6 +++--- src/ca_mat/mul_same_nf.c | 10 ++++++++-- src/ca_mat/randtest.c | 4 ++-- src/ca_mat/window_init.c | 2 +- 11 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/ca_mat.h b/src/ca_mat.h index 4c9f298189..8e7e6d4e47 100644 --- a/src/ca_mat.h +++ b/src/ca_mat.h @@ -43,7 +43,7 @@ void ca_mat_init(ca_mat_t mat, slong r, slong c, ca_ctx_t ctx); void ca_mat_clear(ca_mat_t mat, ca_ctx_t ctx); CA_MAT_INLINE void -ca_mat_swap(ca_mat_t mat1, ca_mat_t mat2, ca_ctx_t ctx) +ca_mat_swap(ca_mat_t mat1, ca_mat_t mat2, ca_ctx_t FLINT_UNUSED(ctx)) { FLINT_SWAP(ca_mat_struct, *mat1, *mat2); } @@ -53,7 +53,7 @@ ca_mat_swap(ca_mat_t mat1, ca_mat_t mat2, ca_ctx_t ctx) void ca_mat_window_init(ca_mat_t window, const ca_mat_t mat, slong r1, slong c1, slong r2, slong c2, ca_ctx_t ctx); CA_MAT_INLINE void -ca_mat_window_clear(ca_mat_t window, ca_ctx_t ctx) +ca_mat_window_clear(ca_mat_t window, ca_ctx_t FLINT_UNUSED(ctx)) { flint_free(window->rows); } diff --git a/src/ca_mat/adjugate_cofactor.c b/src/ca_mat/adjugate_cofactor.c index d719386f27..f92941011b 100644 --- a/src/ca_mat/adjugate_cofactor.c +++ b/src/ca_mat/adjugate_cofactor.c @@ -35,7 +35,7 @@ ca_mat_adjugate_cofactor(ca_mat_t adj, ca_t det, const ca_mat_t A, ca_ctx_t ctx) if (n == 2) { - ca_t t, u; + ca_t u; ca_init(t, ctx); ca_init(u, ctx); ca_mul(t, ca_mat_entry(A, 0, 0), ca_mat_entry(A, 1, 1), ctx); diff --git a/src/ca_mat/charpoly_danilevsky.c b/src/ca_mat/charpoly_danilevsky.c index 22c1dd8bce..8430c9284a 100644 --- a/src/ca_mat/charpoly_danilevsky.c +++ b/src/ca_mat/charpoly_danilevsky.c @@ -15,7 +15,7 @@ #include "gr.h" #include "gr_mat.h" -int +static int _ca_mat_charpoly_danilevsky_inplace(ca_ptr p, ca_mat_t A, ca_ctx_t ctx) { int success; diff --git a/src/ca_mat/companion.c b/src/ca_mat/companion.c index 15e11ab106..59a6da2d19 100644 --- a/src/ca_mat/companion.c +++ b/src/ca_mat/companion.c @@ -11,7 +11,7 @@ #include "ca_mat.h" -void +static void _ca_mat_companion(ca_mat_t A, ca_srcptr poly, const ca_t c, ca_ctx_t ctx) { slong i, j, n; diff --git a/src/ca_mat/det.c b/src/ca_mat/det.c index c3b42db2fa..656b4b5eeb 100644 --- a/src/ca_mat/det.c +++ b/src/ca_mat/det.c @@ -13,7 +13,7 @@ #include "fmpq_mat.h" #include "ca_mat.h" -int +static int _ca_mat_is_fmpq(const ca_mat_t A, ca_ctx_t ctx) { slong i, j; @@ -26,8 +26,8 @@ _ca_mat_is_fmpq(const ca_mat_t A, ca_ctx_t ctx) return 1; } -int -_ca_mat_fmpq_is_fmpz(const ca_mat_t A, ca_ctx_t ctx) +static int +_ca_mat_fmpq_is_fmpz(const ca_mat_t A, ca_ctx_t FLINT_UNUSED(ctx)) { slong i, j; diff --git a/src/ca_mat/diagonalization.c b/src/ca_mat/diagonalization.c index 9606940170..9bd8b2d0dd 100644 --- a/src/ca_mat/diagonalization.c +++ b/src/ca_mat/diagonalization.c @@ -12,7 +12,7 @@ #include "ca_vec.h" #include "ca_mat.h" -truth_t +static truth_t ca_mat_diagonalization_precomp(ca_mat_t D, ca_mat_t P, const ca_mat_t A, const ca_vec_t eigenvalues, const ulong * am, ca_ctx_t ctx) { int success; @@ -46,13 +46,13 @@ ca_mat_diagonalization_precomp(ca_mat_t D, ca_mat_t P, const ca_mat_t A, const c nullity = ca_mat_ncols(b); - if (nullity != am[i]) + if ((ulong) nullity != am[i]) { result = T_FALSE; break; } - for (j = 0; j < am[i]; j++) + for (j = 0; (ulong) j < am[i]; j++) { ca_set(ca_mat_entry(D, added + j, added + j), ca_vec_entry(eigenvalues, i), ctx); diff --git a/src/ca_mat/get_fexpr.c b/src/ca_mat/get_fexpr.c index a822cd86cf..330832a02b 100644 --- a/src/ca_mat/get_fexpr.c +++ b/src/ca_mat/get_fexpr.c @@ -15,6 +15,13 @@ #include "ca_ext.h" #include "ca_mat.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma message "ca_mat_get_fexpr is currently unused/untested/undocumented!" +#endif + void _ca_default_variables(fexpr_ptr ext_vars, slong num_ext); void _ca_get_fexpr_given_ext(fexpr_t res, const ca_t x, ulong flags, diff --git a/src/ca_mat/mul.c b/src/ca_mat/mul.c index 4454478900..f935ada6d9 100644 --- a/src/ca_mat/mul.c +++ b/src/ca_mat/mul.c @@ -13,7 +13,7 @@ #include "fmpq_mat.h" #include "ca_mat.h" -int +static int ca_mat_is_fmpq_mat(const ca_mat_t A, ca_ctx_t ctx) { slong ar, ac, i, j; @@ -28,8 +28,8 @@ ca_mat_is_fmpq_mat(const ca_mat_t A, ca_ctx_t ctx) return 1; } -int -ca_fmpq_mat_is_fmpz_mat(const ca_mat_t A, ca_ctx_t ctx) +static int +ca_fmpq_mat_is_fmpz_mat(const ca_mat_t A, ca_ctx_t FLINT_UNUSED(ctx)) { slong ar, ac, i, j; diff --git a/src/ca_mat/mul_same_nf.c b/src/ca_mat/mul_same_nf.c index 4ff9bdf206..5efd851d33 100644 --- a/src/ca_mat/mul_same_nf.c +++ b/src/ca_mat/mul_same_nf.c @@ -12,6 +12,12 @@ #include "fmpz_poly_mat.h" #include "ca_mat.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + static const fmpz * _nf_denref(const nf_elem_t a, const nf_t nf) { if (nf->flag & NF_LINEAR) @@ -65,7 +71,7 @@ get_lcm_rowwise(fmpz * Aden, const ca_mat_t A, ca_field_t K, slong bits_limit, c else fmpz_lcm(Aden + i, Aden + i, _nf_denref(CA_NF_ELEM(ca_mat_entry(A, i, j)), CA_FIELD_NF(K))); - if (fmpz_bits(Aden + i) > bits_limit) + if (fmpz_bits(Aden + i) > (ulong) bits_limit) return 0; } } @@ -89,7 +95,7 @@ get_lcm_colwise(fmpz * Aden, const ca_mat_t A, ca_field_t K, slong bits_limit, c else fmpz_lcm(Aden + i, Aden + i, _nf_denref(CA_NF_ELEM(ca_mat_entry(A, j, i)), CA_FIELD_NF(K))); - if (fmpz_bits(Aden + i) > bits_limit) + if (fmpz_bits(Aden + i) > (ulong) bits_limit) return 0; } } diff --git a/src/ca_mat/randtest.c b/src/ca_mat/randtest.c index 2c2f3f729f..f0df974634 100644 --- a/src/ca_mat/randtest.c +++ b/src/ca_mat/randtest.c @@ -20,7 +20,7 @@ ca_mat_randtest(ca_mat_t mat, flint_rand_t state, slong length, slong bits, ca_c for (i = 0; i < ca_mat_nrows(mat); i++) for (j = 0; j < ca_mat_ncols(mat); j++) - if (n_randint(state, 100) < density) + if ((slong) n_randint(state, 100) < density) ca_randtest(ca_mat_entry(mat, i, j), state, length, bits, ctx); else ca_zero(ca_mat_entry(mat, i, j), ctx); @@ -35,7 +35,7 @@ ca_mat_randtest_rational(ca_mat_t mat, flint_rand_t state, slong bits, ca_ctx_t for (i = 0; i < ca_mat_nrows(mat); i++) for (j = 0; j < ca_mat_ncols(mat); j++) - if (n_randint(state, 100) < density) + if ((slong) n_randint(state, 100) < density) ca_randtest_rational(ca_mat_entry(mat, i, j), state, bits, ctx); else ca_zero(ca_mat_entry(mat, i, j), ctx); diff --git a/src/ca_mat/window_init.c b/src/ca_mat/window_init.c index e567e96b9b..d1e0244c5b 100644 --- a/src/ca_mat/window_init.c +++ b/src/ca_mat/window_init.c @@ -13,7 +13,7 @@ void ca_mat_window_init(ca_mat_t window, const ca_mat_t mat, - slong r1, slong c1, slong r2, slong c2, ca_ctx_t ctx) + slong r1, slong c1, slong r2, slong c2, ca_ctx_t FLINT_UNUSED(ctx)) { slong i; window->entries = NULL; From dc317a0069325812c65a3c98dc4deff47a8b58f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 15:45:10 +0200 Subject: [PATCH 098/114] ca_poly --- src/ca_poly.h | 4 ++-- src/ca_poly/exp_series.c | 4 ++-- src/ca_poly/gcd.c | 2 +- src/ca_poly/get_fexpr.c | 6 ++++++ src/ca_poly/init.c | 2 +- src/ca_poly/mullow.c | 6 ++++++ src/ca_poly/mullow_same_nf.c | 2 +- src/ca_poly/roots.c | 6 +++--- 8 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/ca_poly.h b/src/ca_poly.h index b30c82e407..fc718f2c08 100644 --- a/src/ca_poly.h +++ b/src/ca_poly.h @@ -55,7 +55,7 @@ void _ca_poly_set_length(ca_poly_t poly, slong len, ca_ctx_t ctx); void _ca_poly_normalise(ca_poly_t poly, ca_ctx_t ctx); CA_POLY_INLINE void -ca_poly_swap(ca_poly_t poly1, ca_poly_t poly2, ca_ctx_t ctx) +ca_poly_swap(ca_poly_t poly1, ca_poly_t poly2, ca_ctx_t FLINT_UNUSED(ctx)) { FLINT_SWAP(ca_poly_struct, *poly1, *poly2); } @@ -159,7 +159,7 @@ ca_poly_div_ca(ca_poly_t res, const ca_poly_t poly, const ca_t c, ca_ctx_t ctx) /* todo: improve, document */ CA_POLY_INLINE void -ca_poly_div_fmpz(ca_poly_t res, const ca_poly_t poly, const fmpz_t c, ca_ctx_t ctx) +ca_poly_div_fmpz(ca_poly_t res, const ca_poly_t FLINT_UNUSED(poly), const fmpz_t c, ca_ctx_t ctx) { ca_t t; ca_init(t, ctx); diff --git a/src/ca_poly/exp_series.c b/src/ca_poly/exp_series.c index 9300652cc6..a8b7143554 100644 --- a/src/ca_poly/exp_series.c +++ b/src/ca_poly/exp_series.c @@ -15,7 +15,7 @@ ca_field_ptr _ca_vec_same_field2(ca_srcptr A, slong Alen, ca_srcptr B, slong Blen, ca_ctx_t ctx); -void +static void _ca_poly_exp_series_basecase(ca_ptr f, ca_srcptr h, slong hlen, slong len, ca_ctx_t ctx) { @@ -83,7 +83,7 @@ _ca_poly_integral_offset(ca_ptr res, ca_srcptr poly, slong len, slong m, ca_ctx_ ca_div_ui(res + k, poly + k, m + k, ctx); } -void +static void _ca_poly_exp_series_newton(ca_ptr f, ca_ptr g, ca_srcptr h, slong hlen, slong n, ca_ctx_t ctx) { diff --git a/src/ca_poly/gcd.c b/src/ca_poly/gcd.c index 5547787a20..208a937d02 100644 --- a/src/ca_poly/gcd.c +++ b/src/ca_poly/gcd.c @@ -16,7 +16,7 @@ #include "acb_mat.h" #include "ca_poly.h" -int +static int _ca_poly_check_coprime_numerical(ca_srcptr A, slong lenA, ca_srcptr B, slong lenB, ca_ctx_t ctx) { acb_t D; diff --git a/src/ca_poly/get_fexpr.c b/src/ca_poly/get_fexpr.c index 3a0b07d1d1..8fbd20b5cb 100644 --- a/src/ca_poly/get_fexpr.c +++ b/src/ca_poly/get_fexpr.c @@ -26,6 +26,12 @@ void _ca_ext_get_fexpr_given_ext(fexpr_t res, const ca_ext_t x, ulong flags, ca_ext_ptr * ext, slong num_ext, const fexpr_struct * ext_vars, ca_ctx_t ctx); +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void ca_poly_get_fexpr(fexpr_t res, const ca_poly_t A, ulong flags, ca_ctx_t ctx) { diff --git a/src/ca_poly/init.c b/src/ca_poly/init.c index bb877dbec8..83bc14c20c 100644 --- a/src/ca_poly/init.c +++ b/src/ca_poly/init.c @@ -12,7 +12,7 @@ #include "ca_poly.h" void -ca_poly_init(ca_poly_t poly, ca_ctx_t ctx) +ca_poly_init(ca_poly_t poly, ca_ctx_t FLINT_UNUSED(ctx)) { poly->coeffs = NULL; poly->length = 0; diff --git a/src/ca_poly/mullow.c b/src/ca_poly/mullow.c index 37e81102b4..fe40025f42 100644 --- a/src/ca_poly/mullow.c +++ b/src/ca_poly/mullow.c @@ -11,6 +11,12 @@ #include "ca_poly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + ca_field_ptr _ca_vec_same_field2(ca_srcptr A, slong Alen, ca_srcptr B, slong Blen, ca_ctx_t ctx) { diff --git a/src/ca_poly/mullow_same_nf.c b/src/ca_poly/mullow_same_nf.c index 488df00406..18e97dee40 100644 --- a/src/ca_poly/mullow_same_nf.c +++ b/src/ca_poly/mullow_same_nf.c @@ -49,7 +49,7 @@ get_lcm(fmpz_t Aden, ca_srcptr A, slong Alen, ca_field_t K, slong bits_limit, ca else fmpz_lcm(Aden, Aden, _nf_denref(CA_NF_ELEM(A + i), CA_FIELD_NF(K))); - if (fmpz_bits(Aden) > bits_limit) + if (fmpz_bits(Aden) > (flint_bitcnt_t) bits_limit) return 0; } diff --git a/src/ca_poly/roots.c b/src/ca_poly/roots.c index 2828eaf4e6..43d6d5c369 100644 --- a/src/ca_poly/roots.c +++ b/src/ca_poly/roots.c @@ -11,7 +11,7 @@ #include "ca_poly.h" -void +static void _ca_poly_roots_quadratic(ca_t r1, ca_t r2, const ca_t a, const ca_t b, const ca_t c, ca_ctx_t ctx) { ca_t d, t; @@ -40,7 +40,7 @@ _ca_poly_roots_quadratic(ca_t r1, ca_t r2, const ca_t a, const ca_t b, const ca_ /* exp(2 pi i * (1 / 3)) */ /* todo: make this faster to construct */ -void +static void ca_omega(ca_t res, ca_ctx_t ctx) { ca_pi_i(res, ctx); @@ -51,7 +51,7 @@ ca_omega(ca_t res, ca_ctx_t ctx) /* Solves a cubic equation using the cubic formula. Assumes (does not check) that a is invertible. */ -int +static int _ca_poly_roots_cubic(ca_t r1, ca_t r2, ca_t r3, const ca_t a, const ca_t b, const ca_t c, const ca_t d, ca_ctx_t ctx) { ca_t D0, D1, C, w1, w2, t; From 882e8794144d7c239f3fd113ffc6d11506e12546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 15:45:15 +0200 Subject: [PATCH 099/114] ca_vec --- src/ca_vec.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ca_vec.h b/src/ca_vec.h index c537eae607..42a5c9f2f2 100644 --- a/src/ca_vec.h +++ b/src/ca_vec.h @@ -45,7 +45,7 @@ void ca_vec_clear(ca_vec_t vec, ca_ctx_t ctx); void _ca_vec_swap(ca_ptr vec1, ca_ptr vec2, slong len, ca_ctx_t ctx); CA_VEC_INLINE void -ca_vec_swap(ca_vec_t vec1, ca_vec_t vec2, ca_ctx_t ctx) +ca_vec_swap(ca_vec_t vec1, ca_vec_t vec2, ca_ctx_t FLINT_UNUSED(ctx)) { FLINT_SWAP(ca_vec_struct, *vec1, *vec2); } @@ -53,7 +53,7 @@ ca_vec_swap(ca_vec_t vec1, ca_vec_t vec2, ca_ctx_t ctx) /* Length */ CA_VEC_INLINE -slong ca_vec_length(const ca_vec_t vec, ca_ctx_t ctx) +slong ca_vec_length(const ca_vec_t vec, ca_ctx_t FLINT_UNUSED(ctx)) { return vec->length; } @@ -131,7 +131,7 @@ _ca_vec_is_fmpq_vec(ca_srcptr vec, slong len, ca_ctx_t ctx) } CA_VEC_INLINE int -_ca_vec_fmpq_vec_is_fmpz_vec(ca_srcptr vec, slong len, ca_ctx_t ctx) +_ca_vec_fmpq_vec_is_fmpz_vec(ca_srcptr vec, slong len, ca_ctx_t FLINT_UNUSED(ctx)) { slong i; for (i = 0; i < len; i++) From 5294c8119531f2de27063959fcf41bd71b2dda3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 15:45:24 +0200 Subject: [PATCH 100/114] fexpr --- src/fexpr.h | 2 +- src/fexpr/equal_si.c | 4 ++-- src/fexpr/expanded_normal_form.c | 2 +- src/fexpr/get_fmpz.c | 2 +- src/fexpr/get_fmpz_mpoly_q.c | 1 - src/fexpr/numerical_enclosure.c | 19 +++++++++++---- src/fexpr/replace.c | 2 +- src/fexpr/set_symbol_str.c | 1 - src/fexpr/write_latex.c | 40 ++++++++++++++------------------ 9 files changed, 38 insertions(+), 35 deletions(-) diff --git a/src/fexpr.h b/src/fexpr.h index 3c56e31325..561c7e688e 100644 --- a/src/fexpr.h +++ b/src/fexpr.h @@ -310,7 +310,7 @@ fexpr_is_builtin_symbol(const fexpr_t expr, slong i) { ulong head; head = expr->data[0]; - return (FEXPR_TYPE(head) == FEXPR_TYPE_SMALL_SYMBOL) && (((head >> 8) & 0xff) == 0) && (FEXPR_BUILTIN_ID(head) == i); + return (FEXPR_TYPE(head) == FEXPR_TYPE_SMALL_SYMBOL) && (((head >> 8) & 0xff) == 0) && (FEXPR_BUILTIN_ID(head) == (ulong) i); } /* todo: document, test */ diff --git a/src/fexpr/equal_si.c b/src/fexpr/equal_si.c index c0e7e5d178..d4f9bdc98c 100644 --- a/src/fexpr/equal_si.c +++ b/src/fexpr/equal_si.c @@ -15,9 +15,9 @@ int fexpr_equal_si(const fexpr_t expr, slong c) { if (c >= FEXPR_COEFF_MIN && c <= FEXPR_COEFF_MAX) - return expr->data[0] == (c << FEXPR_TYPE_BITS); + return expr->data[0] == (ulong) (c << FEXPR_TYPE_BITS); else if (c > 0) - return (expr->data[0] == (FEXPR_TYPE_BIG_INT_POS | (2 << FEXPR_TYPE_BITS)) && expr->data[1] == c); + return (expr->data[0] == (FEXPR_TYPE_BIG_INT_POS | (2 << FEXPR_TYPE_BITS)) && expr->data[1] == (ulong) c); else return (expr->data[0] == (FEXPR_TYPE_BIG_INT_NEG | (2 << FEXPR_TYPE_BITS)) && expr->data[1] == (-(ulong) c)); } diff --git a/src/fexpr/expanded_normal_form.c b/src/fexpr/expanded_normal_form.c index a646013593..bdd4340df7 100644 --- a/src/fexpr/expanded_normal_form.c +++ b/src/fexpr/expanded_normal_form.c @@ -13,7 +13,7 @@ #include "fexpr.h" int -fexpr_expanded_normal_form(fexpr_t res, const fexpr_t expr, ulong flags) +fexpr_expanded_normal_form(fexpr_t res, const fexpr_t expr, ulong FLINT_UNUSED(flags)) { fexpr_vec_t args; fmpz_mpoly_ctx_t ctx; diff --git a/src/fexpr/get_fmpz.c b/src/fexpr/get_fmpz.c index 4721a1402c..8a2fe9a884 100644 --- a/src/fexpr/get_fmpz.c +++ b/src/fexpr/get_fmpz.c @@ -45,7 +45,7 @@ fexpr_get_fmpz(fmpz_t c, const fexpr_t x) if (nlimbs == 1 && x->data[1] <= COEFF_MAX) { _fmpz_demote(c); - *c = negative ? (-(slong) x->data[1]) : x->data[1]; + *c = negative ? -x->data[1] : x->data[1]; } else { diff --git a/src/fexpr/get_fmpz_mpoly_q.c b/src/fexpr/get_fmpz_mpoly_q.c index 9990aa9588..e2e726c2ec 100644 --- a/src/fexpr/get_fmpz_mpoly_q.c +++ b/src/fexpr/get_fmpz_mpoly_q.c @@ -100,7 +100,6 @@ fexpr_get_fmpz_mpoly_q(fmpz_mpoly_q_t res, const fexpr_t expr, const fexpr_vec_t if (fexpr_is_builtin_call(expr, FEXPR_Pow) && (fexpr_nargs(expr) == 2)) { fexpr_t base, exp; - int success; fexpr_view_arg(base, expr, 0); fexpr_view_arg(exp, expr, 1); diff --git a/src/fexpr/numerical_enclosure.c b/src/fexpr/numerical_enclosure.c index 85b16a91f2..dd7cf85c0b 100644 --- a/src/fexpr/numerical_enclosure.c +++ b/src/fexpr/numerical_enclosure.c @@ -17,7 +17,7 @@ #include "fexpr.h" #include "fexpr_builtin.h" -void +static void _acb_root(acb_t res, const acb_t x, const acb_t y, slong prec) { if (acb_is_int(y) && arf_sgn(arb_midref(acb_realref(y))) > 0 && arf_cmpabs_ui(arb_midref(acb_realref(y)), 1000) <= 0) @@ -64,7 +64,7 @@ _acb_root(acb_t res, const acb_t x, const acb_t y, slong prec) break; -int +static int fexpr_get_acb_raw(acb_t res, const fexpr_t expr, slong prec) { if (fexpr_is_integer(expr)) @@ -492,8 +492,8 @@ fexpr_get_acb_raw(acb_t res, const fexpr_t expr, slong prec) } } -int -fexpr_get_acb_with_accuracy(acb_t res, const fexpr_t expr, slong prec, ulong flags) +static int +fexpr_get_acb_with_accuracy(acb_t res, const fexpr_t expr, slong prec, ulong FLINT_UNUSED(flags)) { slong wp, initial, maxprec; int success = 0; @@ -512,8 +512,17 @@ fexpr_get_acb_with_accuracy(acb_t res, const fexpr_t expr, slong prec, ulong fla return success; } +/* FIXME: Should this function be used somewhere? */ + +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma message "fexpr_get_decimal_str is currently unused/untested/undocumented!" +#endif + char * -fexpr_get_decimal_str(const fexpr_t expr, slong digits, ulong flags) +fexpr_get_decimal_str(const fexpr_t expr, slong digits, ulong FLINT_UNUSED(flags)) { calcium_stream_t t; acb_t v; diff --git a/src/fexpr/replace.c b/src/fexpr/replace.c index 6b9425ed33..a4c5d547ff 100644 --- a/src/fexpr/replace.c +++ b/src/fexpr/replace.c @@ -24,7 +24,7 @@ Otherwise, expr will be initialized to a new expression, with a nonzero alloc field. */ -int +static int _fexpr_replace_vec(fexpr_t res_view, const fexpr_t expr, fexpr_srcptr xs, fexpr_srcptr ys, slong len) { slong i, nargs; diff --git a/src/fexpr/set_symbol_str.c b/src/fexpr/set_symbol_str.c index 4fefcc4dd0..b4fffae0bf 100644 --- a/src/fexpr/set_symbol_str.c +++ b/src/fexpr/set_symbol_str.c @@ -36,7 +36,6 @@ fexpr_set_symbol_str(fexpr_t res, const char * s) if (len <= FEXPR_SMALL_SYMBOL_LEN) { - slong i; ulong data; data = FEXPR_TYPE_SMALL_SYMBOL; diff --git a/src/fexpr/write_latex.c b/src/fexpr/write_latex.c index fb0cc7cba0..8ad2039f54 100644 --- a/src/fexpr/write_latex.c +++ b/src/fexpr/write_latex.c @@ -25,7 +25,7 @@ void fexpr_write_latex_symbol(int * subscript, calcium_stream_t out, const fexpr_t expr, ulong flags); int _fexpr_is_symbol_with_trailing_underscore(const fexpr_t expr); -const char * fexpr_get_symbol_str_pointer(char * tmp, const fexpr_t expr) +static const char * fexpr_get_symbol_str_pointer(char * tmp, const fexpr_t expr) { slong i; ulong head = expr->data[0]; @@ -74,7 +74,7 @@ int _fexpr_is_symbol_with_trailing_underscore(const fexpr_t expr) return (len > 1 && s[len - 1] == '_'); } -int _fexpr_is_symbol_with_internal_underscore(const fexpr_t expr) +static int _fexpr_is_symbol_with_internal_underscore(const fexpr_t expr) { const char *s; char tmp[FEXPR_SMALL_SYMBOL_LEN + 1]; @@ -676,7 +676,7 @@ fexpr_power_base_is_safe(const fexpr_t base) } } -void +static void _fexpr_write_latex_pow(calcium_stream_t out, const fexpr_t base, const fexpr_t expo, ulong flags) { if (fexpr_is_any_builtin_call(base) && fexpr_nargs(base) == 1) @@ -1395,7 +1395,7 @@ fexpr_write_latex_residue(calcium_stream_t out, const fexpr_t expr, ulong flags) calcium_write(out, "\\right]"); } -void +static void _fexpr_write_latex_derivative(calcium_stream_t out, const fexpr_t f, const fexpr_t subscript, const fexpr_t order, ulong flags) { if (fexpr_equal_ui(order, 1)) @@ -1912,7 +1912,6 @@ fexpr_write_latex_logic(calcium_stream_t out, const fexpr_t expr, ulong flags) if (fexpr_is_builtin_call(expr, FEXPR_Logic) && nargs == 1) { - fexpr_t arg; fexpr_view_arg(arg, expr, 0); fexpr_write_latex(out, arg, flags | FEXPR_LATEX_LOGIC); return; @@ -1921,7 +1920,6 @@ fexpr_write_latex_logic(calcium_stream_t out, const fexpr_t expr, ulong flags) /* todo: move this */ if (fexpr_is_builtin_call(expr, FEXPR_CongruentMod) && nargs == 3) { - fexpr_t arg; fexpr_view_arg(arg, expr, 0); fexpr_write_latex(out, arg, flags); calcium_write(out, " \\equiv "); @@ -2070,7 +2068,7 @@ fexpr_write_latex_simple(calcium_stream_t out, const fexpr_t expr, ulong flags) calcium_write(out, b); } -void +static void _fexpr_write_latex_simple2(calcium_stream_t out, const fexpr_t expr, ulong flags) { slong i; @@ -2506,13 +2504,13 @@ fexpr_write_latex_matrix(calcium_stream_t out, const fexpr_t expr, ulong flags) if (fexpr_is_builtin_call(expr, FEXPR_Matrix) && nargs == 3) { - fexpr_t for1, for2, f1, f2, i, a, b, j, c, d; + fexpr_t for1, for2, f1, f2, ifx, a, b, jfx, c, d; fexpr_view_arg(for1, expr, 1); fexpr_view_arg(for2, expr, 2); - if (fexpr_view_call3(f1, i, a, b, for1) && - fexpr_view_call3(f2, j, c, d, for2) && + if (fexpr_view_call3(f1, ifx, a, b, for1) && + fexpr_view_call3(f2, jfx, c, d, for2) && fexpr_is_builtin_symbol(f1, FEXPR_For) && fexpr_is_builtin_symbol(f2, FEXPR_For)) { @@ -2554,41 +2552,41 @@ fexpr_write_latex_matrix(calcium_stream_t out, const fexpr_t expr, ulong flags) calcium_write(out, "\\displaystyle{\\begin{pmatrix} "); - fexpr_replace2(x, arg, i, a, j, c); + fexpr_replace2(x, arg, ifx, a, jfx, c); fexpr_write_latex(out, x, flags); calcium_write(out, " & "); - fexpr_replace2(x, arg, i, a, j, c1); + fexpr_replace2(x, arg, ifx, a, jfx, c1); fexpr_write_latex(out, x, flags); calcium_write(out, " & \\cdots & "); - fexpr_replace2(x, arg, i, a, j, d); + fexpr_replace2(x, arg, ifx, a, jfx, d); fexpr_write_latex(out, x, flags); calcium_write(out, " \\\\ "); - fexpr_replace2(x, arg, i, a1, j, c); + fexpr_replace2(x, arg, ifx, a1, jfx, c); fexpr_write_latex(out, x, flags); calcium_write(out, " & "); - fexpr_replace2(x, arg, i, a1, j, c1); + fexpr_replace2(x, arg, ifx, a1, jfx, c1); fexpr_write_latex(out, x, flags); calcium_write(out, " & \\cdots & "); - fexpr_replace2(x, arg, i, a1, j, d); + fexpr_replace2(x, arg, ifx, a1, jfx, d); fexpr_write_latex(out, x, flags); calcium_write(out, " \\\\ "); calcium_write(out, "\\vdots & \\vdots & \\ddots & \\vdots \\\\ "); - fexpr_replace2(x, arg, i, b, j, c); + fexpr_replace2(x, arg, ifx, b, jfx, c); fexpr_write_latex(out, x, flags); calcium_write(out, " & "); - fexpr_replace2(x, arg, i, b, j, c1); + fexpr_replace2(x, arg, ifx, b, jfx, c1); fexpr_write_latex(out, x, flags); calcium_write(out, " & \\cdots & "); - fexpr_replace2(x, arg, i, b, j, d); + fexpr_replace2(x, arg, ifx, b, jfx, d); fexpr_write_latex(out, x, flags); calcium_write(out, " \\end{pmatrix}}"); @@ -2732,7 +2730,7 @@ fexpr_write_latex_decimal(calcium_stream_t out, const fexpr_t expr, ulong flags) } /* Write (x) */ -void +static void _fexpr_write_latex_call1(calcium_stream_t out, const fexpr_t x, ulong flags) { if (fexpr_is_atom(x)) @@ -3506,8 +3504,6 @@ fexpr_write_latex_alg_structure(calcium_stream_t out, const fexpr_t expr, ulong if (nargs >= 1) { - slong i; - fexpr_view_next(arg); if (fexpr_is_builtin_call(arg, FEXPR_Tuple)) From eed843eb436ac31d6b26285a80ad51cf283022c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 15:45:29 +0200 Subject: [PATCH 101/114] gr_mpoly --- src/gr_mpoly.h | 4 ++++ src/gr_mpoly/add.c | 9 ++++++++- src/gr_mpoly/fit_bits.c | 2 +- src/gr_mpoly/mul_johnson.c | 2 +- src/gr_mpoly/randtest_bound.c | 9 +++++++++ src/gr_mpoly/sort_terms.c | 4 ++-- src/gr_mpoly/sub.c | 5 +++-- src/gr_mpoly/test/t-mul_johnson.c | 3 +-- src/gr_mpoly/test/t-mul_monomial.c | 3 +-- src/gr_mpoly/test/util_test.h | 19 +++++++++++++++++++ 10 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 src/gr_mpoly/test/util_test.h diff --git a/src/gr_mpoly.h b/src/gr_mpoly.h index aa6a7e3a6d..ea88da7ed1 100644 --- a/src/gr_mpoly.h +++ b/src/gr_mpoly.h @@ -31,6 +31,8 @@ extern "C" { #endif +FLINT_HEADER_START + typedef struct { gr_ptr coeffs; @@ -224,6 +226,8 @@ WARN_UNUSED_RESULT int gr_mpoly_mul_ui(gr_mpoly_t A, const gr_mpoly_t B, ulong c WARN_UNUSED_RESULT int gr_mpoly_mul_fmpz(gr_mpoly_t A, const gr_mpoly_t B, const fmpz_t c, const mpoly_ctx_t mctx, gr_ctx_t cctx); WARN_UNUSED_RESULT int gr_mpoly_mul_fmpq(gr_mpoly_t A, const gr_mpoly_t B, const fmpq_t c, const mpoly_ctx_t mctx, gr_ctx_t cctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/gr_mpoly/add.c b/src/gr_mpoly/add.c index db77ec982b..081546c91e 100644 --- a/src/gr_mpoly/add.c +++ b/src/gr_mpoly/add.c @@ -12,6 +12,12 @@ #include "mpoly.h" #include "gr_mpoly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + slong _gr_mpoly_add( slong * Alen, gr_ptr Acoeffs, ulong * Aexps, @@ -83,7 +89,8 @@ int gr_mpoly_add( const gr_mpoly_t C, const mpoly_ctx_t mctx, gr_ctx_t cctx) { - slong Abits, N; + slong N; + flint_bitcnt_t Abits; ulong * Bexps = B->exps, * Cexps = C->exps; ulong * cmpmask; int freeBexps = 0, freeCexps = 0; diff --git a/src/gr_mpoly/fit_bits.c b/src/gr_mpoly/fit_bits.c index f4ef12fda4..7c3d79fe09 100644 --- a/src/gr_mpoly/fit_bits.c +++ b/src/gr_mpoly/fit_bits.c @@ -13,7 +13,7 @@ #include "gr_mpoly.h" void -gr_mpoly_fit_bits(gr_mpoly_t A, flint_bitcnt_t bits, const mpoly_ctx_t mctx, gr_ctx_t cctx) +gr_mpoly_fit_bits(gr_mpoly_t A, flint_bitcnt_t bits, const mpoly_ctx_t mctx, gr_ctx_t FLINT_UNUSED(cctx)) { if (A->bits < bits) { diff --git a/src/gr_mpoly/mul_johnson.c b/src/gr_mpoly/mul_johnson.c index cb0c69b70f..4cbbec32cd 100644 --- a/src/gr_mpoly/mul_johnson.c +++ b/src/gr_mpoly/mul_johnson.c @@ -15,7 +15,7 @@ #include "mpoly.h" #include "gr_mpoly.h" -int _gr_mpoly_mul_johnson( +static int _gr_mpoly_mul_johnson( slong * res_len, gr_ptr * coeff1, ulong ** exp1, slong * alloc, slong * exps_alloc, gr_srcptr coeff2, const ulong * exp2, slong len2, diff --git a/src/gr_mpoly/randtest_bound.c b/src/gr_mpoly/randtest_bound.c index 63a31917c1..97d3d736ed 100644 --- a/src/gr_mpoly/randtest_bound.c +++ b/src/gr_mpoly/randtest_bound.c @@ -11,6 +11,15 @@ #include "gr_mpoly.h" +/* FIXME: Should this function be used somewhere? */ + +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma message "gr_mpoly_randtest_bound is currently unused/untested/undocumented!" +#endif + int gr_mpoly_randtest_bound(gr_mpoly_t A, flint_rand_t state, slong length, ulong exp_bound, const mpoly_ctx_t mctx, gr_ctx_t cctx) { diff --git a/src/gr_mpoly/sort_terms.c b/src/gr_mpoly/sort_terms.c index d41f3f7df0..440370a88d 100644 --- a/src/gr_mpoly/sort_terms.c +++ b/src/gr_mpoly/sort_terms.c @@ -19,7 +19,7 @@ and assuming exponent vectors fit into one word and assuming that all bit positions that need to be sorted are in totalmask */ -void _gr_mpoly_radix_sort1( +static void _gr_mpoly_radix_sort1( gr_ptr Acoeffs, ulong * Aexps, slong left, slong right, @@ -103,7 +103,7 @@ void _gr_mpoly_radix_sort1( sort terms in [left, right) by exponent assuming that bits in position >= pos are already sorted */ -void _gr_mpoly_radix_sort( +static void _gr_mpoly_radix_sort( gr_ptr Acoeffs, ulong * Aexps, slong left, slong right, diff --git a/src/gr_mpoly/sub.c b/src/gr_mpoly/sub.c index 7a97a5d5b9..6f273fb818 100644 --- a/src/gr_mpoly/sub.c +++ b/src/gr_mpoly/sub.c @@ -12,7 +12,7 @@ #include "mpoly.h" #include "gr_mpoly.h" -slong _gr_mpoly_sub( +static slong _gr_mpoly_sub( slong * Alen, gr_ptr Acoeffs, ulong * Aexps, gr_srcptr Bcoeffs, const ulong * Bexps, slong Blen, @@ -84,7 +84,8 @@ int gr_mpoly_sub( const gr_mpoly_t C, const mpoly_ctx_t mctx, gr_ctx_t cctx) { - slong Abits, N; + slong N; + flint_bitcnt_t Abits; ulong * Bexps = B->exps, * Cexps = C->exps; ulong * cmpmask; int freeBexps = 0, freeCexps = 0; diff --git a/src/gr_mpoly/test/t-mul_johnson.c b/src/gr_mpoly/test/t-mul_johnson.c index b32efd4b07..2a6e5593e6 100644 --- a/src/gr_mpoly/test/t-mul_johnson.c +++ b/src/gr_mpoly/test/t-mul_johnson.c @@ -11,8 +11,7 @@ #include "test_helpers.h" #include "gr_mpoly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_FUNCTION_START(gr_mpoly_mul_johnson, state) { diff --git a/src/gr_mpoly/test/t-mul_monomial.c b/src/gr_mpoly/test/t-mul_monomial.c index d28ccbbaef..902a1fa59a 100644 --- a/src/gr_mpoly/test/t-mul_monomial.c +++ b/src/gr_mpoly/test/t-mul_monomial.c @@ -11,8 +11,7 @@ #include "test_helpers.h" #include "gr_mpoly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_FUNCTION_START(gr_mpoly_mul_monomial, state) { diff --git a/src/gr_mpoly/test/util_test.h b/src/gr_mpoly/test/util_test.h new file mode 100644 index 0000000000..caed12c013 --- /dev/null +++ b/src/gr_mpoly/test/util_test.h @@ -0,0 +1,19 @@ +/* + Copyright (C) 2024 Albin Ahlbäck + + This file is part of FLINT. + + FLINT is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License (LGPL) as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. See . +*/ + +#ifndef TEST_UTIL_H +#define TEST_UTIL_H + +#include "gr.h" + +FLINT_DLL extern gr_static_method_table _ca_methods; + +#endif From 0efac5ea10cd467f2881def1e63cb07901b96d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sat, 5 Oct 2024 13:22:05 +0200 Subject: [PATCH 102/114] gr_generic --- src/gr_generic.h | 5 ----- src/gr_generic/generic.c | 41 +++++++++++++++++------------------- src/gr_generic/generic_pow.c | 2 +- src/gr_generic/set_fexpr.c | 7 +++++- 4 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/gr_generic.h b/src/gr_generic.h index 08080fba26..b21177be9d 100644 --- a/src/gr_generic.h +++ b/src/gr_generic.h @@ -237,11 +237,6 @@ WARN_UNUSED_RESULT int gr_generic_vec_dot_fmpz(gr_ptr res, gr_srcptr initial, in WARN_UNUSED_RESULT int gr_generic_vec_set_powers(gr_ptr res, gr_srcptr x, slong len, gr_ctx_t ctx); WARN_UNUSED_RESULT int gr_generic_vec_reciprocals(gr_ptr res, slong len, gr_ctx_t ctx); -WARN_UNUSED_RESULT int gr_generic_pow_fmpz_sliding(gr_ptr f, gr_srcptr g, const fmpz_t pow, gr_ctx_t ctx); -WARN_UNUSED_RESULT int gr_generic_pow_ui_sliding(gr_ptr f, gr_srcptr g, ulong pow, gr_ctx_t ctx); -WARN_UNUSED_RESULT int gr_generic_pow_fmpz_binexp(gr_ptr res, gr_srcptr x, const fmpz_t exp, gr_ctx_t ctx); -WARN_UNUSED_RESULT int gr_generic_pow_ui_binexp(gr_ptr res, gr_srcptr x, ulong e, gr_ctx_t ctx); - WARN_UNUSED_RESULT int gr_generic_vec_add(gr_ptr res, gr_srcptr src1, gr_srcptr src2, slong len, gr_ctx_t ctx); WARN_UNUSED_RESULT int gr_generic_vec_sub(gr_ptr res, gr_srcptr src1, gr_srcptr src2, slong len, gr_ctx_t ctx); WARN_UNUSED_RESULT int gr_generic_vec_mul(gr_ptr res, gr_srcptr src1, gr_srcptr src2, slong len, gr_ctx_t ctx); diff --git a/src/gr_generic/generic.c b/src/gr_generic/generic.c index 0908526a1f..263b3c8ccf 100644 --- a/src/gr_generic/generic.c +++ b/src/gr_generic/generic.c @@ -28,27 +28,27 @@ #endif int -gr_generic_ctx_clear(gr_ctx_t ctx) +gr_generic_ctx_clear(gr_ctx_t FLINT_UNUSED(ctx)) { return GR_SUCCESS; } -truth_t gr_generic_ctx_predicate(gr_ctx_t ctx) +truth_t gr_generic_ctx_predicate(gr_ctx_t FLINT_UNUSED(ctx)) { return T_UNKNOWN; } -truth_t gr_generic_ctx_predicate_true(gr_ctx_t ctx) +truth_t gr_generic_ctx_predicate_true(gr_ctx_t FLINT_UNUSED(ctx)) { return T_TRUE; } -truth_t gr_generic_ctx_predicate_false(gr_ctx_t ctx) +truth_t gr_generic_ctx_predicate_false(gr_ctx_t FLINT_UNUSED(ctx)) { return T_FALSE; } -truth_t gr_generic_ctx_is_zero_ring(gr_ctx_t ctx) +static truth_t gr_generic_ctx_is_zero_ring(gr_ctx_t ctx) { gr_ptr t; int status; @@ -83,7 +83,7 @@ gr_generic_set_shallow(gr_ptr res, gr_srcptr x, const gr_ctx_t ctx) memcpy(res, x, ctx->sizeof_elem); } -int gr_generic_write_n(gr_stream_t out, gr_srcptr x, slong n, gr_ctx_t ctx) +int gr_generic_write_n(gr_stream_t out, gr_srcptr x, slong FLINT_UNUSED(n), gr_ctx_t ctx) { return gr_write(out, x, ctx); } @@ -141,7 +141,7 @@ int gr_generic_randtest_small(gr_ptr x, flint_rand_t state, gr_ctx_t ctx) return status; } -slong _gr_generic_length(gr_srcptr x, gr_ctx_t ctx) +static slong _gr_generic_length(gr_srcptr FLINT_UNUSED(x), gr_ctx_t FLINT_UNUSED(ctx)) { return 0; } @@ -904,7 +904,7 @@ int gr_generic_set_fmpz_10exp_fmpz(gr_ptr res, const fmpz_t x, const fmpz_t y, g } } -int gr_generic_get_fexpr_serialize(fexpr_t res, gr_srcptr x, gr_ctx_t ctx) +static int gr_generic_get_fexpr_serialize(fexpr_t res, gr_srcptr x, gr_ctx_t ctx) { return gr_get_fexpr(res, x, ctx); } @@ -988,16 +988,16 @@ int gr_generic_div_fmpq(gr_ptr res, gr_srcptr x, const fmpq_t y, gr_ctx_t ctx) if (fmpq_is_zero(y)) /* for non-rings? */ { - gr_ptr t; + gr_ptr tg; status = GR_SUCCESS; - GR_TMP_INIT(t, ctx); + GR_TMP_INIT(tg, ctx); - status |= gr_set_fmpq(t, y, ctx); + status |= gr_set_fmpq(tg, y, ctx); if (status == GR_SUCCESS) - status = gr_div(res, x, t, ctx); + status = gr_div(res, x, tg, ctx); - GR_TMP_CLEAR(t, ctx); + GR_TMP_CLEAR(tg, ctx); return status; } @@ -1047,7 +1047,7 @@ int gr_generic_divexact(gr_ptr res, gr_srcptr x, gr_srcptr y, gr_ctx_t ctx) return gr_div(res, x, y, ctx); } -truth_t gr_generic_div_nonunique(gr_ptr res, gr_srcptr x, gr_srcptr y, gr_ctx_t ctx) +static truth_t gr_generic_div_nonunique(gr_ptr res, gr_srcptr x, gr_srcptr y, gr_ctx_t ctx) { truth_t zero; int status; @@ -1074,7 +1074,7 @@ truth_t gr_generic_div_nonunique(gr_ptr res, gr_srcptr x, gr_srcptr y, gr_ctx_t return GR_UNABLE; } -truth_t gr_generic_divides(gr_srcptr x, gr_srcptr y, gr_ctx_t ctx) +static truth_t gr_generic_divides(gr_srcptr x, gr_srcptr y, gr_ctx_t ctx) { gr_ptr t; truth_t zero; @@ -1215,7 +1215,7 @@ int gr_generic_numerator(gr_ptr res, gr_srcptr x, gr_ctx_t ctx) return gr_set(res, x, ctx); } -int gr_generic_denominator(gr_ptr res, gr_srcptr x, gr_ctx_t ctx) +int gr_generic_denominator(gr_ptr res, gr_srcptr FLINT_UNUSED(x), gr_ctx_t ctx) { return gr_one(res, ctx); } @@ -1269,7 +1269,7 @@ gr_generic_rsqrt(gr_ptr res, gr_srcptr x, gr_ctx_t ctx) } int -gr_generic_cmp(int * res, gr_srcptr x, gr_srcptr y, gr_ctx_t ctx) +gr_generic_cmp(int * FLINT_UNUSED(res), gr_srcptr FLINT_UNUSED(x), gr_srcptr FLINT_UNUSED(y), gr_ctx_t FLINT_UNUSED(ctx)) { return GR_UNABLE; } @@ -1317,7 +1317,7 @@ gr_generic_cmpabs_other(int * res, gr_srcptr x, gr_srcptr y, gr_ctx_t y_ctx, gr_ return status; } -int +static int gr_generic_min(gr_ptr res, gr_srcptr x, gr_srcptr y, gr_ctx_t ctx) { int cmp; @@ -1331,7 +1331,7 @@ gr_generic_min(gr_ptr res, gr_srcptr x, gr_srcptr y, gr_ctx_t ctx) return gr_set(res, y, ctx); } -int +static int gr_generic_max(gr_ptr res, gr_srcptr x, gr_srcptr y, gr_ctx_t ctx) { int cmp; @@ -1475,7 +1475,6 @@ gr_generic_bernoulli_vec(gr_ptr res, slong len, gr_ctx_t ctx) if (0 && len <= 3000) { - slong i; bernoulli_cache_compute(len); for (i = 0; i < len; i++) bernoulli_fmpq_ui(t + i, i); @@ -1495,8 +1494,6 @@ gr_generic_bernoulli_vec(gr_ptr res, slong len, gr_ctx_t ctx) } } -void arb_fmpz_euler_number_ui(fmpz_t res, ulong n); - int gr_generic_eulernum_ui(gr_ptr res, ulong n, gr_ctx_t ctx) { diff --git a/src/gr_generic/generic_pow.c b/src/gr_generic/generic_pow.c index 84e6b3a2c3..142817839c 100644 --- a/src/gr_generic/generic_pow.c +++ b/src/gr_generic/generic_pow.c @@ -154,7 +154,7 @@ gr_generic_pow_ui_sliding(gr_ptr f, gr_srcptr g, ulong pow, gr_ctx_t ctx) } /* Assumes exp >= 2; res and tmp not not aliased with x. */ -int +static int _gr_generic_pow_ui_binexp(gr_ptr res, gr_ptr tmp, gr_srcptr x, ulong exp, gr_ctx_t ctx) { gr_ptr R, S, T; diff --git a/src/gr_generic/set_fexpr.c b/src/gr_generic/set_fexpr.c index e8d5c36685..589583a730 100644 --- a/src/gr_generic/set_fexpr.c +++ b/src/gr_generic/set_fexpr.c @@ -16,6 +16,12 @@ #include "gr_vec.h" #include "gr_special.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + #define BINARY_OP(gr_func) \ if (nargs == 2) \ { \ @@ -175,7 +181,6 @@ gr_generic_set_fexpr(gr_ptr res, fexpr_vec_t inputs, gr_vec_t outputs, const fex { fexpr_t func, arg; slong op, i, nargs; - int status; gr_ptr t; nargs = fexpr_nargs(expr); From fa6adb3e4b648aea5f591805a28e58b654dfec59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 16:04:32 +0200 Subject: [PATCH 103/114] gr_vec --- src/gr_vec/sum.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gr_vec/sum.c b/src/gr_vec/sum.c index af7de9810e..76b8753767 100644 --- a/src/gr_vec/sum.c +++ b/src/gr_vec/sum.c @@ -13,6 +13,12 @@ #include "thread_support.h" #include "gr_vec.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + typedef struct { gr_method_vec_reduce_op f; From dd7c9bf84a0ab47cd7df76be8424846b4993b592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 17:27:28 +0200 Subject: [PATCH 104/114] gr_mat --- src/gr_mat/eigenvalues.c | 4 +- src/gr_mat/fflu.c | 2 +- src/gr_mat/lu_classical.c | 2 +- src/gr_mat/minpoly_field.c | 2 - src/gr_mat/test/t-adjugate.c | 3 +- src/gr_mat/test/t-charpoly_danilevsky.c | 3 +- src/gr_mat/test/t-charpoly_faddeev.c | 3 +- src/gr_mat/test/t-charpoly_faddeev_bsgs.c | 3 +- src/gr_mat/test/t-charpoly_gauss.c | 3 +- src/gr_mat/test/t-charpoly_householder.c | 3 +- src/gr_mat/test/t-det_berkowitz.c | 3 +- src/gr_mat/test/t-det_cofactor.c | 3 +- src/gr_mat/test/t-det_fflu.c | 3 +- src/gr_mat/test/t-det_lu.c | 3 +- src/gr_mat/test/t-hessenberg.c | 3 +- src/gr_mat/test/t-hessenberg_gauss.c | 3 +- src/gr_mat/test/t-hessenberg_householder.c | 3 +- src/gr_mat/test/t-inv.c | 3 +- src/gr_mat/test/t-minpoly_field.c | 3 +- src/gr_mat/test/t-solve.c | 3 +- src/gr_mat/test/t-solve_den.c | 3 +- src/gr_mat/test/t-solve_den_fflu.c | 3 +- src/gr_mat/test/t-solve_fflu.c | 3 +- src/gr_mat/test/t-solve_lu.c | 3 +- src/gr_mat/test/t-solve_tril.c | 3 +- src/gr_mat/test/t-solve_triu.c | 3 +- src/gr_mat/test/util_test.h | 19 ++ src/gr_mat/test_approx_mul.c | 210 ++++++++++----------- src/gr_mat/test_det.c | 105 +++++------ src/gr_mat/test_lu.c | 61 +++--- src/gr_mat/test_mul.c | 75 ++++---- src/gr_mat/test_nonsingular_solve_tri.c | 77 ++++---- 32 files changed, 306 insertions(+), 317 deletions(-) create mode 100644 src/gr_mat/test/util_test.h diff --git a/src/gr_mat/eigenvalues.c b/src/gr_mat/eigenvalues.c index c6f779723d..d2c80a8959 100644 --- a/src/gr_mat/eigenvalues.c +++ b/src/gr_mat/eigenvalues.c @@ -13,7 +13,7 @@ #include "gr_poly.h" int -gr_mat_eigenvalues(gr_vec_t lambda, gr_vec_t mult, const gr_mat_t mat, int flags, gr_ctx_t ctx) +gr_mat_eigenvalues(gr_vec_t lambda, gr_vec_t mult, const gr_mat_t mat, int FLINT_UNUSED(flags), gr_ctx_t ctx) { int status; gr_poly_t cp; @@ -26,7 +26,7 @@ gr_mat_eigenvalues(gr_vec_t lambda, gr_vec_t mult, const gr_mat_t mat, int flags } int -gr_mat_eigenvalues_other(gr_vec_t lambda, gr_vec_t mult, const gr_mat_t mat, gr_ctx_t mat_ctx, int flags, gr_ctx_t ctx) +gr_mat_eigenvalues_other(gr_vec_t lambda, gr_vec_t mult, const gr_mat_t mat, gr_ctx_t mat_ctx, int FLINT_UNUSED(flags), gr_ctx_t ctx) { int status; gr_poly_t cp; diff --git a/src/gr_mat/fflu.c b/src/gr_mat/fflu.c index b621eabd5c..b51ec09125 100644 --- a/src/gr_mat/fflu.c +++ b/src/gr_mat/fflu.c @@ -13,7 +13,7 @@ #include "gr_mat.h" static void -_gr_mat_swap_rows(gr_mat_t mat, slong * perm, slong r, slong s, gr_ctx_t ctx) +_gr_mat_swap_rows(gr_mat_t mat, slong * perm, slong r, slong s, gr_ctx_t FLINT_UNUSED(ctx)) { if (r != s) { diff --git a/src/gr_mat/lu_classical.c b/src/gr_mat/lu_classical.c index 17fbb17d6d..35af536f6c 100644 --- a/src/gr_mat/lu_classical.c +++ b/src/gr_mat/lu_classical.c @@ -13,7 +13,7 @@ #include "gr_mat.h" static void -_gr_mat_swap_rows(gr_mat_t mat, slong * perm, slong r, slong s, gr_ctx_t ctx) +_gr_mat_swap_rows(gr_mat_t mat, slong * perm, slong r, slong s, gr_ctx_t FLINT_UNUSED(ctx)) { if (r != s) { diff --git a/src/gr_mat/minpoly_field.c b/src/gr_mat/minpoly_field.c index b3692c3826..6728a8f9c7 100644 --- a/src/gr_mat/minpoly_field.c +++ b/src/gr_mat/minpoly_field.c @@ -13,8 +13,6 @@ #include "gr_poly.h" #include "gr_mat.h" -int gr_mat_reduce_row(slong * column, gr_mat_t A, slong * P, slong * L, slong m, gr_ctx_t ctx); - int gr_mat_minpoly_field(gr_poly_t p, const gr_mat_t X, gr_ctx_t ctx) { diff --git a/src/gr_mat/test/t-adjugate.c b/src/gr_mat/test/t-adjugate.c index 1ef1ade792..34bf9e924d 100644 --- a/src/gr_mat/test/t-adjugate.c +++ b/src/gr_mat/test/t-adjugate.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_adjugate, state, count_success, count_domain, count_unable) { diff --git a/src/gr_mat/test/t-charpoly_danilevsky.c b/src/gr_mat/test/t-charpoly_danilevsky.c index 00b2a9d911..e19f4abc71 100644 --- a/src/gr_mat/test/t-charpoly_danilevsky.c +++ b/src/gr_mat/test/t-charpoly_danilevsky.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_charpoly_danilevsky, state, count_success, count_domain, count_unable) { diff --git a/src/gr_mat/test/t-charpoly_faddeev.c b/src/gr_mat/test/t-charpoly_faddeev.c index 91fe7a2d45..3515559be2 100644 --- a/src/gr_mat/test/t-charpoly_faddeev.c +++ b/src/gr_mat/test/t-charpoly_faddeev.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_charpoly_faddeev, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-charpoly_faddeev_bsgs.c b/src/gr_mat/test/t-charpoly_faddeev_bsgs.c index 6fe3ea95a0..2795ab3672 100644 --- a/src/gr_mat/test/t-charpoly_faddeev_bsgs.c +++ b/src/gr_mat/test/t-charpoly_faddeev_bsgs.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_charpoly_faddeev_bsgs, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-charpoly_gauss.c b/src/gr_mat/test/t-charpoly_gauss.c index 90bba1fe50..894fb43629 100644 --- a/src/gr_mat/test/t-charpoly_gauss.c +++ b/src/gr_mat/test/t-charpoly_gauss.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_charpoly_gauss, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-charpoly_householder.c b/src/gr_mat/test/t-charpoly_householder.c index 4db100fde5..a55b886c85 100644 --- a/src/gr_mat/test/t-charpoly_householder.c +++ b/src/gr_mat/test/t-charpoly_householder.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_charpoly_householder, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-det_berkowitz.c b/src/gr_mat/test/t-det_berkowitz.c index 2d2b777905..78a9201294 100644 --- a/src/gr_mat/test/t-det_berkowitz.c +++ b/src/gr_mat/test/t-det_berkowitz.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_det_berkowitz, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-det_cofactor.c b/src/gr_mat/test/t-det_cofactor.c index 34f3181f74..12911f9a52 100644 --- a/src/gr_mat/test/t-det_cofactor.c +++ b/src/gr_mat/test/t-det_cofactor.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_det_cofactor, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-det_fflu.c b/src/gr_mat/test/t-det_fflu.c index 4506988aef..0d424b69df 100644 --- a/src/gr_mat/test/t-det_fflu.c +++ b/src/gr_mat/test/t-det_fflu.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_det_fflu, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-det_lu.c b/src/gr_mat/test/t-det_lu.c index b21085fcdb..85ecf4dd39 100644 --- a/src/gr_mat/test/t-det_lu.c +++ b/src/gr_mat/test/t-det_lu.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_det_lu, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-hessenberg.c b/src/gr_mat/test/t-hessenberg.c index 94c9858773..954f022ad6 100644 --- a/src/gr_mat/test/t-hessenberg.c +++ b/src/gr_mat/test/t-hessenberg.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_hessenberg, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-hessenberg_gauss.c b/src/gr_mat/test/t-hessenberg_gauss.c index 9a1ce2c4ba..f1f77ed7f8 100644 --- a/src/gr_mat/test/t-hessenberg_gauss.c +++ b/src/gr_mat/test/t-hessenberg_gauss.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_hessenberg_gauss, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-hessenberg_householder.c b/src/gr_mat/test/t-hessenberg_householder.c index 139c683edd..55b1e9c6b7 100644 --- a/src/gr_mat/test/t-hessenberg_householder.c +++ b/src/gr_mat/test/t-hessenberg_householder.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_hessenberg_householder, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-inv.c b/src/gr_mat/test/t-inv.c index d1fb43f38b..dfb63fe293 100644 --- a/src/gr_mat/test/t-inv.c +++ b/src/gr_mat/test/t-inv.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_inv, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-minpoly_field.c b/src/gr_mat/test/t-minpoly_field.c index 808ba9f906..ed858930fb 100644 --- a/src/gr_mat/test/t-minpoly_field.c +++ b/src/gr_mat/test/t-minpoly_field.c @@ -15,8 +15,7 @@ #include "gr_mat.h" #include "gr_poly.h" /* #include "fq.h" */ - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_minpoly_field, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-solve.c b/src/gr_mat/test/t-solve.c index a55dc6da04..eccc1cffc4 100644 --- a/src/gr_mat/test/t-solve.c +++ b/src/gr_mat/test/t-solve.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_solve, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-solve_den.c b/src/gr_mat/test/t-solve_den.c index a746d32203..24617baf36 100644 --- a/src/gr_mat/test/t-solve_den.c +++ b/src/gr_mat/test/t-solve_den.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_solve_den, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-solve_den_fflu.c b/src/gr_mat/test/t-solve_den_fflu.c index 1d26fa06b2..f8f39864ab 100644 --- a/src/gr_mat/test/t-solve_den_fflu.c +++ b/src/gr_mat/test/t-solve_den_fflu.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_solve_den_fflu, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-solve_fflu.c b/src/gr_mat/test/t-solve_fflu.c index e66692addc..45ad15c104 100644 --- a/src/gr_mat/test/t-solve_fflu.c +++ b/src/gr_mat/test/t-solve_fflu.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_solve_fflu, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-solve_lu.c b/src/gr_mat/test/t-solve_lu.c index b2199fa71d..a66620b4a2 100644 --- a/src/gr_mat/test/t-solve_lu.c +++ b/src/gr_mat/test/t-solve_lu.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_solve_lu, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-solve_tril.c b/src/gr_mat/test/t-solve_tril.c index 4bed58768d..189561d50a 100644 --- a/src/gr_mat/test/t-solve_tril.c +++ b/src/gr_mat/test/t-solve_tril.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_solve_tril, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/t-solve_triu.c b/src/gr_mat/test/t-solve_triu.c index 9eebeb1935..dd72508c64 100644 --- a/src/gr_mat/test/t-solve_triu.c +++ b/src/gr_mat/test/t-solve_triu.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "gr_mat.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_GR_FUNCTION_START(gr_mat_solve_triu, state, count_success, count_unable, count_domain) { diff --git a/src/gr_mat/test/util_test.h b/src/gr_mat/test/util_test.h new file mode 100644 index 0000000000..caed12c013 --- /dev/null +++ b/src/gr_mat/test/util_test.h @@ -0,0 +1,19 @@ +/* + Copyright (C) 2024 Albin Ahlbäck + + This file is part of FLINT. + + FLINT is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License (LGPL) as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. See . +*/ + +#ifndef TEST_UTIL_H +#define TEST_UTIL_H + +#include "gr.h" + +FLINT_DLL extern gr_static_method_table _ca_methods; + +#endif diff --git a/src/gr_mat/test_approx_mul.c b/src/gr_mat/test_approx_mul.c index 9d510edaeb..a185b1821e 100644 --- a/src/gr_mat/test_approx_mul.c +++ b/src/gr_mat/test_approx_mul.c @@ -15,7 +15,6 @@ void gr_mat_test_approx_mul_max_norm(gr_method_mat_binary_op mul_impl, gr_srcptr rel_tol, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx) { slong iter; - gr_ctx_ptr given_ctx = ctx; for (iter = 0; iter < iters; iter++) { @@ -23,16 +22,16 @@ void gr_mat_test_approx_mul_max_norm(gr_method_mat_binary_op mul_impl, gr_srcptr gr_ptr err, amag, bmag, tol; slong a, b, c; int status = GR_SUCCESS; - gr_ctx_t my_ctx; - gr_ctx_ptr ctx; + gr_ctx_t ctx2; + gr_ctx_ptr ctxptr; - if (given_ctx == NULL) + if (ctx == NULL) { - gr_ctx_init_random(my_ctx, state); - ctx = my_ctx; + gr_ctx_init_random(ctx2, state); + ctxptr = ctx2; } else - ctx = given_ctx; + ctxptr = ctx; if (n_randint(state, 4) == 0) { @@ -45,105 +44,104 @@ void gr_mat_test_approx_mul_max_norm(gr_method_mat_binary_op mul_impl, gr_srcptr c = n_randint(state, maxn); } - gr_mat_init(A, a, b, ctx); - gr_mat_init(B, b, c, ctx); - gr_mat_init(C, a, c, ctx); - gr_mat_init(D, a, c, ctx); - gr_mat_init(ERR, a, c, ctx); - err = gr_heap_init(ctx); - amag = gr_heap_init(ctx); - bmag = gr_heap_init(ctx); - tol = gr_heap_init(ctx); + gr_mat_init(A, a, b, ctxptr); + gr_mat_init(B, b, c, ctxptr); + gr_mat_init(C, a, c, ctxptr); + gr_mat_init(D, a, c, ctxptr); + gr_mat_init(ERR, a, c, ctxptr); + err = gr_heap_init(ctxptr); + amag = gr_heap_init(ctxptr); + bmag = gr_heap_init(ctxptr); + tol = gr_heap_init(ctxptr); - status |= gr_mat_randtest(A, state, ctx); - status |= gr_mat_randtest(B, state, ctx); - status |= gr_mat_randtest(C, state, ctx); - status |= gr_mat_randtest(D, state, ctx); + status |= gr_mat_randtest(A, state, ctxptr); + status |= gr_mat_randtest(B, state, ctxptr); + status |= gr_mat_randtest(C, state, ctxptr); + status |= gr_mat_randtest(D, state, ctxptr); if (b == c && n_randint(state, 2)) { - status |= gr_mat_set(C, A, ctx); - status |= mul_impl(C, C, B, ctx); + status |= gr_mat_set(C, A, ctxptr); + status |= mul_impl(C, C, B, ctxptr); } else if (a == b && n_randint(state, 2)) { - status |= gr_mat_set(C, B, ctx); - status |= mul_impl(C, A, C, ctx); + status |= gr_mat_set(C, B, ctxptr); + status |= mul_impl(C, A, C, ctxptr); } else if (a == b && b == c && n_randint(state, 2)) { - status |= gr_mat_set(B, A, ctx); - status |= mul_impl(C, A, A, ctx); + status |= gr_mat_set(B, A, ctxptr); + status |= mul_impl(C, A, A, ctxptr); } else if (a == b && b == c && n_randint(state, 2)) { - status |= gr_mat_set(B, A, ctx); - status |= gr_mat_set(C, A, ctx); - status |= mul_impl(C, C, C, ctx); + status |= gr_mat_set(B, A, ctxptr); + status |= gr_mat_set(C, A, ctxptr); + status |= mul_impl(C, C, C, ctxptr); } else { - status |= mul_impl(C, A, B, ctx); + status |= mul_impl(C, A, B, ctxptr); } - status |= gr_mat_mul_classical(D, A, B, ctx); + status |= gr_mat_mul_classical(D, A, B, ctxptr); - status |= gr_mat_sub(ERR, C, D, ctx); + status |= gr_mat_sub(ERR, C, D, ctxptr); - status |= gr_mat_norm_max(err, ERR, ctx); - status |= gr_mat_norm_max(amag, A, ctx); - status |= gr_mat_norm_max(bmag, B, ctx); - status |= gr_mul(tol, amag, bmag, ctx); - status |= gr_mul(tol, tol, rel_tol, ctx); + status |= gr_mat_norm_max(err, ERR, ctxptr); + status |= gr_mat_norm_max(amag, A, ctxptr); + status |= gr_mat_norm_max(bmag, B, ctxptr); + status |= gr_mul(tol, amag, bmag, ctxptr); + status |= gr_mul(tol, tol, rel_tol, ctxptr); - if (status == GR_SUCCESS && gr_le(err, tol, ctx) == T_FALSE) + if (status == GR_SUCCESS && gr_le(err, tol, ctxptr) == T_FALSE) { flint_printf("FAIL:\n"); - gr_ctx_println(ctx); - flint_printf("A:\n"); gr_mat_print(A, ctx); flint_printf("\n\n"); - flint_printf("B:\n"); gr_mat_print(B, ctx); flint_printf("\n\n"); - flint_printf("C:\n"); gr_mat_print(C, ctx); flint_printf("\n\n"); - flint_printf("D:\n"); gr_mat_print(D, ctx); flint_printf("\n\n"); - flint_printf("ERR:\n"); gr_mat_print(ERR, ctx); flint_printf("\n\n"); - flint_printf("err:\n"); gr_println(err, ctx); flint_printf("\n\n"); - flint_printf("tol:\n"); gr_println(tol, ctx); flint_printf("\n\n"); + gr_ctx_println(ctxptr); + flint_printf("A:\n"); gr_mat_print(A, ctxptr); flint_printf("\n\n"); + flint_printf("B:\n"); gr_mat_print(B, ctxptr); flint_printf("\n\n"); + flint_printf("C:\n"); gr_mat_print(C, ctxptr); flint_printf("\n\n"); + flint_printf("D:\n"); gr_mat_print(D, ctxptr); flint_printf("\n\n"); + flint_printf("ERR:\n"); gr_mat_print(ERR, ctxptr); flint_printf("\n\n"); + flint_printf("err:\n"); gr_println(err, ctxptr); flint_printf("\n\n"); + flint_printf("tol:\n"); gr_println(tol, ctxptr); flint_printf("\n\n"); flint_abort(); } - gr_mat_clear(A, ctx); - gr_mat_clear(B, ctx); - gr_mat_clear(C, ctx); - gr_mat_clear(D, ctx); - gr_heap_clear(err, ctx); - gr_heap_clear(amag, ctx); - gr_heap_clear(bmag, ctx); - gr_heap_clear(tol, ctx); + gr_mat_clear(A, ctxptr); + gr_mat_clear(B, ctxptr); + gr_mat_clear(C, ctxptr); + gr_mat_clear(D, ctxptr); + gr_heap_clear(err, ctxptr); + gr_heap_clear(amag, ctxptr); + gr_heap_clear(bmag, ctxptr); + gr_heap_clear(tol, ctxptr); - if (given_ctx == NULL) - gr_ctx_clear(ctx); + if (ctx == NULL) + gr_ctx_clear(ctxptr); } } void gr_mat_test_approx_mul_pos_entrywise_accurate(gr_method_mat_binary_op mul_impl, gr_srcptr rel_tol, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx) { slong iter; - gr_ctx_ptr given_ctx = ctx; for (iter = 0; iter < iters; iter++) { gr_mat_t A, B, C, D, ERR, TOL; slong a, b, c; int status = GR_SUCCESS; - gr_ctx_t my_ctx; - gr_ctx_ptr ctx; + gr_ctx_t ctx2; + gr_ctx_ptr ctxptr; - if (given_ctx == NULL) + if (ctx == NULL) { - gr_ctx_init_random(my_ctx, state); - ctx = my_ctx; + gr_ctx_init_random(ctx2, state); + ctxptr = ctx2; } else - ctx = given_ctx; + ctxptr = ctx; if (n_randint(state, 4) == 0) { @@ -156,76 +154,76 @@ void gr_mat_test_approx_mul_pos_entrywise_accurate(gr_method_mat_binary_op mul_i c = n_randint(state, maxn); } - gr_mat_init(A, a, b, ctx); - gr_mat_init(B, b, c, ctx); - gr_mat_init(C, a, c, ctx); - gr_mat_init(D, a, c, ctx); - gr_mat_init(ERR, a, c, ctx); - gr_mat_init(TOL, a, c, ctx); + gr_mat_init(A, a, b, ctxptr); + gr_mat_init(B, b, c, ctxptr); + gr_mat_init(C, a, c, ctxptr); + gr_mat_init(D, a, c, ctxptr); + gr_mat_init(ERR, a, c, ctxptr); + gr_mat_init(TOL, a, c, ctxptr); - status |= gr_mat_randtest(A, state, ctx); - status |= gr_mat_randtest(B, state, ctx); - status |= gr_mat_entrywise_unary_op(A, (gr_method_unary_op) gr_abs, A, ctx); - status |= gr_mat_entrywise_unary_op(B, (gr_method_unary_op) gr_abs, B, ctx); + status |= gr_mat_randtest(A, state, ctxptr); + status |= gr_mat_randtest(B, state, ctxptr); + status |= gr_mat_entrywise_unary_op(A, (gr_method_unary_op) gr_abs, A, ctxptr); + status |= gr_mat_entrywise_unary_op(B, (gr_method_unary_op) gr_abs, B, ctxptr); - status |= gr_mat_randtest(C, state, ctx); - status |= gr_mat_randtest(D, state, ctx); + status |= gr_mat_randtest(C, state, ctxptr); + status |= gr_mat_randtest(D, state, ctxptr); if (b == c && n_randint(state, 2)) { - status |= gr_mat_set(C, A, ctx); - status |= mul_impl(C, C, B, ctx); + status |= gr_mat_set(C, A, ctxptr); + status |= mul_impl(C, C, B, ctxptr); } else if (a == b && n_randint(state, 2)) { - status |= gr_mat_set(C, B, ctx); - status |= mul_impl(C, A, C, ctx); + status |= gr_mat_set(C, B, ctxptr); + status |= mul_impl(C, A, C, ctxptr); } else if (a == b && b == c && n_randint(state, 2)) { - status |= gr_mat_set(B, A, ctx); - status |= mul_impl(C, A, A, ctx); + status |= gr_mat_set(B, A, ctxptr); + status |= mul_impl(C, A, A, ctxptr); } else if (a == b && b == c && n_randint(state, 2)) { - status |= gr_mat_set(B, A, ctx); - status |= gr_mat_set(C, A, ctx); - status |= mul_impl(C, C, C, ctx); + status |= gr_mat_set(B, A, ctxptr); + status |= gr_mat_set(C, A, ctxptr); + status |= mul_impl(C, C, C, ctxptr); } else { - status |= mul_impl(C, A, B, ctx); + status |= mul_impl(C, A, B, ctxptr); } - status |= gr_mat_mul_classical(D, A, B, ctx); + status |= gr_mat_mul_classical(D, A, B, ctxptr); /* |C-D| <= |D| tol */ - status |= gr_mat_sub(ERR, C, D, ctx); - status |= gr_mat_entrywise_unary_op(ERR, (gr_method_unary_op) gr_abs, ERR, ctx); - status |= gr_mat_entrywise_unary_op(TOL, (gr_method_unary_op) gr_abs, D, ctx); - status |= gr_mat_mul_scalar(TOL, TOL, rel_tol, ctx); + status |= gr_mat_sub(ERR, C, D, ctxptr); + status |= gr_mat_entrywise_unary_op(ERR, (gr_method_unary_op) gr_abs, ERR, ctxptr); + status |= gr_mat_entrywise_unary_op(TOL, (gr_method_unary_op) gr_abs, D, ctxptr); + status |= gr_mat_mul_scalar(TOL, TOL, rel_tol, ctxptr); - if (status == GR_SUCCESS && gr_mat_entrywise_binary_predicate_all((gr_method_binary_predicate) gr_le, ERR, TOL, ctx) == T_FALSE) + if (status == GR_SUCCESS && gr_mat_entrywise_binary_predicate_all((gr_method_binary_predicate) gr_le, ERR, TOL, ctxptr) == T_FALSE) { flint_printf("FAIL:\n"); - gr_ctx_println(ctx); - flint_printf("A:\n"); gr_mat_print(A, ctx); flint_printf("\n\n"); - flint_printf("B:\n"); gr_mat_print(B, ctx); flint_printf("\n\n"); - flint_printf("C:\n"); gr_mat_print(C, ctx); flint_printf("\n\n"); - flint_printf("D:\n"); gr_mat_print(D, ctx); flint_printf("\n\n"); - flint_printf("ERR:\n"); gr_mat_print(ERR, ctx); flint_printf("\n\n"); - flint_printf("TOL:\n"); gr_mat_print(TOL, ctx); flint_printf("\n\n"); + gr_ctx_println(ctxptr); + flint_printf("A:\n"); gr_mat_print(A, ctxptr); flint_printf("\n\n"); + flint_printf("B:\n"); gr_mat_print(B, ctxptr); flint_printf("\n\n"); + flint_printf("C:\n"); gr_mat_print(C, ctxptr); flint_printf("\n\n"); + flint_printf("D:\n"); gr_mat_print(D, ctxptr); flint_printf("\n\n"); + flint_printf("ERR:\n"); gr_mat_print(ERR, ctxptr); flint_printf("\n\n"); + flint_printf("TOL:\n"); gr_mat_print(TOL, ctxptr); flint_printf("\n\n"); flint_abort(); } - gr_mat_clear(A, ctx); - gr_mat_clear(B, ctx); - gr_mat_clear(C, ctx); - gr_mat_clear(D, ctx); - gr_mat_clear(ERR, ctx); - gr_mat_clear(TOL, ctx); + gr_mat_clear(A, ctxptr); + gr_mat_clear(B, ctxptr); + gr_mat_clear(C, ctxptr); + gr_mat_clear(D, ctxptr); + gr_mat_clear(ERR, ctxptr); + gr_mat_clear(TOL, ctxptr); - if (given_ctx == NULL) - gr_ctx_clear(ctx); + if (ctx == NULL) + gr_ctx_clear(ctxptr); } } diff --git a/src/gr_mat/test_det.c b/src/gr_mat/test_det.c index abfba71cbb..d52e7d436c 100644 --- a/src/gr_mat/test_det.c +++ b/src/gr_mat/test_det.c @@ -15,20 +15,19 @@ void gr_mat_test_det(gr_method_mat_unary_op_get_scalar det_impl, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx) { slong iter; - gr_ctx_ptr given_ctx = ctx; for (iter = 0; iter < iters; iter++) { - gr_ctx_t my_ctx; - gr_ctx_ptr ctx; + gr_ctx_t ctx2; + gr_ctx_ptr ctxptr; - if (given_ctx == NULL) + if (ctx == NULL) { - gr_ctx_init_random(my_ctx, state); - ctx = my_ctx; + gr_ctx_init_random(ctx2, state); + ctxptr = ctx2; } else - ctx = given_ctx; + ctxptr = ctx; { gr_mat_t A, B, AB; @@ -38,84 +37,84 @@ void gr_mat_test_det(gr_method_mat_unary_op_get_scalar det_impl, flint_rand_t st n = n_randint(state, maxn + 1); - gr_mat_init(A, n, n, ctx); - gr_mat_init(B, n, n, ctx); - gr_mat_init(AB, n, n, ctx); + gr_mat_init(A, n, n, ctxptr); + gr_mat_init(B, n, n, ctxptr); + gr_mat_init(AB, n, n, ctxptr); - detA = gr_heap_init(ctx); - detB = gr_heap_init(ctx); - detAB = gr_heap_init(ctx); - detAdetB = gr_heap_init(ctx); + detA = gr_heap_init(ctxptr); + detB = gr_heap_init(ctxptr); + detAB = gr_heap_init(ctxptr); + detAdetB = gr_heap_init(ctxptr); - status |= gr_mat_randtest(A, state, ctx); - status |= gr_mat_randtest(B, state, ctx); - status |= gr_mat_mul(AB, A, B, ctx); + status |= gr_mat_randtest(A, state, ctxptr); + status |= gr_mat_randtest(B, state, ctxptr); + status |= gr_mat_mul(AB, A, B, ctxptr); - status |= det_impl(detA, A, ctx); - status |= det_impl(detB, B, ctx); - status |= det_impl(detAB, AB, ctx); - status |= gr_mul(detAdetB, detA, detB, ctx); + status |= det_impl(detA, A, ctxptr); + status |= det_impl(detB, B, ctxptr); + status |= det_impl(detAB, AB, ctxptr); + status |= gr_mul(detAdetB, detA, detB, ctxptr); /* Check that the output isn't just 0 */ - if (status == GR_SUCCESS && gr_mat_is_one(A, ctx) == T_TRUE && - gr_is_one(detA, ctx) == T_FALSE) + if (status == GR_SUCCESS && gr_mat_is_one(A, ctxptr) == T_TRUE && + gr_is_one(detA, ctxptr) == T_FALSE) { flint_printf("FAIL\n\n"); - gr_ctx_println(ctx); - flint_printf("A = "); gr_mat_print(A, ctx); flint_printf("\n"); - flint_printf("detA = "); gr_print(detA, ctx); flint_printf("\n"); + gr_ctx_println(ctxptr); + flint_printf("A = "); gr_mat_print(A, ctxptr); flint_printf("\n"); + flint_printf("detA = "); gr_print(detA, ctxptr); flint_printf("\n"); flint_abort(); } - if (status == GR_SUCCESS && gr_equal(detAB, detAdetB, ctx) == T_FALSE) + if (status == GR_SUCCESS && gr_equal(detAB, detAdetB, ctxptr) == T_FALSE) { flint_printf("FAIL\n\n"); - gr_ctx_println(ctx); - flint_printf("A = "); gr_mat_print(A, ctx); flint_printf("\n"); - flint_printf("B = "); gr_mat_print(B, ctx); flint_printf("\n"); - flint_printf("AB = "); gr_mat_print(AB, ctx); flint_printf("\n"); - flint_printf("detA = "); gr_print(detA, ctx); flint_printf("\n"); - flint_printf("detB = "); gr_print(detB, ctx); flint_printf("\n"); - flint_printf("detAB = "); gr_print(detAB, ctx); flint_printf("\n"); - flint_printf("detAdetB = "); gr_print(detAdetB, ctx); flint_printf("\n"); + gr_ctx_println(ctxptr); + flint_printf("A = "); gr_mat_print(A, ctxptr); flint_printf("\n"); + flint_printf("B = "); gr_mat_print(B, ctxptr); flint_printf("\n"); + flint_printf("AB = "); gr_mat_print(AB, ctxptr); flint_printf("\n"); + flint_printf("detA = "); gr_print(detA, ctxptr); flint_printf("\n"); + flint_printf("detB = "); gr_print(detB, ctxptr); flint_printf("\n"); + flint_printf("detAB = "); gr_print(detAB, ctxptr); flint_printf("\n"); + flint_printf("detAdetB = "); gr_print(detAdetB, ctxptr); flint_printf("\n"); flint_abort(); } if ((status & GR_DOMAIN) && !(status & GR_UNABLE)) { flint_printf("FAIL (flags)\n\n"); - gr_ctx_println(ctx); - flint_printf("A = "); gr_mat_print(A, ctx); flint_printf("\n"); - flint_printf("B = "); gr_mat_print(B, ctx); flint_printf("\n"); - flint_printf("AB = "); gr_mat_print(AB, ctx); flint_printf("\n"); + gr_ctx_println(ctxptr); + flint_printf("A = "); gr_mat_print(A, ctxptr); flint_printf("\n"); + flint_printf("B = "); gr_mat_print(B, ctxptr); flint_printf("\n"); + flint_printf("AB = "); gr_mat_print(AB, ctxptr); flint_printf("\n"); flint_abort(); } - gr_mat_clear(A, ctx); - gr_mat_clear(B, ctx); - gr_mat_clear(AB, ctx); + gr_mat_clear(A, ctxptr); + gr_mat_clear(B, ctxptr); + gr_mat_clear(AB, ctxptr); /* Check error handling */ - gr_mat_init(A, n, n + 1, ctx); - status = det_impl(detA, A, ctx); + gr_mat_init(A, n, n + 1, ctxptr); + status = det_impl(detA, A, ctxptr); if (status == GR_SUCCESS) { flint_printf("FAIL (nonsquare matrix)\n\n"); - gr_ctx_println(ctx); - flint_printf("A = "); gr_mat_print(A, ctx); flint_printf("\n"); + gr_ctx_println(ctxptr); + flint_printf("A = "); gr_mat_print(A, ctxptr); flint_printf("\n"); flint_abort(); } - gr_mat_clear(A, ctx); + gr_mat_clear(A, ctxptr); - gr_heap_clear(detA, ctx); - gr_heap_clear(detB, ctx); - gr_heap_clear(detAB, ctx); - gr_heap_clear(detAdetB, ctx); + gr_heap_clear(detA, ctxptr); + gr_heap_clear(detB, ctxptr); + gr_heap_clear(detAB, ctxptr); + gr_heap_clear(detAdetB, ctxptr); } - if (given_ctx == NULL) - gr_ctx_clear(ctx); + if (ctx == NULL) + gr_ctx_clear(ctxptr); } } diff --git a/src/gr_mat/test_lu.c b/src/gr_mat/test_lu.c index 3699c3db86..07861f59a4 100644 --- a/src/gr_mat/test_lu.c +++ b/src/gr_mat/test_lu.c @@ -107,27 +107,26 @@ FLINT_DLL extern gr_static_method_table _ca_methods; void gr_mat_test_lu(gr_method_mat_lu_op lu_impl, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx) { slong iter; - gr_ctx_ptr given_ctx = ctx; for (iter = 0; iter < iters; iter++) { - gr_ctx_t my_ctx; - gr_ctx_ptr ctx; + gr_ctx_t ctx2; + gr_ctx_ptr ctxptr; gr_mat_t A, LU, LU2; slong m, n, d, r, rank, rank_lower_bound, rank_upper_bound; slong * P, * P2; int status; - if (given_ctx == NULL) + if (ctx == NULL) { - gr_ctx_init_random(my_ctx, state); - ctx = my_ctx; + gr_ctx_init_random(ctx2, state); + ctxptr = ctx2; } else - ctx = given_ctx; + ctxptr = ctx; /* Hack: ca can have too much blowup */ - if (((gr_ctx_struct *) ctx)->methods == _ca_methods) + if (((gr_ctx_struct *) ctxptr)->methods == _ca_methods) { m = n_randint(state, FLINT_MIN(maxn, 4) + 1); n = n_randint(state, FLINT_MIN(maxn, 4) + 1); @@ -138,9 +137,9 @@ void gr_mat_test_lu(gr_method_mat_lu_op lu_impl, flint_rand_t state, slong iters n = n_randint(state, maxn + 1); } - gr_mat_init(A, m, n, ctx); - gr_mat_init(LU, m, n, ctx); - gr_mat_init(LU2, m, n, ctx); + gr_mat_init(A, m, n, ctxptr); + gr_mat_init(LU, m, n, ctxptr); + gr_mat_init(LU2, m, n, ctxptr); P = flint_malloc(sizeof(slong) * m); P2 = flint_malloc(sizeof(slong) * m); @@ -148,10 +147,10 @@ void gr_mat_test_lu(gr_method_mat_lu_op lu_impl, flint_rand_t state, slong iters /* Generate matrix with known bounds on rank */ if (n_randint(state, 2)) { - GR_MUST_SUCCEED(gr_mat_randtest(A, state, ctx)); + GR_MUST_SUCCEED(gr_mat_randtest(A, state, ctxptr)); if (lu_impl != ((gr_method_mat_lu_op) gr_mat_lu_classical) && - GR_SUCCESS == gr_mat_lu_classical(&rank_lower_bound, P2, LU2, A, 0, ctx)) + GR_SUCCESS == gr_mat_lu_classical(&rank_lower_bound, P2, LU2, A, 0, ctxptr)) { rank_upper_bound = rank_lower_bound; } @@ -164,14 +163,14 @@ void gr_mat_test_lu(gr_method_mat_lu_op lu_impl, flint_rand_t state, slong iters else { r = n_randint(state, FLINT_MIN(m, n) + 1); - _gr_mat_randrank(A, state, r, 5, ctx); + _gr_mat_randrank(A, state, r, 5, ctxptr); if (n_randint(state, 2)) { d = n_randint(state, 2*m*n + 1); - GR_MUST_SUCCEED(gr_mat_randops(A, state, d, ctx)); + GR_MUST_SUCCEED(gr_mat_randops(A, state, d, ctxptr)); } - if (gr_ctx_is_finite_characteristic(ctx) == T_FALSE) + if (gr_ctx_is_finite_characteristic(ctxptr) == T_FALSE) rank_lower_bound = rank_upper_bound = r; else { @@ -180,25 +179,25 @@ void gr_mat_test_lu(gr_method_mat_lu_op lu_impl, flint_rand_t state, slong iters } } - status = lu_impl(&rank, P, LU, A, 0, ctx); + status = lu_impl(&rank, P, LU, A, 0, ctxptr); if (status == GR_SUCCESS) { /* Check shape of solution */ - check(P, LU, A, rank, ctx); + check(P, LU, A, rank, ctxptr); /* Check rank */ if (rank < rank_lower_bound || rank > rank_upper_bound) { flint_printf("FAIL\n"); - gr_ctx_println(ctx); + gr_ctx_println(ctxptr); flint_printf("wrong rank!\n"); flint_printf("rank = %wd\n", rank); flint_printf("rank bounds = [%wd, %wd]\n", rank_lower_bound, rank_upper_bound); flint_printf("\n\nA:"); - gr_mat_print(A, ctx); + gr_mat_print(A, ctxptr); flint_printf("\n\nLU:"); - gr_mat_print(LU, ctx); + gr_mat_print(LU, ctxptr); flint_abort(); } } @@ -208,7 +207,7 @@ void gr_mat_test_lu(gr_method_mat_lu_op lu_impl, flint_rand_t state, slong iters /* ----------------------------------------------------- */ if (m == n) { - status = lu_impl(&rank, P, LU, A, 1, ctx); + status = lu_impl(&rank, P, LU, A, 1, ctxptr); if (status == GR_SUCCESS) { @@ -222,29 +221,29 @@ void gr_mat_test_lu(gr_method_mat_lu_op lu_impl, flint_rand_t state, slong iters if (!ok) { flint_printf("FAIL\n"); - gr_ctx_println(ctx); + gr_ctx_println(ctxptr); flint_printf("rank check\n"); flint_printf("rank = %wd\n", rank); flint_printf("rank bounds = [%wd, %wd]\n", rank_lower_bound, rank_upper_bound); flint_printf("\n\nA:\n"); - gr_mat_print(A, ctx); + gr_mat_print(A, ctxptr); flint_printf("\n\nLU:\n"); - gr_mat_print(LU, ctx); + gr_mat_print(LU, ctxptr); flint_abort(); } if (rank != 0) - check(P, LU, A, rank, ctx); + check(P, LU, A, rank, ctxptr); } } - gr_mat_clear(A, ctx); - gr_mat_clear(LU, ctx); - gr_mat_clear(LU2, ctx); + gr_mat_clear(A, ctxptr); + gr_mat_clear(LU, ctxptr); + gr_mat_clear(LU2, ctxptr); flint_free(P); flint_free(P2); - if (given_ctx == NULL) - gr_ctx_clear(ctx); + if (ctx == NULL) + gr_ctx_clear(ctxptr); } } diff --git a/src/gr_mat/test_mul.c b/src/gr_mat/test_mul.c index 305dbd078b..1aea5f8531 100644 --- a/src/gr_mat/test_mul.c +++ b/src/gr_mat/test_mul.c @@ -15,23 +15,22 @@ void gr_mat_test_mul(gr_method_mat_binary_op mul_impl, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx) { slong iter; - gr_ctx_ptr given_ctx = ctx; for (iter = 0; iter < iters; iter++) { gr_mat_t A, B, C, D; slong a, b, c; int status = GR_SUCCESS; - gr_ctx_t my_ctx; - gr_ctx_ptr ctx; + gr_ctx_t ctx2; + gr_ctx_ptr ctxptr; - if (given_ctx == NULL) + if (ctx == NULL) { - gr_ctx_init_random(my_ctx, state); - ctx = my_ctx; + gr_ctx_init_random(ctx2, state); + ctxptr = ctx2; } else - ctx = given_ctx; + ctxptr = ctx; if (n_randint(state, 4) == 0) { @@ -44,61 +43,61 @@ void gr_mat_test_mul(gr_method_mat_binary_op mul_impl, flint_rand_t state, slong c = n_randint(state, maxn); } - gr_mat_init(A, a, b, ctx); - gr_mat_init(B, b, c, ctx); - gr_mat_init(C, a, c, ctx); - gr_mat_init(D, a, c, ctx); + gr_mat_init(A, a, b, ctxptr); + gr_mat_init(B, b, c, ctxptr); + gr_mat_init(C, a, c, ctxptr); + gr_mat_init(D, a, c, ctxptr); - status |= gr_mat_randtest(A, state, ctx); - status |= gr_mat_randtest(B, state, ctx); - status |= gr_mat_randtest(C, state, ctx); - status |= gr_mat_randtest(D, state, ctx); + status |= gr_mat_randtest(A, state, ctxptr); + status |= gr_mat_randtest(B, state, ctxptr); + status |= gr_mat_randtest(C, state, ctxptr); + status |= gr_mat_randtest(D, state, ctxptr); if (b == c && n_randint(state, 2)) { - status |= gr_mat_set(C, A, ctx); - status |= mul_impl(C, C, B, ctx); + status |= gr_mat_set(C, A, ctxptr); + status |= mul_impl(C, C, B, ctxptr); } else if (a == b && n_randint(state, 2)) { - status |= gr_mat_set(C, B, ctx); - status |= mul_impl(C, A, C, ctx); + status |= gr_mat_set(C, B, ctxptr); + status |= mul_impl(C, A, C, ctxptr); } else if (a == b && b == c && n_randint(state, 2)) { - status |= gr_mat_set(B, A, ctx); - status |= mul_impl(C, A, A, ctx); + status |= gr_mat_set(B, A, ctxptr); + status |= mul_impl(C, A, A, ctxptr); } else if (a == b && b == c && n_randint(state, 2)) { - status |= gr_mat_set(B, A, ctx); - status |= gr_mat_set(C, A, ctx); - status |= mul_impl(C, C, C, ctx); + status |= gr_mat_set(B, A, ctxptr); + status |= gr_mat_set(C, A, ctxptr); + status |= mul_impl(C, C, C, ctxptr); } else { - status |= mul_impl(C, A, B, ctx); + status |= mul_impl(C, A, B, ctxptr); } - status |= gr_mat_mul_classical(D, A, B, ctx); + status |= gr_mat_mul_classical(D, A, B, ctxptr); - if (status == GR_SUCCESS && gr_mat_equal(C, D, ctx) == T_FALSE) + if (status == GR_SUCCESS && gr_mat_equal(C, D, ctxptr) == T_FALSE) { flint_printf("FAIL:\n"); - gr_ctx_println(ctx); - flint_printf("A:\n"); gr_mat_print(A, ctx); flint_printf("\n\n"); - flint_printf("B:\n"); gr_mat_print(B, ctx); flint_printf("\n\n"); - flint_printf("C:\n"); gr_mat_print(C, ctx); flint_printf("\n\n"); - flint_printf("D:\n"); gr_mat_print(D, ctx); flint_printf("\n\n"); + gr_ctx_println(ctxptr); + flint_printf("A:\n"); gr_mat_print(A, ctxptr); flint_printf("\n\n"); + flint_printf("B:\n"); gr_mat_print(B, ctxptr); flint_printf("\n\n"); + flint_printf("C:\n"); gr_mat_print(C, ctxptr); flint_printf("\n\n"); + flint_printf("D:\n"); gr_mat_print(D, ctxptr); flint_printf("\n\n"); flint_abort(); } - gr_mat_clear(A, ctx); - gr_mat_clear(B, ctx); - gr_mat_clear(C, ctx); - gr_mat_clear(D, ctx); + gr_mat_clear(A, ctxptr); + gr_mat_clear(B, ctxptr); + gr_mat_clear(C, ctxptr); + gr_mat_clear(D, ctxptr); - if (given_ctx == NULL) - gr_ctx_clear(ctx); + if (ctx == NULL) + gr_ctx_clear(ctxptr); } } diff --git a/src/gr_mat/test_nonsingular_solve_tri.c b/src/gr_mat/test_nonsingular_solve_tri.c index 4aa3ed5c4e..376c5bd429 100644 --- a/src/gr_mat/test_nonsingular_solve_tri.c +++ b/src/gr_mat/test_nonsingular_solve_tri.c @@ -12,23 +12,22 @@ #include "gr.h" #include "gr_mat.h" -static void _gr_mat_test_nonsingular_solve_tri(gr_method_mat_binary_op_with_flag solve_impl, int upper, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx) +static void _gr_mat_test_nonsingular_solve_tri(gr_method_mat_binary_op_with_flag FLINT_UNUSED(solve_impl), int upper, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx) { slong iter; - gr_ctx_ptr given_ctx = ctx; for (iter = 0; iter < iters; iter++) { - gr_ctx_t my_ctx; - gr_ctx_ptr ctx; + gr_ctx_t ctx2; + gr_ctx_ptr ctxptr; - if (given_ctx == NULL) + if (ctx == NULL) { - gr_ctx_init_random(my_ctx, state); - ctx = my_ctx; + gr_ctx_init_random(ctx2, state); + ctxptr = ctx2; } else - ctx = given_ctx; + ctxptr = ctx; { gr_mat_t A, X, B, Y; @@ -41,76 +40,76 @@ static void _gr_mat_test_nonsingular_solve_tri(gr_method_mat_binary_op_with_flag cols = n_randint(state, maxn + 1); unit = n_randint(state, 2); - sz = ((gr_ctx_struct *) ctx)->sizeof_elem; + sz = ((gr_ctx_struct *) ctxptr)->sizeof_elem; - gr_mat_init(A, rows, rows, ctx); - gr_mat_init(B, rows, cols, ctx); - gr_mat_init(X, rows, cols, ctx); - gr_mat_init(Y, rows, cols, ctx); + gr_mat_init(A, rows, rows, ctxptr); + gr_mat_init(B, rows, cols, ctxptr); + gr_mat_init(X, rows, cols, ctxptr); + gr_mat_init(Y, rows, cols, ctxptr); - status |= gr_mat_randtest(A, state, ctx); - status |= gr_mat_randtest(X, state, ctx); - status |= gr_mat_randtest(Y, state, ctx); + status |= gr_mat_randtest(A, state, ctxptr); + status |= gr_mat_randtest(X, state, ctxptr); + status |= gr_mat_randtest(Y, state, ctxptr); for (i = 0; i < rows; i++) { if (unit) - status |= gr_one(GR_MAT_ENTRY(A, i, i, sz), ctx); + status |= gr_one(GR_MAT_ENTRY(A, i, i, sz), ctxptr); else - status |= gr_set_ui(GR_MAT_ENTRY(A, i, i, sz), 1 + n_randint(state, 100), ctx); + status |= gr_set_ui(GR_MAT_ENTRY(A, i, i, sz), 1 + n_randint(state, 100), ctxptr); if (upper) for (j = 0; j < i; j++) - status |= gr_zero(GR_MAT_ENTRY(A, i, j, sz), ctx); + status |= gr_zero(GR_MAT_ENTRY(A, i, j, sz), ctxptr); else for (j = i + 1; j < rows; j++) - status |= gr_zero(GR_MAT_ENTRY(A, i, j, sz), ctx); + status |= gr_zero(GR_MAT_ENTRY(A, i, j, sz), ctxptr); } - status |= gr_mat_mul(B, A, X, ctx); + status |= gr_mat_mul(B, A, X, ctxptr); if (unit) /* check that diagonal entries are ignored */ { for (i = 0; i < rows; i++) - status |= gr_set_ui(GR_MAT_ENTRY(A, i, i, sz), 1 + n_randint(state, 100), ctx); + status |= gr_set_ui(GR_MAT_ENTRY(A, i, i, sz), 1 + n_randint(state, 100), ctxptr); } /* Check Y = A^(-1) * (A * X) = X */ if (n_randint(state, 2)) { if (upper) - status |= gr_mat_nonsingular_solve_triu(Y, A, B, unit, ctx); + status |= gr_mat_nonsingular_solve_triu(Y, A, B, unit, ctxptr); else - status |= gr_mat_nonsingular_solve_tril(Y, A, B, unit, ctx); + status |= gr_mat_nonsingular_solve_tril(Y, A, B, unit, ctxptr); } else { - status |= gr_mat_set(Y, B, ctx); + status |= gr_mat_set(Y, B, ctxptr); if (upper) - status |= gr_mat_nonsingular_solve_triu(Y, A, Y, unit, ctx); + status |= gr_mat_nonsingular_solve_triu(Y, A, Y, unit, ctxptr); else - status |= gr_mat_nonsingular_solve_tril(Y, A, Y, unit, ctx); + status |= gr_mat_nonsingular_solve_tril(Y, A, Y, unit, ctxptr); } - if (status == GR_SUCCESS && gr_mat_equal(Y, X, ctx) == T_FALSE) + if (status == GR_SUCCESS && gr_mat_equal(Y, X, ctxptr) == T_FALSE) { flint_printf("FAIL\n"); - gr_ctx_println(ctx); - flint_printf("A = \n"); gr_mat_print(A, ctx); flint_printf("\n\n"); - flint_printf("B = \n"); gr_mat_print(B, ctx); flint_printf("\n\n"); - flint_printf("X = \n"); gr_mat_print(X, ctx); flint_printf("\n\n"); - flint_printf("Y = \n"); gr_mat_print(Y, ctx); flint_printf("\n\n"); + gr_ctx_println(ctxptr); + flint_printf("A = \n"); gr_mat_print(A, ctxptr); flint_printf("\n\n"); + flint_printf("B = \n"); gr_mat_print(B, ctxptr); flint_printf("\n\n"); + flint_printf("X = \n"); gr_mat_print(X, ctxptr); flint_printf("\n\n"); + flint_printf("Y = \n"); gr_mat_print(Y, ctxptr); flint_printf("\n\n"); flint_abort(); } - gr_mat_clear(A, ctx); - gr_mat_clear(B, ctx); - gr_mat_clear(X, ctx); - gr_mat_clear(Y, ctx); + gr_mat_clear(A, ctxptr); + gr_mat_clear(B, ctxptr); + gr_mat_clear(X, ctxptr); + gr_mat_clear(Y, ctxptr); } - if (given_ctx == NULL) - gr_ctx_clear(ctx); + if (ctx == NULL) + gr_ctx_clear(ctxptr); } } From a30910cf6280686c849334d955732ebffe5b6478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sat, 5 Oct 2024 20:44:48 +0200 Subject: [PATCH 105/114] gr_poly --- src/gr_poly.h | 5 +- src/gr_poly/compose.c | 2 +- src/gr_poly/div_divconquer.c | 2 +- src/gr_poly/div_newton.c | 2 +- src/gr_poly/divrem_divconquer.c | 6 ++ src/gr_poly/evaluate_other_rectangular.c | 2 +- src/gr_poly/evaluate_vec_fast.c | 3 +- src/gr_poly/exp_series_basecase.c | 5 +- src/gr_poly/exp_series_newton.c | 2 +- src/gr_poly/hgcd.c | 4 +- src/gr_poly/init.c | 2 +- src/gr_poly/nth_derivative.c | 2 +- src/gr_poly/refine_roots.c | 2 +- src/gr_poly/test/t-atan_series.c | 3 +- src/gr_poly/test/t-compose.c | 3 +- src/gr_poly/test/t-compose_divconquer.c | 3 +- src/gr_poly/test/t-compose_horner.c | 3 +- src/gr_poly/test/t-compose_series.c | 3 +- src/gr_poly/test/t-div_series.c | 3 +- src/gr_poly/test/t-evaluate_vec_fast.c | 3 +- src/gr_poly/test/t-exp_series.c | 3 +- src/gr_poly/test/t-factor_squarefree.c | 3 +- src/gr_poly/test/t-inv_series.c | 3 +- src/gr_poly/test/t-log_series.c | 3 +- src/gr_poly/test/t-mul_karatsuba.c | 3 +- src/gr_poly/test/t-mul_toom33.c | 3 +- src/gr_poly/test/t-pow_series_fmpq.c | 5 +- src/gr_poly/test/t-resultant.c | 3 +- src/gr_poly/test/t-resultant_euclidean.c | 3 +- src/gr_poly/test/t-resultant_hgcd.c | 3 +- src/gr_poly/test/t-resultant_sylvester.c | 3 +- src/gr_poly/test/t-revert_series.c | 3 +- src/gr_poly/test/t-rsqrt_series.c | 3 +- src/gr_poly/test/t-sqrt_series.c | 3 +- src/gr_poly/test/t-squarefree_part.c | 3 +- src/gr_poly/test/util_test.h | 19 ++++ src/gr_poly/test_div.c | 81 +++++++-------- src/gr_poly/test_div_series.c | 55 +++++----- src/gr_poly/test_divrem.c | 93 ++++++++--------- src/gr_poly/test_gcd.c | 119 +++++++++++---------- src/gr_poly/test_inv_series.c | 55 +++++----- src/gr_poly/test_mullow.c | 61 ++++++----- src/gr_poly/test_xgcd.c | 127 +++++++++++------------ src/gr_poly/xgcd.c | 6 +- src/gr_poly/xgcd_hgcd.c | 6 +- 45 files changed, 365 insertions(+), 364 deletions(-) create mode 100644 src/gr_poly/test/util_test.h diff --git a/src/gr_poly.h b/src/gr_poly.h index 3dea1d975c..1fe838a09e 100644 --- a/src/gr_poly.h +++ b/src/gr_poly.h @@ -25,6 +25,8 @@ extern "C" { #endif +FLINT_HEADER_START + void gr_poly_init(gr_poly_t poly, gr_ctx_t ctx); void gr_poly_init2(gr_poly_t poly, slong len, gr_ctx_t ctx); void gr_poly_clear(gr_poly_t poly, gr_ctx_t ctx); @@ -292,7 +294,6 @@ WARN_UNUSED_RESULT int _gr_poly_taylor_shift_convolution(gr_ptr res, gr_srcptr p WARN_UNUSED_RESULT int gr_poly_taylor_shift_convolution(gr_poly_t res, const gr_poly_t f, gr_srcptr c, gr_ctx_t ctx); WARN_UNUSED_RESULT int _gr_poly_taylor_shift_generic(gr_ptr res, gr_srcptr poly, slong len, gr_srcptr c, gr_ctx_t ctx); GR_POLY_INLINE WARN_UNUSED_RESULT int _gr_poly_taylor_shift(gr_ptr res, gr_srcptr f, slong len, gr_srcptr c, gr_ctx_t ctx) { return GR_VEC_SCALAR_OP(ctx, POLY_TAYLOR_SHIFT)(res, f, len, c, ctx); } -WARN_UNUSED_RESULT int _gr_poly_taylor_shift(gr_ptr res, gr_srcptr poly, slong len, gr_srcptr c, gr_ctx_t ctx); WARN_UNUSED_RESULT int gr_poly_taylor_shift(gr_poly_t res, const gr_poly_t f, gr_srcptr c, gr_ctx_t ctx); WARN_UNUSED_RESULT int _gr_poly_compose_horner(gr_ptr res, gr_srcptr poly1, slong len1, gr_srcptr poly2, slong len2, gr_ctx_t ctx); @@ -456,6 +457,8 @@ void _gr_poly_test_div_series(gr_method_poly_binary_trunc_op div_series_impl, fl void _gr_poly_test_gcd(gr_method_poly_gcd_op gcd_impl, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx); void _gr_poly_test_xgcd(gr_method_poly_xgcd_op xgcd_impl, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/gr_poly/compose.c b/src/gr_poly/compose.c index 111d57f17c..16966703b3 100644 --- a/src/gr_poly/compose.c +++ b/src/gr_poly/compose.c @@ -15,7 +15,7 @@ #include "gr_poly.h" /* compose by poly2 = a*x^n + c, no aliasing; n >= 1 */ -int +static int _gr_poly_compose_axnc(gr_ptr res, gr_srcptr poly1, slong len1, gr_srcptr c, gr_srcptr a, slong n, gr_ctx_t ctx) { diff --git a/src/gr_poly/div_divconquer.c b/src/gr_poly/div_divconquer.c index f8674139a2..ef9729b390 100644 --- a/src/gr_poly/div_divconquer.c +++ b/src/gr_poly/div_divconquer.c @@ -17,7 +17,7 @@ int _gr_poly_divrem_divconquer_recursive(gr_ptr Q, gr_ptr BQ, gr_ptr W, gr_srcptr A, gr_srcptr B, slong lenB, gr_srcptr invB, slong cutoff, gr_ctx_t ctx); -int +static int _gr_poly_div_divconquer_recursive(gr_ptr Q, gr_ptr W, gr_srcptr A, gr_srcptr B, slong lenB, gr_srcptr invB, slong cutoff, gr_ctx_t ctx) { diff --git a/src/gr_poly/div_newton.c b/src/gr_poly/div_newton.c index 086c386adc..3ec48b3981 100644 --- a/src/gr_poly/div_newton.c +++ b/src/gr_poly/div_newton.c @@ -14,7 +14,7 @@ #include "gr_poly.h" /* todo: public vec function */ -void +static void _gr_vec_reverse_shallow(gr_ptr res, gr_srcptr vec, slong len, gr_ctx_t ctx) { gr_method_void_unary_op set_shallow = GR_VOID_UNARY_OP(ctx, SET_SHALLOW); diff --git a/src/gr_poly/divrem_divconquer.c b/src/gr_poly/divrem_divconquer.c index a44921c55a..6a431e1e98 100644 --- a/src/gr_poly/divrem_divconquer.c +++ b/src/gr_poly/divrem_divconquer.c @@ -14,6 +14,12 @@ #include "gr_vec.h" #include "gr_poly.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + int _gr_poly_divrem_divconquer_recursive(gr_ptr Q, gr_ptr BQ, gr_ptr W, gr_srcptr A, gr_srcptr B, slong lenB, gr_srcptr invB, slong cutoff, gr_ctx_t ctx) diff --git a/src/gr_poly/evaluate_other_rectangular.c b/src/gr_poly/evaluate_other_rectangular.c index 2c1df5592e..aa036098cc 100644 --- a/src/gr_poly/evaluate_other_rectangular.c +++ b/src/gr_poly/evaluate_other_rectangular.c @@ -14,7 +14,7 @@ #include "gr_poly.h" /* todo: move me */ -int +static int gr_dot_other(gr_ptr res, gr_srcptr initial, int subtract, gr_srcptr vec1, gr_srcptr vec2, slong len, gr_ctx_t ctx2, gr_ctx_t ctx) { int status; diff --git a/src/gr_poly/evaluate_vec_fast.c b/src/gr_poly/evaluate_vec_fast.c index 6ddef31af3..4d87eb8d83 100644 --- a/src/gr_poly/evaluate_vec_fast.c +++ b/src/gr_poly/evaluate_vec_fast.c @@ -54,7 +54,7 @@ void _gr_poly_tree_free(gr_ptr * tree, slong len, gr_ctx_t ctx) } } -int +static int _gr_poly_mul_monic(gr_ptr res, gr_srcptr poly1, slong len1, gr_srcptr poly2, slong len2, gr_ctx_t ctx) { int status = GR_SUCCESS; @@ -176,7 +176,6 @@ _gr_poly_evaluate_vec_fast_precomp(gr_ptr vs, gr_srcptr poly, { if (len == 1) { - gr_ptr tmp; GR_TMP_INIT(tmp, ctx); status |= gr_neg(tmp, tree[0], ctx); status |= _gr_poly_evaluate(vs, poly, plen, tmp, ctx); diff --git a/src/gr_poly/exp_series_basecase.c b/src/gr_poly/exp_series_basecase.c index f233539a33..d8c22cd609 100644 --- a/src/gr_poly/exp_series_basecase.c +++ b/src/gr_poly/exp_series_basecase.c @@ -18,7 +18,7 @@ f[0] = exp(h[0]) hprime[k] = (k+1) * h[k+1] */ -int +static int _gr_poly_exp_series_basecase_rec_precomp1(gr_ptr f, gr_srcptr hprime, slong hlen, slong n, gr_ctx_t ctx) { slong k, l; @@ -45,7 +45,7 @@ _gr_poly_exp_series_basecase_rec_precomp1(gr_ptr f, gr_srcptr hprime, slong hlen f[k-1] = 1/k, k >= 2 hprime[k] = (k+1) * h[k+1] */ -int +static int _gr_poly_exp_series_basecase_rec_precomp2(gr_ptr f, gr_srcptr hprime, slong hlen, slong n, gr_ctx_t ctx) { slong k, l; @@ -99,7 +99,6 @@ _gr_poly_exp_series_basecase(gr_ptr f, gr_srcptr h, slong hlen, slong n, gr_ctx_ if (_gr_vec_is_zero(GR_ENTRY(h, 1, sz), hlen - 2, ctx) == T_TRUE) /* h = a + bx^d */ { slong i, j, d = hlen - 1; - gr_ptr t; GR_TMP_INIT(t, ctx); diff --git a/src/gr_poly/exp_series_newton.c b/src/gr_poly/exp_series_newton.c index 63d97d4315..c8d7feb47b 100644 --- a/src/gr_poly/exp_series_newton.c +++ b/src/gr_poly/exp_series_newton.c @@ -14,7 +14,7 @@ /* c_k x^k -> c_k x^k / (m+k) */ /* todo: optimize */ -int +static int _gr_poly_integral_offset(gr_ptr res, gr_srcptr poly, slong len, slong m, gr_ctx_t ctx) { int status = GR_SUCCESS; diff --git a/src/gr_poly/hgcd.c b/src/gr_poly/hgcd.c index 698f2ee6fa..156b5b9415 100644 --- a/src/gr_poly/hgcd.c +++ b/src/gr_poly/hgcd.c @@ -276,7 +276,7 @@ __mat_mul(gr_ptr * C, slong * lenC, */ -int +static int _gr_poly_hgcd_recursive_iter( slong * ans_sgn, gr_ptr * M, slong * lenM, @@ -374,7 +374,7 @@ _gr_poly_hgcd_recursive_iter( the first two arguments are allowed to be NULL. */ -int _gr_poly_hgcd_recursive( +static int _gr_poly_hgcd_recursive( slong * ans_sgn, gr_ptr * M, slong * lenM, gr_ptr A, slong * lenA, diff --git a/src/gr_poly/init.c b/src/gr_poly/init.c index c12989eaef..641978c345 100644 --- a/src/gr_poly/init.c +++ b/src/gr_poly/init.c @@ -11,7 +11,7 @@ #include "gr_poly.h" -void gr_poly_init(gr_poly_t poly, gr_ctx_t ctx) +void gr_poly_init(gr_poly_t poly, gr_ctx_t FLINT_UNUSED(ctx)) { poly->coeffs = NULL; poly->length = 0; diff --git a/src/gr_poly/nth_derivative.c b/src/gr_poly/nth_derivative.c index a13f73d29c..8b660085b5 100644 --- a/src/gr_poly/nth_derivative.c +++ b/src/gr_poly/nth_derivative.c @@ -46,7 +46,7 @@ gr_poly_nth_derivative(gr_poly_t res, const gr_poly_t poly, ulong n, gr_ctx_t ct int status; const slong len = poly->length; - if (len <= n) + if ((ulong) len <= n) { status = gr_poly_zero(res, ctx); } diff --git a/src/gr_poly/refine_roots.c b/src/gr_poly/refine_roots.c index a4df701d78..c9d300a365 100644 --- a/src/gr_poly/refine_roots.c +++ b/src/gr_poly/refine_roots.c @@ -14,7 +14,7 @@ #include "gr_poly.h" /* evaluate given precomputed powers up to x^m inclusive */ -int +static int _gr_poly_evaluate_rectangular_precomp(gr_ptr res, gr_srcptr poly, slong len, gr_srcptr xpow, slong m, gr_ctx_t ctx) { slong sz = ctx->sizeof_elem; diff --git a/src/gr_poly/test/t-atan_series.c b/src/gr_poly/test/t-atan_series.c index c89bad6d00..38c2be77be 100644 --- a/src/gr_poly/test/t-atan_series.c +++ b/src/gr_poly/test/t-atan_series.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" int test_atan_series(flint_rand_t state, int which) diff --git a/src/gr_poly/test/t-compose.c b/src/gr_poly/test/t-compose.c index 00f4a3b740..84bca55a97 100644 --- a/src/gr_poly/test/t-compose.c +++ b/src/gr_poly/test/t-compose.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_FUNCTION_START(gr_poly_compose, state) { diff --git a/src/gr_poly/test/t-compose_divconquer.c b/src/gr_poly/test/t-compose_divconquer.c index d8fce39576..43b7ed1466 100644 --- a/src/gr_poly/test/t-compose_divconquer.c +++ b/src/gr_poly/test/t-compose_divconquer.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_FUNCTION_START(gr_poly_compose_divconquer, state) { diff --git a/src/gr_poly/test/t-compose_horner.c b/src/gr_poly/test/t-compose_horner.c index 5c9590b2bd..a81f798354 100644 --- a/src/gr_poly/test/t-compose_horner.c +++ b/src/gr_poly/test/t-compose_horner.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_FUNCTION_START(gr_poly_compose_horner, state) { diff --git a/src/gr_poly/test/t-compose_series.c b/src/gr_poly/test/t-compose_series.c index 8798bbf823..d13afb7516 100644 --- a/src/gr_poly/test/t-compose_series.c +++ b/src/gr_poly/test/t-compose_series.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" int test_compose_series(flint_rand_t state, int which) diff --git a/src/gr_poly/test/t-div_series.c b/src/gr_poly/test/t-div_series.c index 9e56b09d38..b9bf589bd4 100644 --- a/src/gr_poly/test/t-div_series.c +++ b/src/gr_poly/test/t-div_series.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" int test_div_series(flint_rand_t state, int which) diff --git a/src/gr_poly/test/t-evaluate_vec_fast.c b/src/gr_poly/test/t-evaluate_vec_fast.c index 80fa92d390..a79afeac81 100644 --- a/src/gr_poly/test/t-evaluate_vec_fast.c +++ b/src/gr_poly/test/t-evaluate_vec_fast.c @@ -13,8 +13,7 @@ #include "ulong_extras.h" #include "gr_vec.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_FUNCTION_START(gr_poly_evaluate_vec_fast, state) { diff --git a/src/gr_poly/test/t-exp_series.c b/src/gr_poly/test/t-exp_series.c index 08d838b3b8..8be7821ea4 100644 --- a/src/gr_poly/test/t-exp_series.c +++ b/src/gr_poly/test/t-exp_series.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" int test_exp_series(flint_rand_t state) diff --git a/src/gr_poly/test/t-factor_squarefree.c b/src/gr_poly/test/t-factor_squarefree.c index 3f345ae431..7afae9b11f 100644 --- a/src/gr_poly/test/t-factor_squarefree.c +++ b/src/gr_poly/test/t-factor_squarefree.c @@ -13,8 +13,7 @@ #include "ulong_extras.h" #include "gr_vec.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_FUNCTION_START(gr_poly_factor_squarefree, state) { diff --git a/src/gr_poly/test/t-inv_series.c b/src/gr_poly/test/t-inv_series.c index 96ef6790f6..5f708da262 100644 --- a/src/gr_poly/test/t-inv_series.c +++ b/src/gr_poly/test/t-inv_series.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" int test_inv_series(flint_rand_t state, int which) diff --git a/src/gr_poly/test/t-log_series.c b/src/gr_poly/test/t-log_series.c index 11c3e1d36c..c6e185ad37 100644 --- a/src/gr_poly/test/t-log_series.c +++ b/src/gr_poly/test/t-log_series.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" int test_log_series(flint_rand_t state) diff --git a/src/gr_poly/test/t-mul_karatsuba.c b/src/gr_poly/test/t-mul_karatsuba.c index 6abac26a76..79b799a4d6 100644 --- a/src/gr_poly/test/t-mul_karatsuba.c +++ b/src/gr_poly/test/t-mul_karatsuba.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" int test_mul(flint_rand_t state, int which) diff --git a/src/gr_poly/test/t-mul_toom33.c b/src/gr_poly/test/t-mul_toom33.c index 16439ac6b7..6fb5cc2f19 100644 --- a/src/gr_poly/test/t-mul_toom33.c +++ b/src/gr_poly/test/t-mul_toom33.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" int test_mul1(flint_rand_t state, int which) diff --git a/src/gr_poly/test/t-pow_series_fmpq.c b/src/gr_poly/test/t-pow_series_fmpq.c index b80dd6fe75..6ba8c6abea 100644 --- a/src/gr_poly/test/t-pow_series_fmpq.c +++ b/src/gr_poly/test/t-pow_series_fmpq.c @@ -13,13 +13,12 @@ #include "ulong_extras.h" #include "fmpq.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" /* Defined in t-pow_series_fmpq.c, t-pow_series_ui.c and t-pow_ui.c */ #define test test_pow_series_fmpq int -test(flint_rand_t state, int which) +test(flint_rand_t state, int FLINT_UNUSED(which)) { gr_ctx_t ctx; slong n; diff --git a/src/gr_poly/test/t-resultant.c b/src/gr_poly/test/t-resultant.c index ed1a1b969c..c6022de06d 100644 --- a/src/gr_poly/test/t-resultant.c +++ b/src/gr_poly/test/t-resultant.c @@ -14,8 +14,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_FUNCTION_START(gr_poly_resultant, state) { diff --git a/src/gr_poly/test/t-resultant_euclidean.c b/src/gr_poly/test/t-resultant_euclidean.c index f2ebd4c3d4..f07a618635 100644 --- a/src/gr_poly/test/t-resultant_euclidean.c +++ b/src/gr_poly/test/t-resultant_euclidean.c @@ -14,8 +14,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_FUNCTION_START(gr_poly_resultant_euclidean, state) { diff --git a/src/gr_poly/test/t-resultant_hgcd.c b/src/gr_poly/test/t-resultant_hgcd.c index ea944d463e..075dafc101 100644 --- a/src/gr_poly/test/t-resultant_hgcd.c +++ b/src/gr_poly/test/t-resultant_hgcd.c @@ -14,8 +14,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_FUNCTION_START(gr_poly_resultant_hgcd, state) { diff --git a/src/gr_poly/test/t-resultant_sylvester.c b/src/gr_poly/test/t-resultant_sylvester.c index aa4ba8b49f..4e37a1566d 100644 --- a/src/gr_poly/test/t-resultant_sylvester.c +++ b/src/gr_poly/test/t-resultant_sylvester.c @@ -14,8 +14,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_FUNCTION_START(gr_poly_resultant_sylvester, state) { diff --git a/src/gr_poly/test/t-revert_series.c b/src/gr_poly/test/t-revert_series.c index 3c495ccc13..a2d8812f15 100644 --- a/src/gr_poly/test/t-revert_series.c +++ b/src/gr_poly/test/t-revert_series.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" int test_revert_series(flint_rand_t state, int which) diff --git a/src/gr_poly/test/t-rsqrt_series.c b/src/gr_poly/test/t-rsqrt_series.c index 8e5de4f9d9..b746e9a0e4 100644 --- a/src/gr_poly/test/t-rsqrt_series.c +++ b/src/gr_poly/test/t-rsqrt_series.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" int test_rsqrt_series(flint_rand_t state, int which) diff --git a/src/gr_poly/test/t-sqrt_series.c b/src/gr_poly/test/t-sqrt_series.c index f83354b154..1776613233 100644 --- a/src/gr_poly/test/t-sqrt_series.c +++ b/src/gr_poly/test/t-sqrt_series.c @@ -12,8 +12,7 @@ #include "test_helpers.h" #include "ulong_extras.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" int test_sqrt_series(flint_rand_t state, int which) diff --git a/src/gr_poly/test/t-squarefree_part.c b/src/gr_poly/test/t-squarefree_part.c index 6b45d5f661..9c66b00c37 100644 --- a/src/gr_poly/test/t-squarefree_part.c +++ b/src/gr_poly/test/t-squarefree_part.c @@ -13,8 +13,7 @@ #include "ulong_extras.h" #include "gr_vec.h" #include "gr_poly.h" - -FLINT_DLL extern gr_static_method_table _ca_methods; +#include "util_test.h" TEST_FUNCTION_START(gr_poly_squarefree_part, state) { diff --git a/src/gr_poly/test/util_test.h b/src/gr_poly/test/util_test.h new file mode 100644 index 0000000000..caed12c013 --- /dev/null +++ b/src/gr_poly/test/util_test.h @@ -0,0 +1,19 @@ +/* + Copyright (C) 2024 Albin Ahlbäck + + This file is part of FLINT. + + FLINT is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License (LGPL) as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. See . +*/ + +#ifndef TEST_UTIL_H +#define TEST_UTIL_H + +#include "gr.h" + +FLINT_DLL extern gr_static_method_table _ca_methods; + +#endif diff --git a/src/gr_poly/test_div.c b/src/gr_poly/test_div.c index 16d9d33826..da663d679f 100644 --- a/src/gr_poly/test_div.c +++ b/src/gr_poly/test_div.c @@ -16,58 +16,57 @@ void _gr_poly_test_div(gr_method_poly_binary_op div_impl, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx) { slong iter; - gr_ctx_ptr given_ctx = ctx; for (iter = 0; iter < iters; iter++) { gr_poly_t A, B, Q, R, QBR; int status = GR_SUCCESS; - gr_ctx_t my_ctx; - gr_ctx_struct * ctx; + gr_ctx_t ctx2; + gr_ctx_struct * ctxptr; - if (given_ctx == NULL) + if (ctx == NULL) { - gr_ctx_init_random(my_ctx, state); - ctx = my_ctx; + gr_ctx_init_random(ctx2, state); + ctxptr = ctx2; } else - ctx = given_ctx; + ctxptr = ctx; - gr_poly_init(A, ctx); - gr_poly_init(B, ctx); - gr_poly_init(Q, ctx); - gr_poly_init(R, ctx); - gr_poly_init(QBR, ctx); + gr_poly_init(A, ctxptr); + gr_poly_init(B, ctxptr); + gr_poly_init(Q, ctxptr); + gr_poly_init(R, ctxptr); + gr_poly_init(QBR, ctxptr); status = GR_SUCCESS; - status |= gr_poly_randtest(A, state, 1 + n_randint(state, maxn), ctx); - status |= gr_poly_randtest(B, state, 1 + n_randint(state, maxn), ctx); + status |= gr_poly_randtest(A, state, 1 + n_randint(state, maxn), ctxptr); + status |= gr_poly_randtest(B, state, 1 + n_randint(state, maxn), ctxptr); if (A->length < B->length) - gr_poly_swap(A, B, ctx); + gr_poly_swap(A, B, ctxptr); - status |= gr_poly_randtest(Q, state, 1 + n_randint(state, maxn), ctx); - status |= gr_poly_randtest(R, state, 1 + n_randint(state, maxn), ctx); + status |= gr_poly_randtest(Q, state, 1 + n_randint(state, maxn), ctxptr); + status |= gr_poly_randtest(R, state, 1 + n_randint(state, maxn), ctxptr); /* randomly generate monic polynomials */ if (n_randint(state, 2) && B->length >= 1) - status |= gr_poly_set_coeff_si(B, B->length - 1, 1, ctx); + status |= gr_poly_set_coeff_si(B, B->length - 1, 1, ctxptr); if (n_randint(state, 3) == 0) { - status |= gr_poly_mul(A, A, B, ctx); - status |= gr_poly_add(A, A, R, ctx); + status |= gr_poly_mul(A, A, B, ctxptr); + status |= gr_poly_add(A, A, R, ctxptr); } if (B->length >= 1) { - gr_poly_fit_length(Q, A->length - B->length + 1, ctx); - status |= div_impl(Q->coeffs, A->coeffs, A->length, B->coeffs, B->length, ctx); - _gr_poly_set_length(Q, A->length - B->length + 1, ctx); - _gr_poly_normalise(Q, ctx); + gr_poly_fit_length(Q, A->length - B->length + 1, ctxptr); + status |= div_impl(Q->coeffs, A->coeffs, A->length, B->coeffs, B->length, ctxptr); + _gr_poly_set_length(Q, A->length - B->length + 1, ctxptr); + _gr_poly_normalise(Q, ctxptr); - status |= gr_poly_mul(R, Q, B, ctx); - status |= gr_poly_sub(R, A, R, ctx); + status |= gr_poly_mul(R, Q, B, ctxptr); + status |= gr_poly_sub(R, A, R, ctxptr); } else { @@ -76,28 +75,28 @@ void _gr_poly_test_div(gr_method_poly_binary_op div_impl, if (status == GR_SUCCESS) { - status |= gr_poly_mul(QBR, Q, B, ctx); - status |= gr_poly_add(QBR, QBR, R, ctx); + status |= gr_poly_mul(QBR, Q, B, ctxptr); + status |= gr_poly_add(QBR, QBR, R, ctxptr); - if (status == GR_SUCCESS && gr_poly_equal(QBR, A, ctx) == T_FALSE) + if (status == GR_SUCCESS && gr_poly_equal(QBR, A, ctxptr) == T_FALSE) { flint_printf("FAIL\n\n"); - flint_printf("A = "); gr_poly_print(A, ctx); flint_printf("\n"); - flint_printf("B = "); gr_poly_print(B, ctx); flint_printf("\n"); - flint_printf("Q = "); gr_poly_print(Q, ctx); flint_printf("\n"); - flint_printf("R = "); gr_poly_print(R, ctx); flint_printf("\n"); - flint_printf("Q*B + R = "); gr_poly_print(QBR, ctx); flint_printf("\n"); + flint_printf("A = "); gr_poly_print(A, ctxptr); flint_printf("\n"); + flint_printf("B = "); gr_poly_print(B, ctxptr); flint_printf("\n"); + flint_printf("Q = "); gr_poly_print(Q, ctxptr); flint_printf("\n"); + flint_printf("R = "); gr_poly_print(R, ctxptr); flint_printf("\n"); + flint_printf("Q*B + R = "); gr_poly_print(QBR, ctxptr); flint_printf("\n"); flint_abort(); } } - gr_poly_clear(A, ctx); - gr_poly_clear(B, ctx); - gr_poly_clear(Q, ctx); - gr_poly_clear(R, ctx); - gr_poly_clear(QBR, ctx); + gr_poly_clear(A, ctxptr); + gr_poly_clear(B, ctxptr); + gr_poly_clear(Q, ctxptr); + gr_poly_clear(R, ctxptr); + gr_poly_clear(QBR, ctxptr); - if (given_ctx == NULL) - gr_ctx_clear(ctx); + if (ctx == NULL) + gr_ctx_clear(ctxptr); } } diff --git a/src/gr_poly/test_div_series.c b/src/gr_poly/test_div_series.c index 18a60c18b8..f6070dd52d 100644 --- a/src/gr_poly/test_div_series.c +++ b/src/gr_poly/test_div_series.c @@ -16,62 +16,61 @@ void _gr_poly_test_div_series(gr_method_poly_binary_trunc_op div_series_impl, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx) { slong iter; - gr_ctx_ptr given_ctx = ctx; for (iter = 0; iter < iters; iter++) { gr_ptr A, B, AdivB, A2; slong lenA, lenB, len; int status = GR_SUCCESS; - gr_ctx_t my_ctx; - gr_ctx_struct * ctx; + gr_ctx_t ctx2; + gr_ctx_struct * ctxptr; - if (given_ctx == NULL) + if (ctx == NULL) { - gr_ctx_init_random(my_ctx, state); - ctx = my_ctx; + gr_ctx_init_random(ctx2, state); + ctxptr = ctx2; } else - ctx = given_ctx; + ctxptr = ctx; lenA = 1 + n_randint(state, maxn); lenB = 1 + n_randint(state, maxn); len = 1 + n_randint(state, maxn); - A = gr_heap_init_vec(lenA, ctx); - B = gr_heap_init_vec(lenB, ctx); - AdivB = gr_heap_init_vec(len, ctx); - A2 = gr_heap_init_vec(len, ctx); + A = gr_heap_init_vec(lenA, ctxptr); + B = gr_heap_init_vec(lenB, ctxptr); + AdivB = gr_heap_init_vec(len, ctxptr); + A2 = gr_heap_init_vec(len, ctxptr); - GR_MUST_SUCCEED(_gr_vec_randtest(A, state, lenA, ctx)); - GR_MUST_SUCCEED(_gr_vec_randtest(B, state, lenB, ctx)); - GR_MUST_SUCCEED(_gr_vec_randtest(AdivB, state, len, ctx)); + GR_MUST_SUCCEED(_gr_vec_randtest(A, state, lenA, ctxptr)); + GR_MUST_SUCCEED(_gr_vec_randtest(B, state, lenB, ctxptr)); + GR_MUST_SUCCEED(_gr_vec_randtest(AdivB, state, len, ctxptr)); - status |= div_series_impl(AdivB, A, lenA, B, lenB, len, ctx); + status |= div_series_impl(AdivB, A, lenA, B, lenB, len, ctxptr); if (status == GR_SUCCESS) { - status |= _gr_poly_mullow(A2, AdivB, len, B, lenB, len, ctx); + status |= _gr_poly_mullow(A2, AdivB, len, B, lenB, len, ctxptr); - if (status == GR_SUCCESS && _gr_poly_equal(A2, len, A, FLINT_MIN(lenA, len), ctx) == T_FALSE) + if (status == GR_SUCCESS && _gr_poly_equal(A2, len, A, FLINT_MIN(lenA, len), ctxptr) == T_FALSE) { flint_printf("FAIL:\n"); - gr_ctx_println(ctx); + gr_ctx_println(ctxptr); flint_printf("lenA = %wd, len = %wd\n\n", lenA, len); - flint_printf("A:\n"); _gr_vec_print(A, lenA, ctx); flint_printf("\n\n"); - flint_printf("B:\n"); _gr_vec_print(B, lenB, ctx); flint_printf("\n\n"); - flint_printf("AdivB:\n"); _gr_vec_print(AdivB, len, ctx); flint_printf("\n\n"); - flint_printf("A2:\n"); _gr_vec_print(A2, len, ctx); flint_printf("\n\n"); + flint_printf("A:\n"); _gr_vec_print(A, lenA, ctxptr); flint_printf("\n\n"); + flint_printf("B:\n"); _gr_vec_print(B, lenB, ctxptr); flint_printf("\n\n"); + flint_printf("AdivB:\n"); _gr_vec_print(AdivB, len, ctxptr); flint_printf("\n\n"); + flint_printf("A2:\n"); _gr_vec_print(A2, len, ctxptr); flint_printf("\n\n"); flint_abort(); } } - gr_heap_clear_vec(A, lenA, ctx); - gr_heap_clear_vec(B, len, ctx); - gr_heap_clear_vec(AdivB, len, ctx); - gr_heap_clear_vec(A2, len, ctx); + gr_heap_clear_vec(A, lenA, ctxptr); + gr_heap_clear_vec(B, len, ctxptr); + gr_heap_clear_vec(AdivB, len, ctxptr); + gr_heap_clear_vec(A2, len, ctxptr); - if (given_ctx == NULL) - gr_ctx_clear(ctx); + if (ctx == NULL) + gr_ctx_clear(ctxptr); } } diff --git a/src/gr_poly/test_divrem.c b/src/gr_poly/test_divrem.c index 3af027e1d6..13cb950f4b 100644 --- a/src/gr_poly/test_divrem.c +++ b/src/gr_poly/test_divrem.c @@ -16,73 +16,72 @@ void _gr_poly_test_divrem(gr_method_poly_binary_binary_op divrem_impl, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx) { slong iter; - gr_ctx_ptr given_ctx = ctx; for (iter = 0; iter < iters; iter++) { gr_poly_t A, B, Q, R, QBR; int status = GR_SUCCESS; - gr_ctx_t my_ctx; - gr_ctx_struct * ctx; + gr_ctx_t ctx2; + gr_ctx_struct * ctxptr; - if (given_ctx == NULL) + if (ctx == NULL) { - gr_ctx_init_random(my_ctx, state); - ctx = my_ctx; + gr_ctx_init_random(ctx2, state); + ctxptr = ctx2; } else - ctx = given_ctx; + ctxptr = ctx; - gr_poly_init(A, ctx); - gr_poly_init(B, ctx); - gr_poly_init(Q, ctx); - gr_poly_init(R, ctx); - gr_poly_init(QBR, ctx); + gr_poly_init(A, ctxptr); + gr_poly_init(B, ctxptr); + gr_poly_init(Q, ctxptr); + gr_poly_init(R, ctxptr); + gr_poly_init(QBR, ctxptr); status = GR_SUCCESS; - status |= gr_poly_randtest(A, state, 1 + n_randint(state, maxn), ctx); - status |= gr_poly_randtest(B, state, 1 + n_randint(state, maxn), ctx); + status |= gr_poly_randtest(A, state, 1 + n_randint(state, maxn), ctxptr); + status |= gr_poly_randtest(B, state, 1 + n_randint(state, maxn), ctxptr); if (A->length < B->length) - gr_poly_swap(A, B, ctx); + gr_poly_swap(A, B, ctxptr); - status |= gr_poly_randtest(Q, state, 1 + n_randint(state, maxn), ctx); - status |= gr_poly_randtest(R, state, 1 + n_randint(state, maxn), ctx); + status |= gr_poly_randtest(Q, state, 1 + n_randint(state, maxn), ctxptr); + status |= gr_poly_randtest(R, state, 1 + n_randint(state, maxn), ctxptr); /* randomly generate monic polynomials */ if (n_randint(state, 2) && B->length >= 1) - status |= gr_poly_set_coeff_si(B, B->length - 1, 1, ctx); + status |= gr_poly_set_coeff_si(B, B->length - 1, 1, ctxptr); if (n_randint(state, 3) == 0) { - status |= gr_poly_mul(A, A, B, ctx); - status |= gr_poly_add(A, A, R, ctx); + status |= gr_poly_mul(A, A, B, ctxptr); + status |= gr_poly_add(A, A, R, ctxptr); } if (B->length >= 1) { - gr_poly_fit_length(Q, A->length - B->length + 1, ctx); - gr_poly_fit_length(R, B->length - 1, ctx); + gr_poly_fit_length(Q, A->length - B->length + 1, ctxptr); + gr_poly_fit_length(R, B->length - 1, ctxptr); if (n_randint(state, 2)) { - status |= divrem_impl(Q->coeffs, R->coeffs, A->coeffs, A->length, B->coeffs, B->length, ctx); + status |= divrem_impl(Q->coeffs, R->coeffs, A->coeffs, A->length, B->coeffs, B->length, ctxptr); } else { /* test aliasing */ gr_poly_t A2; - gr_poly_init(A2, ctx); - status |= gr_poly_set(A2, A, ctx); - status |= divrem_impl(Q->coeffs, A2->coeffs, A2->coeffs, A->length, B->coeffs, B->length, ctx); - status |= _gr_vec_set(R->coeffs, A2->coeffs, B->length - 1, ctx); - gr_poly_clear(A2, ctx); + gr_poly_init(A2, ctxptr); + status |= gr_poly_set(A2, A, ctxptr); + status |= divrem_impl(Q->coeffs, A2->coeffs, A2->coeffs, A->length, B->coeffs, B->length, ctxptr); + status |= _gr_vec_set(R->coeffs, A2->coeffs, B->length - 1, ctxptr); + gr_poly_clear(A2, ctxptr); } - _gr_poly_set_length(Q, A->length - B->length + 1, ctx); - _gr_poly_set_length(R, B->length - 1, ctx); - _gr_poly_normalise(Q, ctx); - _gr_poly_normalise(R, ctx); + _gr_poly_set_length(Q, A->length - B->length + 1, ctxptr); + _gr_poly_set_length(R, B->length - 1, ctxptr); + _gr_poly_normalise(Q, ctxptr); + _gr_poly_normalise(R, ctxptr); } else { @@ -91,28 +90,28 @@ void _gr_poly_test_divrem(gr_method_poly_binary_binary_op divrem_impl, if (status == GR_SUCCESS) { - status |= gr_poly_mul(QBR, Q, B, ctx); - status |= gr_poly_add(QBR, QBR, R, ctx); + status |= gr_poly_mul(QBR, Q, B, ctxptr); + status |= gr_poly_add(QBR, QBR, R, ctxptr); - if (status == GR_SUCCESS && gr_poly_equal(QBR, A, ctx) == T_FALSE) + if (status == GR_SUCCESS && gr_poly_equal(QBR, A, ctxptr) == T_FALSE) { flint_printf("FAIL\n\n"); - flint_printf("A = "); gr_poly_print(A, ctx); flint_printf("\n"); - flint_printf("B = "); gr_poly_print(B, ctx); flint_printf("\n"); - flint_printf("Q = "); gr_poly_print(Q, ctx); flint_printf("\n"); - flint_printf("R = "); gr_poly_print(R, ctx); flint_printf("\n"); - flint_printf("Q*B + R = "); gr_poly_print(QBR, ctx); flint_printf("\n"); + flint_printf("A = "); gr_poly_print(A, ctxptr); flint_printf("\n"); + flint_printf("B = "); gr_poly_print(B, ctxptr); flint_printf("\n"); + flint_printf("Q = "); gr_poly_print(Q, ctxptr); flint_printf("\n"); + flint_printf("R = "); gr_poly_print(R, ctxptr); flint_printf("\n"); + flint_printf("Q*B + R = "); gr_poly_print(QBR, ctxptr); flint_printf("\n"); flint_abort(); } } - gr_poly_clear(A, ctx); - gr_poly_clear(B, ctx); - gr_poly_clear(Q, ctx); - gr_poly_clear(R, ctx); - gr_poly_clear(QBR, ctx); + gr_poly_clear(A, ctxptr); + gr_poly_clear(B, ctxptr); + gr_poly_clear(Q, ctxptr); + gr_poly_clear(R, ctxptr); + gr_poly_clear(QBR, ctxptr); - if (given_ctx == NULL) - gr_ctx_clear(ctx); + if (ctx == NULL) + gr_ctx_clear(ctxptr); } } diff --git a/src/gr_poly/test_gcd.c b/src/gr_poly/test_gcd.c index 1912bc5e2b..e4e22dcd8e 100644 --- a/src/gr_poly/test_gcd.c +++ b/src/gr_poly/test_gcd.c @@ -78,137 +78,136 @@ void _gr_poly_test_gcd(gr_method_poly_gcd_op gcd_impl, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx) { slong iter; - gr_ctx_ptr given_ctx = ctx; for (iter = 0; iter < iters; iter++) { - gr_ctx_t my_ctx; - gr_ctx_struct * ctx; + gr_ctx_t ctx2; + gr_ctx_struct * ctxptr; - if (given_ctx == NULL) + if (ctx == NULL) { - gr_ctx_init_random(my_ctx, state); - ctx = my_ctx; + gr_ctx_init_random(ctx2, state); + ctxptr = ctx2; } else - ctx = given_ctx; + ctxptr = ctx; { gr_poly_t A, B, C, AC, BC, MC, G; int status = GR_SUCCESS; slong n; - gr_poly_init(A, ctx); - gr_poly_init(B, ctx); - gr_poly_init(C, ctx); - gr_poly_init(AC, ctx); - gr_poly_init(BC, ctx); - gr_poly_init(MC, ctx); - gr_poly_init(G, ctx); + gr_poly_init(A, ctxptr); + gr_poly_init(B, ctxptr); + gr_poly_init(C, ctxptr); + gr_poly_init(AC, ctxptr); + gr_poly_init(BC, ctxptr); + gr_poly_init(MC, ctxptr); + gr_poly_init(G, ctxptr); n = 1 + n_randint(state, maxn); - status = gr_poly_randtest(A, state, n, ctx); - status |= gr_poly_randtest(B, state, n, ctx); + status = gr_poly_randtest(A, state, n, ctxptr); + status |= gr_poly_randtest(B, state, n, ctxptr); - status |= gr_poly_gcd_wrapper(gcd_impl, G, A, B, ctx); + status |= gr_poly_gcd_wrapper(gcd_impl, G, A, B, ctxptr); if (status == GR_SUCCESS) { - if (gr_poly_is_zero(G, ctx) == T_FALSE) + if (gr_poly_is_zero(G, ctxptr) == T_FALSE) { - status |= gr_poly_divrem(AC, BC, A, G, ctx); + status |= gr_poly_divrem(AC, BC, A, G, ctxptr); - if (status == GR_SUCCESS && gr_poly_is_zero(BC, ctx) == T_FALSE) + if (status == GR_SUCCESS && gr_poly_is_zero(BC, ctxptr) == T_FALSE) { flint_printf("FAIL: gcd does not divide A\n\n"); - flint_printf("A = "); gr_poly_print(A, ctx); flint_printf("\n"); - flint_printf("B = "); gr_poly_print(B, ctx); flint_printf("\n"); - flint_printf("G = "); gr_poly_print(G, ctx); flint_printf("\n"); + flint_printf("A = "); gr_poly_print(A, ctxptr); flint_printf("\n"); + flint_printf("B = "); gr_poly_print(B, ctxptr); flint_printf("\n"); + flint_printf("G = "); gr_poly_print(G, ctxptr); flint_printf("\n"); flint_abort(); } - status |= gr_poly_divrem(AC, BC, B, G, ctx); + status |= gr_poly_divrem(AC, BC, B, G, ctxptr); - if (status == GR_SUCCESS && gr_poly_is_zero(BC, ctx) == T_FALSE) + if (status == GR_SUCCESS && gr_poly_is_zero(BC, ctxptr) == T_FALSE) { flint_printf("FAIL: gcd does not divide B\n\n"); - flint_printf("A = "); gr_poly_print(A, ctx); flint_printf("\n"); - flint_printf("B = "); gr_poly_print(B, ctx); flint_printf("\n"); - flint_printf("G = "); gr_poly_print(G, ctx); flint_printf("\n"); + flint_printf("A = "); gr_poly_print(A, ctxptr); flint_printf("\n"); + flint_printf("B = "); gr_poly_print(B, ctxptr); flint_printf("\n"); + flint_printf("G = "); gr_poly_print(G, ctxptr); flint_printf("\n"); flint_abort(); } } } - if (status == GR_SUCCESS && gr_poly_is_one(G, ctx) == T_TRUE) + if (status == GR_SUCCESS && gr_poly_is_one(G, ctxptr) == T_TRUE) { - status |= gr_poly_randtest(C, state, n, ctx); + status |= gr_poly_randtest(C, state, n, ctxptr); - status |= gr_poly_mul(AC, A, C, ctx); - status |= gr_poly_mul(BC, B, C, ctx); + status |= gr_poly_mul(AC, A, C, ctxptr); + status |= gr_poly_mul(BC, B, C, ctxptr); switch (n_randint(state, 3)) { case 0: - status |= gr_poly_set(G, AC, ctx); - status |= gr_poly_gcd(G, G, BC, ctx); + status |= gr_poly_set(G, AC, ctxptr); + status |= gr_poly_gcd(G, G, BC, ctxptr); break; case 1: - status |= gr_poly_set(G, BC, ctx); - status |= gr_poly_gcd(G, AC, G, ctx); + status |= gr_poly_set(G, BC, ctxptr); + status |= gr_poly_gcd(G, AC, G, ctxptr); break; default: - status |= gr_poly_gcd(G, AC, BC, ctx); + status |= gr_poly_gcd(G, AC, BC, ctxptr); break; } if (status == GR_SUCCESS) { - if (gr_poly_is_zero(C, ctx) == T_FALSE) + if (gr_poly_is_zero(C, ctxptr) == T_FALSE) { - status |= gr_poly_make_monic(MC, C, ctx); + status |= gr_poly_make_monic(MC, C, ctxptr); - if (status == GR_SUCCESS && gr_poly_equal(MC, G, ctx) == T_FALSE) + if (status == GR_SUCCESS && gr_poly_equal(MC, G, ctxptr) == T_FALSE) { flint_printf("FAIL\n\n"); - flint_printf("A = "); gr_poly_print(A, ctx); flint_printf("\n"); - flint_printf("B = "); gr_poly_print(B, ctx); flint_printf("\n"); - flint_printf("C = "); gr_poly_print(C, ctx); flint_printf("\n"); - flint_printf("G = "); gr_poly_print(G, ctx); flint_printf("\n"); + flint_printf("A = "); gr_poly_print(A, ctxptr); flint_printf("\n"); + flint_printf("B = "); gr_poly_print(B, ctxptr); flint_printf("\n"); + flint_printf("C = "); gr_poly_print(C, ctxptr); flint_printf("\n"); + flint_printf("G = "); gr_poly_print(G, ctxptr); flint_printf("\n"); flint_abort(); } } } } - status = gr_poly_randtest(A, state, n, ctx); - status |= gr_poly_gcd_wrapper(gcd_impl, G, A, A, ctx); + status = gr_poly_randtest(A, state, n, ctxptr); + status |= gr_poly_gcd_wrapper(gcd_impl, G, A, A, ctxptr); if (status == GR_SUCCESS) { - status |= gr_poly_make_monic(B, A, ctx); + status |= gr_poly_make_monic(B, A, ctxptr); - if (status == GR_SUCCESS && gr_poly_equal(G, B, ctx) == T_FALSE) + if (status == GR_SUCCESS && gr_poly_equal(G, B, ctxptr) == T_FALSE) { flint_printf("FAIL (self)\n\n"); - flint_printf("A = "); gr_poly_print(A, ctx); flint_printf("\n"); - flint_printf("B = "); gr_poly_print(B, ctx); flint_printf("\n"); - flint_printf("G = "); gr_poly_print(G, ctx); flint_printf("\n"); + flint_printf("A = "); gr_poly_print(A, ctxptr); flint_printf("\n"); + flint_printf("B = "); gr_poly_print(B, ctxptr); flint_printf("\n"); + flint_printf("G = "); gr_poly_print(G, ctxptr); flint_printf("\n"); flint_abort(); } } - gr_poly_clear(A, ctx); - gr_poly_clear(B, ctx); - gr_poly_clear(C, ctx); - gr_poly_clear(AC, ctx); - gr_poly_clear(BC, ctx); - gr_poly_clear(MC, ctx); - gr_poly_clear(G, ctx); + gr_poly_clear(A, ctxptr); + gr_poly_clear(B, ctxptr); + gr_poly_clear(C, ctxptr); + gr_poly_clear(AC, ctxptr); + gr_poly_clear(BC, ctxptr); + gr_poly_clear(MC, ctxptr); + gr_poly_clear(G, ctxptr); } - if (given_ctx == NULL) - gr_ctx_clear(ctx); + if (ctx == NULL) + gr_ctx_clear(ctxptr); } } diff --git a/src/gr_poly/test_inv_series.c b/src/gr_poly/test_inv_series.c index fb99eed718..e0792c00e7 100644 --- a/src/gr_poly/test_inv_series.c +++ b/src/gr_poly/test_inv_series.c @@ -16,62 +16,61 @@ void _gr_poly_test_inv_series(gr_method_poly_unary_trunc_op inv_series_impl, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx) { slong iter; - gr_ctx_ptr given_ctx = ctx; for (iter = 0; iter < iters; iter++) { gr_ptr A, invA, AinvA, one; slong lenA, len; int status = GR_SUCCESS; - gr_ctx_t my_ctx; - gr_ctx_struct * ctx; + gr_ctx_t ctx2; + gr_ctx_struct * ctxptr; - if (given_ctx == NULL) + if (ctx == NULL) { - gr_ctx_init_random(my_ctx, state); - ctx = my_ctx; + gr_ctx_init_random(ctx2, state); + ctxptr = ctx2; } else - ctx = given_ctx; + ctxptr = ctx; lenA = 1 + n_randint(state, maxn); len = 1 + n_randint(state, maxn); - A = gr_heap_init_vec(lenA, ctx); - invA = gr_heap_init_vec(len, ctx); - AinvA = gr_heap_init_vec(len, ctx); - one = gr_heap_init_vec(len, ctx); + A = gr_heap_init_vec(lenA, ctxptr); + invA = gr_heap_init_vec(len, ctxptr); + AinvA = gr_heap_init_vec(len, ctxptr); + one = gr_heap_init_vec(len, ctxptr); - GR_MUST_SUCCEED(_gr_vec_randtest(A, state, lenA, ctx)); - GR_MUST_SUCCEED(_gr_vec_randtest(invA, state, len, ctx)); + GR_MUST_SUCCEED(_gr_vec_randtest(A, state, lenA, ctxptr)); + GR_MUST_SUCCEED(_gr_vec_randtest(invA, state, len, ctxptr)); - status |= inv_series_impl(invA, A, lenA, len, ctx); + status |= inv_series_impl(invA, A, lenA, len, ctxptr); if (status == GR_SUCCESS) { - status |= _gr_poly_mullow(AinvA, A, lenA, invA, len, len, ctx); + status |= _gr_poly_mullow(AinvA, A, lenA, invA, len, len, ctxptr); - status |= _gr_vec_zero(one, len, ctx); - status |= gr_one(one, ctx); + status |= _gr_vec_zero(one, len, ctxptr); + status |= gr_one(one, ctxptr); - if (status == GR_SUCCESS && _gr_vec_equal(AinvA, one, len, ctx) == T_FALSE) + if (status == GR_SUCCESS && _gr_vec_equal(AinvA, one, len, ctxptr) == T_FALSE) { flint_printf("FAIL:\n"); - gr_ctx_println(ctx); + gr_ctx_println(ctxptr); flint_printf("lenA = %wd, len = %wd\n\n", lenA, len); - flint_printf("A:\n"); _gr_vec_print(A, lenA, ctx); flint_printf("\n\n"); - flint_printf("invA:\n"); _gr_vec_print(invA, len, ctx); flint_printf("\n\n"); - flint_printf("AinvA:\n"); _gr_vec_print(AinvA, len, ctx); flint_printf("\n\n"); + flint_printf("A:\n"); _gr_vec_print(A, lenA, ctxptr); flint_printf("\n\n"); + flint_printf("invA:\n"); _gr_vec_print(invA, len, ctxptr); flint_printf("\n\n"); + flint_printf("AinvA:\n"); _gr_vec_print(AinvA, len, ctxptr); flint_printf("\n\n"); flint_abort(); } } - gr_heap_clear_vec(A, lenA, ctx); - gr_heap_clear_vec(invA, len, ctx); - gr_heap_clear_vec(AinvA, len, ctx); - gr_heap_clear_vec(one, len, ctx); + gr_heap_clear_vec(A, lenA, ctxptr); + gr_heap_clear_vec(invA, len, ctxptr); + gr_heap_clear_vec(AinvA, len, ctxptr); + gr_heap_clear_vec(one, len, ctxptr); - if (given_ctx == NULL) - gr_ctx_clear(ctx); + if (ctx == NULL) + gr_ctx_clear(ctxptr); } } diff --git a/src/gr_poly/test_mullow.c b/src/gr_poly/test_mullow.c index d641ae852e..2c0f247c67 100644 --- a/src/gr_poly/test_mullow.c +++ b/src/gr_poly/test_mullow.c @@ -16,7 +16,6 @@ void _gr_poly_test_mullow(gr_method_poly_binary_trunc_op mullow_impl, gr_method_ flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx) { slong iter; - gr_ctx_ptr given_ctx = ctx; if (mullow_ref == NULL) mullow_ref = (gr_method_poly_binary_trunc_op) _gr_poly_mullow_generic; @@ -26,68 +25,68 @@ void _gr_poly_test_mullow(gr_method_poly_binary_trunc_op mullow_impl, gr_method_ gr_ptr A, B, C, D; slong n1, n2, n; int status = GR_SUCCESS; - gr_ctx_t my_ctx; - gr_ctx_struct * ctx; + gr_ctx_t ctx2; + gr_ctx_struct * ctxptr; int squaring; - if (given_ctx == NULL) + if (ctx == NULL) { - gr_ctx_init_random(my_ctx, state); - ctx = my_ctx; + gr_ctx_init_random(ctx2, state); + ctxptr = ctx2; } else - ctx = given_ctx; + ctxptr = ctx; squaring = n_randint(state, 2); n1 = 1 + n_randint(state, 1 + maxn); - n2 = squaring ? n1 : 1 + n_randint(state, 1 + maxn); + n2 = squaring ? n1 : 1 + (slong) n_randint(state, 1 + maxn); n = 1 + n_randint(state, 1 + maxn); n = FLINT_MIN(n, n1 + n2 - 1); - A = gr_heap_init_vec(n1, ctx); - B = squaring ? A : gr_heap_init_vec(n2, ctx); - C = gr_heap_init_vec(n, ctx); - D = gr_heap_init_vec(n, ctx); + A = gr_heap_init_vec(n1, ctxptr); + B = squaring ? A : gr_heap_init_vec(n2, ctxptr); + C = gr_heap_init_vec(n, ctxptr); + D = gr_heap_init_vec(n, ctxptr); - GR_MUST_SUCCEED(_gr_vec_randtest(A, state, n1, ctx)); + GR_MUST_SUCCEED(_gr_vec_randtest(A, state, n1, ctxptr)); if (!squaring) - GR_MUST_SUCCEED(_gr_vec_randtest(B, state, n2, ctx)); - GR_MUST_SUCCEED(_gr_vec_randtest(C, state, n, ctx)); + GR_MUST_SUCCEED(_gr_vec_randtest(B, state, n2, ctxptr)); + GR_MUST_SUCCEED(_gr_vec_randtest(C, state, n, ctxptr)); #if 0 /* Useful for debugging */ slong i; for (i = 0; i < n1; i++) - GR_IGNORE(gr_set_ui(GR_ENTRY(A, i, ctx->sizeof_elem), i + 1, ctx)); + GR_IGNORE(gr_set_ui(GR_ENTRY(A, i, ctxptr->sizeof_elem), i + 1, ctxptr)); for (i = 0; i < n2; i++) - GR_IGNORE(gr_set_ui(GR_ENTRY(B, i, ctx->sizeof_elem), i + 1, ctx)); + GR_IGNORE(gr_set_ui(GR_ENTRY(B, i, ctxptr->sizeof_elem), i + 1, ctxptr)); #endif - status |= mullow_impl(C, A, n1, B, n2, n, ctx); + status |= mullow_impl(C, A, n1, B, n2, n, ctxptr); if (status == GR_SUCCESS) - status |= mullow_ref(D, A, n1, B, n2, n, ctx); + status |= mullow_ref(D, A, n1, B, n2, n, ctxptr); - if (status == GR_SUCCESS && _gr_vec_equal(C, D, n, ctx) == T_FALSE) + if (status == GR_SUCCESS && _gr_vec_equal(C, D, n, ctxptr) == T_FALSE) { flint_printf("FAIL:\n"); - gr_ctx_println(ctx); + gr_ctx_println(ctxptr); flint_printf("len1 = %wd, len2 = %wd, len = %wd, squaring = %d\n\n", n1, n2, n, squaring); - flint_printf("A:\n"); _gr_vec_print(A, n1, ctx); flint_printf("\n\n"); - flint_printf("B:\n"); _gr_vec_print(B, n2, ctx); flint_printf("\n\n"); - flint_printf("C:\n"); _gr_vec_print(C, n, ctx); flint_printf("\n\n"); - flint_printf("D:\n"); _gr_vec_print(D, n, ctx); flint_printf("\n\n"); + flint_printf("A:\n"); _gr_vec_print(A, n1, ctxptr); flint_printf("\n\n"); + flint_printf("B:\n"); _gr_vec_print(B, n2, ctxptr); flint_printf("\n\n"); + flint_printf("C:\n"); _gr_vec_print(C, n, ctxptr); flint_printf("\n\n"); + flint_printf("D:\n"); _gr_vec_print(D, n, ctxptr); flint_printf("\n\n"); flint_abort(); } - gr_heap_clear_vec(A, n1, ctx); + gr_heap_clear_vec(A, n1, ctxptr); if (!squaring) - gr_heap_clear_vec(B, n2, ctx); - gr_heap_clear_vec(C, n, ctx); - gr_heap_clear_vec(D, n, ctx); + gr_heap_clear_vec(B, n2, ctxptr); + gr_heap_clear_vec(C, n, ctxptr); + gr_heap_clear_vec(D, n, ctxptr); - if (given_ctx == NULL) - gr_ctx_clear(ctx); + if (ctx == NULL) + gr_ctx_clear(ctxptr); } } diff --git a/src/gr_poly/test_xgcd.c b/src/gr_poly/test_xgcd.c index f3bf418ae6..ec31833182 100644 --- a/src/gr_poly/test_xgcd.c +++ b/src/gr_poly/test_xgcd.c @@ -16,128 +16,127 @@ void _gr_poly_test_xgcd(gr_method_poly_xgcd_op xgcd_impl, flint_rand_t state, slong iters, slong maxn, gr_ctx_t ctx) { slong iter; - gr_ctx_ptr given_ctx = ctx; for (iter = 0; iter < iters; iter++) { - gr_ctx_t my_ctx; - gr_ctx_struct * ctx; + gr_ctx_t ctx2; + gr_ctx_struct * ctxptr; - if (given_ctx == NULL) + if (ctx == NULL) { - gr_ctx_init_random(my_ctx, state); - ctx = my_ctx; + gr_ctx_init_random(ctx2, state); + ctxptr = ctx2; } else - ctx = given_ctx; + ctxptr = ctx; { gr_poly_t a, b, d, g, s, t, v, w; int status = GR_SUCCESS; int aliasing; - gr_poly_init(a, ctx); - gr_poly_init(b, ctx); - gr_poly_init(d, ctx); - gr_poly_init(g, ctx); - gr_poly_init(s, ctx); - gr_poly_init(t, ctx); - gr_poly_init(v, ctx); - gr_poly_init(w, ctx); + gr_poly_init(a, ctxptr); + gr_poly_init(b, ctxptr); + gr_poly_init(d, ctxptr); + gr_poly_init(g, ctxptr); + gr_poly_init(s, ctxptr); + gr_poly_init(t, ctxptr); + gr_poly_init(v, ctxptr); + gr_poly_init(w, ctxptr); - status |= gr_poly_randtest(a, state, 1 + n_randint(state, maxn), ctx); - status |= gr_poly_randtest(b, state, 1 + n_randint(state, maxn), ctx); + status |= gr_poly_randtest(a, state, 1 + n_randint(state, maxn), ctxptr); + status |= gr_poly_randtest(b, state, 1 + n_randint(state, maxn), ctxptr); /* common factor */ if (n_randint(state, 2)) { - status |= gr_poly_randtest(t, state, 1 + n_randint(state, maxn), ctx); - status |= gr_poly_mul(a, a, t, ctx); - status |= gr_poly_mul(b, b, t, ctx); + status |= gr_poly_randtest(t, state, 1 + n_randint(state, maxn), ctxptr); + status |= gr_poly_mul(a, a, t, ctxptr); + status |= gr_poly_mul(b, b, t, ctxptr); } - status |= gr_poly_randtest(g, state, 3, ctx); - status |= gr_poly_randtest(s, state, 3, ctx); - status |= gr_poly_randtest(t, state, 3, ctx); + status |= gr_poly_randtest(g, state, 3, ctxptr); + status |= gr_poly_randtest(s, state, 3, ctxptr); + status |= gr_poly_randtest(t, state, 3, ctxptr); aliasing = n_randint(state, 8); switch (aliasing) { case 0: - status |= gr_poly_xgcd_wrapper(xgcd_impl, g, s, t, a, b, ctx); + status |= gr_poly_xgcd_wrapper(xgcd_impl, g, s, t, a, b, ctxptr); break; case 1: - status |= gr_poly_set(g, a, ctx); - status |= gr_poly_xgcd_wrapper(xgcd_impl, g, s, t, g, b, ctx); + status |= gr_poly_set(g, a, ctxptr); + status |= gr_poly_xgcd_wrapper(xgcd_impl, g, s, t, g, b, ctxptr); break; case 2: - status |= gr_poly_set(s, a, ctx); - status |= gr_poly_xgcd_wrapper(xgcd_impl, g, s, t, s, b, ctx); + status |= gr_poly_set(s, a, ctxptr); + status |= gr_poly_xgcd_wrapper(xgcd_impl, g, s, t, s, b, ctxptr); break; case 3: - status |= gr_poly_set(t, a, ctx); - status |= gr_poly_xgcd_wrapper(xgcd_impl, g, s, t, t, b, ctx); + status |= gr_poly_set(t, a, ctxptr); + status |= gr_poly_xgcd_wrapper(xgcd_impl, g, s, t, t, b, ctxptr); break; case 4: - status |= gr_poly_set(g, b, ctx); - status |= gr_poly_xgcd_wrapper(xgcd_impl, g, s, t, a, g, ctx); + status |= gr_poly_set(g, b, ctxptr); + status |= gr_poly_xgcd_wrapper(xgcd_impl, g, s, t, a, g, ctxptr); break; case 5: - status |= gr_poly_set(s, b, ctx); - status |= gr_poly_xgcd_wrapper(xgcd_impl, g, s, t, a, s, ctx); + status |= gr_poly_set(s, b, ctxptr); + status |= gr_poly_xgcd_wrapper(xgcd_impl, g, s, t, a, s, ctxptr); break; case 6: - status |= gr_poly_set(t, b, ctx); - status |= gr_poly_xgcd_wrapper(xgcd_impl, g, s, t, a, t, ctx); + status |= gr_poly_set(t, b, ctxptr); + status |= gr_poly_xgcd_wrapper(xgcd_impl, g, s, t, a, t, ctxptr); break; case 7: - status |= gr_poly_set(b, a, ctx); - status |= gr_poly_xgcd_wrapper(xgcd_impl, g, s, t, a, a, ctx); + status |= gr_poly_set(b, a, ctxptr); + status |= gr_poly_xgcd_wrapper(xgcd_impl, g, s, t, a, a, ctxptr); break; default: break; } - status |= gr_poly_gcd_euclidean(d, a, b, ctx); + status |= gr_poly_gcd_euclidean(d, a, b, ctxptr); - status |= gr_poly_mul(v, s, a, ctx); - status |= gr_poly_mul(w, t, b, ctx); - status |= gr_poly_add(w, v, w, ctx); + status |= gr_poly_mul(v, s, a, ctxptr); + status |= gr_poly_mul(w, t, b, ctxptr); + status |= gr_poly_add(w, v, w, ctxptr); - if (status == GR_SUCCESS && (gr_poly_equal(d, g, ctx) == T_FALSE || gr_poly_equal(g, w, ctx) == T_FALSE)) + if (status == GR_SUCCESS && (gr_poly_equal(d, g, ctxptr) == T_FALSE || gr_poly_equal(g, w, ctxptr) == T_FALSE)) { flint_printf("FAIL:\n"); - gr_poly_print(a, ctx), flint_printf("\n\n"); - gr_poly_print(b, ctx), flint_printf("\n\n"); - gr_poly_print(d, ctx), flint_printf("\n\n"); - gr_poly_print(g, ctx), flint_printf("\n\n"); - gr_poly_print(s, ctx), flint_printf("\n\n"); - gr_poly_print(t, ctx), flint_printf("\n\n"); - gr_poly_print(v, ctx), flint_printf("\n\n"); - gr_poly_print(w, ctx), flint_printf("\n\n"); + gr_poly_print(a, ctxptr), flint_printf("\n\n"); + gr_poly_print(b, ctxptr), flint_printf("\n\n"); + gr_poly_print(d, ctxptr), flint_printf("\n\n"); + gr_poly_print(g, ctxptr), flint_printf("\n\n"); + gr_poly_print(s, ctxptr), flint_printf("\n\n"); + gr_poly_print(t, ctxptr), flint_printf("\n\n"); + gr_poly_print(v, ctxptr), flint_printf("\n\n"); + gr_poly_print(w, ctxptr), flint_printf("\n\n"); flint_abort(); } - if ((ctx->which_ring == GR_CTX_FMPQ || (ctx->which_ring == GR_CTX_NMOD8 && gr_ctx_is_field(ctx) == T_TRUE)) && status != GR_SUCCESS) + if ((ctxptr->which_ring == GR_CTX_FMPQ || (ctxptr->which_ring == GR_CTX_NMOD8 && gr_ctx_is_field(ctxptr) == T_TRUE)) && status != GR_SUCCESS) { flint_printf("FAIL: did not succeed over Q or Z/pZ\n\n"); - gr_poly_print(a, ctx), flint_printf("\n\n"); - gr_poly_print(b, ctx), flint_printf("\n\n"); + gr_poly_print(a, ctxptr), flint_printf("\n\n"); + gr_poly_print(b, ctxptr), flint_printf("\n\n"); flint_abort(); } - gr_poly_clear(a, ctx); - gr_poly_clear(b, ctx); - gr_poly_clear(d, ctx); - gr_poly_clear(g, ctx); - gr_poly_clear(s, ctx); - gr_poly_clear(t, ctx); - gr_poly_clear(v, ctx); - gr_poly_clear(w, ctx); + gr_poly_clear(a, ctxptr); + gr_poly_clear(b, ctxptr); + gr_poly_clear(d, ctxptr); + gr_poly_clear(g, ctxptr); + gr_poly_clear(s, ctxptr); + gr_poly_clear(t, ctxptr); + gr_poly_clear(v, ctxptr); + gr_poly_clear(w, ctxptr); } - if (given_ctx == NULL) - gr_ctx_clear(ctx); + if (ctx == NULL) + gr_ctx_clear(ctxptr); } } diff --git a/src/gr_poly/xgcd.c b/src/gr_poly/xgcd.c index ddfa4e7abe..1684c10961 100644 --- a/src/gr_poly/xgcd.c +++ b/src/gr_poly/xgcd.c @@ -37,8 +37,6 @@ gr_poly_xgcd_wrapper(gr_method_poly_xgcd_op _xgcd_op, gr_poly_t G, gr_poly_t S, const slong lenA = A->length, lenB = B->length; int status = GR_SUCCESS; slong sz = ctx->sizeof_elem; - gr_ptr t; - if (lenA == 0) /* lenA = lenB = 0 */ { @@ -48,6 +46,8 @@ gr_poly_xgcd_wrapper(gr_method_poly_xgcd_op _xgcd_op, gr_poly_t G, gr_poly_t S, } else if (lenB == 0) /* lenA > lenB = 0 */ { + gr_ptr t; + GR_TMP_INIT(t, ctx); status |= gr_inv(t, GR_ENTRY(A->coeffs, lenA - 1, sz), ctx); status |= gr_poly_mul_scalar(G, A, t, ctx); @@ -62,6 +62,8 @@ gr_poly_xgcd_wrapper(gr_method_poly_xgcd_op _xgcd_op, gr_poly_t G, gr_poly_t S, } else if (lenB == 1) /* lenA >= lenB = 1 */ { + gr_ptr t; + GR_TMP_INIT(t, ctx); status |= gr_inv(t, B->coeffs, ctx); status |= gr_poly_set_scalar(T, t, ctx); diff --git a/src/gr_poly/xgcd_hgcd.c b/src/gr_poly/xgcd_hgcd.c index 9a708a3648..f66dfb4596 100644 --- a/src/gr_poly/xgcd_hgcd.c +++ b/src/gr_poly/xgcd_hgcd.c @@ -247,8 +247,6 @@ gr_poly_xgcd_hgcd(gr_poly_t G, gr_poly_t S, gr_poly_t T, const gr_poly_t A, cons const slong lenA = A->length, lenB = B->length; int status = GR_SUCCESS; slong sz = ctx->sizeof_elem; - gr_ptr t; - if (lenA == 0) /* lenA = lenB = 0 */ { @@ -258,6 +256,8 @@ gr_poly_xgcd_hgcd(gr_poly_t G, gr_poly_t S, gr_poly_t T, const gr_poly_t A, cons } else if (lenB == 0) /* lenA > lenB = 0 */ { + gr_ptr t; + GR_TMP_INIT(t, ctx); status |= gr_inv(t, GR_ENTRY(A->coeffs, lenA - 1, sz), ctx); status |= gr_poly_mul_scalar(G, A, t, ctx); @@ -272,6 +272,8 @@ gr_poly_xgcd_hgcd(gr_poly_t G, gr_poly_t S, gr_poly_t T, const gr_poly_t A, cons } else if (lenB == 1) /* lenA >= lenB = 1 */ { + gr_ptr t; + GR_TMP_INIT(t, ctx); status |= gr_inv(t, B->coeffs, ctx); status |= gr_poly_set_scalar(T, t, ctx); From 82a954dbd0dced0d858cf97a4cab3378f483cac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 20:09:03 +0200 Subject: [PATCH 106/114] gr_special --- src/gr_special/bin.c | 18 +++++++++--------- src/gr_special/chebyshev_t.c | 1 - src/gr_special/fac.c | 11 +++++------ src/gr_special/fib.c | 24 ++++++++++++------------ 4 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/gr_special/bin.c b/src/gr_special/bin.c index 73331a40eb..13c9e913e0 100644 --- a/src/gr_special/bin.c +++ b/src/gr_special/bin.c @@ -16,7 +16,7 @@ /* todo: other algorithms; specializations */ -int +static int gr_rising_ui_forward(gr_ptr res, gr_srcptr x, ulong n, gr_ctx_t ctx) { gr_ptr t; @@ -172,11 +172,11 @@ gr_generic_bin_uiui(gr_ptr res, ulong n, ulong k, gr_ctx_t ctx) if (status != GR_SUCCESS) { - fmpz_t t; - fmpz_init(t); - fmpz_bin_uiui(t, n, k); - status = gr_set_fmpz(res, t, ctx); - fmpz_clear(t); + fmpz_t tf; + fmpz_init(tf); + fmpz_bin_uiui(tf, n, k); + status = gr_set_fmpz(res, tf, ctx); + fmpz_clear(tf); } } @@ -248,7 +248,7 @@ gr_generic_bin_ui_vec(gr_ptr res, ulong n, slong len, gr_ctx_t ctx) if (len == 1) return gr_one(res, ctx); - m = FLINT_MIN(len - 1, n / 2) + 1; + m = FLINT_MIN(len - 1, (slong) (n / 2)) + 1; finite_char = gr_ctx_is_finite_characteristic(ctx); @@ -309,11 +309,11 @@ gr_generic_bin_ui_vec(gr_ptr res, ulong n, slong len, gr_ctx_t ctx) /* todo: vec reverse */ if (m < len) { - for (i = m; i <= FLINT_MIN(n, len - 1); i++) + for (i = m; i <= FLINT_MIN((slong) n, len - 1); i++) status |= gr_set(GR_ENTRY(res, i, sz), GR_ENTRY(res, n - i, sz), ctx); } - if (len - 1 > n) + if ((ulong) len - 1 > n) status |= _gr_vec_zero(GR_ENTRY(res, n + 1, sz), len - 1 - n, ctx); return status; diff --git a/src/gr_special/chebyshev_t.c b/src/gr_special/chebyshev_t.c index 9398501511..91b7a963aa 100644 --- a/src/gr_special/chebyshev_t.c +++ b/src/gr_special/chebyshev_t.c @@ -117,7 +117,6 @@ gr_generic_chebyshev_t_fmpz(gr_ptr y, const fmpz_t n, gr_srcptr x, gr_ctx_t ctx) { /* we only need one value, so break out final iteration */ gr_ptr t, u; - fmpz_t n1; GR_TMP_INIT2(t, u, ctx); fmpz_init(n1); diff --git a/src/gr_special/fac.c b/src/gr_special/fac.c index d342d8a360..35ebe5f414 100644 --- a/src/gr_special/fac.c +++ b/src/gr_special/fac.c @@ -336,7 +336,6 @@ gr_generic_harmonic_ui(gr_ptr res, ulong n, gr_ctx_t ctx) if (n > 100 && gr_ctx_has_real_prec(ctx) == T_TRUE) { - gr_ptr t; GR_TMP_INIT(t, ctx); status |= gr_set_ui(t, n, ctx); status |= gr_add_ui(t, t, 1, ctx); @@ -349,11 +348,11 @@ gr_generic_harmonic_ui(gr_ptr res, ulong n, gr_ctx_t ctx) if (n <= 100 || gr_ctx_is_finite_characteristic(ctx) == T_FALSE) { - fmpq_t t; - fmpq_init(t); - fmpq_harmonic_ui(t, n); - status = gr_set_fmpq(res, t, ctx); - fmpq_clear(t); + fmpq_t tq; + fmpq_init(tq); + fmpq_harmonic_ui(tq, n); + status = gr_set_fmpq(res, tq, ctx); + fmpq_clear(tq); return status; } diff --git a/src/gr_special/fib.c b/src/gr_special/fib.c index 49688b9b46..bce3faf041 100644 --- a/src/gr_special/fib.c +++ b/src/gr_special/fib.c @@ -76,18 +76,18 @@ gr_generic_fib2_fmpz(gr_ptr v, gr_ptr u, const fmpz_t n, gr_ctx_t ctx) if (fmpz_sgn(n) < 0) { - fmpz_t t; - fmpz_init(t); - fmpz_neg(t, n); - fmpz_add_ui(t, t, 1); + fmpz_t tz; + fmpz_init(tz); + fmpz_neg(tz, n); + fmpz_add_ui(tz, tz, 1); - status |= gr_generic_fib2_fmpz(u, v, t, ctx); - if (fmpz_is_even(t)) + status |= gr_generic_fib2_fmpz(u, v, tz, ctx); + if (fmpz_is_even(tz)) status |= gr_neg(u, u, ctx); else status |= gr_neg(v, v, ctx); - fmpz_clear(t); + fmpz_clear(tz); return status; } @@ -104,11 +104,11 @@ gr_generic_fib2_fmpz(gr_ptr v, gr_ptr u, const fmpz_t n, gr_ctx_t ctx) bit = nbits - FIBTAB_BITS; { - fmpz_t t; - fmpz_init(t); - fmpz_tdiv_q_2exp(t, n, bit); - i = *t; - fmpz_clear(t); + fmpz_t tz; + fmpz_init(tz); + fmpz_tdiv_q_2exp(tz, n, bit); + i = *tz; + fmpz_clear(tz); } if (!COEFF_IS_MPZ(*n)) From 01765b5dae60051c09ca81aa53fd0c6034e0b821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 21:37:00 +0200 Subject: [PATCH 107/114] fmpz_mpoly_q --- src/fmpz_mpoly_q/evaluate_acb.c | 2 +- src/fmpz_mpoly_q/used_vars.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fmpz_mpoly_q/evaluate_acb.c b/src/fmpz_mpoly_q/evaluate_acb.c index 1db660d4aa..891f49d70b 100644 --- a/src/fmpz_mpoly_q/evaluate_acb.c +++ b/src/fmpz_mpoly_q/evaluate_acb.c @@ -15,7 +15,7 @@ #include "gr.h" #include "gr_generic.h" -void +static void fmpz_mpoly_evaluate_acb(acb_t res, const fmpz_mpoly_t pol, acb_srcptr x, slong prec, const fmpz_mpoly_ctx_t ctx) { gr_ctx_t CC; diff --git a/src/fmpz_mpoly_q/used_vars.c b/src/fmpz_mpoly_q/used_vars.c index 46e4a0eea7..109258ddd1 100644 --- a/src/fmpz_mpoly_q/used_vars.c +++ b/src/fmpz_mpoly_q/used_vars.c @@ -13,7 +13,7 @@ #include "fmpz_mpoly_q.h" /* ANDs used without zeroing */ -void +static void _fmpz_mpoly_used_vars(int * used, const fmpz_mpoly_t f, const fmpz_mpoly_ctx_t ctx) { slong i, n; From 77e1fd09caf349da5dff12b0379cebc75811c8fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 8 Oct 2024 21:37:07 +0200 Subject: [PATCH 108/114] calcium --- src/calcium/write_acb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calcium/write_acb.c b/src/calcium/write_acb.c index 8c15bbf79d..fb69fe821e 100644 --- a/src/calcium/write_acb.c +++ b/src/calcium/write_acb.c @@ -12,7 +12,7 @@ #include "acb.h" #include "calcium.h" -void +static void calcium_write_arb(calcium_stream_t out, const arb_t x, slong digits, ulong flags) { calcium_write_free(out, arb_get_str(x, digits, flags)); From 8d49390e100458f33e65b5c1de3bff961f11eedd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Wed, 9 Oct 2024 01:12:28 +0200 Subject: [PATCH 109/114] qqbar --- src/qqbar/affine_transform.c | 28 +++++++------- src/qqbar/atan_pi.c | 6 +++ src/qqbar/composed_op.c | 2 +- src/qqbar/equal_fmpq_poly_val.c | 2 +- src/qqbar/evaluate_fmpq_poly.c | 34 +++++++++-------- src/qqbar/express_in_field.c | 2 +- src/qqbar/get_fexpr.c | 63 +++++++++++++++++-------------- src/qqbar/pow.c | 2 +- src/qqbar/randtest.c | 8 ++-- src/qqbar/root_ui.c | 16 ++++---- src/qqbar/roots_poly_squarefree.c | 2 +- src/qqbar/set_fexpr.c | 34 ++++++++--------- src/qqbar/write.c | 11 ++++++ 13 files changed, 119 insertions(+), 91 deletions(-) diff --git a/src/qqbar/affine_transform.c b/src/qqbar/affine_transform.c index e4853f2b5e..bba103c2fd 100644 --- a/src/qqbar/affine_transform.c +++ b/src/qqbar/affine_transform.c @@ -69,11 +69,11 @@ qqbar_scalar_op(qqbar_t res, const qqbar_t x, const fmpz_t a, const fmpz_t b, co /* Special case: set to rational */ if (fmpz_is_zero(a)) { - fmpq_t t; - fmpq_init(t); - fmpq_set_fmpz_frac(t, b, c); - qqbar_set_fmpq(res, t); - fmpq_clear(t); + fmpq_t tq; + fmpq_init(tq); + fmpq_set_fmpz_frac(tq, b, c); + qqbar_set_fmpq(res, tq); + fmpq_clear(tq); return; } @@ -82,18 +82,18 @@ qqbar_scalar_op(qqbar_t res, const qqbar_t x, const fmpz_t a, const fmpz_t b, co /* Special case: rational arithmetic */ if (d == 1) { - fmpq_t t; - fmpq_init(t); - fmpz_neg(fmpq_numref(t), QQBAR_POLY(x)->coeffs); - fmpz_set(fmpq_denref(t), QQBAR_POLY(x)->coeffs + 1); + fmpq_t tq; + fmpq_init(tq); + fmpz_neg(fmpq_numref(tq), QQBAR_POLY(x)->coeffs); + fmpz_set(fmpq_denref(tq), QQBAR_POLY(x)->coeffs + 1); if (!fmpz_is_one(a)) - fmpq_mul_fmpz(t, t, a); + fmpq_mul_fmpz(tq, tq, a); if (!fmpz_is_zero(b)) - fmpq_add_fmpz(t, t, b); + fmpq_add_fmpz(tq, tq, b); if (!fmpz_is_one(c)) - fmpq_div_fmpz(t, t, c); - qqbar_set_fmpq(res, t); - fmpq_clear(t); + fmpq_div_fmpz(tq, tq, c); + qqbar_set_fmpq(res, tq); + fmpq_clear(tq); return; } diff --git a/src/qqbar/atan_pi.c b/src/qqbar/atan_pi.c index c9c3fac91c..0a50f53a1c 100644 --- a/src/qqbar/atan_pi.c +++ b/src/qqbar/atan_pi.c @@ -19,6 +19,12 @@ # include #endif +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void best_rational_fast(slong * p, ulong * q, double x, slong N) { diff --git a/src/qqbar/composed_op.c b/src/qqbar/composed_op.c index 1e59f9b2ea..2233bf9e00 100644 --- a/src/qqbar/composed_op.c +++ b/src/qqbar/composed_op.c @@ -196,7 +196,7 @@ qqbar_fmpz_poly_composed_op(fmpz_poly_t res, const fmpz_poly_t A, const fmpz_pol #include "profiler.h" #endif -void +static void qqbar_binary_op_without_guess(qqbar_t res, const qqbar_t x, const qqbar_t y, int op) { slong i, prec, found; diff --git a/src/qqbar/equal_fmpq_poly_val.c b/src/qqbar/equal_fmpq_poly_val.c index d5a1bc8425..54baa6e08a 100644 --- a/src/qqbar/equal_fmpq_poly_val.c +++ b/src/qqbar/equal_fmpq_poly_val.c @@ -19,7 +19,7 @@ /* C = A o P mod B */ /* todo: rem P by B initially if larger */ /* todo: brent-kung or something more clever */ -void +static void fmpq_poly_compose_fmpz_poly_mod_fmpz_poly(fmpq_poly_t C, const fmpz_poly_t A, const fmpq_poly_t P, const fmpz_poly_t B) { slong i, m; diff --git a/src/qqbar/evaluate_fmpq_poly.c b/src/qqbar/evaluate_fmpq_poly.c index 502bdc0381..afbe8e4c39 100644 --- a/src/qqbar/evaluate_fmpq_poly.c +++ b/src/qqbar/evaluate_fmpq_poly.c @@ -83,7 +83,7 @@ _qqbar_evaluate_fmpq_poly(qqbar_t res, const fmpz * poly, const fmpz_t den, slon } else { - fmpq_poly_t t, minpoly; + fmpq_poly_t minpoly; nf_t nf; nf_elem_t elem; fmpq_mat_t mat; @@ -93,20 +93,24 @@ _qqbar_evaluate_fmpq_poly(qqbar_t res, const fmpz * poly, const fmpz_t den, slon /* todo: other special cases; deflation? */ is_power = _fmpz_vec_is_zero(poly, len - 1); - /* nf_init wants an fmpq_poly_t, so mock up one */ - t->coeffs = QQBAR_POLY(x)->coeffs; - t->den[0] = 1; - t->length = QQBAR_POLY(x)->length; - t->alloc = QQBAR_POLY(x)->alloc; - - nf_init(nf, t); - nf_elem_init(elem, nf); - - t->coeffs = (fmpz *) poly; - t->length = len; - t->den[0] = *den; - t->alloc = len; - nf_elem_set_fmpq_poly(elem, t, nf); + { + fmpq_poly_t t; + + /* nf_init wants an fmpq_poly_t, so mock up one */ + t->coeffs = QQBAR_POLY(x)->coeffs; + t->den[0] = 1; + t->length = QQBAR_POLY(x)->length; + t->alloc = QQBAR_POLY(x)->alloc; + + nf_init(nf, t); + nf_elem_init(elem, nf); + + t->coeffs = (fmpz *) poly; + t->length = len; + t->den[0] = *den; + t->alloc = len; + nf_elem_set_fmpq_poly(elem, t, nf); + } fmpq_mat_init(mat, d, d); nf_elem_rep_mat(mat, elem, nf); diff --git a/src/qqbar/express_in_field.c b/src/qqbar/express_in_field.c index e752faed0e..a74a4311bf 100644 --- a/src/qqbar/express_in_field.c +++ b/src/qqbar/express_in_field.c @@ -14,7 +14,7 @@ #include "qqbar.h" int -qqbar_express_in_field(fmpq_poly_t res, const qqbar_t alpha, const qqbar_t x, slong max_bits, int flags, slong prec) +qqbar_express_in_field(fmpq_poly_t res, const qqbar_t alpha, const qqbar_t x, slong FLINT_UNUSED(max_bits), int FLINT_UNUSED(flags), slong prec) { slong d, dx; acb_ptr vec; diff --git a/src/qqbar/get_fexpr.c b/src/qqbar/get_fexpr.c index a2950b4b18..a964a8de9d 100644 --- a/src/qqbar/get_fexpr.c +++ b/src/qqbar/get_fexpr.c @@ -18,6 +18,12 @@ #include "ulong_extras.h" #include "qqbar.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + static ulong _deflation(const fmpz * poly, slong len) { fmpz_poly_t t; @@ -26,7 +32,7 @@ static ulong _deflation(const fmpz * poly, slong len) return arb_fmpz_poly_deflation(t); } -void +static void fexpr_set_arb(fexpr_t res, const arb_t x) { fexpr_t mid, rad, h; @@ -47,7 +53,7 @@ fexpr_set_arb(fexpr_t res, const arb_t x) fexpr_clear(h); } -void +static void fexpr_set_acb(fexpr_t res, const acb_t x) { if (arb_is_zero(acb_imagref(x))) @@ -83,7 +89,7 @@ fexpr_set_acb(fexpr_t res, const acb_t x) } /* todo: better code (no temporaries) */ -void +static void fexpr_set_list_fmpz_poly(fexpr_t res, const fmpz_poly_t poly) { fexpr_struct * coeffs; @@ -140,7 +146,7 @@ qqbar_get_fexpr_repr(fexpr_t res, const qqbar_t x) } -void +static void _qqbar_get_fexpr_root_nearest(fexpr_t res, const fmpz_poly_t poly, const char * re_s, const char * im_s) { fexpr_t Decimal, a, b, I, s; @@ -417,7 +423,7 @@ qqbar_get_fexpr_root_indexed(fexpr_t res, const qqbar_t x) _qqbar_vec_clear(conjugates, d); } -void +static void fexpr_sqrt(fexpr_t res, const fexpr_t a) { /* todo: handle aliasing in call1 */ @@ -440,7 +446,7 @@ fexpr_sqrt(fexpr_t res, const fexpr_t a) } } -void +static void fexpr_div_ui(fexpr_t res, const fexpr_t a, ulong c) { fexpr_t t, u; @@ -454,12 +460,12 @@ fexpr_div_ui(fexpr_t res, const fexpr_t a, ulong c) } /* cos(pi p/q) */ -void +static void _fexpr_cos_pi_pq(fexpr_t res, slong p, ulong q) { int sign = 1; int sine = 0; - ulong g; + ulong g, p_us; fexpr_t t, u; if (p < 0) @@ -469,38 +475,39 @@ _fexpr_cos_pi_pq(fexpr_t res, slong p, ulong q) } p = p % (2 * q); + p_us = p; - if (p > q) + if (p_us > q) { - p = 2 * q - p; + p_us = 2 * q - p_us; } - if (2 * p > q) + if (2 * p_us > q) { - p = q - p; + p_us = q - p_us; sign = -1; } - if (p == 0) + if (p_us == 0) { fexpr_set_si(res, sign); return; } - if (2 * p == q) + if (2 * p_us == q) { fexpr_set_ui(res, 0); return; } - if (3 * p == q) + if (3 * p_us == q) { fexpr_set_si(res, sign); fexpr_div_ui(res, res, 2); return; } - if (4 * p == q) + if (4 * p_us == q) { fexpr_set_ui(res, 2); fexpr_sqrt(res, res); @@ -510,7 +517,7 @@ _fexpr_cos_pi_pq(fexpr_t res, slong p, ulong q) return; } - if (6 * p == q) + if (6 * p_us == q) { fexpr_set_ui(res, 3); fexpr_sqrt(res, res); @@ -520,7 +527,7 @@ _fexpr_cos_pi_pq(fexpr_t res, slong p, ulong q) return; } - if (12 * p == q || 12 * p == 5 * q) + if (12 * p_us == q || 12 * p_us == 5 * q) { fexpr_init(t); fexpr_init(u); @@ -529,7 +536,7 @@ _fexpr_cos_pi_pq(fexpr_t res, slong p, ulong q) fexpr_sqrt(t, t); fexpr_set_ui(u, 1); - if (12 * p == q) + if (12 * p_us == q) fexpr_add(res, t, u); else fexpr_sub(res, t, u); @@ -548,30 +555,30 @@ _fexpr_cos_pi_pq(fexpr_t res, slong p, ulong q) return; } - if (4 * p > q) + if (4 * p_us > q) { - p = q - 2 * p; + p_us = q - 2 * p_us; q = 2 * q; sine = 1; } - g = n_gcd(p, q); + g = n_gcd(p_us, q); if (g != 1) { - p /= g; + p_us /= g; q /= g; } fexpr_init(t); fexpr_init(u); - if (p == 1) + if (p_us == 1) { fexpr_set_symbol_builtin(res, FEXPR_Pi); } else { - fexpr_set_ui(t, p); + fexpr_set_ui(t, p_us); fexpr_set_symbol_builtin(u, FEXPR_Pi); fexpr_mul(res, t, u); } @@ -596,7 +603,7 @@ qqbar_try_as_cyclotomic(qqbar_t zeta, fmpq_poly_t poly, const qqbar_t x) { ulong * phi; ulong N1, N2, d2, order, d; - slong p, q, i; + ulong p, q, i; double U; slong bits; int success; @@ -657,8 +664,8 @@ qqbar_try_as_cyclotomic(qqbar_t zeta, fmpq_poly_t poly, const qqbar_t x) } /* poly(exp(2 pi i / n)) */ -void -_qqbar_get_fexpr_cyclotomic(fexpr_t res, const fmpq_poly_t poly, slong n, int pure_real, int pure_imag) +static void +_qqbar_get_fexpr_cyclotomic(fexpr_t res, const fmpq_poly_t poly, slong n, int pure_real, int FLINT_UNUSED(pure_imag)) { fexpr_vec_t terms; fexpr_t term, t, u, v, w; diff --git a/src/qqbar/pow.c b/src/qqbar/pow.c index 9ed0983ff5..3582e0df3f 100644 --- a/src/qqbar/pow.c +++ b/src/qqbar/pow.c @@ -17,7 +17,7 @@ #include "arb_fmpz_poly.h" #include "qqbar.h" -void +static void _qqbar_sqr_undeflatable(qqbar_t res, const qqbar_t x) { fmpz_poly_t A, B; diff --git a/src/qqbar/randtest.c b/src/qqbar/randtest.c index 276115d87f..1ce3da792c 100644 --- a/src/qqbar/randtest.c +++ b/src/qqbar/randtest.c @@ -15,7 +15,7 @@ #include "arb_fmpz_poly.h" #include "qqbar.h" -void +static void _qqbar_randtest(qqbar_t res, flint_rand_t state, slong deg, slong bits, int real) { fmpz_poly_t pol; @@ -29,10 +29,10 @@ _qqbar_randtest(qqbar_t res, flint_rand_t state, slong deg, slong bits, int real { fmpq_t t; fmpq_init(t); - do { + do fmpq_randtest(t, state, bits); - } while (fmpz_bits(fmpq_numref(t)) > bits || - fmpz_bits(fmpq_denref(t)) > bits); + while (fmpz_bits(fmpq_numref(t)) > (ulong) bits + || fmpz_bits(fmpq_denref(t)) > (ulong) bits); qqbar_set_fmpq(res, t); fmpq_clear(t); return; diff --git a/src/qqbar/root_ui.c b/src/qqbar/root_ui.c index 39756a37a8..43576c109d 100644 --- a/src/qqbar/root_ui.c +++ b/src/qqbar/root_ui.c @@ -49,7 +49,7 @@ _qqbar_fast_detect_simple_principal_surd(const qqbar_t x) /* The imaginary part enclosure may not be exactly zero; we can still use the enclosure if it is precise enough to guarantee that there are no collisions with the conjugate roots. */ - if (acb_rel_accuracy_bits(QQBAR_ENCLOSURE(x)) > FLINT_BIT_COUNT(d) + 5) + if (acb_rel_accuracy_bits(QQBAR_ENCLOSURE(x)) > (slong) FLINT_BIT_COUNT(d) + 5) return arb_is_positive(acb_realref(QQBAR_ENCLOSURE(x))); return 0; @@ -87,12 +87,12 @@ qqbar_root_ui(qqbar_t res, const qqbar_t x, ulong n) /* todo: could also handle conjugates of such roots */ if ((d == 1 && (n == 2 || qqbar_sgn_re(x) > 0)) || _qqbar_fast_detect_simple_principal_surd(x)) { - fmpq_t t; - fmpq_init(t); - fmpz_neg(fmpq_numref(t), QQBAR_COEFFS(x)); - fmpz_set(fmpq_denref(t), QQBAR_COEFFS(x) + d); - qqbar_fmpq_root_ui(res, t, d * n); - fmpq_clear(t); + fmpq_t tq; + fmpq_init(tq); + fmpz_neg(fmpq_numref(tq), QQBAR_COEFFS(x)); + fmpz_set(fmpq_denref(tq), QQBAR_COEFFS(x) + d); + qqbar_fmpq_root_ui(res, tq, d * n); + fmpq_clear(tq); return; } @@ -103,7 +103,7 @@ qqbar_root_ui(qqbar_t res, const qqbar_t x, ulong n) ulong q; if (qqbar_is_root_of_unity(&p, &q, x)) { - if (2 * p > q) + if (2 * (ulong) p > q) p -= q; qqbar_root_of_unity(res, p, q * n); return; diff --git a/src/qqbar/roots_poly_squarefree.c b/src/qqbar/roots_poly_squarefree.c index f1e1c4d413..b8e9d3cac3 100644 --- a/src/qqbar/roots_poly_squarefree.c +++ b/src/qqbar/roots_poly_squarefree.c @@ -115,7 +115,7 @@ _qqbar_roots_poly_squarefree(qqbar_ptr roots, qqbar_srcptr coeffs, slong len, sl { ulong hi, lo; umul_ppmm(hi, lo, conjugations, qqbar_degree(coeffs + i)); - if (hi != 0 || lo > deg_limit) + if (hi != 0 || lo > (ulong) deg_limit) return 0; conjugations = lo; } diff --git a/src/qqbar/set_fexpr.c b/src/qqbar/set_fexpr.c index b8787ce4c7..9251c7ead5 100644 --- a/src/qqbar/set_fexpr.c +++ b/src/qqbar/set_fexpr.c @@ -26,7 +26,7 @@ int qqbar_set_fexpr(qqbar_t res, const fexpr_t expr); -int +static int _fexpr_parse_arf(arf_t res, const fexpr_t expr) { if (fexpr_is_integer(expr)) @@ -148,7 +148,7 @@ _fexpr_parse_arf(arf_t res, const fexpr_t expr) return 0; } -int +static int _fexpr_parse_mag(mag_t res, const fexpr_t expr) { int success; @@ -179,7 +179,7 @@ _fexpr_parse_mag(mag_t res, const fexpr_t expr) } -int +static int _fexpr_parse_arb(arb_t res, const fexpr_t expr) { if (fexpr_is_builtin_call(expr, FEXPR_RealBall) && fexpr_nargs(expr) == 2) @@ -195,7 +195,7 @@ _fexpr_parse_arb(arb_t res, const fexpr_t expr) return 0; } -int +static int _fexpr_parse_acb(acb_t res, const fexpr_t expr) { fexpr_t t, u; @@ -229,7 +229,7 @@ _fexpr_parse_acb(acb_t res, const fexpr_t expr) return 0; } -int +static int fmpq_set_decimal(fmpq_t res, const char * inp, slong max_bits) { char * emarker; @@ -480,7 +480,7 @@ _fexpr_get_rational_arg_pi(fmpq_t res, const fexpr_t expr, int times_i) return 0; } -void +static void qqbar_set_fmpz_poly_root_indexed(qqbar_t res, const fmpz_poly_t poly, slong root_index) { qqbar_ptr roots; @@ -492,7 +492,7 @@ qqbar_set_fmpz_poly_root_indexed(qqbar_t res, const fmpz_poly_t poly, slong root _qqbar_vec_clear(roots, d); } -void +static void qqbar_set_fmpz_poly_root_nearest(qqbar_t res, const fmpz_poly_t poly, const qqbar_t point) { qqbar_ptr roots; @@ -587,11 +587,11 @@ qqbar_set_fexpr(qqbar_t res, const fexpr_t expr) if (fexpr_is_integer(expr)) { - fmpz_t t; - fmpz_init(t); - fexpr_get_fmpz(t, expr); - qqbar_set_fmpz(res, t); - fmpz_clear(t); + fmpz_t tq; + fmpz_init(tq); + fexpr_get_fmpz(tq, expr); + qqbar_set_fmpz(res, tq); + fmpz_clear(tq); return 1; } @@ -1027,17 +1027,17 @@ qqbar_set_fexpr(qqbar_t res, const fexpr_t expr) success = success && qqbar_is_rational(t) && (!qqbar_is_zero(res) || qqbar_sgn_re(t) >= 0); if (success) { - fmpz_t p, q; + fmpz_t p, qz; fmpz_init(p); - fmpz_init(q); + fmpz_init(qz); fmpz_neg(p, QQBAR_COEFFS(t)); - fmpz_set(q, QQBAR_COEFFS(t) + 1); + fmpz_set(qz, QQBAR_COEFFS(t) + 1); - success = (fmpz_bits(q) <= 20 && fmpz_bits(p) <= FLINT_BITS - 4); + success = (fmpz_bits(qz) <= 20 && fmpz_bits(p) <= FLINT_BITS - 4); if (success) { - qqbar_root_ui(res, res, *q); + qqbar_root_ui(res, res, *qz); if (*p >= 0) qqbar_pow_ui(res, res, *p); else diff --git a/src/qqbar/write.c b/src/qqbar/write.c index cf417714ce..0990944455 100644 --- a/src/qqbar/write.c +++ b/src/qqbar/write.c @@ -12,6 +12,17 @@ #include "calcium.h" #include "qqbar.h" +/* FIXME: Should this function be used somewhere? */ + +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma message "qqbar_writen is currently unused/untested/undocumented!" +# pragma message "qqbar_writend is currently unused/untested/undocumented!" +# pragma message "qqbar_get_str_nd is currently unused/untested/undocumented!" +#endif + /* Todo: document, unify and generalize. This is currently only used for the Python interface, but other wrappers will want good printing code too. */ From fd0a8d2d652b2b61769b26e1b80bb5a1e4ad5835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Wed, 9 Oct 2024 01:12:38 +0200 Subject: [PATCH 110/114] ca_ext --- src/ca_ext.h | 4 ++++ src/ca_ext/cache_init.c | 2 +- src/ca_ext/init.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ca_ext.h b/src/ca_ext.h index 3dcea91376..812196bc39 100644 --- a/src/ca_ext.h +++ b/src/ca_ext.h @@ -24,6 +24,8 @@ extern "C" { #endif +FLINT_HEADER_START + /* Types *********************************************************************/ /* note: types and macros are defined in ca.h since they are needed there */ @@ -87,6 +89,8 @@ void ca_ext_cache_init(ca_ext_cache_t cache, ca_ctx_t ctx); void ca_ext_cache_clear(ca_ext_cache_t cache, ca_ctx_t ctx); ca_ext_ptr ca_ext_cache_insert(ca_ext_cache_t cache, const ca_ext_t x, ca_ctx_t ctx); +FLINT_HEADER_END + #ifdef __cplusplus } #endif diff --git a/src/ca_ext/cache_init.c b/src/ca_ext/cache_init.c index c9c2965977..73b3a01d1b 100644 --- a/src/ca_ext/cache_init.c +++ b/src/ca_ext/cache_init.c @@ -14,7 +14,7 @@ #define INITIAL_HASH_SIZE 16 void -ca_ext_cache_init(ca_ext_cache_t cache, ca_ctx_t ctx) +ca_ext_cache_init(ca_ext_cache_t cache, ca_ctx_t FLINT_UNUSED(ctx)) { slong i; diff --git a/src/ca_ext/init.c b/src/ca_ext/init.c index 7b0f64d1e6..788596cae9 100644 --- a/src/ca_ext/init.c +++ b/src/ca_ext/init.c @@ -26,7 +26,7 @@ static ulong hash_func(calcium_func_code func, ca_srcptr args, slong nargs, ca_c } void -ca_ext_init_qqbar(ca_ext_t res, const qqbar_t x, ca_ctx_t ctx) +ca_ext_init_qqbar(ca_ext_t res, const qqbar_t x, ca_ctx_t FLINT_UNUSED(ctx)) { fmpq_poly_t t; From d63713b76f780a677f3a785326be7bccd1457864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Wed, 9 Oct 2024 01:12:46 +0200 Subject: [PATCH 111/114] ca_field --- src/ca_field/build_ideal.c | 31 +++++++++++++++++------------- src/ca_field/build_ideal_erf.c | 14 +++++++++++--- src/ca_field/cache_init.c | 2 +- src/ca_field/cache_insert.c | 18 +++++++++++------ src/ca_field/cmp.c | 10 ++++++++-- src/ca_field/init.c | 4 ++-- src/ca_field/set_ext.c | 2 +- src/ca_field/test/t-cache_insert.c | 2 +- 8 files changed, 54 insertions(+), 29 deletions(-) diff --git a/src/ca_field/build_ideal.c b/src/ca_field/build_ideal.c index 10856185ce..b5cdaf7ad2 100644 --- a/src/ca_field/build_ideal.c +++ b/src/ca_field/build_ideal.c @@ -21,8 +21,14 @@ #include "gr.h" -slong -acb_multi_lindep(fmpz_mat_t rel, acb_srcptr vec, slong len, int check, slong prec) +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + +static slong +acb_multi_lindep(fmpz_mat_t rel, acb_srcptr vec, slong len, int FLINT_UNUSED(check), slong prec) { fmpz_mat_t A; arf_t tmpr, halfr; @@ -184,7 +190,7 @@ acb_multi_lindep(fmpz_mat_t rel, acb_srcptr vec, slong len, int check, slong pre void _nf_elem_get_fmpz_poly_den_shallow(fmpz_poly_t pol, fmpz_t den, const nf_elem_t a, const nf_t nf); void -_ca_field_ideal_insert_clear_mpoly(ca_field_t K, fmpz_mpoly_t poly, fmpz_mpoly_ctx_t mctx, ca_ctx_t ctx) +_ca_field_ideal_insert_clear_mpoly(ca_field_t K, fmpz_mpoly_t poly, fmpz_mpoly_ctx_t mctx, ca_ctx_t FLINT_UNUSED(ctx)) { if (poly->length == 0) { @@ -199,7 +205,7 @@ _ca_field_ideal_insert_clear_mpoly(ca_field_t K, fmpz_mpoly_t poly, fmpz_mpoly_c fmpz_mpoly_clear(poly, mctx); } -int ext_as_pow_pq(slong *p, slong *q, const ca_ext_t x, ca_ctx_t ctx) +static int ext_as_pow_pq(slong *p, slong *q, const ca_ext_t x, ca_ctx_t ctx) { if (CA_EXT_HEAD(x) == CA_Sqrt) { @@ -226,7 +232,7 @@ int ext_as_pow_pq(slong *p, slong *q, const ca_ext_t x, ca_ctx_t ctx) return 0; } -int +static int ca_field_prove_log_relation(ca_field_t K, const fmpz * rel, acb_srcptr z, const slong * logs, @@ -315,7 +321,7 @@ ca_field_prove_log_relation(ca_field_t K, const fmpz * rel, return success; } -slong +static slong ca_field_insert_log_relation(ca_field_t K, fmpz * rel, const slong * logs, @@ -375,7 +381,7 @@ ca_field_insert_log_relation(ca_field_t K, /* Find log relations. */ -void +static void ca_field_build_ideal_logs(ca_field_t K, ca_ctx_t ctx) { slong * logs; @@ -517,11 +523,11 @@ ca_field_build_ideal_logs(ca_field_t K, ca_ctx_t ctx) flint_free(logs); } -int +static int ca_field_prove_multiplicative_relation(ca_field_t K, const fmpz * rel, - acb_srcptr z, + acb_srcptr FLINT_UNUSED(z), const slong * powers, - slong num_powers, slong prec, ca_ctx_t ctx) + slong num_powers, slong FLINT_UNUSED(prec), ca_ctx_t ctx) { ca_t t, u; slong i; @@ -676,7 +682,7 @@ ca_field_prove_multiplicative_relation(ca_field_t K, const fmpz * rel, return success; } -slong +static slong ca_field_insert_multiplicative_relation(ca_field_t K, fmpz * rel, const slong * powers, @@ -735,7 +741,7 @@ ca_field_insert_multiplicative_relation(ca_field_t K, /* Find relations involving exponentials, powers and roots. */ /* Todo: more special cases (including roots of unity) */ -void +static void ca_field_build_ideal_multiplicative(ca_field_t K, ca_ctx_t ctx) { slong i, len; @@ -1114,7 +1120,6 @@ ca_field_build_ideal(ca_field_t K, ca_ctx_t ctx) if (ctx->options[CA_OPT_USE_GROEBNER]) { - slong i; int want_groebner; want_groebner = 1; diff --git a/src/ca_field/build_ideal_erf.c b/src/ca_field/build_ideal_erf.c index 9abefb1277..6504e7d359 100644 --- a/src/ca_field/build_ideal_erf.c +++ b/src/ca_field/build_ideal_erf.c @@ -13,11 +13,17 @@ #include "ca_ext.h" #include "ca_field.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + void _ca_field_ideal_insert_clear_mpoly(ca_field_t K, fmpz_mpoly_t poly, fmpz_mpoly_ctx_t mctx, ca_ctx_t ctx); /* todo: optimize */ -truth_t ca_check_equal_neg(const ca_t x, const ca_t y, ca_ctx_t ctx) +static truth_t ca_check_equal_neg(const ca_t x, const ca_t y, ca_ctx_t ctx) { ca_t t; truth_t res; @@ -29,7 +35,7 @@ truth_t ca_check_equal_neg(const ca_t x, const ca_t y, ca_ctx_t ctx) } /* set a*x_a + b*x_b + c */ -void +static void fmpz_mpoly_set_linear_three_term_si(fmpz_mpoly_t poly, slong a, slong xa, slong b, slong xb, slong c, const fmpz_mpoly_ctx_t ctx) { ulong * exp; @@ -52,6 +58,7 @@ fmpz_mpoly_set_linear_three_term_si(fmpz_mpoly_t poly, slong a, slong xa, slong flint_free(exp); } +#if 0 /* set a*x_a*x_a2 + b*x_b + c */ void fmpz_mpoly_set_linear2_three_term_si(fmpz_mpoly_t poly, slong a, slong xa, slong xa2, slong b, slong xb, slong c, const fmpz_mpoly_ctx_t ctx) @@ -77,6 +84,7 @@ fmpz_mpoly_set_linear2_three_term_si(fmpz_mpoly_t poly, slong a, slong xa, slong flint_free(exp); } +#endif /* Set the term c * x_var^x_exp */ void @@ -102,7 +110,7 @@ fmpz_mpoly_set_coeff_si_x(fmpz_mpoly_t poly, } -void +static void fmpz_mpoly_set_coeff_si_xy(fmpz_mpoly_t poly, slong c, slong x_var, ulong x_exp, diff --git a/src/ca_field/cache_init.c b/src/ca_field/cache_init.c index 5f7bc20d3c..d29031b410 100644 --- a/src/ca_field/cache_init.c +++ b/src/ca_field/cache_init.c @@ -14,7 +14,7 @@ #define INITIAL_HASH_SIZE 16 void -ca_field_cache_init(ca_field_cache_t cache, ca_ctx_t ctx) +ca_field_cache_init(ca_field_cache_t cache, ca_ctx_t FLINT_UNUSED(ctx)) { slong i; diff --git a/src/ca_field/cache_insert.c b/src/ca_field/cache_insert.c index f48ab27c38..49f877c463 100644 --- a/src/ca_field/cache_insert.c +++ b/src/ca_field/cache_insert.c @@ -12,7 +12,13 @@ #include "ca_ext.h" #include "ca_field.h" -ca_field_ptr ca_field_cache_lookup_qqbar(ca_field_cache_t cache, const qqbar_t x, ca_ctx_t ctx) +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + +ca_field_ptr ca_field_cache_lookup_qqbar(ca_field_cache_t cache, const qqbar_t x, ca_ctx_t FLINT_UNUSED(ctx)) { ulong xhash; ca_field_ptr K; @@ -42,8 +48,8 @@ ca_field_ptr ca_field_cache_lookup_qqbar(ca_field_cache_t cache, const qqbar_t x flint_throw(FLINT_ERROR, "(%s)\n", __func__); } -ulong -_ca_field_hash(ca_ext_struct ** ext, slong len, ca_ctx_t ctx) +static ulong +_ca_field_hash(ca_ext_struct ** ext, slong len, ca_ctx_t FLINT_UNUSED(ctx)) { ulong s; slong i; @@ -55,13 +61,13 @@ _ca_field_hash(ca_ext_struct ** ext, slong len, ca_ctx_t ctx) return s; } -ulong +static ulong ca_field_hash(const ca_field_t K, ca_ctx_t ctx) { return _ca_field_hash(K->ext, K->length, ctx); } -static int _ca_field_equal_ext(const ca_field_t K, ca_ext_struct ** x, slong len, ca_ctx_t ctx) +static int _ca_field_equal_ext(const ca_field_t K, ca_ext_struct ** x, slong len, ca_ctx_t FLINT_UNUSED(ctx)) { slong i; @@ -75,7 +81,7 @@ static int _ca_field_equal_ext(const ca_field_t K, ca_ext_struct ** x, slong len return 1; } -void +static void ca_field_init_set_ext(ca_field_t K, ca_ext_struct ** ext, slong len, ca_ctx_t ctx) { if (len == 0) diff --git a/src/ca_field/cmp.c b/src/ca_field/cmp.c index 0d63588631..7d59ee3377 100644 --- a/src/ca_field/cmp.c +++ b/src/ca_field/cmp.c @@ -13,6 +13,12 @@ #include "ca_ext.h" #include "ca_field.h" +/* FIXME: Remove this guard against warnings. Best thing would probably be to + * implement an *-impl.h to keep track of local functions. */ +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + static int _fmpz_poly_compare_abslex(const fmpz * a, const fmpz * b, slong len) { @@ -105,7 +111,7 @@ _fmpz_mpoly_cmp2(const fmpz_mpoly_t x, const fmpz_mpoly_t y, fmpz_mpoly_ctx_t ct return 0; } -int +static int _fmpz_mpoly_q_cmp(const fmpz_mpoly_q_t x, const fmpz_mpoly_q_t y, fmpz_mpoly_ctx_t ctx) { int c; @@ -168,7 +174,7 @@ ca_depth(const ca_t x, ca_ctx_t ctx) } static slong -ca_ext_depth(const ca_ext_t x, ca_ctx_t ctx) +ca_ext_depth(const ca_ext_t x, ca_ctx_t FLINT_UNUSED(ctx)) { return CA_EXT_DEPTH(x); } diff --git a/src/ca_field/init.c b/src/ca_field/init.c index 5ea46b8a12..0f2cf3b5e9 100644 --- a/src/ca_field/init.c +++ b/src/ca_field/init.c @@ -13,7 +13,7 @@ #include "ca_ext.h" #include "ca_field.h" -void +static void _ca_ctx_init_mctx(ca_ctx_t ctx, slong len) { while (ctx->mctx_len < len) @@ -33,7 +33,7 @@ _ca_ctx_init_mctx(ca_ctx_t ctx, slong len) void -ca_field_init_qq(ca_field_t K, ca_ctx_t ctx) +ca_field_init_qq(ca_field_t K, ca_ctx_t FLINT_UNUSED(ctx)) { CA_FIELD_LENGTH(K) = 0; CA_FIELD_EXT(K) = NULL; diff --git a/src/ca_field/set_ext.c b/src/ca_field/set_ext.c index d00ff5a51f..f77185be36 100644 --- a/src/ca_field/set_ext.c +++ b/src/ca_field/set_ext.c @@ -14,7 +14,7 @@ #include "ca_field.h" void -ca_field_set_ext(ca_field_t K, slong i, ca_ext_srcptr x, ca_ctx_t ctx) +ca_field_set_ext(ca_field_t K, slong i, ca_ext_srcptr x, ca_ctx_t FLINT_UNUSED(ctx)) { CA_FIELD_EXT_ELEM(K, i) = (ca_ext_ptr) x; CA_FIELD_HASH(K) = CA_FIELD_HASH(K) * 100003 + CA_EXT_HASH(x); diff --git a/src/ca_field/test/t-cache_insert.c b/src/ca_field/test/t-cache_insert.c index e7d031a4c2..81a7664f0b 100644 --- a/src/ca_field/test/t-cache_insert.c +++ b/src/ca_field/test/t-cache_insert.c @@ -14,7 +14,7 @@ #include "ca_ext.h" #include "ca_field.h" -static int _ca_field_equal_ext(const ca_field_t K, ca_ext_struct ** x, slong len, ca_ctx_t ctx) +static int _ca_field_equal_ext(const ca_field_t K, ca_ext_struct ** x, slong len, ca_ctx_t FLINT_UNUSED(ctx)) { slong i; From ab33d2c6acca90bf5c8c5caaa2098eeab4abca89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Wed, 9 Oct 2024 11:56:52 +0200 Subject: [PATCH 112/114] padic_poly --- src/padic_poly/test/t-inv_series.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/padic_poly/test/t-inv_series.c b/src/padic_poly/test/t-inv_series.c index bbc920714c..1dd0b1eacb 100644 --- a/src/padic_poly/test/t-inv_series.c +++ b/src/padic_poly/test/t-inv_series.c @@ -11,18 +11,20 @@ #include "test_helpers.h" #include "ulong_extras.h" +#include "padic.h" #include "padic_poly.h" TEST_FUNCTION_START(padic_poly_inv_series, state) { - int i, result; + slong ix; + int result; padic_ctx_t ctx; fmpz_t p; slong N; /* Check aliasing */ - for (i = 0; i < 100 * flint_test_multiplier(); i++) + for (ix = 0; ix < 100 * flint_test_multiplier(); ix++) { padic_poly_t a, b, c; slong n; @@ -77,7 +79,7 @@ TEST_FUNCTION_START(padic_poly_inv_series, state) and we will have a b = 1 mod p^{N-|v|}. Thus, require that N - |v| > 0. */ - for (i = 0; i < 100 * flint_test_multiplier(); i++) + for (ix = 0; ix < 100 * flint_test_multiplier(); ix++) { padic_poly_t a, b, c; slong n, N2; From 77dabaabfab5243ee830611d1374ceb1c90748d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Wed, 9 Oct 2024 11:57:37 +0200 Subject: [PATCH 113/114] fmpz_vec --- src/fmpz_vec/test/t-get_set_fft.c | 7 ++++--- src/fmpz_vec/test/t-get_set_nmod_vec.c | 5 +++-- src/fmpz_vec/test/t-scalar_fdiv_q_fmpz.c | 7 ++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/fmpz_vec/test/t-get_set_fft.c b/src/fmpz_vec/test/t-get_set_fft.c index e2de3e3305..6690a657ed 100644 --- a/src/fmpz_vec/test/t-get_set_fft.c +++ b/src/fmpz_vec/test/t-get_set_fft.c @@ -17,10 +17,11 @@ TEST_FUNCTION_START(fmpz_vec_get_set_fft, state) { - int i, result; + slong ix; + int result; /* convert back and forth and compare */ - for (i = 0; i < 1000 * flint_test_multiplier(); i++) + for (ix = 0; ix < 1000 * flint_test_multiplier(); ix++) { fmpz * a, * b; flint_bitcnt_t bits; @@ -66,7 +67,7 @@ TEST_FUNCTION_START(fmpz_vec_get_set_fft, state) } /* convert back and forth unsigned and compare */ - for (i = 0; i < 1000 * flint_test_multiplier(); i++) + for (ix = 0; ix < 1000 * flint_test_multiplier(); ix++) { fmpz * a, * b; flint_bitcnt_t bits; diff --git a/src/fmpz_vec/test/t-get_set_nmod_vec.c b/src/fmpz_vec/test/t-get_set_nmod_vec.c index b2cf09b8bf..945ca549ae 100644 --- a/src/fmpz_vec/test/t-get_set_nmod_vec.c +++ b/src/fmpz_vec/test/t-get_set_nmod_vec.c @@ -18,10 +18,11 @@ TEST_FUNCTION_START(fmpz_vec_get_set_nmod_vec, state) { - int i, result; + slong ix; + int result; /* Check conversion to and from nmod_vec */ - for (i = 0; i < 1000 * flint_test_multiplier(); i++) + for (ix = 0; ix < 1000 * flint_test_multiplier(); ix++) { fmpz *a, *b; nn_ptr c; diff --git a/src/fmpz_vec/test/t-scalar_fdiv_q_fmpz.c b/src/fmpz_vec/test/t-scalar_fdiv_q_fmpz.c index a0c4578566..12d85815f5 100644 --- a/src/fmpz_vec/test/t-scalar_fdiv_q_fmpz.c +++ b/src/fmpz_vec/test/t-scalar_fdiv_q_fmpz.c @@ -17,9 +17,10 @@ TEST_FUNCTION_START(fmpz_vec_scalar_fdiv_q_fmpz, state) { - int i, result; + slong ix; + int result; - for (i = 0; i < 1000 * flint_test_multiplier(); i++) + for (ix = 0; ix < 1000 * flint_test_multiplier(); ix++) { fmpz *a, *b, *c; fmpz_t n; @@ -78,7 +79,7 @@ TEST_FUNCTION_START(fmpz_vec_scalar_fdiv_q_fmpz, state) } /* Test aliasing of a and c */ - for (i = 0; i < 1000 * flint_test_multiplier(); i++) + for (ix = 0; ix < 1000 * flint_test_multiplier(); ix++) { fmpz *a, *b; fmpz_t n; From 46738f2534cee5f3e50f1b40e046bd1067b56648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Wed, 9 Oct 2024 14:23:26 +0200 Subject: [PATCH 114/114] arb_calc --- src/arb_calc/test/t-isolate_roots.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arb_calc/test/t-isolate_roots.c b/src/arb_calc/test/t-isolate_roots.c index 6bba889ac7..128ecc711f 100644 --- a/src/arb_calc/test/t-isolate_roots.c +++ b/src/arb_calc/test/t-isolate_roots.c @@ -15,7 +15,7 @@ /* sin((pi/2)x) */ static int -sin_pi2_x(arb_ptr out, const arb_t inp, void * params, slong order, slong prec) +sin_pi2_x(arb_ptr out, const arb_t inp, void * FLINT_UNUSED(params), slong order, slong prec) { arb_ptr x;