Skip to content

Combine Pauli measurements and postselection #7492

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ddddddanni
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the size: XL lines changed >1000 label Jul 15, 2025
Copy link
Collaborator

@eliottrosenberg eliottrosenberg left a comment

Choose a reason for hiding this comment

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

Thanks, Danni! This is a really great start! In addition to the comments below, it would be great if we could return the fraction of the bitstrings that survive the postselection, and maybe even more granular information in addition, like how many violate each of the symmetries. Maybe we can also optionally return the raw bitstrings to the users in case they want to do more analysis on them.

together.
postselection_symmetries: A dictionary mapping Pauli strings or Pauli sums to
expected values for postselection symmetries. The
circuit is the eigenvector of each Pauli string or
Copy link
Collaborator

Choose a reason for hiding this comment

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

-> "The final state generated by the circuit is an eigenvector ... with the specified eigenvalues."


circuit: circuits.FrozenCircuit
pauli_strings: list[ops.PauliString] | list[list[ops.PauliString]]
postselection_symmetries: dict[ops.PauliString | ops.PauliSum, int]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe this should default to None?


circuit: circuits.FrozenCircuit
pauli_strings: list[ops.PauliString] | list[list[ops.PauliString]]
postselection_symmetries: dict[ops.PauliString | ops.PauliSum, int]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I realized that if I try to construct a dictionary with PauliSums as keys, I get the error TypeError: unhashable type: 'PauliSum'. Do you have any suggestions of what to do here? Should we use tuples or make a new data structure?

@ddddddanni
Copy link
Contributor Author

Thanks, Danni! This is a really great start! In addition to the comments below, it would be great if we could return the fraction of the bitstrings that survive the postselection, and maybe even more granular information in addition, like how many violate each of the symmetries. Maybe we can also optionally return the raw bitstrings to the users in case they want to do more analysis on them.

I actually have

@attrs.frozen
class PostFilteringSymmetryCalibrationResult:
    """Result of post-selection symmetry calibration.
    Attributes:
        raw_bitstrings: The raw bitstrings obtained from the measurement.
        filtered_bitstrings: The bitstrings after applying post-selection symmetries.
    """

    raw_bitstrings: np.ndarray
    filtered_bitstrings: np.ndarray

Maybe I can add:

  1. fraction_of_survived_bistrings: float
  2. symmetry_to_filtered_bistrings: dict{paulistring|paulisum, list[bitstrings]}?

sampler: work.Sampler,
circuits_to_pauli_params: list[CircuitToPauliStringsParameters],
pauli_measurement_circuits: list[circuits.Circuit],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need this input given that we have circuits_to_pauli_params?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess the user doesn't use this function directly, so it's ok

@eliottrosenberg
Copy link
Collaborator

eliottrosenberg commented Jul 15, 2025

@ddddddanni ah, I missed that I can do .calibration_result.filtered_bitstrings and .calibration_result.calibration_result.filtered_bitstrings. That's great! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: XL lines changed >1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants