-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
LRE ZNE comparison tutorial #2551
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2551 +/- ##
=======================================
Coverage 98.72% 98.72%
=======================================
Files 92 92
Lines 4161 4167 +6
=======================================
+ Hits 4108 4114 +6
Misses 53 53 ☔ View full report in Codecov by Sentry. |
@natestemen @cosenal in the docs-build, I am getting the following error: build finished with problems, 1 warning. what does this mean? |
@FarLab You can see the error if you scroll up https://github.com/unitaryfund/mitiq/actions/runs/11644169797/job/32425762750?pr=2551#step:8:1469 Seems like you referenced a file and there was an issue with creating the link. You can also see that the corresponding link is broken in the RTD build. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great demonstration Farrokh! I've left some minor comments, along with one larger suggestion for the second half.
print(f'Average error for ideal values: {np.abs(np.mean(ideal_values) - p(0.7))}') | ||
``` | ||
|
||
For the ideal values we still see a small error, since the circuits are randomly generated and the theoretical value is achieved in the limit where we generate all the possible circuits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the error in the ideal because we only have a sample of 50 circuits? What would it mean to generate "all the possible circuits"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the ideal value (the function p that I defined) is the probability of measuring 0 when taking an average over all the rotated rb circuits. In this case we are only generating 50 such random circuits, so there will be noise due to randomness. I can try to rephrase it a bit better!
print(f'Average error of mitigated values using ZNE: {error_zne}') | ||
``` | ||
|
||
## Resource estimation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this section, instead of re-computing all the circuits, what if we
- converted our python function
execute
into anExecutor
,1 and - used the
Executor
attributesexecuted_circuits
andcalls_to_executor
to understand the overhead.
I think this would make for a cleaner tutorial, and demonstrate some of the maybe less-used functionality of the executor class. The downside of this approach is that it means we don't use the multivariate_layer_scaling
and scaled_circuits
functions here.
Footnotes
-
Technically, we'll have to define two
Executor
objects, one for ZNE, and another for LRE so the circuits are kept separate. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can discuss this in more detail, but I think it is nice to use these new functions to access the circuits that are to be executed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Met with Farrokh to discuss today and we agreed the tutorial as written is good. The resource estimation workflow is good to demo on its own, even if the circuits have to be regenerated. It demonstrates a more realistic workflow, rather than running, and then looking at overhead.
A small tutorial applying LRE and ZNE on rotated randomized benchmarking circuits, comparing the performance on a small set of circuits and the resources required for it.