Skip to content

Commit a2212fd

Browse files
committed
bindings: auto generate acb_* .pxd files
1 parent ef90f58 commit a2212fd

File tree

14 files changed

+129
-85
lines changed

14 files changed

+129
-85
lines changed

bin/all_rst_to_pxd.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ modules="\
1515
arb\
1616
arb_poly\
1717
arb_mat\
18+
acb\
19+
acb_poly\
20+
acb_mat\
1821
"
1922

2023
for module in $modules; do

bin/rst_to_pxd.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
(re.compile(r"\bfmpz\b"),"fmpz_struct"),
4545
(re.compile(r"\bfmpq\b"), "fmpq_struct"),
4646
(re.compile(r"\bin\b"), "in_"),
47+
(re.compile(r"\blambda\b"), "lambda_"),
4748
]
4849
# comment out functions which use these types
4950
comment_types = re.compile(r"(\bFILE\b)|(\bmpz_t\b)|(\bmpq_t\b)")

src/flint/flintlib/acb.pxd

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
from flint.flintlib.flint cimport ulong, slong, flint_rand_t
1+
from flint.flintlib.acb_types cimport acb_ptr, acb_srcptr, acb_t
2+
from flint.flintlib.arb_types cimport arb_ptr, arb_srcptr, arb_t, mag_srcptr, mag_t
3+
from flint.flintlib.arf_types cimport arf_srcptr, arf_t
4+
from flint.flintlib.flint cimport flint_rand_t, fmpz_struct, slong, ulong
25
from flint.flintlib.fmpq cimport fmpq_t
3-
from flint.flintlib.fmpz cimport fmpz_t, fmpz_struct
4-
from flint.flintlib.arf_types cimport arf_t, arf_srcptr
5-
from flint.flintlib.arb_types cimport mag_t, mag_srcptr, arb_struct, arb_t, arb_ptr
6+
from flint.flintlib.fmpz_types cimport fmpz_t
67

7-
cdef extern from "flint/acb.h":
8-
ctypedef struct acb_struct:
9-
arb_struct real
10-
arb_struct imag
11-
12-
ctypedef acb_struct * acb_ptr
13-
ctypedef const acb_struct * acb_srcptr
14-
ctypedef acb_struct acb_t[1]
8+
# unknown type FILE
159

16-
arb_ptr acb_realref(const acb_t x)
17-
arb_ptr acb_imagref(const acb_t x)
10+
# .. macro:: acb_realref(x)
11+
# .. macro:: acb_imagref(x)
1812

