-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Allow to pass Circuit to single-qubit gates compensation #4118
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
Conversation
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.
Couple comments.
This is technically a breaking change since you're changing the name of an argument. It's probably fine though. I bet most people would be using it as a positional arg
@@ -834,6 +853,42 @@ def make_zeta_chi_gamma_compensation_for_moments( | |||
The moment to calibration mapping is updated for the new circuit so that successive | |||
calibrations could be applied. | |||
""" | |||
|
|||
if isinstance(circuit, Circuit): |
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.
factor this out into a helper method?
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.
Done, I wanted to send out this PR quickly so it wasn't really clean.
match the circuit against a given characterizations. This step is not computationally | ||
efficient and can be avoided by passing the pre-calculated instance of |
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.
what do you mean by not efficient? Am I correct in deducing that it has a quadratic runtime where it scans over all the calibrations for each moment? Is this bad in practice?
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.
I have changed the docstring.
In the beginning I was fixed on optimizing this computational cost but after looking at this right now it's probably not relevant. This code will not scale to large circuits and more quibts anyway so it's probably fine to do this calculations many times for now. It would probably be also cleaner in terms of API if we did all the compilation like that from the start: this allows to mix different characterizations (XEB/Floquet together as well) and the structure "CircuitsWithCalibrations" would not be necessary.
PTAL |
…4118) * Allow to pass Circuit to Z gates compensation * Apply review comments * Fix linter errors * Fix linter errors * Fix missing coverage * Fixes after merge
The current workflow of calibrations is first to call
prepare_characterization_for_moments
which returns the annotatedCircuit
wrapped in an instance ofCircuitWithCalibration
. Although this solution is efficient because allows to extract moments to characterize only once (which is not a cheap operation), this is not convenient to use in practice. In the current situation this annotated circuit must be stored and passed tomake_zeta_chi_gamma_compensation_for_moments
later.This change allows to pass
Circuit
intomake_zeta_chi_gamma_compensation_for_moments
which will do the same analysis as was done before again. However, it makes the API more convenient to use.