@@ -19,7 +19,6 @@ from flint.flintlib.arb_mat cimport *
1919from flint.flintlib.arf cimport *
2020from flint.flintlib.acb cimport *
2121from flint.flintlib.acb_mat cimport *
22- from flint.flintlib.acb_theta cimport *
2322
2423cimport cython
2524
@@ -818,47 +817,18 @@ cdef class acb_mat(flint_mat):
818817
819818 def theta (tau , z , square = False ):
820819 r """
821- Computes the vector valued Riemann theta function `( \t heta_{a,b}{z, tau) : a, b \i n \{ 0,1\} ^ {g}\) ` or its squares.
822- This is a wrapper for the function `acb_theta_all` and it follows the same conventions for the ordering of the theta characteristics.
823-
824- >>> from flint import acb, acb_mat, showgood
825- >>> z = acb( 1+ 1j) ; tau = acb( 1. 25+ 3j)
826- >>> t0, t1, t2, t3 = acb_mat( [[tau ]]) . theta( acb_mat( [[z ]]))
827- >>> sum( [abs(x) for x in acb_mat([z.modular_theta(tau) ]) - acb_mat( [[-t3,t2,t0,t1 ]]) ])
828- [+/- 3.82e-14 ]
829- >>> for i in range( 4) :showgood( lambda: acb_mat( [[tau ]]) . theta( acb_mat( [[z ]])) [i ], dps=25)
830- ...
831- 0. 9694430387796704100046143 - 0. 03055696120816803328582847j
832- 1. 030556961196006476576271 + 0. 03055696120816803328582847j
833- -1. 220790267576967690128359 - 1. 827055516791154669091679j
834- -1. 820235910124989594900076 + 1. 216251950154477951760042j
835- >>> acb_mat( [[1j,0 ],[0,2*1j ]]) . theta( acb_mat( [[0 ],[0 ]]))
836- ( [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)
837-
838- """
839- g = tau.nrows()
840- assert tau.ncols() == g
841- assert z.nrows() == g
842- assert z.ncols() == 1
843-
844- # convert input
845- cdef acb_ptr zvec
846- zvec = _acb_vec_init(g)
847- cdef long i
848- for i in range (g):
849- acb_set(zvec + i, acb_mat_entry((< acb_mat> z).val, i, 0 ))
850-
851- # initialize the output
852- cdef slong nb = 1 << (2 * g)
853- cdef acb_ptr theta = _acb_vec_init(nb)
854-
855- acb_theta_all(theta, zvec, tau.val, square, getprec())
856- _acb_vec_clear(zvec, g)
857- # copy the output
858- res = tuple ()
859- for i in range (nb):
860- r = acb.__new__ (acb)
861- acb_set((< acb> r).val, theta + i)
862- res += (r,)
863- _acb_vec_clear(theta, nb)
864- return res
820+ Computes the vector valued Riemann theta function
821+ `( \t heta_{a,b}{z, tau) : a, b \i n \{ 0,1\} ^ {g}\) ` or its squares.
822+ This is a wrapper for the C-function `acb_theta_all` and it follows the
823+ same conventions for the ordering of the theta characteristics.
824+
825+ This is a wrapper for :meth:`. acb_theta. acb_mat_theta`; see the
826+ documentation for that method for details for examples.
827+ """
828+ try :
829+ from .acb_theta import acb_mat_theta
830+ except ImportError :
831+ acb_mat_theta = None
832+ if acb_mat_theta is None :
833+ raise NotImplementedError (" acb.theta() needs Flint >= 3.1.0" )
834+ return acb_mat_theta(z, tau, square = square)
0 commit comments