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.
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
Add BackendEstimatorV2 #11931
Add BackendEstimatorV2 #11931
Changes from 4 commits
a688bf4
6edfce0
49d1ebd
eae8fe8
27c920d
e5c09a6
abf87a5
a0f1628
8354449
571c079
dd4d8a6
aea3460
28e86d5
c809af7
6aaa98d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Reminder to remove "or BackendV1" if it is decided that this class sholudn't BackendV1.
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.
This sentence is unfinished. I'm also wondering if we can somehow change the name away from abelian, so as not to imply that XX and YY are grouped.
group_qubitwise_commuting
or something? However, not a big deal, more important is that this is mentioned in the docstring.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 copied it from
BackendEstimator
. But as you mentioned, it looks like unfinished. I revised it.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.
This is a workaround to support both
BasicSimulator
andAerSimulator
when translating measurement circuits to their basis gates.If I don't set
basis
, some tests forBasicSimulator
fail as follows.On the other hand, if I use
generate_preset_passmanager
instead ofOptimize1qGatesDecomposition
, it causes an error withAerSimulator
as follows.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.
Since I'm not sure the details of
precison
, thisshots
estimation is quite rough one. Could you tell me how can we determine the number of shots depending onprecision
, @ihincks and @chriseclectic?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.
FWIW, I find confusing that the default
precision
parameter is 0but precision should be larger than 0.
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 will update it with the same default value with qiskit-ibm-runtime.
https://github.com/Qiskit/qiskit-ibm-runtime/blob/50797a909f376a5ab051b4cefd787ced7a2160e0/qiskit_ibm_runtime/options/estimator_options.py#L44
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 left a different comment about the default value before reading this. Please go ahead and set it to any reasonable >0 value you like.
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 you've written looks like a good first stab, and essentially the same as the one in the IBM runtime at the moment. For this reason I think it's okay as-is.
If we wanted to make a better guess we could do this: suppose a sparse Pauli sum observable
A=\sum_i a_i P_i
. ThenVar[A]=\sum_i |a_i|^2 Var[P_i]
. If we take the worst case that each P_i has expectation value 0, then each Var[P_i] will be about 1, so thatVar[A]=\sum_i |a_i|^2
. So a conservative guess would be to go through every observable in the array, find the one with the worst such variance, and use that to decide the shots.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.
Thank you for the details. I copied the API doc of qiskit-ibm-runtime and simplified the code by removing
_VARIANCE_UPPER_BOUND
.