1
$\begingroup$

I am a complete newbie to quantum computing and qiskit. I am trying to implement $H$ gate in Measurement-Based QC architecture based on a paper "Qiskit As a Simulation Platform for Measurement-based Quantum Computation". I have added an image of it.

enter image description here

Using the following code, I was able to create a circuit as mentioned, but I am not able to understand the output

from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer


qr = QuantumRegister(5)
cr = ClassicalRegister(5)
qc = QuantumCircuit(qr, cr)

qc.h(qr[1])
qc.h(qr[2])
qc.h(qr[3])
qc.h(qr[4])

qc.cz(qr[0], qr[1])
qc.cz(qr[1], qr[2])
qc.cz(qr[2], qr[3])
qc.cz(qr[3], qr[4])


b1 = qc.barrier()

qc.h(qr[0])
qc.sdg(qr[1])
qc.h(qr[1])

qc.sdg(qr[2])
qc.h(qr[2])

qc.sdg(qr[3])
qc.h(qr[3])

b2 = qc.barrier()

qc.measure(qr[0], cr[0])
qc.measure(qr[1], cr[1])
qc.measure(qr[2], cr[2])
qc.measure(qr[3], cr[3])

backend_sim = Aer.get_backend('qasm_simulator')

from qiskit.compiler import transpile

job_sim = backend_sim.run(transpile(qc, backend_sim))

result_sim = job_sim.result()

counts = result_sim.get_counts(qc)
print(counts)

The following is the output I received but I am not able to understand it

{'01110': 71, '00010': 69, '00001': 79, '01010': 72, '01111': 50, '00110': 64, '00011': 56, '00100': 60, '01000': 64, '01100': 81, '01001': 62, '00000': 66, '01011': 55, '01101': 64, '00111': 48, '00101': 63}

I know that when input is $|0\rangle$, the output is $|-\rangle$, so how can I show $|-\rangle$ from the present output?

Also, is there any way I can show the graph state of the $H$ gate as mentioned in Fig.4, using qiskit

$\endgroup$
2
  • $\begingroup$ Two things: First, in what you posted, no mention is made about compensating for different measurement results in the output. I think there is some influence from the parity of the results of measurements from qubits 1 and 3. $\endgroup$
    – DaftWullie
    Nov 17 at 15:52
  • 1
    $\begingroup$ Second: if you think you're getting out state $|-\rangle$, why not just apply Hadamard before you measure it so that you expect to always get $|1\rangle$? $\endgroup$
    – DaftWullie
    Nov 17 at 15:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.