1- from flint.flintlib.flint cimport fmpz_struct, ulong, mp_limb_t, mp_ptr
2- from flint.flintlib.flint cimport mp_size_t, mp_bitcnt_t, slong, flint_rand_t, flint_bitcnt_t
1+ from flint.flintlib.flint cimport flint_bitcnt_t, flint_rand_t, fmpz_struct, nmod_t, slong, ulong
2+ from flint.flintlib.fmpz_factor cimport fmpz_factor_t
3+ from flint.flintlib.fmpz_types cimport fmpz_preinvn_t, fmpz_t
34
4- cdef extern from " flint/fmpz.h" :
5- ctypedef fmpz_struct fmpz_t[1 ]
5+ # unknown type FILE
6+ # unknown type fmpz_comb_t
7+ # unknown type fmpz_comb_temp_t
8+ # unknown type fmpz_multi_CRT_t
9+ # unknown type mpf_t
10+ # unknown type mpfr_rnd_t
11+ # unknown type mpfr_t
12+ # unknown type mpz_ptr
13+ # unknown type mpz_t
14+ # unknown type nn_ptr
15+ # unknown type nn_srcptr
16+ # unknown type size_t
617
7- ctypedef struct fmpz_preinvn_struct:
8- mp_ptr dinv
9- slong n
10- flint_bitcnt_t norm
11- ctypedef fmpz_preinvn_struct fmpz_preinvn_t[1 ]
18+ # .. macro:: COEFF_MAX
19+ # .. macro:: COEFF_MIN
20+ # .. macro:: COEFF_IS_MPZ(f)
21+ # .. macro:: MPZ_MIN_ALLOC
1222
13- # from here on is parsed
14- # fmpz_struct PTR_TO_COEFF(__mpz_struct * ptr)
15- # __mpz_struct * COEFF_TO_PTR(fmpz_struct f)
16- int COEFF_IS_MPZ(fmpz_struct f)
17- # __mpz_struct * _fmpz_new_mpz(void)
23+ cdef extern from " flint/fmpz.h" :
24+ # fmpz_struct PTR_TO_COEFF(mpz_ptr ptr)
25+ # mpz_ptr COEFF_TO_PTR(fmpz_struct f)
26+ # mpz_ptr _fmpz_new_mpz(void)
1827 void _fmpz_clear_mpz(fmpz_struct f)
1928 void _fmpz_cleanup_mpz_content()
2029 void _fmpz_cleanup()
21- # __mpz_struct * _fmpz_promote(fmpz_t f)
22- # __mpz_struct * _fmpz_promote_val(fmpz_t f)
30+ # mpz_ptr _fmpz_promote(fmpz_t f)
31+ # mpz_ptr _fmpz_promote_val(fmpz_t f)
2332 void _fmpz_demote(fmpz_t f)
2433 void _fmpz_demote_val(fmpz_t f)
34+ int _fmpz_is_canonical(const fmpz_t f)
2535 void fmpz_init(fmpz_t f)
2636 void fmpz_init2(fmpz_t f, ulong limbs)
2737 void fmpz_clear(fmpz_t f)
2838 void fmpz_init_set(fmpz_t f, const fmpz_t g)
2939 void fmpz_init_set_ui(fmpz_t f, ulong g)
3040 void fmpz_init_set_si(fmpz_t f, slong g)
41+ void fmpz_randbits_unsigned(fmpz_t f, flint_rand_t state, flint_bitcnt_t bits)
3142 void fmpz_randbits(fmpz_t f, flint_rand_t state, flint_bitcnt_t bits)
32- void fmpz_randtest(fmpz_t f, flint_rand_t state, flint_bitcnt_t bits)
3343 void fmpz_randtest_unsigned(fmpz_t f, flint_rand_t state, flint_bitcnt_t bits)
44+ void fmpz_randtest(fmpz_t f, flint_rand_t state, flint_bitcnt_t bits)
3445 void fmpz_randtest_not_zero(fmpz_t f, flint_rand_t state, flint_bitcnt_t bits)
3546 void fmpz_randm(fmpz_t f, flint_rand_t state, const fmpz_t m)
3647 void fmpz_randtest_mod(fmpz_t f, flint_rand_t state, const fmpz_t m)
3748 void fmpz_randtest_mod_signed(fmpz_t f, flint_rand_t state, const fmpz_t m)
3849 void fmpz_randprime(fmpz_t f, flint_rand_t state, flint_bitcnt_t bits, int proved)
3950 slong fmpz_get_si(const fmpz_t f)
4051 ulong fmpz_get_ui(const fmpz_t f)
41- void fmpz_get_uiui(mp_limb_t * hi, mp_limb_t * low, const fmpz_t f)
42- # moved to nmod.pxd
43- # mp_limb_t fmpz_get_nmod(const fmpz_t f, nmod_t mod)
52+ void fmpz_get_uiui(ulong * hi, ulong * low, const fmpz_t f)
53+ ulong fmpz_get_nmod(const fmpz_t f, nmod_t mod)
4454 double fmpz_get_d(const fmpz_t f)
4555 # void fmpz_set_mpf(fmpz_t f, const mpf_t x)
4656 # void fmpz_get_mpf(mpf_t x, const fmpz_t f)
4757 # void fmpz_get_mpfr(mpfr_t x, const fmpz_t f, mpfr_rnd_t rnd)
4858 double fmpz_get_d_2exp(slong * exp, const fmpz_t f)
4959 # void fmpz_get_mpz(mpz_t x, const fmpz_t f)
50- # int fmpz_get_mpn(mp_ptr * n, fmpz_t n_in)
60+ # int fmpz_get_mpn(nn_ptr * n, fmpz_t n_in)
5161 char * fmpz_get_str(char * str , int b, const fmpz_t f)
5262 void fmpz_set_si(fmpz_t f, slong val)
5363 void fmpz_set_ui(fmpz_t f, ulong val)
5464 void fmpz_set_d(fmpz_t f, double c)
5565 void fmpz_set_d_2exp(fmpz_t f, double d, slong exp)
5666 void fmpz_neg_ui(fmpz_t f, ulong val)
57- void fmpz_set_uiui(fmpz_t f, mp_limb_t hi, mp_limb_t lo)
58- void fmpz_neg_uiui(fmpz_t f, mp_limb_t hi, mp_limb_t lo)
67+ void fmpz_set_uiui(fmpz_t f, ulong hi, ulong lo)
68+ void fmpz_neg_uiui(fmpz_t f, ulong hi, ulong lo)
5969 void fmpz_set_signed_uiui(fmpz_t f, ulong hi, ulong lo)
6070 void fmpz_set_signed_uiuiui(fmpz_t f, ulong hi, ulong mid, ulong lo)
6171 void fmpz_set_ui_array(fmpz_t out, const ulong * in_, slong n)
6272 void fmpz_set_signed_ui_array(fmpz_t out, const ulong * in_, slong n)
6373 void fmpz_get_ui_array(ulong * out, slong n, const fmpz_t in_)
6474 void fmpz_get_signed_ui_array(ulong * out, slong n, const fmpz_t in_)
75+ # void fmpz_set_mpn_large(fmpz_t z, nn_srcptr src, slong n, int negative)
6576 void fmpz_get_signed_uiui(ulong * hi, ulong * lo, const fmpz_t in_)
6677 # void fmpz_set_mpz(fmpz_t f, const mpz_t x)
6778 int fmpz_set_str(fmpz_t f, const char * str , int b)
68- void fmpz_set_ui_smod(fmpz_t f, mp_limb_t x, mp_limb_t m)
79+ void fmpz_set_ui_smod(fmpz_t f, ulong x, ulong m)
6980 # void flint_mpz_init_set_readonly(mpz_t z, const fmpz_t f)
7081 # void flint_mpz_clear_readonly(mpz_t z)
7182 # void fmpz_init_set_readonly(fmpz_t f, const mpz_t z)
7283 void fmpz_clear_readonly(fmpz_t f)
7384 int fmpz_read(fmpz_t f)
74- int fmpz_print(fmpz_t x)
75- size_t fmpz_sizeinbase(const fmpz_t f, int b)
85+ # int fmpz_fread(FILE * file, fmpz_t f)
86+ # size_t fmpz_inp_raw(fmpz_t x, FILE * fin)
87+ # int fmpz_fprint(FILE * fs, const fmpz_t x)
88+ int fmpz_print(const fmpz_t x)
89+ # size_t fmpz_out_raw(FILE * fout, const fmpz_t x )
90+ # size_t fmpz_sizeinbase(const fmpz_t f, int b)
7691 flint_bitcnt_t fmpz_bits(const fmpz_t f)
77- mp_size_t fmpz_size(const fmpz_t f)
92+ slong fmpz_size(const fmpz_t f)
7893 int fmpz_sgn(const fmpz_t f)
7994 flint_bitcnt_t fmpz_val2(const fmpz_t f)
8095 void fmpz_swap(fmpz_t f, fmpz_t g)
@@ -85,8 +100,8 @@ cdef extern from "flint/fmpz.h":
85100 int fmpz_fits_si(const fmpz_t f)
86101 void fmpz_setbit(fmpz_t f, ulong i)
87102 int fmpz_tstbit(const fmpz_t f, ulong i)
88- mp_limb_t fmpz_abs_lbound_ui_2exp(slong * exp, const fmpz_t x, int bits)
89- mp_limb_t fmpz_abs_ubound_ui_2exp(slong * exp, const fmpz_t x, int bits)
103+ ulong fmpz_abs_lbound_ui_2exp(slong * exp, const fmpz_t x, int bits)
104+ ulong fmpz_abs_ubound_ui_2exp(slong * exp, const fmpz_t x, int bits)
90105 int fmpz_cmp(const fmpz_t f, const fmpz_t g)
91106 int fmpz_cmp_ui(const fmpz_t f, ulong g)
92107 int fmpz_cmp_si(const fmpz_t f, slong g)
@@ -155,10 +170,11 @@ cdef extern from "flint/fmpz.h":
155170 void fmpz_mod(fmpz_t f, const fmpz_t g, const fmpz_t h)
156171 ulong fmpz_mod_ui(fmpz_t f, const fmpz_t g, ulong h)
157172 void fmpz_smod(fmpz_t f, const fmpz_t g, const fmpz_t h)
158- # void fmpz_preinvn_init(fmpz_preinvn_t inv, const fmpz_t f)
159- # void fmpz_preinvn_clear(fmpz_preinvn_t inv)
160- # void fmpz_fdiv_qr_preinvn(fmpz_t f, fmpz_t s, const fmpz_t g, const fmpz_t h, const fmpz_preinvn_t hinv)
173+ void fmpz_preinvn_init(fmpz_preinvn_t inv, const fmpz_t f)
174+ void fmpz_preinvn_clear(fmpz_preinvn_t inv)
175+ void fmpz_fdiv_qr_preinvn(fmpz_t f, fmpz_t s, const fmpz_t g, const fmpz_t h, const fmpz_preinvn_t hinv)
161176 void fmpz_pow_ui(fmpz_t f, const fmpz_t g, ulong x)
177+ void fmpz_ui_pow_ui(fmpz_t f, ulong g, ulong x)
162178 int fmpz_pow_fmpz(fmpz_t f, const fmpz_t g, const fmpz_t x)
163179 void fmpz_powm_ui(fmpz_t f, const fmpz_t g, ulong e, const fmpz_t m)
164180 void fmpz_powm(fmpz_t f, const fmpz_t g, const fmpz_t e, const fmpz_t m)
@@ -196,43 +212,38 @@ cdef extern from "flint/fmpz.h":
196212 int fmpz_jacobi(const fmpz_t a, const fmpz_t n)
197213 int fmpz_kronecker(const fmpz_t a, const fmpz_t n)
198214 void fmpz_divides_mod_list(fmpz_t xstart, fmpz_t xstride, fmpz_t xlength, const fmpz_t a, const fmpz_t b, const fmpz_t n)
199- int fmpz_bit_pack(mp_limb_t * arr, flint_bitcnt_t shift, flint_bitcnt_t bits, fmpz_t coeff, int negate, int borrow)
200- int fmpz_bit_unpack(fmpz_t coeff, mp_limb_t * arr, flint_bitcnt_t shift, flint_bitcnt_t bits, int negate, int borrow)
201- void fmpz_bit_unpack_unsigned(fmpz_t coeff, const mp_limb_t * arr, flint_bitcnt_t shift, flint_bitcnt_t bits)
215+ int fmpz_bit_pack(ulong * arr, flint_bitcnt_t shift, flint_bitcnt_t bits, const fmpz_t coeff, int negate, int borrow)
216+ int fmpz_bit_unpack(fmpz_t coeff, ulong * arr, flint_bitcnt_t shift, flint_bitcnt_t bits, int negate, int borrow)
217+ void fmpz_bit_unpack_unsigned(fmpz_t coeff, const ulong * arr, flint_bitcnt_t shift, flint_bitcnt_t bits)
202218 void fmpz_complement(fmpz_t r, const fmpz_t f)
203219 void fmpz_clrbit(fmpz_t f, ulong i)
204220 void fmpz_combit(fmpz_t f, ulong i)
205221 void fmpz_and(fmpz_t r, const fmpz_t a, const fmpz_t b)
206222 void fmpz_or(fmpz_t r, const fmpz_t a, const fmpz_t b)
207223 void fmpz_xor(fmpz_t r, const fmpz_t a, const fmpz_t b)
208- int fmpz_popcnt(const fmpz_t a)
209- void fmpz_CRT_ui(fmpz_t out, fmpz_t r1, fmpz_t m1, ulong r2, ulong m2, int sign)
210- void fmpz_CRT(fmpz_t out, const fmpz_t r1, const fmpz_t m1, fmpz_t r2, fmpz_t m2, int sign)
211- # void fmpz_multi_mod_ui(mp_limb_t * out, const fmpz_t in_, const fmpz_comb_t comb, fmpz_comb_temp_t temp)
212- # void fmpz_multi_CRT_ui(fmpz_t output, mp_srcptr residues, const fmpz_comb_t comb, fmpz_comb_temp_t ctemp, int sign)
213- # void fmpz_comb_init(fmpz_comb_t comb, mp_srcptr primes, slong num_primes)
224+ ulong fmpz_popcnt(const fmpz_t a)
225+ void fmpz_CRT_ui(fmpz_t out, const fmpz_t r1, const fmpz_t m1, ulong r2, ulong m2, int sign)
226+ void fmpz_CRT(fmpz_t out, const fmpz_t r1, const fmpz_t m1, const fmpz_t r2, const fmpz_t m2, int sign)
227+ # void fmpz_multi_mod_ui(ulong * out, const fmpz_t in_, const fmpz_comb_t comb, fmpz_comb_temp_t temp)
228+ # void fmpz_multi_CRT_ui(fmpz_t output, nn_srcptr residues, const fmpz_comb_t comb, fmpz_comb_temp_t ctemp, int sign)
229+ # void fmpz_comb_init(fmpz_comb_t comb, nn_srcptr primes, slong num_primes)
214230 # void fmpz_comb_temp_init(fmpz_comb_temp_t temp, const fmpz_comb_t comb)
215231 # void fmpz_comb_clear(fmpz_comb_t comb)
216232 # void fmpz_comb_temp_clear(fmpz_comb_temp_t temp)
217- # void fmpz_multi_crt_init(fmpz_multi_crt_t CRT)
218- # int fmpz_multi_crt_precompute(fmpz_multi_crt_t CRT, const fmpz_struct * moduli, slong len)
219- # int fmpz_multi_crt_precompute_p(fmpz_multi_crt_t CRT, const fmpz_struct * const * moduli, slong len)
220- # void fmpz_multi_crt_precomp(fmpz_t output, const fmpz_multi_crt_t P, const fmpz_struct * inputs)
221- # void fmpz_multi_crt_precomp_p(fmpz_t output, const fmpz_multi_crt_t P, const fmpz_struct * const * inputs)
222- int fmpz_multi_crt(fmpz_t output, const fmpz_struct * moduli, const fmpz_struct * values, slong len )
223- # void fmpz_multi_crt_clear(fmpz_multi_crt_t P)
224- # slong _nmod_poly_crt_local_size(const nmod_poly_crt_t CRT)
225- # void _fmpz_multi_crt_run(fmpz_struct * outputs, const fmpz_multi_crt_t CRT, const fmpz_struct * inputs)
226- # void _fmpz_multi_crt_run_p(fmpz_struct * outputs, const fmpz_multi_crt_t CRT, const fmpz_struct * const * inputs)
233+ # void fmpz_multi_CRT_init(fmpz_multi_CRT_t CRT)
234+ # int fmpz_multi_CRT_precompute(fmpz_multi_CRT_t CRT, const fmpz_struct * moduli, slong len)
235+ # void fmpz_multi_CRT_precomp(fmpz_t output, const fmpz_multi_CRT_t P, const fmpz_struct * inputs, int sign)
236+ int fmpz_multi_CRT(fmpz_t output, const fmpz_struct * moduli, const fmpz_struct * values, slong len , int sign)
237+ # void fmpz_multi_CRT_clear(fmpz_multi_CRT_t P)
227238 int fmpz_is_strong_probabprime(const fmpz_t n, const fmpz_t a)
228239 int fmpz_is_probabprime_lucas(const fmpz_t n)
229240 int fmpz_is_probabprime_BPSW(const fmpz_t n)
230241 int fmpz_is_probabprime(const fmpz_t p)
231242 int fmpz_is_prime_pseudosquare(const fmpz_t n)
232- # int fmpz_is_prime_pocklington(fmpz_t F, fmpz_t R, const fmpz_t n, mp_ptr pm1, slong num_pm1)
233- # void _fmpz_nm1_trial_factors(const fmpz_t n, mp_ptr pm1, slong * num_pm1, ulong limit)
234- # int fmpz_is_prime_morrison(fmpz_t F, fmpz_t R, const fmpz_t n, mp_ptr pp1, slong num_pp1)
235- # void _fmpz_np1_trial_factors(const fmpz_t n, mp_ptr pp1, slong * num_pp1, ulong limit)
243+ # int fmpz_is_prime_pocklington(fmpz_t F, fmpz_t R, const fmpz_t n, nn_ptr pm1, slong num_pm1)
244+ # void _fmpz_nm1_trial_factors(const fmpz_t n, nn_ptr pm1, slong * num_pm1, ulong limit)
245+ # int fmpz_is_prime_morrison(fmpz_t F, fmpz_t R, const fmpz_t n, nn_ptr pp1, slong num_pp1)
246+ # void _fmpz_np1_trial_factors(const fmpz_t n, nn_ptr pp1, slong * num_pp1, ulong limit)
236247 int fmpz_is_prime(const fmpz_t n)
237248 void fmpz_lucas_chain(fmpz_t Vm, fmpz_t Vm1, const fmpz_t A, const fmpz_t m, const fmpz_t n)
238249 void fmpz_lucas_chain_full(fmpz_t Vm, fmpz_t Vm1, const fmpz_t A, const fmpz_t B, const fmpz_t m, const fmpz_t n)
@@ -243,11 +254,9 @@ cdef extern from "flint/fmpz.h":
243254 int fmpz_divisor_in_residue_class_lenstra(fmpz_t fac, const fmpz_t n, const fmpz_t r, const fmpz_t s)
244255 void fmpz_nextprime(fmpz_t res, const fmpz_t n, int proved)
245256 void fmpz_primorial(fmpz_t res, ulong n)
246- # void fmpz_factor_euler_phi(fmpz_t res, const fmpz_factor_t fac)
257+ void fmpz_factor_euler_phi(fmpz_t res, const fmpz_factor_t fac)
247258 void fmpz_euler_phi(fmpz_t res, const fmpz_t n)
248- # int fmpz_factor_moebius_mu(const fmpz_factor_t fac)
259+ int fmpz_factor_moebius_mu(const fmpz_factor_t fac)
249260 int fmpz_moebius_mu(const fmpz_t n)
250- # void fmpz_factor_divisor_sigma(fmpz_t res, ulong k, const fmpz_factor_t fac)
261+ void fmpz_factor_divisor_sigma(fmpz_t res, ulong k, const fmpz_factor_t fac)
251262 void fmpz_divisor_sigma(fmpz_t res, ulong k, const fmpz_t n)
252-
253-
0 commit comments