Exemplo n.º 1
0
def dbs_rpv_test():
    from states import bell
    ns = 5 * 10**3
    cxx = np.zeros(ns)
    cyy = np.zeros(ns)
    czz = np.zeros(ns)
    for j in range(0, ns):
        rpv = rpvg.rpv_zhsl(4)
        rhor = rpv[0] * mf.proj(4, bell(0, 0)) + rpv[1] * mf.proj(
            4, bell(0, 1))
        rhor += (rpv[2] * mf.proj(4, bell(1, 0)) +
                 rpv[3] * mf.proj(4, bell(1, 1)))
        cm = gm.corr_mat(2, 2, rhor)
        cxx[j] = cm[0][0]
        cyy[j] = cm[1][1]
        czz[j] = cm[2][2]
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    ax.scatter(cxx, cyy, czz, c='b', marker='o', s=0.5)
    ax.set_xlabel('c_xx')
    ax.set_ylabel('c_yy')
    ax.set_zlabel('c_zz')
    ax.set_xlim(-1, 1)
    ax.set_ylim(-1, 1)
    ax.set_zlim(-1, 1)
    ax.plot([-1, 1], [-1, 1], [-1, -1], color='b')
    ax.plot([-1, 1], [1, -1], [1, 1], color='b')
    ax.plot([-1, 1], [-1, -1], [-1, 1], color='b')
    ax.plot([-1, -1], [-1, 1], [-1, 1], color='b')
    ax.plot([1, -1], [1, 1], [-1, 1], color='b')
    ax.plot([1, 1], [1, -1], [-1, 1], color='b')
    plt.show()
Exemplo n.º 2
0
def dbs_circuit_test_():
    ns = 5 * 10**3
    cxx = np.zeros(ns)
    cyy = np.zeros(ns)
    czz = np.zeros(ns)
    p = np.zeros((2, 2))
    a = np.zeros(4)
    for j in range(0, ns):
        rpv = rpvg.rpv_zhsl(4)
        a = np.reshape(rpv, (2, 2))
        alpha, beta, gamma = bds_circuit_angles(a)
        psi = bds_circuit_(alpha, beta, gamma)
        rhor = ptr.pTraceL(4, 4, mf.proj(16, psi))
        cm = gm.corr_mat(2, 2, rhor)
        cxx[j] = cm[0][0]
        cyy[j] = cm[1][1]
        czz[j] = cm[2][2]
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    ax.scatter(cxx, cyy, czz, c='b', marker='o', s=0.75)
    ax.set_xlabel('c_xx')
    ax.set_ylabel('c_yy')
    ax.set_zlabel('c_zz')
    ax.set_xlim(-1, 1)
    ax.set_ylim(-1, 1)
    ax.set_zlim(-1, 1)
    ax.plot([-1, 1], [-1, 1], [-1, -1], color='b')
    ax.plot([-1, 1], [1, -1], [1, 1], color='b')
    ax.plot([-1, 1], [-1, -1], [-1, 1], color='b')
    ax.plot([-1, -1], [-1, 1], [-1, 1], color='b')
    ax.plot([1, -1], [1, 1], [-1, 1], color='b')
    ax.plot([1, 1], [1, -1], [-1, 1], color='b')
    plt.show()
Exemplo n.º 3
0
def dbs_circuit_test():
    ns = 5 * 10**3
    cxx = np.zeros(ns)
    cyy = np.zeros(ns)
    czz = np.zeros(ns)
    for j in range(0, ns):
        rpv = rpvg.rpv_zhsl(4)
        theta = 2.0 * math.acos(math.sqrt(rpv[0] + rpv[1]))
        alpha = 2.0 * math.acos(math.sqrt(rpv[0] + rpv[2]))
        psi = bds_circuit(theta, alpha)
        rhor = ptr.pTraceL(4, 4, mf.proj(16, psi))
        cm = gm.corr_mat(2, 2, rhor)
        cxx[j] = cm[0][0]
        cyy[j] = cm[1][1]
        czz[j] = cm[2][2]
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    ax.scatter(cxx, cyy, czz, c='b', marker='o', s=1)
    ax.set_xlabel('c_xx')
    ax.set_ylabel('c_yy')
    ax.set_zlabel('c_zz')
    ax.set_xlim(-1, 1)
    ax.set_ylim(-1, 1)
    ax.set_zlim(-1, 1)
    ax.plot([-1, 1], [-1, 1], [-1, -1], color='b')
    ax.plot([-1, 1], [1, -1], [1, 1], color='b')
    ax.plot([-1, 1], [-1, -1], [-1, 1], color='b')
    ax.plot([-1, -1], [-1, 1], [-1, 1], color='b')
    ax.plot([1, -1], [1, 1], [-1, 1], color='b')
    ax.plot([1, 1], [1, -1], [-1, 1], color='b')
    plt.show()
Exemplo n.º 4
0
def rdm_std(d):
    from numpy import zeros
    rdm = zeros((d, d), dtype=complex)
    from rpvg import rpv_zhsl
    rpv = rpv_zhsl(d)
    from rug import ru_gram_schmidt
    ru = ru_gram_schmidt(d)
    for j in range(0, d):
        for k in range(j, d):
            for l in range(0, d):
                rdm[j][k] = rdm[j][k] + rpv[l]*(ru[j][l].real*ru[k][l].real
                                                + ru[j][l].imag*ru[k][l].imag
                                                + (1j)*(ru[j][l].imag*ru[k][l].real
                                                        - ru[j][l].real*ru[k][l].imag))
                if j != k:
                    rdm[k][j] = rdm[j][k].real - (1j)*rdm[j][k].imag
    return rdm
Exemplo n.º 5
0
def rsvg(d):
    from numpy import zeros
    rn = zeros(d)
    rpv = zeros(d)
    rsv = zeros(d, dtype=complex)
    from rpvg import rpv_zhsl
    rpv = rpv_zhsl(d)
    from math import pi, sqrt, cos, sin
    tpi = 2.0 * pi
    from random import random
    for j in range(0, d):
        rn[j] = random()
        arg = tpi * rn[j]
        ph = cos(arg) + (1j) * sin(arg)
        rsv[j] = sqrt(rpv[j]) * ph
    return rsv


#------------------------------------------------------------------------------------------------------------------------------------