Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
5.1k stars 2.34k forks source link

Add qubits and clbits to dag in `DAGCircuit::with_capacity` #13090

Closed ElePT closed 3 weeks ago

ElePT commented 3 weeks ago

Summary

Follow-up to #13002 that adds qubits and clbits to the dag when num_qubits or num_clbits are non-zero. This would enable, for example, directly appending instructions using an iterator (https://github.com/Qiskit/qiskit/pull/13032) after creating a new rust DAGCircuit. The alternative is making users add the qubits/clbits manually.

I don't think this is 100% necessary but it definitely increases the usability of with_capacity, in fact, this is how it's done in CircuitData (L238-251).

Details and comments

qiskit-bot commented 3 weeks ago

One or more of the following people are relevant to this code:

ElePT commented 3 weeks ago

Closing after internal discussion.