Skip to content

Commit 97b096f

Browse files
committed
return a matrix instead of a tuple
1 parent 1ceedba commit 97b096f

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

src/flint/types/acb_theta.pyx

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,32 @@ def acb_mat_theta(acb_mat z, acb_mat tau, ulong square=False):
1414
1515
>>> from flint import acb, acb_mat, showgood
1616
>>> z = acb(1+1j); tau = acb(1.25+3j)
17-
>>> t0, t1, t2, t3 = acb_mat([[tau]]).theta(acb_mat([[z]]))
17+
>>> t0, t1, t2, t3 = acb_mat([[tau]]).theta(acb_mat([[z]])).entries()
1818
>>> sum([abs(x) for x in acb_mat([z.modular_theta(tau)]) - acb_mat([[-t3,t2,t0,t1]])])
1919
[+/- 3.82e-14]
20-
>>> for i in range(4):showgood(lambda: acb_mat([[tau]]).theta(acb_mat([[z]]))[i], dps=25)
20+
>>> for i in range(4):showgood(lambda: acb_mat([[tau]]).theta(acb_mat([[z]])).entries()[i], dps=25)
2121
...
2222
0.9694430387796704100046143 - 0.03055696120816803328582847j
2323
1.030556961196006476576271 + 0.03055696120816803328582847j
2424
-1.220790267576967690128359 - 1.827055516791154669091679j
2525
-1.820235910124989594900076 + 1.216251950154477951760042j
26-
>>> acb_mat([[1j,0],[0,2*1j]]).theta(acb_mat([[0],[0]]))
27-
([1.09049252082308 +/- 3.59e-15] + [+/- 2.43e-16]j, [1.08237710165638 +/- 4.15e-15] + [+/- 2.43e-16]j, [0.916991251621117 +/- 6.30e-16] + [+/- 2.43e-16]j, [0.910167024735558 +/- 7.93e-16] + [+/- 2.43e-16]j, [0.451696791791346 +/- 5.46e-16] + [+/- 2.43e-16]j, [+/- 2.43e-16] + [+/- 2.43e-16]j, [0.379830212998946 +/- 4.47e-16] + [+/- 2.43e-16]j, [+/- 2.43e-16] + [+/- 2.43e-16]j, [0.916991251621117 +/- 6.30e-16] + [+/- 2.43e-16]j, [0.910167024735558 +/- 7.93e-16] + [+/- 2.43e-16]j, [+/- 2.43e-16] + [+/- 2.43e-16]j, [+/- 2.43e-16] + [+/- 2.43e-16]j, [0.379830212998946 +/- 4.47e-16] + [+/- 2.43e-16]j, [+/- 2.43e-16] + [+/- 2.43e-16]j, [+/- 2.43e-16] + [+/- 2.43e-16]j, [+/- 2.43e-16] + [+/- 2.43e-16]j)
26+
>>> acb_mat([[1j,0],[0,2*1j]]).theta(acb_mat([[0],[0]])).transpose()
27+
[ [1.09049252082308 +/- 3.59e-15] + [+/- 2.43e-16]j]
28+
[ [1.08237710165638 +/- 4.15e-15] + [+/- 2.43e-16]j]
29+
[[0.916991251621117 +/- 6.30e-16] + [+/- 2.43e-16]j]
30+
[[0.910167024735558 +/- 7.93e-16] + [+/- 2.43e-16]j]
31+
[[0.451696791791346 +/- 5.46e-16] + [+/- 2.43e-16]j]
32+
[ [+/- 2.43e-16] + [+/- 2.43e-16]j]
33+
[[0.379830212998946 +/- 4.47e-16] + [+/- 2.43e-16]j]
34+
[ [+/- 2.43e-16] + [+/- 2.43e-16]j]
35+
[[0.916991251621117 +/- 6.30e-16] + [+/- 2.43e-16]j]
36+
[[0.910167024735558 +/- 7.93e-16] + [+/- 2.43e-16]j]
37+
[ [+/- 2.43e-16] + [+/- 2.43e-16]j]
38+
[ [+/- 2.43e-16] + [+/- 2.43e-16]j]
39+
[[0.379830212998946 +/- 4.47e-16] + [+/- 2.43e-16]j]
40+
[ [+/- 2.43e-16] + [+/- 2.43e-16]j]
41+
[ [+/- 2.43e-16] + [+/- 2.43e-16]j]
42+
[ [+/- 2.43e-16] + [+/- 2.43e-16]j]
2843
2944
"""
3045
g = tau.nrows()
@@ -46,11 +61,11 @@ def acb_mat_theta(acb_mat z, acb_mat tau, ulong square=False):
4661
acb_theta_all(theta, zvec, tau.val, square, getprec())
4762
_acb_vec_clear(zvec, g)
4863
# copy the output
49-
res = tuple()
64+
res = []
5065
cdef acb r
5166
for i in range(nb):
5267
r = acb.__new__(acb)
5368
acb_set(r.val, theta + i)
54-
res += (r,)
69+
res.append(r)
5570
_acb_vec_clear(theta, nb)
56-
return res
71+
return acb_mat([res])

0 commit comments

Comments
 (0)