Пример #1
0
def tabulate_erfc(nroots, tbase):
    Tmin = mpmath.mpf(tbase)
    Tmax = Tmin + 1
    Tp = (Tmin + Tmax) / 2

    tabulate_points = get_tabulate_points(tbase, Tp)
    boundary_points = [r / 2 + 0.5 for r in chebrt]

    fac = mpmath.mpf(2) / ngrids

    rs = []
    ws = []
    for x in tabulate_points:
        for low in boundary_points:
            r, w = rys_roots_weights_partial(nroots, x, low)
            rs.append(r)
            ws.append(w)
    rs = np.array(rs).reshape(ngrids, ngrids, nroots)
    ws = np.array(ws).reshape(ngrids, ngrids, nroots)

    # einsum('lkn,il,jk->nji', rs, cs)
    tab_rs = np.array(
        [cs.dot(rs[:, :, ir]).dot(cs.T).T * fac**2 for ir in range(nroots)])
    tab_ws = np.array(
        [cs.dot(ws[:, :, ir]).dot(cs.T).T * fac**2 for ir in range(nroots)])
    return tab_rs, tab_ws
Пример #2
0
def tabulate_erf(nroots, tbase):
    Tmin = mpmath.mpf(tbase)
    Tmax = Tmin + 1
    Tp = (Tmin + Tmax) / 2

    tabulate_points = get_tabulate_points(tbase, Tp)

    fac = mpmath.mpf(2) / ngrids

    rs = []
    ws = []
    for x in tabulate_points:
        r, w = rys_roots_weights_partial(nroots, x)
        rs.append(r)
        ws.append(w)
    rs = np.array(rs)
    ws = np.array(ws)

    # einsum('kn,jk->nj', rs, cs)
    tab_rs = rs.T.dot(cs.T) * fac
    tab_ws = ws.T.dot(cs.T) * fac
    return tab_rs, tab_ws