Improve performance of RB circuit generation #1263
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The circuit generation for RB experiments is slow due to the use of indexing on sparse matrices (
_CLIFFORD_COMPOSE_2Q
fromqiskit_experiments.library.randomized_benchmarking.clifford_utils
). Since indexing is the only operation used on_CLIFFORD_COMPOSE_2Q
we can improve performance by using thelil_matrix
format.Details and comments
Improve performance of RB circuit generation by changing the format of
_CLIFFORD_COMPOSE_2Q
tolil_matrix
.Micro benchmark:
Result:
Application benchmark:
results in a speedup from 2.1419544219970703 to 1.154689073562622 seconds.
PR checklist (delete when all criteria are met)
CONTRIBUTING.md
.reno
if this change needs to be documented in the release notes. (no release note required)