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

New algorithm for generating Clifford circuits for single qubit. #2

Merged
merged 5 commits into from
Jun 7, 2022

Conversation

merav-aharoni
Copy link
Owner

@merav-aharoni merav-aharoni commented May 26, 2022

Summary

We generate all 24 transpiled Cliffords once (in the basis {rz, sx}. Then, for every rb_circuit, select Cliffords at random and compose them to a circuit

Details and comments

Current version is faster than the original version. The main change I made since the previous version, is adding the parameter inplace to the QuantumCircuit.compose() operation. This uses the existing circuit, rather than copying to a new circuit.

For benchmarking, I ran the test test.randomized_benchmarking.test_randomized_benchmarking.TestStandardRB.test_single_qubit from the test suite. Here are a few measurements (average of 5 runs):
With num_samples = 1, existing rb_experiment: time = 1.2374 sec
this branch: time = 0.7710 sec
With num_samples = 10 existing rb_experiment: time = 8.3614 sec
this branch: time = 1.2056 sec

…enerate once all 24 transpiled Cliffords. Then, for every rb_circuit, select Cliffords at random and compose them to a circuit
…. Added parameter to all calls to compose to use inplace=True. Removed redundant method generate_all_transpiled_clifford_circuits
@merav-aharoni merav-aharoni changed the title New algorithm for generating Clifford circuits for single qubit. We g… New algorithm for generating Clifford circuits for single qubit. May 29, 2022
@merav-aharoni
Copy link
Owner Author

There is a difference between the EPC computed by this branch as compared to the existing rb_experiment. This must be investigated.

…use front=True, because I assume front=False when creating the circuits
@merav-aharoni
Copy link
Owner Author

merav-aharoni commented May 31, 2022

After fixing the random number generator, the new algorithm generates the exact same circuits as the original algorithm, as well as the same result for EPC.
I ran performance comparison on three circuits, 3 iterations each, StandardRB.num_samples=1, same seed for both algorithms, full_sampling=False.
Here are the results:
image

@merav-aharoni
Copy link
Owner Author

@dekel.meirom ran a comparison between the RB version in this PR and QC code on Bangkok. The experiment consists of circuits with lengths = [1, 2, 3, 5, 9, 17, 31, 56, 99, 177, 316, 562, 999, 1778, 3162]. QC code takes 83 sec while this version takes 100 sec

@merav-aharoni
Copy link
Owner Author

A few comments on future work:

  1. For 1-qubit RB, need to implement with full_sampling=True, and check performance in this case.
  2. The current version is a draft - need to re-write the code.
  3. For 2-qubit RB, creating the transpiled circuits during __init__ will not be efficient. We should consider creating them once and storing in a file. Or perhaps randomly generating transpiled cliffords according to the length of the circuit, e.g., if we have 1 circuit of length 100, generate only 100 random cliffords.

@merav-aharoni merav-aharoni merged commit ab7d4f3 into main Jun 7, 2022
@merav-aharoni merav-aharoni deleted the rb_performance branch June 7, 2022 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant