def test_calcMatrix_S3001(usePyImpl=False): """ Some test case for S = [3,0,1] which failed at some earlier point. """ D = -3 HermWeight = 6 B_cF = 7 S = matrix(ZZ, 2, [3,0,0,1]) l = S.det() if usePyImpl: from helpers import calcRestrictMatrix_py as calcMatrix else: from helpers import calcRestrictMatrix_any as calcMatrix M_S = calcMatrix(D=D, HermWeight=HermWeight, B_cF=B_cF, S=S) M_S = M_S.matrix_over_field() # matrix over rational field precLimit = M_S.nrows() assert precLimit == calcPrecisionDimension(B_cF=B_cF, S=S) # These are the Elliptic modular forms with weight 2*HermWeight to \Gamma_0(l). ell_dim, fe_expansion_matrix_l = getElliptModFormsBasisMatrix(l, 2*HermWeight, precLimit) assert fe_expansion_matrix_l.rank() == ell_dim ell_modform_fe_expansions_l = fe_expansion_matrix_l.row_module() assert ell_modform_fe_expansions_l.dimension() == ell_dim M_S_module = M_S.column_module() restriction_fe_expansions = ell_modform_fe_expansions_l.intersection( M_S_module ) print "intersection:" print restriction_fe_expansions assert restriction_fe_expansions.dimension() > 0
def fast_fail_test_D3_k6(B_cF=5): """ We had some problems with cases where `check_eisenstein_series_D3_weight6()` failed. This test function tries simplify/reduce a test case for the fail. The fail is probably not up-to-date anymore because a few bugs have been already fixed and it probably doesn't work anymore as-is. We leave it like this for now in case we need its code to do a similar test-case later on. """ from checks import check_eisenstein_series_D3_weight6 D = -3 HermWeight = 6 calc = C.Calc() calc.init(D = D, HermWeight = HermWeight, B_cF=B_cF) calc.calcReducedCurlF() while True: calc.curlS_clearMatrices() S = calc.getNextS() if S == matrix(2, 2, [3, 0, 0, 1]): break l = S.det() l = toInt(l) M_S = calcRestrictMatrix(calc) # matrix over integer ring M_S = M_S.matrix_over_field() # matrix over rational field precLimit = M_S.nrows() assert calcPrecisionDimension(B_cF=B_cF, S=S) == precLimit verbose("get elliptic modform space with precision %i ..." % precLimit) ell_dim, fe_expansion_matrix_l = getElliptModFormsBasisMatrix(l, 2*HermWeight, precLimit) assert ell_dim == fe_expansion_matrix_l.rank() ell_modform_fe_expansions_l = fe_expansion_matrix_l.row_module() verbose("dim of elliptic modform space: %i" % ell_modform_fe_expansions_l.dimension()) verbose("calc M_S_module...") M_S_module = M_S.column_module() verbose("dimension of M_S column module: %i" % M_S_module.dimension()) restriction_fe_expansions = ell_modform_fe_expansions_l.intersection( M_S_module ) verbose("dimension of restriction_fe_expansions: %i" % restriction_fe_expansions.dimension()) herm_modform_fe_expannsion_S = M_S.solve_right( restriction_fe_expansions.basis_matrix().transpose() ) herm_modform_fe_expannsion_S_module = herm_modform_fe_expannsion_S.column_module() verbose("dimension of herm column module: %i" % herm_modform_fe_expannsion_S_module.dimension()) verbose("calc M_S_right_kernel...") M_S_right_kernel = M_S.right_kernel() verbose("dimension of M_S right kernel: %i" % M_S_right_kernel.dimension()) herm_modform_fe_expannsion_S_module += M_S_right_kernel try: check_eisenstein_series_D3_weight6( vs=herm_modform_fe_expannsion_S_module, B_cF=B_cF ) except Exception: print "restriction_fe_expansions =", restriction_fe_expansions print "M_S_right_kernel =", M_S_right_kernel print "herm_modform_fe_expannsion_S_module =", herm_modform_fe_expannsion_S_module raise
def test_calcPrecisionDimension(D=-3, HermWeight=6, B_cF=7): """ Test the precision limit calculation. This is \curlF(S) in the text. This has been implemented in both C++ and in Python as `calcPrecisionDimension()`. """ from helpers import calcPrecisionDimension, CurlO space = CurlO(D) import algo_cython as C calc = C.Calc() calc.init(D=D, HermWeight=HermWeight, B_cF=B_cF) calc.calcReducedCurlF() for i in range(1000): calc.curlS_clearMatrices() S = calc.getNextS() M = calc.calcMatrix() S_repr = (S[0,0], space.as_tuple_b(S[0,1]), S[1,1]) assert M.nrows() == calcPrecisionDimension(B_cF=B_cF, S=S), "fail at i = %i, S = %r, M.nrows = %i" % (i, S_repr, M.nrows())
def test_calcMatrix_S2a1(usePyImpl=False, B_cF=7): """ Some test case for S = [2,...,1] which failed at some earlier point. """ D = -3 HermWeight = 6 K = QuadraticField(D) a, b, c = 2, QQ(1)/2*K.gen() + QQ(1)/2, 1 S = matrix(K, 2, [a, b, b.conjugate(), c]) l = S.det() if usePyImpl: from helpers import calcRestrictMatrix_py as calcMatrix else: from helpers import calcRestrictMatrix_any as calcMatrix M_S = calcMatrix(D=D, HermWeight=HermWeight, B_cF=B_cF, S=S) M_S = M_S.matrix_over_field() # matrix over rational field precLimit = M_S.nrows() assert precLimit == calcPrecisionDimension(B_cF=B_cF, S=S) # These are the Elliptic modular forms with weight 2*HermWeight to \Gamma_0(l). ell_dim, fe_expansion_matrix_l = getElliptModFormsBasisMatrix(l, 2*HermWeight, precLimit) assert fe_expansion_matrix_l.rank() == ell_dim ell_modform_fe_expansions_l = fe_expansion_matrix_l.row_module() assert ell_modform_fe_expansions_l.dimension() == ell_dim M_S_module = M_S.column_module() restriction_fe_expansions = ell_modform_fe_expansions_l.intersection( M_S_module ) assert restriction_fe_expansions.dimension() > 0 herm_modform_fe_expannsion_S = M_S.solve_right( restriction_fe_expansions.basis_matrix().transpose() ) herm_modform_fe_expannsion_S_module = herm_modform_fe_expannsion_S.column_module() M_S_right_kernel = M_S.right_kernel() herm_modform_fe_expannsion_S_module += M_S_right_kernel import checks checks.check_eisenstein_series_D3_weight6( vs=herm_modform_fe_expannsion_S_module, B_cF=B_cF )