13+
cdef extern from "flint/acb.h":
1914
void acb_init(acb_t x)
2015
void acb_clear(acb_t x)
2116
acb_ptr _acb_vec_init(slong n)
@@ -46,12 +41,16 @@ cdef extern from "flint/acb.h":
4641
void acb_add_error_arb(acb_t x, const arb_t err)
4742
void acb_get_mid(acb_t m, const acb_t x)
4843
void acb_print(const acb_t x)
44+
# void acb_fprint(FILE * file, const acb_t x)
4945
void acb_printd(const acb_t x, slong digits)
46+
# void acb_fprintd(FILE * file, const acb_t x, slong digits)
5047
void acb_printn(const acb_t x, slong digits, ulong flags)
48+
# void acb_fprintn(FILE * file, const acb_t x, slong digits, ulong flags)
5149
void acb_randtest(acb_t z, flint_rand_t state, slong prec, slong mag_bits)
5250
void acb_randtest_special(acb_t z, flint_rand_t state, slong prec, slong mag_bits)
5351
void acb_randtest_precise(acb_t z, flint_rand_t state, slong prec, slong mag_bits)
5452
void acb_randtest_param(acb_t z, flint_rand_t state, slong prec, slong mag_bits)
53+
void acb_urandom(acb_t z, flint_rand_t state, slong prec)
5554
int acb_is_zero(const acb_t z)
5655
int acb_is_one(const acb_t z)
5756
int acb_is_finite(const acb_t z)
@@ -104,6 +103,7 @@ cdef extern from "flint/acb.h":
104103
void acb_sub(acb_t z, const acb_t x, const acb_t y, slong prec)
105104
void acb_mul_onei(acb_t z, const acb_t x)
106105
void acb_div_onei(acb_t z, const acb_t x)
106+
void acb_mul_i_pow_si(acb_t z, const acb_t x, slong k)
107107
void acb_mul_ui(acb_t z, const acb_t x, ulong y, slong prec)
108108
void acb_mul_si(acb_t z, const acb_t x, slong y, slong prec)
109109
void acb_mul_fmpz(acb_t z, const acb_t x, const fmpz_t y, slong prec)
@@ -143,6 +143,7 @@ cdef extern from "flint/acb.h":
143143
void acb_sqrt_analytic(acb_t r, const acb_t z, int analytic, slong prec)
144144
void acb_rsqrt(acb_t r, const acb_t z, slong prec)
145145
void acb_rsqrt_analytic(acb_t r, const acb_t z, int analytic, slong prec)
146+
void acb_sqrts(acb_t y1, acb_t y2, const acb_t x, slong prec)
146147
void acb_quadratic_roots_fmpz(acb_t r1, acb_t r2, const fmpz_t a, const fmpz_t b, const fmpz_t c, slong prec)
147148
void acb_root_ui(acb_t r, const acb_t z, ulong k, slong prec)
148149
void acb_pow_fmpz(acb_t y, const acb_t b, const fmpz_t e, slong prec)
@@ -226,9 +227,16 @@ cdef extern from "flint/acb.h":
226227
void _acb_vec_zero(acb_ptr A, slong n)
227228
int _acb_vec_is_zero(acb_srcptr vec, slong len)
228229
int _acb_vec_is_real(acb_srcptr v, slong len)
230+
int _acb_vec_is_finite(acb_srcptr vec, slong len)
231+
int _acb_vec_equal(acb_srcptr vec1, acb_srcptr vec2, slong len)
232+
int _acb_vec_overlaps(acb_srcptr vec1, acb_srcptr vec2, slong len)
233+
int _acb_vec_contains(acb_srcptr vec1, acb_srcptr vec2, slong len)
229234
void _acb_vec_set(acb_ptr res, acb_srcptr vec, slong len)
230235
void _acb_vec_set_round(acb_ptr res, acb_srcptr vec, slong len, slong prec)
231236
void _acb_vec_swap(acb_ptr vec1, acb_ptr vec2, slong len)
237+
void _acb_vec_get_real(arb_ptr re, acb_srcptr vec, slong len)
238+
void _acb_vec_get_imag(arb_ptr im, acb_srcptr vec, slong len)
239+
void _acb_vec_set_real_imag(acb_ptr vec, arb_srcptr re, arb_srcptr im, slong len)
232240
void _acb_vec_neg(acb_ptr res, acb_srcptr vec, slong len)
233241
void _acb_vec_add(acb_ptr res, acb_srcptr vec1, acb_srcptr vec2, slong len, slong prec)
234242
void _acb_vec_sub(acb_ptr res, acb_srcptr vec1, acb_srcptr vec2, slong len, slong prec)
@@ -244,6 +252,7 @@ cdef extern from "flint/acb.h":
244252
void _acb_vec_scalar_div_arb(acb_ptr res, acb_srcptr vec, slong len, const arb_t c, slong prec)
245253
void _acb_vec_scalar_mul_fmpz(acb_ptr res, acb_srcptr vec, slong len, const fmpz_t c, slong prec)
246254
void _acb_vec_scalar_div_fmpz(acb_ptr res, acb_srcptr vec, slong len, const fmpz_t c, slong prec)
255+
void _acb_vec_sqr(acb_ptr res, acb_srcptr vec, slong len, slong prec)
247256
slong _acb_vec_bits(acb_srcptr vec, slong len)
248257
void _acb_vec_set_powers(acb_ptr xs, const acb_t x, slong len, slong prec)
249258
void _acb_vec_unit_roots(acb_ptr z, slong order, slong len, slong prec)
@@ -253,3 +262,5 @@ cdef extern from "flint/acb.h":
253262
void _acb_vec_trim(acb_ptr res, acb_srcptr vec, slong len)
254263
int _acb_vec_get_unique_fmpz_vec(fmpz_struct * res, acb_srcptr vec, slong len)
255264
void _acb_vec_sort_pretty(acb_ptr vec, slong len)
265+
void _acb_vec_printd(acb_srcptr vec, slong len, slong digits)
266+
void _acb_vec_printn(acb_srcptr vec, slong len, slong digits, ulong flags)

