Skip to content

Add rust representation for non-gate standard circuit operations #12966

@mtreinish

Description

@mtreinish

What should we add?

Now that we have a rust native representation for circuit operations we can build an work with circuits and gates directly in rust. However right now the only rust native operations defined are the standard gate library. These are the bulk of the cirucit operations used in Qiskit so there is a large gain from starting with just this set. But as we move more logic intro rust having a more complete representation of the standard circuit operations will be necessary.

Right now in rust there are 4 categories of object, StandardGate, PyGate, PyInstruction, and PyOperation. I think it would be best to add a new field StandardInstruction (or StandardOperation operation is a more descriptive term, but these will be analgous to the Instruction subclasses in Python) which we can use to add rust native representations of standard non-gate operations. This would house operations like Measure and Reset which aren't unitary operations but are similarly static.

The other option is to rename StandardGate to StandardOperations and add these operations to it. Personally I think there it's advantageous to leverage the type system to differentiate unitary gates from other operations like this (similar to how we use isinstance(op, Gate) in python). But I don't feel super strongly about it. There is also a tradeoff because we can only support so many variants in PackedOperation before we run out of space in the type so we do have to be careful about proliferating types there.

Metadata

Metadata

Assignees

Labels

RustThis PR or issue is related to Rust code in the repositorytype: feature requestNew feature or request

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions