That is, we use a Rust data structure BitData to store and manipulate variables, although the individual variables are still PyObjects. Previously, the Python-side containers and methods for manipulating variables were used.
It would be easier to a PR like this if there were some refactoring in dag_circuit.rs. For example, fn substitute_node_with_dag is over 500 lines long. One problem is the scope of local variables is not clear from the syntactic clues.
Closes #13027
Summary
This follows the plan in #1307. This PR is centered on augmenting this https://github.com/Qiskit/qiskit/blob/cc2edc9f7172d75ec454fdaf5748326cd3720f90/crates/circuit/src/dag_circuit.rs#L237-L240
with
That is, we use a Rust data structure
BitData
to store and manipulate variables, although the individual variables are stillPyObject
s. Previously, the Python-side containers and methods for manipulating variables were used.Status
Most of this is done, modulo debugging because it does not yet successfully compile. The part that is left is in https://github.com/Qiskit/qiskit/blob/cc2edc9f7172d75ec454fdaf5748326cd3720f90/crates/circuit/src/dag_circuit.rs#L2866 This is a bit more work than all the rest because it involves iteration over the
Var
s and logic on the contents. For example, a set difference implemented as a Python call must be translated to or otherwise replaced in Rust.It would be easier to a PR like this if there were some refactoring in dag_circuit.rs. For example,
fn substitute_node_with_dag
is over 500 lines long. One problem is the scope of local variables is not clear from the syntactic clues.