Esempio n. 1
0
def diff_opetator_4(f1, f2, f3, f4):
    l = [f1, f2, f3, f4]
    wt_s = [f.wt for f in l]
    prec_res = common_prec(l)
    base_ring = common_base_ring(l)
    m = [[a.wt * a for a in l],
         pmap(lambda a: a.differentiate_wrt_tau(), l),
         pmap(lambda a: a.differentiate_wrt_w(), l),
         pmap(lambda a: a.differentiate_wrt_z(), l)]
    res = det_deg2(m, wt=sum((f.wt for f in l)) + 1)
    res = ModFormQexpLevel1(
        sum(wt_s) + 3, res.fc_dct, prec_res, base_ring=base_ring)
    return res
Esempio n. 2
0
 def divide(self, f, prec, parallel=False):
     if parallel:
         res_forms = pmap(lambda x: x.divide(f, prec), self.forms)
     else:
         res_forms = [a.divide(f, prec) for a in self.forms]
     res_br = common_base_ring(res_forms)
     return SymWtGenElt(res_forms, prec, base_ring=res_br)
Esempio n. 3
0
def _dict_parallel(f, ls):
    if current_num_of_procs.num_of_procs == 1:
        return f(ls[0])

    res = {}
    for d in pmap(f, ls):
        res.update(d)
    return res
Esempio n. 4
0
 def basis_of_subsp_annihilated_by(self, pol, a=2, parallel=False):
     '''
     Returns the basis of the subspace annihilated by pol(T(a)).
     '''
     S = PolynomialRing(QQ, names="x")
     pol = S(pol)
     A = self.hecke_matrix(a)
     B = polynomial_func(pol)(A.transpose())
     if parallel:
         with number_of_procs(1):
             res = pmap(self._to_form, B.kernel().basis())
     else:
         res = [self._to_form(v) for v in B.kernel().basis()]
     return res
Esempio n. 5
0
def x35_with_prec_inner(prec):
    prec = PrecisionDeg2(prec)
    load_cached_gens_from_file(prec)
    k = 35
    key = "x" + str(k)
    f = load_deg2_cached_gens(key, prec, k, cuspidal=True)
    if f:
        return f
    l = pmap(lambda k: eisenstein_series_degree2(k, prec), [4, 6, 10, 12])
    res = diff_opetator_4(*l)
    a = res[(2, -1, 3)]
    res = res * a ** (-1)
    res._is_cuspidal = True
    res._is_gen = key
    Deg2global_gens_dict[key] = res
    return res.change_ring(ZZ)
Esempio n. 6
0
def calc_forms(func, forms, prec, autom=True, wt=None,
               num_of_procs=multiprocessing.cpu_count()):
    '''
    func is a function which takes forms as an argument.
    Calculate func(forms) by interpolation.
    '''
    bd = prec.value if isinstance(prec, PrecisionDeg2) else prec
    parity = wt % 2 if autom else None

    if not autom:
        t_vals = [QQ(a) for a in range(-2 * bd, 0) + range(1, 2 * bd + 2)]
    elif parity == 0:
        t_vals = [QQ(a) for a in range(1, 2 * bd + 2)]
    else:
        t_vals = [QQ(a) for a in range(2, 2 * bd + 2)]

    def _f(r):
        return (r, func([_to_polynomial(f, r) for f in forms]))
    t_dct = dict(pmap(_f, t_vals, num_of_procs=num_of_procs))
    fc_dct = interpolate_deg2(t_dct, bd, autom=autom, parity=parity)
    if not autom:
        return QexpLevel1(fc_dct, bd)
    else:
        return ModFormQexpLevel1(wt, fc_dct, bd)
Esempio n. 7
0
 def test_pmap(self):
     self.assertEqual([x ** 2 for x in range(100)],
                      pmap(lambda x: x ** 2, range(100), num_of_procs=4))