src/flint/flintlib/acb_dirichlet.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from flint.flintlib.flint cimport ulong, slong
44
from flint.flintlib.acb_poly cimport acb_poly_t
55
from flint.flintlib.fmpz cimport fmpz_t
66
from flint.flintlib.arb_types cimport mag_t, mag_struct, arb_t, arb_ptr
7-
from flint.flintlib.acb cimport acb_struct, acb_srcptr
7+
from flint.flintlib.acb_types cimport acb_struct, acb_srcptr
88
from flint.flintlib.fmpq cimport fmpq_t
99
from flint.flintlib.arf cimport arf_t
1010
from flint.flintlib.arb cimport arb_srcptr

src/flint/flintlib/acb_hypgeom.pxd

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
from flint.flintlib.acb cimport acb_t, acb_srcptr, acb_ptr
2-
from flint.flintlib.acb_poly cimport acb_poly_t, acb_poly_struct
3-
from flint.flintlib.mag cimport mag_t
41
from flint.flintlib.flint cimport ulong, slong
2+
from flint.flintlib.acb_types cimport (
3+
acb_t,
4+
acb_srcptr,
5+
acb_ptr,
6+
acb_poly_t,
7+
acb_poly_struct,
8+
)
9+
from flint.flintlib.arb_types cimport mag_t
510

611
cdef extern from "flint/acb_hypgeom.h":
712
# from here on is parsed

src/flint/flintlib/acb_mat.pxd

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,16 @@
1-
from flint.flintlib.flint cimport ulong, flint_rand_t, slong
2-
from flint.flintlib.fmpz_mat cimport fmpz_mat_t
1+
from flint.flintlib.acb_types cimport acb_mat_t, acb_poly_t, acb_ptr, acb_srcptr, acb_t
2+
from flint.flintlib.arb_types cimport arb_mat_t, arb_t, mag_t
3+
from flint.flintlib.flint cimport flint_rand_t, slong, ulong
34
from flint.flintlib.fmpq_mat cimport fmpq_mat_t
4-
from flint.flintlib.mag cimport mag_t
5-
from flint.flintlib.fmpz cimport fmpz_t
6-
from flint.flintlib.acb_poly cimport acb_poly_t
7-
from flint.flintlib.arb cimport arb_t
8-
from flint.flintlib.acb cimport acb_ptr, acb_struct, acb_t, acb_srcptr
9-
from flint.flintlib.arb_mat cimport arb_mat_t
5+
from flint.flintlib.fmpz_types cimport fmpz_mat_t, fmpz_t
106

11-
cdef extern from "flint/acb_mat.h":
12-
ctypedef struct acb_mat_struct:
13-
acb_ptr entries
14-
long r
15-
long c
16-
acb_ptr * rows
7+
# unknown type FILE
178

18-
ctypedef acb_mat_struct acb_mat_t[1]
19-
#macros
20-
acb_struct * acb_mat_entry(acb_mat_t mat, long i, long j)
9+
# .. macro:: acb_mat_entry(mat, i, j)
10+
# .. macro:: acb_mat_nrows(mat)
11+
# .. macro:: acb_mat_ncols(mat)
2112

