Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add infrastructure for gates, instruction, and operations in Rust #12459

Merged
merged 68 commits into from
Jun 13, 2024
Merged
Changes from 1 commit
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
fb70814
Add infrastructure for gates, instruction, and operations in Rust
mtreinish May 3, 2024
ad3e3c5
Merge branch 'main' into gates-in-rust
mtreinish May 25, 2024
37c0780
Fix Python->Rust Param conversion
mtreinish May 25, 2024
a6e69ba
Fix qasm3 exporter for std gates without stdgates.inc
mtreinish May 25, 2024
4e34642
Fix base scheduler analysis pass duration setting
mtreinish May 25, 2024
0edcfb0
Fix python lint
mtreinish May 25, 2024
f896512
Fix last failing qasm3 test for std gates without stdgates.inc
mtreinish May 25, 2024
046737f
Remove superfluous comment
mtreinish May 25, 2024
5c5b90f
Cache imported classes with GILOnceCell
mtreinish May 26, 2024
7329399
Remove unused python variables
mtreinish May 26, 2024
ae64fd7
Add missing file
mtreinish May 26, 2024
76599b2
Update QuantumCircuit gate methods to bypass Python object
mtreinish May 26, 2024
14b7133
Deduplicate gate matrix definitions
mtreinish May 26, 2024
0863830
Fix lint
mtreinish May 26, 2024
c4cda8d
Attempt to fix qasm3 test failure
mtreinish May 26, 2024
ffe04e5
Merge branch 'main' into gates-in-rust
mtreinish May 28, 2024
e9bb053
Add compile time option to cache py gate returns for rust std gates
mtreinish May 28, 2024
dfb02de
Merge branch 'main' into gates-in-rust
mtreinish May 28, 2024
0980d8d
Add num_nonlocal_gates implementation in rust
mtreinish May 29, 2024
dc9e8f0
Merge remote-tracking branch 'origin/main' into gates-in-rust
mtreinish May 29, 2024
b35bdbd
Performance tuning circuit construction
mtreinish May 30, 2024
3ea95de
Add back validation of parameters on gate methods
mtreinish May 31, 2024
2f81bde
Skip validation on gate creation from rust
mtreinish May 31, 2024
725f226
Offload operation copying to rust
mtreinish Jun 3, 2024
3ec3d3e
Merge remote-tracking branch 'origin/main' into gates-in-rust
mtreinish Jun 3, 2024
ed42276
Fix lint
mtreinish Jun 3, 2024
8017ca6
Perform deepcopy in rust
mtreinish Jun 3, 2024
9e21116
Fix QuantumCircuit.compose() performance regression
mtreinish Jun 3, 2024
29f278f
Fix map_ops test case with no caching case
mtreinish Jun 3, 2024
a7061d5
Fix typos in docs
mtreinish Jun 4, 2024
42d5a48
Shrink memory usage for extra mutable instruction state
mtreinish Jun 4, 2024
1ac5d4a
Remove Option<> from params field in CircuitInstruction
mtreinish Jun 4, 2024
951dec2
Merge branch 'main' into gates-in-rust
mtreinish Jun 4, 2024
0398e6a
Eagerly construct rust python wrappers in .append()
mtreinish Jun 4, 2024
8065184
Simplify code around handling python errors in rust
mtreinish Jun 4, 2024
39be17b
Revert "Skip validation on gate creation from rust"
mtreinish Jun 5, 2024
142d71b
Temporarily use git for qasm3 import
mtreinish Jun 5, 2024
39f1358
Fix lint
mtreinish Jun 5, 2024
5139411
Fix lint for real (we really need to use a py312 compatible version o…
mtreinish Jun 5, 2024
0d59bd4
Fix test failure caused by incorrect lint fix
mtreinish Jun 5, 2024
cfcc3d6
Relax trait-method typing requirements
jakelishman Jun 6, 2024
8cfa4d0
Encapsulate `GILOnceCell` initialisers to local logic
jakelishman Jun 6, 2024
1e3c064
Simplify Interface for building circuit of standard gates in rust
mtreinish Jun 6, 2024
faac655
Simplify complex64 creation in gate_matrix.rs
mtreinish Jun 6, 2024
c9ac618
Simplify initialization of array of elements that are not Copy (#28)
jlapeyre Jun 6, 2024
5ce3c87
Merge remote-tracking branch 'ibm/main' into gates-in-rust
jakelishman Jun 7, 2024
7715744
Fix doc typos
mtreinish Jun 7, 2024
4a93c83
Add conversion trait for OperationType -> OperationInput and simplify…
mtreinish Jun 7, 2024
1809a22
Use destructuring for operation_type_to_py extra attr handling
mtreinish Jun 7, 2024
f858158
Simplify trait bounds for map_indices()
mtreinish Jun 7, 2024
26bc1ae
Make Qubit and Clbit newtype member public
mtreinish Jun 7, 2024
649509f
Use snakecase for gate matrix names
mtreinish Jun 8, 2024
067c5b4
Remove pointless underscore prefix
mtreinish Jun 8, 2024
1231cb3
Use downcast instead of bound
mtreinish Jun 9, 2024
0281b6c
Rwork _append reference cycle handling
mtreinish Jun 9, 2024
c78c44a
Make CircuitData.global_phase_param_index a class attr
mtreinish Jun 9, 2024
c61d1ad
Use &[Param] instead of &SmallVec<..> for operation_type_and_data_to_py
mtreinish Jun 9, 2024
252a089
Have get_params_unsorted return a set
mtreinish Jun 9, 2024
402bc29
Use lookup table for static property methods of StandardGate
mtreinish Jun 9, 2024
978d90f
Use PyTuple::empty_bound()
mtreinish Jun 9, 2024
a116719
Fix lint
mtreinish Jun 9, 2024
de4b91e
Add missing test method docstring
mtreinish Jun 9, 2024
ef31751
Reuse allocations in parameter table update
mtreinish Jun 9, 2024
6c68e60
Remove unnecessary global phase zeroing
mtreinish Jun 10, 2024
1723267
Move manually set params to a separate function
mtreinish Jun 10, 2024
b438748
Fix release note typo
mtreinish Jun 12, 2024
56969cb
Use constant for global-phase index
jakelishman Jun 13, 2024
adbe9e7
Switch requirement to release version
jakelishman Jun 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix typos in docs
This commit fixes several docs typos that were caught during code review.

Co-authored-by: Eli Arbel <[email protected]>
mtreinish and eliarbel authored Jun 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit a7061d5a62a188412b0b40a48f5fbdf815cb579b
4 changes: 2 additions & 2 deletions crates/circuit/README.md
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ enum. The `OperationType` enum has four variants which are used to define the di
operation objects that can be on a circuit:

- `StandardGate`: a rust native representation of a member of the Qiskit standard gate library. This is
an `enum` that enuerates all the gates in the library and statically defines all the gate properties
an `enum` that enumerates all the gates in the library and statically defines all the gate properties
except for gates that take parameters,
- `PyGate`: A struct that wraps a gate outside the standard library defined in Python. This struct wraps
a `Gate` instance (or subclass) as a `PyObject`. The static properties of this object (such as name,
@@ -53,7 +53,7 @@ operation objects that can be on a circuit:
the struct.

There is also an `Operation` trait defined which defines the common access pattern interface to these
4 types along with the `OperationType` parent. This trait defined methods to access the standard data
4 types along with the `OperationType` parent. This trait defines methods to access the standard data
model attributes of operations in Qiskit. This includes things like the name, number of qubits, the matrix, the definition, etc.

## ParameterTable
2 changes: 1 addition & 1 deletion crates/circuit/src/imports.rs
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ pub static SINGLETON_GATE: GILOnceCell<PyObject> = GILOnceCell::new();
/// qiskit.circuit.singleton.SingletonControlledGate
pub static SINGLETON_CONTROLLED_GATE: GILOnceCell<PyObject> = GILOnceCell::new();

/// A mapping from the enum varian in crate::operations::StandardGate to the python
/// A mapping from the enum variant in crate::operations::StandardGate to the python
/// module path and class name to import it. This is used to populate the conversion table
/// when a gate is added directly via the StandardGate path and there isn't a Python object
/// to poll the _standard_gate attribute for.