예제 #1
0
    U.R(U.H, N, 0), \
    U.control(N, U.S, 1, 0), \
    U.R(U.H, N, 1), \
    U.control(N, U.T, 2, 0), \
    U.control(N, U.S, 2, 1), \
    U.R(U.H, N, 2) ]
Ushor7 = np.around(U.dotN(Useq), 10)

# calculate the states
psi = np.zeros(2**N, np.complex64)
psi[U.bin2dec('1000000')] = 1
psi = psi.T

psiout = np.dot(Ushor7, psi)

U.displaytracedstates(psiout, N, tracemask='1111000')

# for Ushor11, should get 0,4
# for Ushor7, should get 0,2,4,6
# see Vandersypen's thesis p.207


# now get unitaries for the Kitaev version
N = 5

a11 = [
    U.control(N, U.X, 0, 1), \
    U.control(N, U.X, 0, 3) ]
Ua11 = U.dotN(a11)

a7a = [
예제 #2
0
                for pulse in pulseseq:
                    pulse.use_ideal = True
            else:
                for ps in pulseseq:
                    for pulse in ps:
                        pulse.use_ideal = True

        print "initial state", y0, "| expected order", select_order
        params.initial_state("quantum", qstate = y0)

        tic = time.time()
        if doKitaev:
            result = Kit.simulateevolution(pulseseq, params, dec)
        else:
            data = qc.simulateevolution(pulseseq, params, dec)
            result = U.displaytracedstates(data.YRPN[-1], pop=True)
        if not doIdeal: print "runtime: ", time.time()-tic, "sec"
        

else:
    tic = time.time()
    if doKitaev:
        result = Kit.simulateevolution(pulseseq, params, dec)
        print np.around(result, 3)

    else:
        data = qc.simulateevolution(pulseseq, params, dec)
        result = U.displaytracedstates(data.YRPN[-1], pop=True)
        print np.around(result, 3)
    if not doIdeal: print "runtime: ", time.time()-tic, "sec"