Skip to content
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

Merged
merged 23 commits into from
Sep 23, 2019

Conversation

viathor
Copy link
Collaborator

@viathor viathor commented Sep 16, 2019

First part of #2113.

@googlebot googlebot added the cla: yes Makes googlebot stop complaining. label Sep 16, 2019
@viathor viathor requested a review from Strilanc September 16, 2019 17:49
cirq/experiments/__init__.py Outdated Show resolved Hide resolved
cirq/experiments/fidelity_estimation.py Show resolved Hide resolved
cirq/experiments/fidelity_estimation.py Outdated Show resolved Hide resolved
cirq/experiments/fidelity_estimation.py Show resolved Hide resolved
cirq/experiments/fidelity_estimation.py Outdated Show resolved Hide resolved
cirq/experiments/fidelity_estimation.py Outdated Show resolved Hide resolved
cirq/experiments/fidelity_estimation.py Show resolved Hide resolved
cirq/experiments/fidelity_estimation.py Outdated Show resolved Hide resolved
cirq/experiments/fidelity_estimation.py Outdated Show resolved Hide resolved
cirq/experiments/fidelity_estimation_test.py Outdated Show resolved Hide resolved
from cirq.sim import final_wavefunction


def compute_linear_xeb_fidelity(
Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Collaborator Author

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).

cirq/experiments/fidelity_estimation.py Outdated Show resolved Hide resolved
cirq/experiments/fidelity_estimation.py Outdated Show resolved Hide resolved
cirq/experiments/fidelity_estimation_test.py Outdated Show resolved Hide resolved
cirq/experiments/fidelity_estimation_test.py Show resolved Hide resolved
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(
Copy link
Contributor

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(...)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #2153.

cirq/experiments/fidelity_estimation_test.py Outdated Show resolved Hide resolved
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:
Copy link
Contributor

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #2154.

cirq/experiments/fidelity_estimation_test.py Outdated Show resolved Hide resolved
@viathor viathor merged commit 0b141c4 into quantumlib:master Sep 23, 2019
@viathor viathor deleted the fidelity_estimation branch September 23, 2019 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants