0
$\begingroup$

If I have a circuit with 3 qubits and repeated gates as follow:

circ = QuantumCircuit(3, 3)
for i in range(100):
    # some gates, details is not important 
    circ.rx(0.1, 0)
    circ.ry(0.1, 1)
    circ.ccx(0,1,2)

Clearly the repeated gates will be transpiled (and uploaded to IBMQ via Internet) 100 times. How can I change the code so that the repeated part only need to be transpiled (and uploaded) one time?

$\endgroup$
2
  • $\begingroup$ Hi Charles, I am not sure I understand what you are trying to do. The circuit you are gave is a single circuit with lots of repeated part... when you execute it, this particular circuit will be transpiled once to whatever hardware you want to execute it on... $\endgroup$ – KAJ226 May 11 at 17:27
  • 6
    $\begingroup$ Maybe you want this transpilation process to be faster? Then since your circuit is only repeated, you can traspile one of the part, then append them together to give you the fully transpiled circuit... then just specify to execute this circuit as it in your execution... this way the transpiler doesn't do any additional work on top. $\endgroup$ – KAJ226 May 11 at 17:30

Your Answer

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

Browse other questions tagged or ask your own question.