Skip to content

Commit b63144d

Browse files
committed
Wrapping acb_theta_all
1 parent 4ef88ba commit b63144d

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

src/flint/flintlib/acb_theta.pxd

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,30 @@ from flint.flintlib.acb cimport acb_t, acb_srcptr, acb_ptr
22
from flint.flintlib.acb_poly cimport acb_poly_struct, acb_poly_t
33
from flint.flintlib.arb cimport arb_t, arb_ptr, arb_srcptr
44
from flint.flintlib.flint cimport ulong, slong, flint_rand_t
5-
from flint.flintlib.fmpz_mat cimport fmpz_mat_t
5+
from flint.flintlib.fmpz_mat cimport fmpz_mat_t, fmpz_mat_struct
66
from flint.flintlib.acb_mat cimport acb_mat_t
77
from flint.flintlib.arb_mat cimport arb_mat_t
88
from flint.flintlib.arf cimport arf_t
99

1010

11-
# unimported types {'acb_theta_eld_t', 'acb_theta_naive_worker_t', 'acb_theta_ql_worker_t'}
12-
1311
cdef extern from "flint/acb_theta.h":
12+
ctypedef struct acb_theta_eld_struct:
13+
slong dim
14+
slong ambient_dim
15+
slong * last_coords
16+
slong min
17+
slong mid
18+
slong max
19+
slong nr
20+
slong nl
21+
acb_theta_eld_struct * rchildren
22+
acb_theta_eld_struct * lchildren
23+
slong nb_pts, nb_border
24+
slong * box
25+
ctypedef acb_theta_eld_struct acb_theta_eld_t[1]
26+
ctypedef void (*acb_theta_naive_worker_t)(acb_ptr, acb_srcptr, acb_srcptr, const slong *, slong, const acb_t, const slong *, slong, slong, slong, slong)
27+
ctypedef int (*acb_theta_ql_worker_t)(acb_ptr, acb_srcptr, acb_srcptr, arb_srcptr, arb_srcptr, const acb_mat_t, slong, slong)
28+
1429
void acb_theta_all(acb_ptr th, acb_srcptr z, const acb_mat_t tau, int sqr, slong prec)
1530
void acb_theta_naive_fixed_ab(acb_ptr th, ulong ab, acb_srcptr zs, slong nb, const acb_mat_t tau, slong prec)
1631
void acb_theta_naive_all(acb_ptr th, acb_srcptr zs, slong nb, const acb_mat_t tau, slong prec)

src/flint/types/acb_mat.pyx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ from flint.flintlib.arb_mat cimport *
1919
from flint.flintlib.arf cimport *
2020
from flint.flintlib.acb cimport *
2121
from flint.flintlib.acb_mat cimport *
22+
from flint.flintlib.acb_theta cimport *
2223

2324
cimport cython
2425

@@ -814,3 +815,35 @@ cdef class acb_mat(flint_mat):
814815
if left:
815816
return Elist, L
816817
return Elist, R
818+
819+
def theta(tau, z, square=False):
820+
r"""
821+
FIXME
822+
"""
823+
g = tau.nrows()
824+
assert g > 1
825+
assert tau.ncols() == g
826+
assert z.nrows() == g
827+
assert z.ncols() == 1
828+
829+
# convert input
830+
cdef acb_ptr zvec
831+
zvec = _acb_vec_init(g)
832+
cdef long i
833+
for i in range(g):
834+
acb_set(zvec + i, acb_mat_entry((<acb_mat>z).val, i, 0))
835+
836+
# initialize the output
837+
cdef slong nb = 1 << (2 * g)
838+
cdef acb_ptr theta = _acb_vec_init(nb)
839+
840+
acb_theta_all(theta, zvec, tau.val, square, getprec())
841+
_acb_vec_clear(zvec, g)
842+
# copy the output
843+
res = tuple()
844+
for i in range(nb):
845+
r = acb.__new__(acb)
846+
acb_set((<acb>r).val, theta + i)
847+
res += (r,)
848+
_acb_vec_clear(theta, nb)
849+
return res

0 commit comments

Comments
 (0)