4
$\begingroup$

While I'm simulating one Big quantum circuit in Qiskit, I wonder how we can divide one big quantum circuit into several sub-circuits. I looked in Qiskit API documents, but I couldn't find it.

Is there anyway that I can do that?

$\endgroup$
1
  • 2
    $\begingroup$ If your big circuit has smaller circuit that are separated from each other, that is, the set of qubits are not entangled, then just write them as two different circuits and run them separately if you wish. You have to create that big circuit in the first place, right? So instead of define a single circuit, define multiple smaller circuits.... $\endgroup$
    – KAJ226
    Commented Mar 19, 2021 at 15:51

1 Answer 1

1
$\begingroup$

This is the best I have at the moment.

def split_circuit(circuit, start, end):
    nq = len(circuit.qubits)
    qc2 = qis.QuantumCircuit(nq)
    for x in circuit[start:end]:
        qc2.append(x[0], x[1])
    return qc2

I hope it helps. I too want something like this built in. Ideally it would just use something like the slicing.

$\endgroup$

Your Answer

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

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