Skip to content

Make rust Qubit and Clbit the source of truth in a circuit #13269

@mtreinish

Description

@mtreinish

Currently we have a Python space Qubit and Clbit class which is the source of truth of bits in a circuit. We also have a rust space Qubit and Clbit struct which are indices representing the order of qubits in the circuit but those indices map back to a Qubit python space object which is used from python to address the bits in the circuit. But this relationship is backwards from a performance perspective because it means we always need to create a python object to handle bits, even when creating a circuit in rust. This leads to a significant performance overhead for things like synthesis functions that are generating circuits where the overhead to create bit objects and map them to indices so we have a rust native bit object to use. We should invert this relationship so we have the pure rust bit as the source of truth and the python space object serves as a reference to that.

Metadata

Metadata

Assignees

Labels

RustThis PR or issue is related to Rust code in the repositoryperformance

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions