@@ -97,26 +97,48 @@ def acb_theta(acb_mat z, acb_mat tau, ulong square=False):
9797 return acb_mat([res])
9898
9999
100- def acb_theta_jets (acb_mat z , acb_mat tau , slong ord , ulong square = False ):
100+ def acb_theta_jets (acb_mat z , acb_mat tau , slong ord ):
101101 r """
102- Corrected wrapper for acb_theta_jet to handle multivariate Taylor expansions.
102+ Computes the coefficients of the Taylor expansion of the vector valued Riemann
103+ theta function `( \t heta_{a,b}( z, \t au) : a, b \i n \{ 0,1\} ^ {g}) ` or its squares.
104+
105+ This is a wrapper for the C-function
106+ `acb_theta_jet <https://flintlib. org/doc/acb_theta. html#c. acb_theta_jet>`_
107+ and it follows the same conventions for the ordering of the theta characteristics.
108+
109+ This should be used via the method :meth:`. acb_mat. theta_jets`, explicitly ``tau. theta_jets( z, ord) ``.
110+
111+ >>> from flint import acb, acb_mat, showgood, ctx
112+ >>> z = acb( 1+ 1j) ; tau = acb( 1. 25+ 3j)
113+ >>> acb_mat( [[tau ]]) . theta_jets( acb_mat( [[z ]]) ,2) # doctest: + SKIP
114+ [[0.969443038779670 +/- 5.67e-16 ] + [-0.0305569612081680 +/- 5.13e-17 ]j,
115+ [-0.191993710594950 +/- 4.89e-16 ] + [0.191993710747776 +/- 7.42e-16 ]j,
116+ [0.60317023860834 +/- 2.93e-15 ] + [0.60317023764810 +/- 4.86e-15 ]j]
117+ [[1.03055696119601 +/- 3.89e-15 ] + [0.0305569612081680 +/- 5.13e-17 ]j,
118+ [0.191993710594950 +/- 4.89e-16 ] + [-0.191993710442123 +/- 4.62e-16 ]j,
119+ [-0.60317023668787 +/- 5.90e-15 ] + [-0.60317023764810 +/- 4.86e-15 ]j]
120+ [[-1.22079026757697 +/- 4.36e-15 ] + [-1.82705551679115 +/- 5.17e-15 ]j,
121+ [-5.71849316258739 +/- 7.02e-15 ] + [3.82088827346268 +/- 5.75e-15 ]j,
122+ [6.0241074288587 +/- 3.88e-14 ] + [9.0163253443780 +/- 2.05e-14 ]j]
123+ [[-1.82023591012499 +/- 2.67e-15 ] + [1.21625195015448 +/- 4.14e-15 ]j,
124+ [3.8353056542516 +/- 4.99e-14 ] + [5.73981078971270 +/- 6.74e-15 ]j,
125+ [8.9823364151977 +/- 2.44e-14 ] + [-6.0022138700195 +/- 3.72e-14 ]j]
103126 """
104127 g = tau.nrows()
105128 if g == 0 :
106129 return []
107130
108- # 1. Calculate the length of the jet for one characteristic
131+ # Calculate the length of the jet for one characteristic
109132 # This is the number of multi-indices (alpha) such that |alpha| < ord
110133 cdef slong nj = acb_theta_jet_nb(g, ord )
111134
112- # 2. Total number of characteristics
135+ # Total number of characteristics
113136 cdef slong nb = 1 << (2 * g)
114137
115- # 3. Total number of acb elements to allocate
138+ # Total number of acb elements to allocate
116139 # FLINT stores nj coefficients for each of the nb characteristics
117140 cdef slong total_size = nb * nj
118141
119- # Convert input z to acb_ptr
120142 cdef acb_ptr zvec = _acb_vec_init(g)
121143 cdef slong i, j
122144 for i in range (g):
@@ -126,6 +148,7 @@ def acb_theta_jets(acb_mat z, acb_mat tau, slong ord, ulong square=False):
126148 cdef slong nb_in = 1 # Number of input z vectors
127149 cdef ulong ab = 0 # Base characteristic
128150 cdef ulong all = True # Compute all 2^2g characteristics
151+ cdef ulong square = False # Don't compute the squares of the thetas.
129152
130153 # Initialize the output buffer
131154 cdef acb_ptr theta = _acb_vec_init(total_size)
@@ -134,7 +157,7 @@ def acb_theta_jets(acb_mat z, acb_mat tau, slong ord, ulong square=False):
134157 # Note: Computes all partial derivatives up to total order 'ord'
135158 acb_theta_jet(theta, zvec, nb_in, tau.val, ord , ab, all , square, getprec())
136159
137- # 4. Copy the output into a structured format
160+ # Copy the output into a structured format
138161 # We return a list of lists: res[char_idx] = [coeff_0, coeff_1, ...]
139162 res = []
140163 cdef acb r
@@ -151,50 +174,4 @@ def acb_theta_jets(acb_mat z, acb_mat tau, slong ord, ulong square=False):
151174 _acb_vec_clear(zvec, g)
152175 _acb_vec_clear(theta, total_size)
153176
154- return res
155-
156-
157- # def acb_theta_jet(acb_mat z, acb_mat tau, slong ord, ulong square=False):
158- # r"""
159- # Computes derivatives of the vector valued Riemann theta function
160- # `(\theta_{a,b}(z, \tau) : a, b \in \{0,1\}^{g})` or its squares.
161- #
162- # This is a wrapper for the C-function
163- # `acb_theta_jet <https://flintlib.org/doc/acb_theta.html#c.acb_theta_jet>`_
164- # and it follows the same conventions for the ordering of the theta characteristics.
165- #
166- # This should be used via the method :meth:`.acb_mat.theta`, explicitly ``tau.theta(z)``.
167- # """
168- # g = tau.nrows()
169- # assert tau.ncols() == g
170- # assert z.nrows() == g
171- # assert z.ncols() == 1
172- #
173- # # convert input
174- # cdef acb_ptr zvec
175- # zvec = _acb_vec_init(g)
176- # cdef long i
177- # for i in range(g):
178- # acb_set(zvec + i, acb_mat_entry(z.val, i, 0))
179- # cdef slong nb_in = 1
180- # cdef ulong ab = 0
181- # cdef ulong all = True
182- #
183- # # initialize the output
184- # cdef slong nb = 1 << (2 * g)
185- # # 1. Calculate the length of the jet for one characteristic
186- # # This is the number of multi-indices (alpha) such that |alpha| < ord
187- # cdef slong nj = acb_theta_jet_len(g, ord)
188- # cdef acb_ptr theta = _acb_vec_init(nb)
189- #
190- # acb_theta_jet(theta, zvec, nb_in, tau.val, ord, ab, all, square, getprec())
191- # _acb_vec_clear(zvec, g)
192- # # copy the output
193- # res = []
194- # cdef acb r
195- # for i in range(nb):
196- # r = acb.__new__(acb)
197- # acb_set(r.val, theta + i)
198- # res.append(r)
199- # _acb_vec_clear(theta, nb)
200- # return acb_mat([res])
177+ return acb_mat(res)
0 commit comments