I'm starting with Qiskit in Python.

My question is regarding to have registers and sub-register. Something like this


The constructor of QuantumRegister has only the number of qubits to create, and I find no way to add previously existing qubit to other register


1 Answer 1


If you want to add previously existing qubits to other register you can obviously compose or append to add previously existing qubits to other register, let's say we have have two qubits who are in state |++> and we want to add them to our register which has for example 4 qubits, we can do

sub_circuit = QuantumCircuit(2)
circuit = QuantumCircuit(4)
qr = circuit.qregs[0]
circuit = circuit.append(sub_circ.to_instruction(), [qr[0], qr[1]])

You'll get something like this

picture of the final circuit

  • $\begingroup$ Thank! I'll try the "subcircuit" approach. This is not exacty what I was looking for, but it's useful $\endgroup$
    – Sourcerer
    Aug 18, 2020 at 9:23

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.