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

# Block B for the second time step

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.

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

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?

| improve this answer | |
  • $\begingroup$ Thanks, this was really helpful. $\endgroup$ – SHASHANK RANU Aug 26 at 14:37
  • $\begingroup$ @SHASHANKRANU happy to see so, could you maybe accept the answer? Thanks :) $\endgroup$ – Lena Aug 27 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.