예제 #1
0
    for j in range(d):
        singleSiteSwap[i * d + j, j * d + i] = 1
myO = np.zeros((d**2, d**2), dtype=complex)
for i in range(d):
    for j in range(d):
        myO[i * d + i, j * d + j] = 1


N = 32
A1Start = N // 4
A1End = N // 2
lenA1 = A1End - A1Start
A2Start = A1End
A2End = 3 * N // 4
lenA2 = A2End - A2Start
psi = bops.getStartupState(N, d=d, mode='aklt')
M = 10000 # int(sys.argv[1])
A1Estimations = [[None for i in range(lenA1)] for m in range(M)]
A2Estimations = [[None for i in range(lenA2)] for m in range(M)]

for m in range(M):
    psiCopy = bops.copyState(psi)
    us = [None for i in range(lenA1 + lenA2)]
    for i in range(A1Start, A2End):
        u = rm.haar_measure(d, 's' + str(i))
        us[i - A1Start] = u.tensor
        bops.applySingleSiteOp(psiCopy, u, i)
    meas = rm.randomMeasurement(psiCopy, A1Start, A2End)
    for i in range(lenA1):
        A1Estimations[m][i] = (d + 1) * rotate(getProjector(meas[i], d), dagger(us[i])) - np.eye(d)
    for i in range(lenA2):
예제 #2
0
                             backend=None)


def trUnitary(site):
    return tn.Node(Utr, name=('U' + str(site)),
                             axis_names=['s' + str(site), 's' + str(site) + '*'],
                             backend=None)


N = 32
B = 0
D = 0
A1 = [i for i in range(int(N/4), int(N/2))]
A2 = [i for i in range(int(N/2), int(3 * N/4))]
onsiteTerms, neighborTerms = getHamiltonianMatrices(N, B, D)
psi = bops.getStartupState(N, d=d)
# H = dmrg.getDMRGH(N, onsiteTerms, neighborTerms, d=3)
# HLs, HRs = dmrg.getHLRs(H, psi)
# psi, E0, truncErrs = dmrg.getGroundState(H, HLs, HRs, psi, None)
# print('E0 = ' + str(E0))
for k in [len(psi) - 1 - i for i in range(len(psi) - A2[-1] - 1)]:
    psi = bops.shiftWorkingSite(psi, k, '<<')

# psiDagger = bops.copyState(psi, conj=True)
# i = A1[-1]
# sigma = trUnitary(i)
# temp = bops.copyState([psi[i]])[0]
# temp.tensor = np.conj(temp.tensor)
# T = bops.permute(bops.multiContraction(bops.multiContraction(temp, sigma, [1], [0]), psiDagger[i], [2], [1]), [0, 2, 1, 3])
# origSizes = [T.tensor.shape[0], T.tensor.shape[1]]
# tMatrix = np.round(np.reshape(T.tensor, [origSizes[0] * origSizes[1], origSizes[0] * origSizes[1]]), 14)
예제 #3
0
def fullState(psi):
    curr = psi[0]
    for i in range(1, len(psi)):
        curr = bops.multiContraction(curr, psi[i], [i + 1], [0])
    ten = np.round(curr.tensor, decimals=5)
    return ten


N = 8
T = 1
C = 1/T
J = C
Omega = 1/T
delta = 1
onsiteTermsXXZ, neighborTermsXXZ = getXXZHamiltonianMatrices(0, 1)
psi = bops.getStartupState(N, 'antiferromagnetic')

# HXXZ = dmrg.getDMRGH(N, onsiteTermsXXZ, neighborTermsXXZ)
# HLs, HRs = dmrg.getHLRs(HXXZ, psi0)
# psi, E0, truncErrs = dmrg.getGroundState(HXXZ, HLs, HRs, psi0, None)
# print('E0 = ' + str(E0))
# print('E0 = ' + str(dmrg.stateEnergy(psi, HXXZ)))
# hpsi = dmrg.applyH(psi, HXXZ)
# hpsi[0].tensor /= math.sqrt(abs(bops.getOverlap(hpsi, hpsi)))
# print('<psi|hpsi> = ' + str(bops.getOverlap(psi, hpsi)))
R2 = bops.getRenyiEntropy(psi, 2, int(len(psi) / 2 - 1))

NU = 200
etas = [1, 2, 3, N, int(N * 1.5), N * 2, int(N * 2.5), N * 3]
results = [None] * len(etas)
dt = J * 1e-2
예제 #4
0
                bops.multiContraction(psi[i], projector1, [1], [0]), [0, 2, 1])


def fullState(psi):
    curr = psi[0]
    for i in range(1, len(psi)):
        curr = bops.multiContraction(curr, psi[i], [i + 1], [0])
    ten = np.round(curr.tensor, decimals=5)
    return ten


for NA in [4 * i for i in range(1, 7)]:
    NB = NA
    N = NA + NB
    onsiteTermsXX, neighborTermsXX = getXXHamiltonianMatrices(1, 0)
    psi = bops.getStartupState(N)
    HXX = dmrg.getDMRGH(N, onsiteTermsXX, neighborTermsXX)
    HLs, HRs = dmrg.getHLRs(HXX, psi)
    psiXX, E0, truncErrs = dmrg.getGroundState(HXX, HLs, HRs, psi, None)
    with open('results/psiXX_NA_' + str(NA) + '_NB_' + str(NB), 'wb') as f:
        pickle.dump(psiXX, f)
    for n in [2, 3, 4]:
        with open(
                'results/expected_MPS_NA_' + str(NA) + '_NB_' + str(NB) +
                '_n_' + str(n), 'wb') as f:
            pickle.dump(bops.getRenyiEntropy(psiXX, n, NA), f)
    print('Done with N = ' + str(NA))

ASize = int(sys.argv[1])
n = int(sys.argv[2])
option = sys.argv[3]