Esempio n. 1
0
def choose_seq_points(e, f, nneg, npos):
    # Pick first nneg+npos points

    if (nneg + npos) % 2 != 0:
        print('Number of chosen points should be even!', nneg, npos,
              nneg + npos)
        npos += 1
    q = nneg + npos
    # ee = np.zeros(q, dtype=mp.mpc)
    # ff = np.zeros((q, f.shape[1]), dtype=mp.mpc)
    ee = fp.zeros(q, 1)
    ff = fp.zeros(q, f.cols)
    for i in range(0, nneg):
        ee[i] = mp.conj(e[nneg - 1 - i])
        ff[i] = mp.conj(f[nneg - 1 - i])
    for i in range(nneg, nneg + npos):
        ee[i] = e[i - nneg]
        ff[i] = f[i - nneg]
    return ee, ff
Esempio n. 2
0
def choose_prandom_points(e, f, nneg, npos):
    # Subroutine selects from input nneg+npos points
    # first nneg+npos-nrnd points are selected sequently,
    # then nrnd points are picked randomly
    # Number of randomly selected points nrnd is determined randomly in interval (4, 18)
    # e -- input complex array with energy points
    # f -- input complex array with values of function in points e[i]

    nrnd = random.randrange(4, 18, 2)

    if (nneg + npos) % 2 != 0:
        print('Number of chosen points should be even!', nneg, npos,
              nneg + npos)
        npos += 1
    q = nneg + npos
    r = len(e)
    ee = fp.zeros(q, 1)
    ff = fp.zeros(q, f.cols)
    for i in range(0, nneg):
        ee[i] = mp.conj(e[nneg - 1 - i])
        ff[i] = mp.conj(f[nneg - 1 - i])
    for i in range(nneg, q - nrnd):
        ee[i] = e[i - nneg]
        ff[i] = f[i - nneg]

    # Make list of random points
    pp = random.sample(range(q - nrnd, r - 1), nrnd)
    # Sort them
    pp.sort()
    # Fix repeated points (if there are)
    for i in range(0, nrnd - 1):
        if pp[i] == pp[i + 1]:
            pp[i + 1] += 1
    # The last two points should be sequential to fix diff at the tail of F(z).
    pp[nrnd - 1] = pp[nrnd - 2] + 1

    # Construct
    for i in range(0, nrnd):
        ee[q - nrnd + i] = e[pp[i]]
        ff[q - nrnd + i] = f[pp[i]]

    return ee, ff
Esempio n. 3
0
def test_eighe_randmatrix():
    N = 5

    for a in xrange(10):
        A = (2 * mp.randmatrix(N, N) - 1) + 1j * (2 * mp.randmatrix(N, N) - 1)

        for i in xrange(0, N):
            A[i, i] = mp.re(A[i, i])
            for j in xrange(i + 1, N):
                A[j, i] = mp.conj(A[i, j])

        run_eighe(A)
Esempio n. 4
0
def test_eighe_randmatrix():
    N = 5

    for a in xrange(10):
        A = (2 * mp.randmatrix(N, N) - 1) + 1j * (2 * mp.randmatrix(N, N) - 1)

        for i in xrange(0, N):
            A[i,i] = mp.re(A[i,i])
            for j in xrange(i + 1, N):
                A[j,i] = mp.conj(A[i,j])

        run_eighe(A)
Esempio n. 5
0
def test_eighe_irandmatrix():
    N = 4
    R = 4

    for a in xrange(10):
        A = irandmatrix(N, R) + 1j * irandmatrix(N, R)

        for i in xrange(0, N):
            A[i, i] = mp.re(A[i, i])
            for j in xrange(i + 1, N):
                A[j, i] = mp.conj(A[i, j])

        run_eighe(A)
Esempio n. 6
0
def test_eighe_irandmatrix():
    N = 4
    R = 4

    for a in xrange(10):
        A=irandmatrix(N, R) + 1j * irandmatrix(N, R)

        for i in xrange(0, N):
            A[i,i] = mp.re(A[i,i])
            for j in xrange(i + 1, N):
                A[j,i] = mp.conj(A[i,j])

        run_eighe(A)
Esempio n. 7
0
def mp_normsqr(cplx):
    return mp.re(mp.conj(cplx) * cplx)
Esempio n. 8
0
def E_pi_minus(lx, ly):
    fle = float(mp.re(mp.sqrt(mp.conj(fl(lx, ly, 0) * fl(lx, ly, 0)))))
    return -1 * t * fle / (1 + s * fle)
Esempio n. 9
0
def createP_sigma(lx, ly, band):
    C = table.C_Sigma(ly / (2 / mp.sqrt(3)), lx / (mp.sqrt(3) / 2), band)
    #Values tabulated on a rectangular grid, flipped and compensated for.

    C = [
        C[0], C[1], C[2], C[3] / (3**(1 / 2)), C[4] / (3**(1 / 2)),
        C[5] / (3**(1 / 2))
    ]
    #For sqrt(3) normalisation, see paper for reference.

    f = lambda kx, ky, kz: C[0] * fi_As(lx, ly, kx, ky, kz) + C[1] * fi_Ax(
        lx, ly, kx, ky, kz) + C[2] * fi_Ay(lx, ly, kx, ky, kz) + C[3] * fi_Bs(
            lx, ly, kx, ky, kz) + C[4] * fi_Bx(lx, ly, kx, ky, kz) + C[
                5] * fi_By(lx, ly, kx, ky, kz)

    nrm = 1 / mp.sqrt(
        mp.conj(C[0]) * C[0] + mp.conj(C[1]) * C[1] + mp.conj(C[2]) * C[2] +
        3 *
        (mp.conj(C[3]) * C[3] + mp.conj(C[4]) * C[4] + mp.conj(C[5]) * C[5]) +
        2 * mp.re((mp.conj(C[0]) * C[3] * pss + mp.conj(C[0]) * C[4] * psx +
                   mp.conj(C[0]) * C[5] * psy + mp.conj(C[1]) * C[3] * psx +
                   mp.conj(C[1]) * C[4] * pxx + mp.conj(C[1]) * C[5] * pxy +
                   mp.conj(C[2]) * C[3] * psy + mp.conj(C[2]) * C[4] * pxy +
                   mp.conj(C[2]) * C[5] * pyy) *
                  (mp.exp(1j * mp.fdot([lx, ly, 0], R_1)) +
                   mp.exp(1j * mp.fdot([lx, ly, 0], R_2)) +
                   mp.exp(1j * mp.fdot([lx, ly, 0], R_3)))))

    return lambda kx, ky, kz: f(kx, ky, kz) * nrm
Esempio n. 10
0
def get_G_from_U(U, chi):
    n = U.rows
    Vinvdagger = mp.eye(n) * mp.one / mp.conj(chi)
    Gdagger = Vinvdagger - U
    return Gdagger.H