-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve performance of multiplication of cliffords (#1275)
### Summary The circuit generation for 2-qubit RB experiments is slow due to the Clifford multiplication. Internally Clifford numbers are converted to Qiskit circuits, decomposed and then multiplied. We can avoid the conversion to circuits and indexing in a sparse table by creating a dense version of `_CLIFFORD_COMPOSE_2Q`. ### Details and comments Bechmark: ``` import time import qiskit from qiskit_experiments.library import InterleavedRB gate=qiskit.circuit.library.CXGate() rb=InterleavedRB(gate, physical_qubits= (0,1),lengths= [1,10,50,100,200, 1000], num_samples= 100) t0=time.time() c=rb.circuits() dt=time.time()-t0 print(dt) ``` improved from 21.2 to 7.9 seconds. Micro benchmark ``` from qiskit_experiments.library.randomized_benchmarking.clifford_utils import compose_2q %timeit compose_2q(15, 10412) #main: 56.2 µs ± 11.4 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each) #PR: 3.58 µs ± 362 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each) ``` ### PR checklist (delete when all criteria are met) - [x] I have read the contributing guide `CONTRIBUTING.md`. - [x] I have added the tests to cover my changes. (no changes to public methods) - [x] I have updated the documentation accordingly. (no changes to public methods) - [x] I have added a release note file using `reno` if this change needs to be documented in the release notes. (no release note required)
- Loading branch information
1 parent
8355155
commit 49a5218
Showing
8 changed files
with
84 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-87 Bytes
(90%)
qiskit_experiments/library/randomized_benchmarking/data/clifford_compose_1q.npz
Binary file not shown.
Binary file added
BIN
+334 KB
...t_experiments/library/randomized_benchmarking/data/clifford_compose_2q_dense_selected.npz
Binary file not shown.
Binary file removed
BIN
-424 KB
qiskit_experiments/library/randomized_benchmarking/data/clifford_compose_2q_sparse.npz
Binary file not shown.
Binary file modified
BIN
-6 Bytes
(98%)
qiskit_experiments/library/randomized_benchmarking/data/clifford_inverse_1q.npz
Binary file not shown.
Binary file modified
BIN
-1.41 KB
(92%)
qiskit_experiments/library/randomized_benchmarking/data/clifford_inverse_2q.npz
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters