Skip to content

Commit ecce0a7

Browse files
committed
bindings: generate fmpz.pxd automatically
1 parent 397d973 commit ecce0a7

File tree

8 files changed

+139
-97
lines changed

8 files changed

+139
-97
lines changed

bin/all_rst_to_pxd.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
FLINT_DOC_DIR=$1
4+
5+
set -e
6+
7+
modules="fmpz"
8+
9+
for module in $modules; do
10+
echo "Processing $module"
11+
bin/rst_to_pxd.py flint/$module --flint-doc-dir=$FLINT_DOC_DIR > src/flint/flintlib/$module.pxd
12+
done

bin/rst_to_pxd.py

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,15 @@
4040
# recognize a function definition in rst
4141
is_func = re.compile(r"\.\.( )+(c:)?function( )*::")
4242
# rename types to avoid python -- c name collisions
43-
rename_types = [(re.compile(r"\bfmpz\b"),"fmpz_struct"),(re.compile(r"\bfmpq\b"), "fmpq_struct")]
43+
rename_types = [
44+
(re.compile(r"\bfmpz\b"),"fmpz_struct"),
45+
(re.compile(r"\bfmpq\b"), "fmpq_struct"),
46+
(re.compile(r"\bin\b"), "in_"),
47+
]
4448
# comment out functions which use these types
4549
comment_types = re.compile(r"(\bFILE\b)|(\bmpz_t\b)|(\bmpq_t\b)")
4650
comment_set = set(["FILE", "mpz_t", "mpq_t"])
47-
c_types = set(["char", "short", "long", "int", "float", "double"])
51+
c_types = set(["void", "char", "short", "long", "int", "float", "double"])
4852
type_modifers = re.compile(r"\*|(\bconst\b)|(\bunsigned\b)|(\bsigned\b)")
4953
import_dict = {}
5054

@@ -79,13 +83,15 @@ def undecorate(str):
7983
remove variable name, const, ``*``, etc. to just get types
8084
"""
8185
ret = str.strip()
82-
ret = ret[:ret.rfind(' ')]
86+
if ' ' in ret:
87+
ret = ret[:ret.rfind(' ')]
8388
ret = re.sub(type_modifers, '', ret)
8489
return ret.strip()
8590

8691
def get_parameter_types(str):
8792
params = str[str.find("(") + 1 : str.rfind(")")].split(",")
88-
return [undecorate(s) for s in params]
93+
params.append(str.split()[0])
94+
return [undecorate(s) for s in params if s]
8995

9096
def clean_types(function):
9197
ret = function.strip()
@@ -98,8 +104,15 @@ def get_functions(file):
98104
Get a list of functions from an rst file
99105
"""
100106
ret = []
107+
macros = []
101108
in_list = False
102109
for line in file:
110+
# Keep track of the macros
111+
# We want to give them types in cython...
112+
if line.startswith('.. macro'):
113+
macros.append(line.strip())
114+
continue
115+
103116
m = is_func.match(line)
104117
if m:
105118
ret.append( clean_types(line[m.end():]))
@@ -110,7 +123,7 @@ def get_functions(file):
110123
in_list = False
111124
else:
112125
ret.append(clean_types(line))
113-
return ret
126+
return ret, macros
114127

115128
def get_all_types(function_list):
116129
ret = set()
@@ -119,6 +132,11 @@ def get_all_types(function_list):
119132
ret.add(t)
120133
return ret
121134

135+
136+
def has_types(line, types):
137+
return any(t in types for t in get_parameter_types(line))
138+
139+
122140
def gen_imports(function_list):
123141
"""
124142
Generate import statements for known functions.
@@ -132,10 +150,12 @@ def gen_imports(function_list):
132150
imports[import_dict[t]].append(t)
133151
else:
134152
ret.add(t)
135-
for k,v in imports.items():
136-
types = ", ".join(v)
153+
for k,v in sorted(imports.items()):
154+
types = ", ".join(sorted(v))
137155
print("from flint.flintlib." + k + " cimport " + types)
138-
return ret
156+
return sorted(ret)
157+
158+
139159

140160
def generate_pxd_file(h_name, opts):
141161
fill_import_dict(opts.flint_lib_dir)
@@ -146,14 +166,18 @@ def generate_pxd_file(h_name, opts):
146166
docdir = opts.flint_doc_dir
147167
name = name[6:]
148168
with open(os.path.join(docdir, name + ".rst")) as f:
149-
l = get_functions(f)
150-
s = gen_imports(l)
169+
l, macros = get_functions(f)
170+
unknown_types = gen_imports(l)
171+
print()
172+
for t in unknown_types:
173+
print("# unknown type " + t)
151174
print()
152-
print ("\n# unimported types ", s - comment_set)
175+
for m in macros:
176+
print("# " + m)
153177
print()
154178
print(r'cdef extern from "' + h_name +r'.h":')
155179
for f in l:
156-
if comment_types.search(f):
180+
if has_types(f, unknown_types):
157181
print(" # " + f)
158182
else:
159183
print(" " + f)

src/flint/flintlib/flint.pxd

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ cdef extern from "flint/fmpz.h":
3636

3737
ctypedef slong fmpz_struct
3838

39+
cdef extern from "flint/fmpz.h":
40+
int COEFF_IS_MPZ(fmpz_struct x)
41+
3942
cdef extern from *:
4043
"""
4144
/*
@@ -83,25 +86,3 @@ cdef extern from *:
8386
#endif
8487
"""
8588
slong pylong_as_slong(PyObject *pylong, int *overflow)
86-
87-
88-
"""
89-
cdef extern from "flint/fmpz_mpoly_factor.h":
90-
91-
ctypedef struct fmpz_mpoly_factor_struct:
92-
fmpz_t content
93-
fmpz_mpoly_struct * poly
94-
fmpz_struct * exp
95-
slong length
96-
slong alloc
97-
98-
ctypedef fmpz_mpoly_factor_struct fmpz_mpoly_factor_t[1]
99-
100-
101-
void fmpz_mpoly_factor_init(fmpz_mpoly_factor_t fac, const fmpz_mpoly_ctx_t ctx)
102-
103-
void fmpz_mpoly_factor_clear(fmpz_mpoly_factor_t fac, const fmpz_mpoly_ctx_t ctx)
104-
105-
int fmpz_mpoly_factor(fmpz_mpoly_factor_t fac, const fmpz_mpoly_t A, int full, const fmpz_mpoly_ctx_t ctx)
106-
"""
107-

src/flint/flintlib/fmpz.pxd

Lines changed: 69 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,95 @@
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-

src/flint/flintlib/fmpz_factor.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from flint.flintlib.flint cimport fmpz_struct, ulong, mp_limb_t, slong, flint_rand_t
2-
from flint.flintlib.fmpz cimport fmpz_t
2+
from flint.flintlib.fmpz_types cimport fmpz_t
33

44
cdef extern from "flint/fmpz_factor.h":
55
ctypedef struct fmpz_factor_struct:

0 commit comments

Comments
 (0)