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 lint
  • Loading branch information
mtreinish committed May 26, 2024
commit 0863830506ae45e7fbdbca2e06c36bd2ae26b0c9
69 changes: 34 additions & 35 deletions test/python/qasm3/test_export.py
Original file line number Diff line number Diff line change
@@ -1959,40 +1959,40 @@ def test_basis_gates(self):

id_len = len(str(id(first_x)))
expected_qasm = [
"OPENQASM 3.0;",
re.compile(r"gate u3_\d{%s}\(_gate_p_0, _gate_p_1, _gate_p_2\) _gate_q_0 \{" % id_len),
" U(pi/2, 0, pi) _gate_q_0;",
"}",
re.compile(r"gate u2_\d{%s}\(_gate_p_0, _gate_p_1\) _gate_q_0 \{" % id_len),
re.compile(r" u3_\d{%s}\(pi/2, 0, pi\) _gate_q_0;" % id_len),
"}",
"gate h _gate_q_0 {",
re.compile(r" u2_\d{%s}\(0, pi\) _gate_q_0;" % id_len),
"}",
re.compile(r"gate u3_\d{%s}\(_gate_p_0, _gate_p_1, _gate_p_2\) _gate_q_0 \{" % id_len),
" U(pi, 0, pi) _gate_q_0;",
"}",
"gate x _gate_q_0 {",
re.compile(r" u3_\d{%s}\(pi, 0, pi\) _gate_q_0;" % id_len),
"}",
"bit[2] c;",
"qubit[3] q;",
"h q[1];",
"cx q[1], q[2];",
"barrier q[0], q[1], q[2];",
"cx q[0], q[1];",
"h q[0];",
"barrier q[0], q[1], q[2];",
"c[0] = measure q[0];",
"c[1] = measure q[1];",
"barrier q[0], q[1], q[2];",
"if (c[1]) {",
" x q[2];",
"}",
"if (c[0]) {",
" z q[2];",
"}",
"",
"OPENQASM 3.0;",
re.compile(r"gate u3_\d{%s}\(_gate_p_0, _gate_p_1, _gate_p_2\) _gate_q_0 \{" % id_len),
" U(pi/2, 0, pi) _gate_q_0;",
"}",
re.compile(r"gate u2_\d{%s}\(_gate_p_0, _gate_p_1\) _gate_q_0 \{" % id_len),
re.compile(r" u3_\d{%s}\(pi/2, 0, pi\) _gate_q_0;" % id_len),
"}",
"gate h _gate_q_0 {",
re.compile(r" u2_\d{%s}\(0, pi\) _gate_q_0;" % id_len),
"}",
re.compile(r"gate u3_\d{%s}\(_gate_p_0, _gate_p_1, _gate_p_2\) _gate_q_0 \{" % id_len),
" U(pi, 0, pi) _gate_q_0;",
"}",
"gate x _gate_q_0 {",
re.compile(r" u3_\d{%s}\(pi, 0, pi\) _gate_q_0;" % id_len),
"}",
"bit[2] c;",
"qubit[3] q;",
"h q[1];",
"cx q[1], q[2];",
"barrier q[0], q[1], q[2];",
"cx q[0], q[1];",
"h q[0];",
"barrier q[0], q[1], q[2];",
"c[0] = measure q[0];",
"c[1] = measure q[1];",
"barrier q[0], q[1], q[2];",
"if (c[1]) {",
" x q[2];",
"}",
"if (c[0]) {",
" z q[2];",
"}",
"",
]
res = Exporter(includes=[], basis_gates=["cx", "z", "U"]).dumps(qc).splitlines()
for result, expected in zip(res, expected_qasm):
@@ -2003,7 +2003,6 @@ def test_basis_gates(self):
expected.search(result), f"Line {result} doesn't match regex: {expected}"
)


def test_teleportation(self):
"""Teleportation with physical qubits"""
qc = QuantumCircuit(3, 2)
Loading