0
$\begingroup$

I am implementing an Ising chain over 8 qubits. It involves pair-wise CNOT between all the qubits. In the first time step, I am doing CNOTs between qubits 0 and 1, 2 and 3, 4 and 5, and 6 and 7. In the second time step, I would do CNOTs between qubits 1 and 2, 3 and 4, and 5 and 6. I have written the code as follows:

# Block A for the first time step
qp.cx(q0,q1)
qp.cx(q2,q3)
qp.cx(q4,q5)
qp.cx(q6,q7) 

# Block B for the second time step
qp.cx(q1,q2)
qp.cx(q3,q4)
qp.cx(q5,q6)

I would like the gates in Block A to be applied simultaneously. Then, in the next step, gates in Block B should be applied simultaneously. How to convey to the compiler that I do not want the above written code to be compiled sequentially, rather I want it to be applied block-wise.

$\endgroup$
1
  • $\begingroup$ Why does not suit barrier between the blocks? $\endgroup$
    – Psanfi
    Aug 22 '20 at 17:19
1
$\begingroup$

Did you try to put a barrier between your two blocks? You can do this by writing this qp.barrier() right after your first block, then Qiskit will transpile separately the two blocks. Is this what you were searching for?

$\endgroup$
2
  • $\begingroup$ Thanks, this was really helpful. $\endgroup$ Aug 26 '20 at 14:37
  • $\begingroup$ @SHASHANKRANU happy to see so, could you maybe accept the answer? Thanks :) $\endgroup$
    – Lena
    Aug 27 '20 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.