summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Raum <martin@raum-brothers.eu>2014-11-05 08:13:20 +0100
committerMartin Raum <martin@raum-brothers.eu>2014-11-14 09:47:47 +0100
commitc887b1c12d622e4309a3902e729f72fd392701c7 (patch)
treea9dd7161f61c0f5554fb8e8c54fe6aa642e57c22
parentAdd doctests to higherrank_dimension.py. (diff)
Correct doctests of Jacobi form tests
-rw-r--r--src/sage/modular/jacobi/test_classical.py23
-rw-r--r--src/sage/modular/jacobi/test_classical_weak.py101
-rw-r--r--src/sage/modular/jacobi/test_higherrank.py219
-rw-r--r--src/sage/modular/jacobi/test_higherrank_dimension.py80
-rw-r--r--src/sage/modular/jacobi/test_vector_valued.py305
5 files changed, 711 insertions, 17 deletions
diff --git a/src/sage/modular/jacobi/test_classical.py b/src/sage/modular/jacobi/test_classical.py
index ef2f704..c57cc23 100644
--- a/src/sage/modular/jacobi/test_classical.py
+++ b/src/sage/modular/jacobi/test_classical.py
@@ -40,6 +40,20 @@ from sage.modular.jacobi.classical import (
)
def test_classical_jacobi_forms():
+ r"""
+ Test classical Jacobi forms for correctness. See individual tests
+ for more details.
+
+ .. NOTE:
+
+ This is a test generator to be used by nosetest.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_classical import test_classical_jacobi_forms
+ sage: test_classical_jacobi_forms()
+ <generator object ...>
+ """
prec = 10
k_mod = 6
@@ -62,6 +76,15 @@ def _test_classical_jacobi_forms(k, m, k_mod, prec):
- `k_mod` -- An integer.
- ``prec`` -- An integer.
+
+ .. NOTE:
+
+ This is a test to be used by nosetest.
+
+ EXAMPLES::
+
+ sage: from sage.modular.jacobi.test_classical import _test_classical_jacobi_forms
+ sage: _test_classical_jacobi_forms(4,1,4,3)
"""
P = PolynomialRing(LaurentPolynomialRing(QQ, 'zeta'), 'q')
q = P.gen(0)
diff --git a/src/sage/modular/jacobi/test_classical_weak.py b/src/sage/modular/jacobi/test_classical_weak.py
index 9e71cfe..4f7a728 100644
--- a/src/sage/modular/jacobi/test_classical_weak.py
+++ b/src/sage/modular/jacobi/test_classical_weak.py
@@ -4,6 +4,7 @@ Tests for classical_weak.py.
AUTHOR:
- Martin Raum
+
"""
#===============================================================================
@@ -42,6 +43,20 @@ from sage.modular.jacobi.classical_weak import (
)
def test_classical_weak_jacobi_forms():
+ r"""
+ Test classical weak Jacobi forms for correctness. See individual tests
+ for more details.
+
+ .. NOTE:
+
+ This is a test generator to be used by nosetest.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_classical_weak import test_classical_weak_jacobi_forms
+ sage: test_classical_weak_jacobi_forms()
+ <generator object ...>
+ """
prec = 20
for k in [10, 11, 15, 18]:
@@ -65,6 +80,9 @@ def test_classical_weak_jacobi_forms():
def _test_classical_weak_jacobi_forms__taylor_coefficients(k, m, prec):
r"""
+ Test classical weak Jacobi forms by inspecting their Taylor
+ coefficients.
+
INPUT:
- `k -- An integer.
@@ -73,6 +91,11 @@ def _test_classical_weak_jacobi_forms__taylor_coefficients(k, m, prec):
- ``prec`` -- A non-negative integer that corresponds to a precision of
the q-expansion.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_classical_weak import _test_classical_weak_jacobi_forms__taylor_coefficients
+ sage: _test_classical_weak_jacobi_forms__taylor_coefficients(4,1,3)
"""
jacobi_forms = classical_weak_jacobi_forms(k, m, prec)
taylor_expansions = _classical_weak_jacobi_taylor_coefficients(k, m)
@@ -100,6 +123,13 @@ def _taylor_coefficients(expansion, k, m, prec) :
OUTPUT:
A list of power series in `q`.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_classical_weak import _taylor_coefficients
+ sage: phi = {(0,0): 40, (0,1): 0, (1,0): 5040, (1,1): 2240}
+ sage: _taylor_coefficients(phi, 4, 1, 2)
+ [1 + 240*q + O(q^2), q + O(q^2)]
"""
R = PowerSeriesRing(ZZ, 'q'); q = R.gen(0)
@@ -138,27 +168,52 @@ def _predicted_taylor_coefficients(fs, prec) :
OUPUT:
- A list of power series.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_classical_weak import _predicted_taylor_coefficients
+ sage: e4 = EisensteinForms(1,4).0.qexp
+ sage: _predicted_taylor_coefficients([e4,lambda prec: e4(prec)-e4(prec)], 2)
+ [1 + 240*q + O(q^2), q + O(q^2)]
"""
R = PowerSeriesRing(ZZ, 'q'); q = R.gen(0)
diff = lambda f: f.derivative().shift(1)
normalize = lambda f: f / gcd(f.list()) if f != 0 else f
- diffnorm = lambda f,l: normalize(reduce(lambda a, g: g(a), l*[diff], f))
taylor_coefficients = list()
allf = R(0)
for f in fs :
- allf = f(prec) + diffnorm(allf, 1)
+ allf = f(prec) + normalize(diff(allf))
taylor_coefficients.append(allf)
return taylor_coefficients
def _test_classical_weak_jacobi_forms__taylor_coefficient_modularity(nu_bound, k, m, prec):
+ r"""
+ Test that the corrected taylor coefficients of classical weak
+ Jacobi forms are modular.
+
+ INPUT:
+
+ - ``nu_bound`` -- An integer.
+
+ - `k` -- An integer.
+
+ - `m` -- An integer.
+
+ - ``prec`` -- An integer.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_classical_weak import _test_classical_weak_jacobi_forms__taylor_coefficient_modularity
+ sage: _test_classical_weak_jacobi_forms__taylor_coefficient_modularity(2,4,1,2)
+ """
assert k % 2 == 0
phis = classical_weak_jacobi_forms(k, m, prec)
- fss = [[_corrected_taylor_expansions(nu, phi, k, m, prec) for phi in phis]
+ fss = [[_corrected_taylor_coefficient(nu, phi, k, m, prec) for phi in phis]
for nu in range(0,nu_bound,2)]
fss_vec = [ [vector(f.padded_list(prec)) for f in fs] for fs in fss ]
@@ -169,8 +224,7 @@ def _test_classical_weak_jacobi_forms__taylor_coefficient_modularity(nu_bound, k
for (fs_vec, mf_span) in zip(fss_vec, mf_spans)
for f_vec in fs_vec)
-
-def _corrected_taylor_expansions(nu, phi, k, m, prec):
+def _corrected_taylor_coefficient(nu, phi, k, m, prec):
r"""
Return the ``2 nu``-th corrected Taylor coefficient.
@@ -193,6 +247,13 @@ def _corrected_taylor_expansions(nu, phi, k, m, prec):
..TODO:
Implement this for odd Taylor coefficients.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_classical_weak import _corrected_taylor_coefficient
+ sage: phi = {(0,0): 40, (0,1): 0, (1,0): 5040, (1,1): 2240}
+ sage: _corrected_taylor_coefficient(2,phi,4,1,2)
+ 0
"""
assert nu % 2 == 0
@@ -223,6 +284,11 @@ def _test_classical_weak_jacobi_forms__multiplication(k, m, k_mod, prec):
- `k_mod` -- An integer.
- ``prec`` -- An integer.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_classical_weak import _test_classical_weak_jacobi_forms__multiplication
+ sage: _test_classical_weak_jacobi_forms__multiplication(4,1,4,2)
"""
P = PolynomialRing(LaurentPolynomialRing(QQ, 'zeta'), 'q')
q = P.gen(0)
@@ -250,6 +316,24 @@ def _test_classical_weak_jacobi_forms__multiplication(k, m, k_mod, prec):
assert phi2_vec in psi_span
def _test_classical_weak_jacobi_forms__torsion_point(torsion_point, k, m, prec):
+ r"""
+ Check that weak Jacobi forms evaluated at torsion points are modular.
+
+ INPUT:
+
+ - ``torsion_point`` - A rational.
+
+ - `k` -- An integer.
+
+ - `m -- A positive integer.
+
+ - ``prec`` -- An integer.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_classical_weak import _test_classical_weak_jacobi_forms__torsion_point
+ sage: _test_classical_weak_jacobi_forms__torsion_point(0,4,1,2)
+ """
jforms = classical_weak_jacobi_forms(k, m, prec)
fs = [_eval_at_torsion_point(torsion_point, phi, k, m, prec) for phi in jforms]
fs_vec = [vector(f.padded_list(prec)) for f in fs]
@@ -280,6 +364,13 @@ def _eval_at_torsion_point(torsion_point, phi, k, m, prec) :
OUPUT:
- A power series.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_classical_weak import _eval_at_torsion_point
+ sage: phi = {(0,0): 40, (0,1): 0, (1,0): 5040, (1,1): 2240}
+ sage: _eval_at_torsion_point(0,phi,4,1,2)
+ 40 + 9600*q
"""
from sage.rings.all import CyclotomicField
diff --git a/src/sage/modular/jacobi/test_higherrank.py b/src/sage/modular/jacobi/test_higherrank.py
index b078d28..89b29f8 100644
--- a/src/sage/modular/jacobi/test_higherrank.py
+++ b/src/sage/modular/jacobi/test_higherrank.py
@@ -49,6 +49,15 @@ from sage.modular.jacobi.higherrank import (
def _test_set__jacobi_m():
+ r"""
+ A set of quadratic forms used in subsequent tests.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank import _test_set__jacobi_m
+ sage: _test_set__jacobi_m()
+ [Quadratic form...]
+ """
return [QuadraticForm(matrix([[2]])),
QuadraticForm(matrix([[8]])),
QuadraticForm(matrix(2, [2, 0, 0, 2])),
@@ -57,7 +66,21 @@ def _test_set__jacobi_m():
def test_higherrank_jacobi_reduce_fe_index():
- for m in _test_set__jacobi_m():
+ r"""
+ Test reduction of Fourier expansion indices in the case of higher
+ rank Jacobi indices. See individual tests for more details.
+
+ .. NOTE:
+
+ This is a test generator to be used by nosetest.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank import test_higherrank_jacobi_reduce_fe_index
+ sage: test_higherrank_jacobi_reduce_fe_index()
+ <generator object ...>
+ """
+ for m in _test_set__jacobi_m():
r_classes = higherrank_jacobi_r_classes(m)[0]
m_span = m.matrix().row_module()
m_adj = QuadraticForm(2 * m.matrix().adjoint())
@@ -71,6 +94,27 @@ def test_higherrank_jacobi_reduce_fe_index():
(n, r), m, r_classes, m_adj, m_span)
def _test_higherrank_jacobi_reduce_fe_index((n, r), m, r_classes, m_adj, m_span):
+ r"""
+ Test invariants of the of the reduction of Fourier expansion
+ indices.
+
+ INPUT:
+
+ - `(n,r)` -- A pair of an integer `n` and a tuple `r` of integers.
+
+ - `m` -- A quadratic form.
+
+ - ``r_classes`` -- See meth:`sage.modular.jacobi.higherrank.higherrank_jacobi_r_classes`.
+
+ - ``m_adj`` -- A quadratic form.
+
+ - ``m_span`` -- A module over the integers.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank import _test_higherrank_jacobi_reduce_fe_index
+ sage: _test_higherrank_jacobi_reduce_fe_index((1,(0,)), QuadraticForm(ZZ,1,[1]), [[(0,)], [(1,), (-1,)]], QuadraticForm(ZZ,1,[1]), span([vector([2])]))
+ """
from sage.modular.jacobi.higherrank import higherrank_jacobi_reduce_fe_index
((nred, rred), s) = higherrank_jacobi_reduce_fe_index((n, r), m, r_classes, m_adj, m_span)
@@ -85,6 +129,21 @@ def _test_higherrank_jacobi_reduce_fe_index((n, r), m, r_classes, m_adj, m_span)
assert 2*m.det()*n - m_adj(r) == 2*m.det()*nred - m_adj(rred)
def test__higherrank_jacobi_reduce_fe_index__r():
+ r"""
+ Test reduction of the second component of Fourier expansion
+ indices in the case of higher rank Jacobi indices. See individual
+ tests for more details.
+
+ .. NOTE:
+
+ This is a test generator to be used by nosetest.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank import test__higherrank_jacobi_reduce_fe_index__r
+ sage: test__higherrank_jacobi_reduce_fe_index__r()
+ <generator object ...>
+ """
for m in _test_set__jacobi_m():
r_classes = higherrank_jacobi_r_classes(m)[0]
m_span = m.matrix().row_module()
@@ -95,6 +154,23 @@ def test__higherrank_jacobi_reduce_fe_index__r():
r, r_classes, m_span)
def _test__higherrank_jacobi_reduce_fe_index__r(r, r_classes, m_span):
+ r"""
+ Test invariants of the of the reduction of Fourier expansion
+ indices.
+
+ INPUT:
+
+ - `r` -- A tuple `r` of integers.
+
+ - ``r_classes`` -- See meth:`sage.modular.jacobi.higherrank.higherrank_jacobi_r_classes`.
+
+ - ``m_span`` -- A module over the integers.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank import _test__higherrank_jacobi_reduce_fe_index__r
+ sage: _test__higherrank_jacobi_reduce_fe_index__r((0,), [[(0,)], [(1,), (-1,)]], span([vector([2])]))
+ """
from sage.modular.jacobi.higherrank import _higherrank_jacobi_reduce_fe_index__r
(rred, s) = _higherrank_jacobi_reduce_fe_index__r(r, r_classes, m_span)
@@ -107,11 +183,40 @@ def _test__higherrank_jacobi_reduce_fe_index__r(r, r_classes, m_span):
for r_class in r_classes)
def test_higherrank_jacobi_r_classes():
+ r"""
+ Test computation of equivalence classes of second components of
+ Fourier expansion indices in the case of higher rank Jacobi
+ indices. See individual tests for more details.
+
+ .. NOTE:
+
+ This is a test generator to be used by nosetest.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank import test_higherrank_jacobi_r_classes
+ sage: test_higherrank_jacobi_r_classes()
+ <generator object ...>
+ """
for m in _test_set__jacobi_m():
yield (_test_higherrank_jacobi_r_classes,
m)
def _test_higherrank_jacobi_r_classes(m):
+ r"""
+ Test computation of equivalence classes of second components of
+ Fourier expansion indices in the case of higher rank Jacobi
+ indices.
+
+ INPUT:
+
+ - `m` -- A quadratic form.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank import _test_higherrank_jacobi_r_classes
+ sage: _test_higherrank_jacobi_r_classes(QuadraticForm(ZZ,1,[1]))
+ """
from sage.modular.jacobi.higherrank import higherrank_jacobi_r_classes
(r_classes, r_classes_reduction_signs) = higherrank_jacobi_r_classes(m)
@@ -152,11 +257,38 @@ def _test_higherrank_jacobi_r_classes(m):
)
def test__complete_set_of_restriction_vectors():
+ r"""
+ Test restriction vectors in the case of higher
+ rank Jacobi indices. See individual tests for more details.
+
+ .. NOTE:
+
+ This is a test generator to be used by nosetest.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank import test__complete_set_of_restriction_vectors
+ sage: test__complete_set_of_restriction_vectors()
+ <generator object ...>
+ """
for m in _test_set__jacobi_m():
yield (_test__complete_set_of_restriction_vectors,
m)
def _test__complete_set_of_restriction_vectors(m):
+ r"""
+ Test restriction vectors in the case of higher
+ rank Jacobi indices.
+
+ INPUT:
+
+ - `m` -- A quadratic form.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank import _test__complete_set_of_restriction_vectors
+ sage: _test__complete_set_of_restriction_vectors(QuadraticForm(ZZ,1,[1]))
+ """
m_span = m.matrix().row_module()
(r_classes, r_classes_reduction_signs) = higherrank_jacobi_r_classes(m)
rst_vectors = _complete_set_of_restriction_vectors(m, r_classes, r_classes_reduction_signs, m_span)
@@ -206,6 +338,20 @@ def _test__complete_set_of_restriction_vectors(m):
assert rst_matrix_odd.rank() == len(r_classes) - pm_fixed_point_size
def test_higherrank_jacobi_forms():
+ r"""
+ Test Jacobi forms with higher rank indices. See individual tests
+ for more details.
+
+ .. NOTE:
+
+ This is a test generator to be used by nosetest.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank import test_higherrank_jacobi_forms
+ sage: test_higherrank_jacobi_forms()
+ <generator object ...>
+ """
for m in _test_set__jacobi_m():
for k in [8, 11, 19, 20]:
prec = 5
@@ -216,6 +362,27 @@ def test_higherrank_jacobi_forms():
k, m, 6, prec, jforms)
def _test_higherrank_jacobi_forms__restriction(k, m, prec, jforms):
+ r"""
+ Test Jacobi forms with higher rank indices by restricting them to
+ scalar Jacobi indices.
+
+ INPUT:
+
+ - `k` -- An integer.
+
+ - `m` -- A qudratic form.
+
+ - ``prec`` -- An integer.
+
+ - ``jforms`` -- A list of dictionaries, representing Jacobi forms.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank import _test_higherrank_jacobi_forms__restriction
+ sage: from sage.modular.jacobi.higherrank import higherrank_jacobi_forms
+ sage: jforms = higherrank_jacobi_forms(4,QuadraticForm(ZZ,1,[1]),3)
+ sage: _test_higherrank_jacobi_forms__restriction(4,QuadraticForm(ZZ,1,[1]),3,jforms)
+ """
r_classes = higherrank_jacobi_r_classes(m)[0]
m_adj = QuadraticForm(2 * m.matrix().adjoint())
m_span = m.matrix().row_module()
@@ -248,12 +415,35 @@ def _test_higherrank_jacobi_forms__restriction(k, m, prec, jforms):
## there is a non trivial restriction for each phi
assert all(nmb != 0 for nmb in nmb_nonzero_rsts)
-def _restrict_jacobi_form(k, phi, s, indices_red, indices_rest):
+def _restrict_jacobi_form(k, phi, s, indices_red, indices_rst):
+ """
+ Restrict a Jacobi forms along `s`.
+
+ INPUT:
+
+ - `k` -- An integer.
+
+ - ``phi`` -- A dictionary, representing the Fourier expansion of a
+ Jacobi form.
+
+ - `s` -- A tuple of integers.
+
+ - ``indices_red`` -- Reductions of Fourier indices of ``phi``.
+
+ - ``indices_rst`` -- A list of Fourier indices of the restriction.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank import _test_higherrank_jacobi_forms__restriction
+ sage: from sage.modular.jacobi.higherrank import higherrank_jacobi_forms
+ sage: jforms = higherrank_jacobi_forms(4,QuadraticForm(ZZ,1,[1]),3)
+ sage: _test_higherrank_jacobi_forms__restriction(4,QuadraticForm(ZZ,1,[1]),3,jforms) ## indirect test
+ """
phi_rst = dict()
for ((n,r), (nrred, sign)) in indices_red:
r_rst = s.dot_product(vector(r))
- if (n, r_rst) in indices_rest:
+ if (n, r_rst) in indices_rst:
try:
phi_rst[(n, r_rst)] += sign**k * phi[nrred]
except KeyError:
@@ -262,6 +452,29 @@ def _restrict_jacobi_form(k, phi, s, indices_red, indices_rest):
return phi_rst
def _test_higherrank_jacobi_forms__multiplication(k, m, k_mod, prec, jforms):
+ r"""
+ Test Jacobi forms with higher rank indices by taking products with
+ modular forms.
+
+ INPUT:
+
+ - `k` -- An integer.
+
+ - `m` -- A qudratic form.
+
+ - ``k_mod`` -- An integer.
+
+ - ``prec`` -- An integer.
+
+ - ``jforms`` -- A list of dictionaries, representing Jacobi forms.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank import _test_higherrank_jacobi_forms__multiplication
+ sage: from sage.modular.jacobi.higherrank import higherrank_jacobi_forms
+ sage: jforms = higherrank_jacobi_forms(4,QuadraticForm(ZZ,1,[1]),3)
+ sage: _test_higherrank_jacobi_forms__multiplication(4,QuadraticForm(ZZ,1,[1]),4,3,jforms)
+ """
l = m.dim()
(r_classes, _) = higherrank_jacobi_r_classes(m)
m_adj = QuadraticForm(2 * m.matrix().adjoint())
diff --git a/src/sage/modular/jacobi/test_higherrank_dimension.py b/src/sage/modular/jacobi/test_higherrank_dimension.py
index 4a6857b..fb9b493 100644
--- a/src/sage/modular/jacobi/test_higherrank_dimension.py
+++ b/src/sage/modular/jacobi/test_higherrank_dimension.py
@@ -32,16 +32,51 @@ from sage.all import (prod, zero_vector, matrix,
import operator
def _test_set__quadratic_forms():
+ r"""
+ A set of quadratic forms used in subsequent tests.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank_dimension import _test_set__quadratic_forms
+ sage: _test_set__quadratic_forms()
+ [Quadratic form...]
+ """
return [QuadraticForm(matrix([[14]])),
QuadraticForm(-matrix(2, [2, 1, 1, 2])),
QuadraticForm(-matrix(2, [2, 0, 0, 2])),
QuadraticForm(-matrix(2, [2, 0, 0, 4])),
QuadraticForm(matrix(3, [2,1,1, 1,2,1, 1,1,2]))]
-def test__discrimant_form():
+
+def test__discriminant_form():
+ r"""
+ Test discriminant forms. See individual tests for more details.
+
+ .. NOTE:
+
+ This is a test generator to be used by nosetest.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank_dimension import test__discriminant_form
+ sage: test__discriminant_form()
+ <generator object ...>
+ """
for L in _test_set__quadratic_forms():
yield (_test__discriminant_form, L)
def _test__discriminant_form(L):
+ r"""
+ Test discriminant forms. See individual tests for more details.
+
+ INPUT:
+
+ - `L` -- A quadratic form.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank_dimension import _test__discriminant_form
+ sage: _test__discriminant_form(QuadraticForm(ZZ,1,[1]))
+ """
from sage.modular.jacobi.higherrank_dimension import _discriminant_form
(eds, quad, bil) = _discriminant_form(L)
@@ -63,7 +98,6 @@ def _test__discriminant_form(L):
w = l*[0]
for b in range(eds[ix]):
w[ix] = b
- print w
if bil(*(v+w)) not in ZZ: break
else:
raise AssertionError()
@@ -77,10 +111,31 @@ def _test__discriminant_form(L):
assert bil(*(v+w)) in ZZ
def test__discriminant_form_pmone():
+ r"""
+ Test meth:`discriminant_form_pmone`. See individual tests for more details.
+
+ .. NOTE:
+
+ This is a test generator to be used by nosetest.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank_dimension import test__discriminant_form_pmone
+ sage: test__discriminant_form_pmone()
+ <generator object ...>
+ """
for L in _test_set__quadratic_forms():
yield (_test__discriminant_form_pmone, L)
def _test__discriminant_form_pmone(L):
+ r"""
+ Test meth:`discriminant_form_pmone`.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank_dimension import _test__discriminant_form_pmone
+ sage: _test__discriminant_form_pmone(QuadraticForm(ZZ,1,[1]))
+ """
from sage.modular.jacobi.higherrank_dimension import (_discriminant_form,
_discriminant_form_pmone)
@@ -97,10 +152,31 @@ def _test__discriminant_form_pmone(L):
if y != x)
def test__weil_representation():
+ r"""
+ Test Weil representation. See individual tests for more details.
+
+ .. NOTE:
+
+ This is a test generator to be used by nosetest.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank_dimension import test__weil_representation
+ sage: test__weil_representation()
+ <generator object ...>
+ """
for L in _test_set__quadratic_forms():
yield (_test__weil_representation, L)
def _test__weil_representation(L):
+ r"""
+ Test Weil representation.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_higherrank_dimension import _test__weil_representation
+ sage: _test__weil_representation(QuadraticForm(ZZ,1,[1]))
+ """
from sage.modular.jacobi.higherrank_dimension import (_discriminant_form,
_discriminant_form_pmone,
_weil_representation)
diff --git a/src/sage/modular/jacobi/test_vector_valued.py b/src/sage/modular/jacobi/test_vector_valued.py
index b4ae4cb..14ce088 100644
--- a/src/sage/modular/jacobi/test_vector_valued.py
+++ b/src/sage/modular/jacobi/test_vector_valued.py
@@ -43,18 +43,50 @@ from sage.modular.jacobi.vector_valued import (
)
def _test_set__quadratic_forms():
+ r"""
+ A set of quadratic forms used in subsequent tests.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_vector_valued import _test_set__quadratic_forms
+ sage: _test_set__quadratic_forms()
+ [Quadratic form...]
+ """
return [QuadraticForm(matrix([[6]])),
QuadraticForm(diagonal_matrix([2,4])),
QuadraticForm(matrix(3, [2,1,1, 1,2,1, 1,1,2]))]
def _test_set__indefinite_quadratic_forms():
+ r"""
+ A set of indefinite quadratic forms used in subsequent tests.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_vector_valued import _test_set__indefinite_quadratic_forms
+ sage: _test_set__indefinite_quadratic_forms()
+ [Quadratic form...]
+ """
return [QuadraticForm(matrix([[-2]])),
QuadraticForm(matrix(2, [-2,-1,-1,-2])),
QuadraticForm(matrix(2, [-2,0,0,-4])),
QuadraticForm(matrix(3, [-2,-1,-1, -1,-2,-1, -1,-1,-2])
.block_sum(matrix(2, [2,0,0,-4])))]
-def test_vector_valued():
+def test_vector_valued_modular_forms():
+ r"""
+ Test vector valued modular forms. See individual tests
+ for more details.
+
+ .. NOTE:
+
+ This is a test generator to be used by nosetest.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_vector_valued import test_vector_valued_modular_forms
+ sage: test_vector_valued_modular_forms()
+ <generator object ...>
+ """
prec = 5
for L in _test_set__quadratic_forms():
@@ -62,10 +94,33 @@ def test_vector_valued():
vforms = vector_valued_modular_forms(k, L, prec)
assert len(vforms) != 0
- yield (_test_vector_valued__multiplication,
- prec, k, L, 4, vforms)
+ yield (_test_vector_valued_modular_forms__multiplication,
+ k, L, 4, prec, vforms)
+
+def _test_vector_valued_modular_forms__multiplication(k, L, k_mod, prec, vforms):
+ r"""
+ Test vector valued modular forms by taking products with classical
+ modular forms.
+
+ INPUT:
+
+ - `k` -- An integer.
+
+ - `m` -- A qudratic form.
-def _test_vector_valued__multiplication(prec, k, L, k_mod, vforms):
+ - ``k_mod`` -- An integer.
+
+ - ``prec`` -- An integer.
+
+ - ``vforms`` -- A list of dictionaries, representing vector valued modular forms.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_vector_valued import _test_vector_valued_modular_forms__multiplication
+ sage: from sage.modular.jacobi.vector_valued import vector_valued_modular_forms
+ sage: vforms = vector_valued_modular_forms(7/2,QuadraticForm(ZZ,1,[1]),2)
+ sage: _test_vector_valued_modular_forms__multiplication(7/2,QuadraticForm(ZZ,1,[1]),4,2,vforms)
+ """
L_span = L.matrix().row_module()
img_forms = vector_valued_modular_forms(k + k_mod, L, prec)
@@ -73,6 +128,20 @@ def _test_vector_valued__multiplication(prec, k, L, k_mod, vforms):
_multipliy_and_check(prec, f.qexp(prec).dict(), vforms, 0, img_forms, L_span)
def test_vector_valued_modular_forms_weakly_holomorphic():
+ r"""
+ Test weakly holomorphic vector valued modular forms. See
+ individual tests for more details.
+
+ .. NOTE:
+
+ This is a test generator to be used by nosetest.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_vector_valued import test_vector_valued_modular_forms_weakly_holomorphic
+ sage: test_vector_valued_modular_forms_weakly_holomorphic()
+ <generator object ...>
+ """
prec = 5
k_mod = 4
@@ -87,9 +156,23 @@ def test_vector_valued_modular_forms_weakly_holomorphic():
yield (_test_vector_valued_modular_forms_weakly_holomorphic__order,
order, vforms)
yield (_test_vector_valued_modular_forms_weakly_holomorphic__multiplication,
- prec, k, L, order, vforms)
+ k, L, order, prec, vforms)
def test_vector_valued_modular_forms_weakly_holomorphic_with_principal_part():
+ r"""
+ Test weakly holomorphic vector valued modular forms with given
+ principal part. See individual tests for more details.
+
+ .. NOTE:
+
+ This is a test generator to be used by nosetest.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_vector_valued import test_vector_valued_modular_forms_weakly_holomorphic_with_principal_part
+ sage: test_vector_valued_modular_forms_weakly_holomorphic_with_principal_part()
+ <generator object ...>
+ """
prec = 5
for (k, L, pp) in [(11/ZZ(2), QuadraticForm(matrix([[4]])), {(0,): {-1: 2}}),
(5, QuadraticForm(matrix(2, [2,1,1,2])), {(0,1): {-1/ZZ(3): 1}, (0,2): {-1/ZZ(3): -1}})]:
@@ -101,9 +184,25 @@ def test_vector_valued_modular_forms_weakly_holomorphic_with_principal_part():
yield (_test_vector_valued_modular_forms_weakly_holomorphic__order,
1, [wvvform])
yield (_test_vector_valued_modular_forms_weakly_holomorphic__multiplication,
- prec, k, L, 1, [wvvform])
+ k, L, 1, prec, [wvvform])
def _test_vector_valued_modular_forms_weakly_holomorphic__principal_part(wvvform, pp, L):
+ r"""
+ Test weakly holomorphic vector valued modular forms with given
+ principal part.
+
+ INPUT:
+
+ - ``wvvform`` -- A dictionary representing a weakly holomorphic modular forms.
+
+ - ``pp`` -- A dictionary representing a principal part.
+
+ - `L` -- A quadratic form.
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_vector_valued import _test_vector_valued_modular_forms_weakly_holomorphic__principal_part
+ sage: _test_vector_valued_modular_forms_weakly_holomorphic__principal_part({(0,) : {-1: 1}}, {(0,) : {-1: 1}}, QuadraticForm(ZZ,1,[1]))
+ """
from sage.combinat.dict_addition import dict_addition
pp_computed = {}
@@ -130,11 +229,47 @@ def _test_vector_valued_modular_forms_weakly_holomorphic__principal_part(wvvform
assert pp_contribution == pp_computed_contribution
def _test_vector_valued_modular_forms_weakly_holomorphic__order(order, vforms):
+ r"""
+ Test the order at infinity of weakly holomorphic vector valued modular forms.
+
+ INPUT:
+
+ - ``order`` -- An integer.
+
+ - ``vforms`` -- A dictionary representing a weakly holomorphic modular forms.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_vector_valued import _test_vector_valued_modular_forms_weakly_holomorphic__order
+ sage: _test_vector_valued_modular_forms_weakly_holomorphic__order(1, [{(0,) : {1: 1}}])
+ """
for f in vforms:
for (mu,fe) in f.items():
assert all(n >= -order for n in fe.keys())
-def _test_vector_valued_modular_forms_weakly_holomorphic__multiplication(prec, k, L, order, vforms):
+def _test_vector_valued_modular_forms_weakly_holomorphic__multiplication(k, L, order, prec, vforms):
+ r"""
+ Test weakly holomorphic vector valued modular forms by multiplying
+ them with a power of the discriminant modular form.
+
+ INPUT:
+
+ - `k` -- An integer.
+
+ - `L` -- A quadratic form.
+
+ - ``order`` -- An integer.
+
+ - ``vforms`` -- A dictionary representing a weakly holomorphic modular forms.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_vector_valued import _test_vector_valued_modular_forms_weakly_holomorphic__multiplication
+sage: from sage.modular.jacobi.vector_valued import vector_valued_modular_forms
+ sage: vforms = vector_valued_modular_forms(7/2,QuadraticForm(ZZ,1,[1]),2)
+ sage: _test_vector_valued_modular_forms_weakly_holomorphic__multiplication(7/2, QuadraticForm(ZZ,1,[1]), 1, 2, vforms)
+ """
+
L_span = L.matrix().row_module()
img_forms = vector_valued_modular_forms(k + 12*order, L, prec + order)
@@ -142,6 +277,29 @@ def _test_vector_valued_modular_forms_weakly_holomorphic__multiplication(prec, k
_multipliy_and_check(prec, f, vforms, -order, img_forms, L_span)
def _multipliy_and_check(prec, f_factor, vforms, valuation, img_forms, L_span):
+ r"""
+ Multiply vector valued modular forms with a modular form and check
+ the image.
+
+ INPUT:
+
+ - ``prec`` -- An integer.
+
+ - ``f_factor`` -- A dictionary representing a modular form.
+
+ - ``vforms`` -- A list of dictionaries, representing vector valued modular forms.
+
+ - ``img_forms`` -- A list of dictionaries, representing vector valued modular forms.
+
+ - ``L_span`` -- A module over the integers.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_vector_valued import _test_vector_valued_modular_forms__multiplication
+ sage: from sage.modular.jacobi.vector_valued import vector_valued_modular_forms
+ sage: vforms = vector_valued_modular_forms(7/2,QuadraticForm(ZZ,1,[1]),2)
+ sage: _test_vector_valued_modular_forms__multiplication(7/2,QuadraticForm(ZZ,1,[1]),4,2,vforms) # indirect test
+ """
## NOTE: we assume that img_forms consists of expansions that are
## regular at infinity
assert valuation <= 0 and valuation in ZZ
@@ -162,18 +320,70 @@ def _multipliy_and_check(prec, f_factor, vforms, valuation, img_forms, L_span):
assert fg_vec in img_span
def _mul_simple_vvform(f, g, L_span):
+ r"""
+ Multiply a vector valued modular form `g` by a classical one `f`.
+
+ INPUT:
+
+ - `f` -- A dictionary representing a classical modular form.
+
+ - `g` -- A dictionary representing a vector valued modular form.
+
+ - ``L_span`` -- A module over the integers.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_vector_valued import _mul_simple_vvform
+ sage: _mul_simple_vvform({1: 2}, {(0,): {0: 1}}, span([vector([2])]))
+ {(0,): {1: 2}}
+ """
res = {}
for (s,c) in f.items():
res = _add_vvforms(res, _mul_scalar_vvform(c,_shift_vvform(g, s)), L_span)
return res
def _shift_vvform(f, s):
+ r"""
+ Shift the exponents of a vector valued modular form.
+
+ INPUT:
+
+ - `f` -- A dictionary representing a classical modular form.
+
+ - `s` -- An integer.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_vector_valued import _shift_vvform
+ sage: _shift_vvform({(0,): {0: 1}}, 1)
+ {(0,): {1: 1}}
+ """
res = {}
for (mu, fe) in f.items():
res[mu] = dict((n+s,c) for (n,c) in fe.items())
return res
def _vvform_to_vector(mu_list, valuation, prec, f):
+ r"""
+ Convert a vector valued modular form into a vector of rationals.
+
+ INPUT:
+
+ - ``mu_list`` -- A list of elements of a finite generate abelian group.
+
+ - ``valuation`` -- An integer.
+
+ - ``prec`` -- An integer.
+
+ - `g` -- A dictionary representing a vector valued modular form.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_vector_valued import _vvform_to_vector
+ sage: mu_module = ZZ**1 / span([vector([2])])
+ sage: _vvform_to_vector(list(mu_module), 0, 1, {(0,): {0: 1}, (1,): {1/4: 3}})
+ (1, 0)
+ """
mu_module = mu_list[0].parent()
cmp_len = prec - valuation
@@ -195,11 +405,37 @@ def _vvform_to_vector(mu_list, valuation, prec, f):
return res
def test_stably_equivalent_positive_definite_quadratic_form():
+ r"""
+ Test implementation to find positive definite quadratic forms.
+ See individual tests for more details.
+
+ .. NOTE:
+
+ This is a test generator to be used by nosetest.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_vector_valued import test_stably_equivalent_positive_definite_quadratic_form
+ sage: test_stably_equivalent_positive_definite_quadratic_form()
+ <generator object ...>
+ """
for L in _test_set__indefinite_quadratic_forms():
yield (_test_stably_equivalent_positive_definite_quadratic_form,
L)
def _test_stably_equivalent_positive_definite_quadratic_form(L):
+ r"""
+ Test implementation to find positive definite quadratic forms.
+
+ INPUT:
+
+ - `L` -- A quadratic form.
+
+ TESTS::
+
+ sage: from sage.modular.jacobi.test_vector_valued import _test_stably_equivalent_positive_definite_quadratic_form
+ sage: _test_stably_equivalent_positive_definite_quadratic_form(QuadraticForm(ZZ,1,[1]))
+ """
M = stably_equivalent_positive_definite_quadratic_form(L, True)
assert M.is_positive_definite()
@@ -211