22-
long acb_mat_nrows(const acb_mat_t x)
23-
long acb_mat_ncols(const acb_mat_t x)
24-
# from here on is parsed
13+
cdef extern from "flint/acb_mat.h":
2514
void acb_mat_init(acb_mat_t mat, slong r, slong c)
2615
void acb_mat_clear(acb_mat_t mat)
2716
slong acb_mat_allocated_bytes(const acb_mat_t x)
@@ -33,9 +22,13 @@ cdef extern from "flint/acb_mat.h":
3322
void acb_mat_set_fmpq_mat(acb_mat_t dest, const fmpq_mat_t src, slong prec)
3423
void acb_mat_set_arb_mat(acb_mat_t dest, const arb_mat_t src)
3524
void acb_mat_set_round_arb_mat(acb_mat_t dest, const arb_mat_t src, slong prec)
25+
void acb_mat_get_real(arb_mat_t re, const arb_mat_t mat)
26+
void acb_mat_get_imag(arb_mat_t im, const arb_mat_t mat)
27+
void acb_mat_set_real_imag(acb_mat_t mat, const arb_mat_t re, const arb_mat_t im)
3628
void acb_mat_randtest(acb_mat_t mat, flint_rand_t state, slong prec, slong mag_bits)
3729
void acb_mat_randtest_eig(acb_mat_t mat, flint_rand_t state, acb_srcptr E, slong prec)
3830
void acb_mat_printd(const acb_mat_t mat, slong digits)
31+
# void acb_mat_fprintd(FILE * file, const acb_mat_t mat, slong digits)
3932
int acb_mat_equal(const acb_mat_t mat1, const acb_mat_t mat2)
4033
int acb_mat_overlaps(const acb_mat_t mat1, const acb_mat_t mat2)
4134
int acb_mat_contains(const acb_mat_t mat1, const acb_mat_t mat2)
@@ -55,13 +48,14 @@ cdef extern from "flint/acb_mat.h":
5548
void acb_mat_zero(acb_mat_t mat)
5649
void acb_mat_one(acb_mat_t mat)
5750
void acb_mat_ones(acb_mat_t mat)
51+
void acb_mat_onei(acb_mat_t mat)
5852
void acb_mat_indeterminate(acb_mat_t mat)
5953
void acb_mat_dft(acb_mat_t mat, int type, slong prec)
6054
void acb_mat_transpose(acb_mat_t dest, const acb_mat_t src)
6155
void acb_mat_conjugate_transpose(acb_mat_t dest, const acb_mat_t src)
6256
void acb_mat_conjugate(acb_mat_t dest, const acb_mat_t src)
6357
void acb_mat_bound_inf_norm(mag_t b, const acb_mat_t A)
64-
void acb_mat_frobenius_norm(acb_t res, const acb_mat_t A, slong prec)
58+
void acb_mat_frobenius_norm(arb_t res, const acb_mat_t A, slong prec)
6559
void acb_mat_bound_frobenius_norm(mag_t res, const acb_mat_t A)
6660
void acb_mat_neg(acb_mat_t dest, const acb_mat_t src)
6761
void acb_mat_add(acb_mat_t res, const acb_mat_t mat1, const acb_mat_t mat2, slong prec)
@@ -88,6 +82,10 @@ cdef extern from "flint/acb_mat.h":
8882
void acb_mat_scalar_div_fmpz(acb_mat_t B, const acb_mat_t A, const fmpz_t c, slong prec)
8983
void acb_mat_scalar_div_arb(acb_mat_t B, const acb_mat_t A, const arb_t c, slong prec)
9084
void acb_mat_scalar_div_acb(acb_mat_t B, const acb_mat_t A, const acb_t c, slong prec)
85+
void _acb_mat_vector_mul_row(acb_ptr res, acb_srcptr v, const acb_mat_t A, slong prec)
86+
void _acb_mat_vector_mul_col(acb_ptr res, const acb_mat_t A, acb_srcptr v, slong prec)
87+
void acb_mat_vector_mul_row(acb_ptr res, acb_srcptr v, const acb_mat_t A, slong prec)
88+
void acb_mat_vector_mul_col(acb_ptr res, const acb_mat_t A, acb_srcptr v, slong prec)
9189
int acb_mat_lu_classical(slong * perm, acb_mat_t LU, const acb_mat_t A, slong prec)
9290
int acb_mat_lu_recursive(slong * perm, acb_mat_t LU, const acb_mat_t A, slong prec)
9391
int acb_mat_lu(slong * perm, acb_mat_t LU, const acb_mat_t A, slong prec)
@@ -124,7 +122,7 @@ cdef extern from "flint/acb_mat.h":
124122
void acb_mat_add_error_mag(acb_mat_t mat, const mag_t err)
125123
int acb_mat_approx_eig_qr(acb_ptr E, acb_mat_t L, acb_mat_t R, const acb_mat_t A, const mag_t tol, slong maxiter, slong prec)
126124
void acb_mat_eig_global_enclosure(mag_t eps, const acb_mat_t A, acb_srcptr E, const acb_mat_t R, slong prec)
127-
void acb_mat_eig_enclosure_rump(acb_t l, acb_mat_t J, acb_mat_t R, const acb_mat_t A, const acb_t lambda_approx, const acb_mat_t R_approx, slong prec)
125+
void acb_mat_eig_enclosure_rump(acb_t lambda_, acb_mat_t J, acb_mat_t R, const acb_mat_t A, const acb_t lambda_approx, const acb_mat_t R_approx, slong prec)
128126
int acb_mat_eig_simple_rump(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)
129127
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)
130128
int acb_mat_eig_simple(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)

0 commit comments

Comments
 (0)