-
Notifications
You must be signed in to change notification settings - Fork 1k
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
XEB fidelity estimator for large circuits #2114
Conversation
from cirq.sim import final_wavefunction | ||
|
||
|
||
def compute_linear_xeb_fidelity( |
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 word compute
is redundant; drop it. Just linear_xeb_fidelity
.
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.
Or e.g. linear_xeb_fidelity_of_samples
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.
Agree with dropping "compute". I wouldn't append "of_samples" since it's equally redundant: samples are the only type of input that XEB fidelity estimator supports (as is explained in the comments).
n_incoherent = int(depolarization * n_samples) | ||
n_coherent = n_samples - n_incoherent | ||
incoherent_samples = np.random.randint(dim, size=n_incoherent) | ||
circuit_with_measurements = cirq.Circuit.from_ops( |
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.
Append with circuit + cirq.measure(...)
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.
Filed #2153.
incoherent_samples = np.random.randint(dim, size=n_incoherent) | ||
circuit_with_measurements = cirq.Circuit.from_ops( | ||
circuit, cirq.measure(*qubit_order, key=MEASUREMENT_KEY)) | ||
if n_coherent > 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 think this optimize belongs inside sim.run
instead of outside of it. Also this is test code; don't worry about 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.
Filed #2154.
First part of #2113.