Open
Conversation
This commit makes signficicant changes to the organization of the tutorial on the 3-qubit repetition code, while leaving the structure and calculations nearly unchanged. Some of the changes re. * Removed discussion of stabilizers * Changed text introducing sections in various ways. * Registers are no longer global. Rather are created in and returned from a function. * Variable names have been changed to follow somewhat common usage in text books. * Some calculation and reports are factored into functions. * Shot dicts are sorted to have the same bitstring order within the notebook as well as between runs. * A bit more explanation of reading error syndrome. * Transpilation discussion improved. * "isa_" names retained. But now, definiition of ISA given. * Circuits with correction and without were run in separate sampler jobs. Now they are run in a single job.
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Contributor
|
One or more of the following people are relevant to this code: |
6 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes made in this PR
This commit makes significant changes to the organization of the tutorial on the 3-qubit repetition code, while leaving the structure and calculations nearly unchanged.
Notebook with changes proposed in this PR
Some of the changes are.
Removed discussion of stabilizers
Changed text introducing sections in various ways.
Registers are no longer global. Rather, are created in and returned from a function.
Variable names have been changed to follow somewhat common usage in text books.
Some calculation and reports are factored into functions.
Shot dicts are sorted to have the same bitstring order within the notebook as well as between runs.
A bit more explanation of reading error syndrome.
Transpilation discussion improved.
"isa_" names retained. But now, definition of ISA given.
Circuits with correction and without were run in separate sampler jobs. Now they are run in a single job.
Number of shots 10_000 rather than 1000
Put
backend.least_busy(...in "Setup".Removed code that resets the ancilla qubits after the error syndrome is read into the classical register. This would be relevant if we were doing further work in the circuit and wanted to do additional rounds of error correction. (See issue below)
The existing code labels the first of the code qubits, i.e. the data qubits, as the one that carries the input state:
state_data = qreg_data[0]. I like this idea and tried to retain it. But in the end, it made the functions a bit more complicated, and less readable. So I dropped this idea.Issues
There are still some issues that could be addressed. But this PR was taking a lot of time, so I have not addressed them
Write a summary or conclusion or observation
As it stands, using error correction makes the results worse, fairly consistently. This is not what we want. I went over the circuit a few times. I haven't yet found a problem. I also have run the code with the main branch (before this commit) and I find the same problem. I mostly did this with a fake backend in order to collect better statistics.
I suspect something like a coding error such that a qubit that is correct is nonetheless flipped.
Mid-circuit measurements
measure_2(MidCircuitMeasure) is not supported onAerSimulator. A user who plays with this notebook might want to use a fake backend, or another backend that does not supportmeasure_2. But we have hard-coded use of this instruction. A fake backend carries exactly the same instruction set as the backend that it mimics. In particular, it will "support"measure_2. But running theSamplerraises an error becauseAerSimulatordoes not support it.One solution is
and
Does
MidCircuitMeasure()support more than one qubit? The doc string says, 1 qubt, 1 clbit. However, it is a subclass ofInstruction, so that the docstring for the attributes are appended and these say you can specifynum_qubitsandnum_clbits. I (or someone) could just try this. UsingMidCircuitMeasureis a bit more complicated than the methodmeasure.When using
MidCircuitMeasurement, the plot of the circuit is a bit less clear than it was usingmeasure(). In the case at hand, there are two syndrome measurements. Usingmeasure()you can see each line. ButMidCircuitMeasurementdraws a box with no structure around the two. The latter is probably better for a large number of wires.Explanation of statistics
We could explain why we count both 000 and 111 as success when the real correct result is 111.
Resetting ancillas
As mentioned above, I removed code that resets the ancillas after reading the syndrome. In this experiment, there is no point in resetting them. However, this code could be presented and discussed in a section after the main experiment.