-
Notifications
You must be signed in to change notification settings - Fork 984
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
Extract SV/DM/CliffordSimState from simulators #5260
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95-martin-orion
requested changes
Apr 19, 2022
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 of concerns with nontrivial method changes, but on the whole this is definitely looking nicer.
95-martin-orion
approved these changes
Apr 21, 2022
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.
Looks solid to me.
95-martin-orion
added
the
automerge
Tells CirqBot to sync and merge this PR. (If it's running.)
label
Apr 21, 2022
CirqBot
added
the
front_of_queue_automerge
CirqBot uses this label to indicate (and remember) what's being merged next.
label
Apr 21, 2022
CirqBot
removed
automerge
Tells CirqBot to sync and merge this PR. (If it's running.)
front_of_queue_automerge
CirqBot uses this label to indicate (and remember) what's being merged next.
labels
Apr 21, 2022
tonybruguier
pushed a commit
to tonybruguier/Cirq
that referenced
this pull request
Apr 22, 2022
First part of quantumlib#5244, so that we don't have two variants of "XYZSimulatorState". @95-martin-orion As mentioned in a comment to that issue, these sim states aren't exposed to the end user (except CliffordState), and end up being an unnecessary layer that wraps the ActOnArgs used in the simulation. This PR removes them from the simulation, and instead uses the ActOnArgs (specifically the OperationTarget[ActOnArgs]) directly. This allows us simply to deprecate and remove those classes in the future. (For Clifford, we also remove it from the simulation logic, and only create the CliffordState object in the public functions that expose it). There are two distinct parts to this PR. The first was to move some of the shared logic between ActOnArgs and ActOnArgsContainer down a level in the hierarchy to OperationTarget. (*Primarily* this was to give a common `qubit_map` property rather than having to create one from the `qubits` each time it was required subsequently. The second part is the migration from using the existing XYZSimState classes to using the ActOnArgs directly. The root of this is in `StepResultBase._simulator_state`. Previously each XYZStepResult defined its own `_simulator_state` property, that created the XYZSimState we're trying to extract. This PR deletes those and replaces them with the new `StepResultBase._simulator_state`, which returns the `OperationTarget[TActOnArgs]` instead. That bubbles up into `_final_simulator_state`, and the various functions in the XYZStepResults and XYZTrialResults have been modified to account for that change. Finally, since the simulators are no longer bound to these `XYZSimulatorStates` anymore, `TSimulatorState` is removed from the type parameters everywhere possible.
CirqBot
pushed a commit
that referenced
this pull request
Apr 22, 2022
rht
pushed a commit
to rht/Cirq
that referenced
this pull request
May 1, 2023
First part of quantumlib#5244, so that we don't have two variants of "XYZSimulatorState". @95-martin-orion As mentioned in a comment to that issue, these sim states aren't exposed to the end user (except CliffordState), and end up being an unnecessary layer that wraps the ActOnArgs used in the simulation. This PR removes them from the simulation, and instead uses the ActOnArgs (specifically the OperationTarget[ActOnArgs]) directly. This allows us simply to deprecate and remove those classes in the future. (For Clifford, we also remove it from the simulation logic, and only create the CliffordState object in the public functions that expose it). There are two distinct parts to this PR. The first was to move some of the shared logic between ActOnArgs and ActOnArgsContainer down a level in the hierarchy to OperationTarget. (*Primarily* this was to give a common `qubit_map` property rather than having to create one from the `qubits` each time it was required subsequently. The second part is the migration from using the existing XYZSimState classes to using the ActOnArgs directly. The root of this is in `StepResultBase._simulator_state`. Previously each XYZStepResult defined its own `_simulator_state` property, that created the XYZSimState we're trying to extract. This PR deletes those and replaces them with the new `StepResultBase._simulator_state`, which returns the `OperationTarget[TActOnArgs]` instead. That bubbles up into `_final_simulator_state`, and the various functions in the XYZStepResults and XYZTrialResults have been modified to account for that change. Finally, since the simulators are no longer bound to these `XYZSimulatorStates` anymore, `TSimulatorState` is removed from the type parameters everywhere possible.
rht
pushed a commit
to rht/Cirq
that referenced
this pull request
May 1, 2023
…5281) Follow-up to quantumlib#5260, as that PR makes final_step_result unnecessary. Also deprecate DensityMatrixSimulatorState and StateVectorSimulatorState Closes quantumlib#5271
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
First part of #5244, so that we don't have two variants of "XYZSimulatorState".
@95-martin-orion
As mentioned in a comment to that issue, these sim states aren't exposed to the end user (except CliffordState), and end up being an unnecessary layer that wraps the ActOnArgs used in the simulation. This PR removes them from the simulation, and instead uses the ActOnArgs (specifically the OperationTarget[ActOnArgs]) directly. This allows us simply to deprecate and remove those classes in the future. (For Clifford, we also remove it from the simulation logic, and only create the CliffordState object in the public functions that expose it).
There are two distinct parts to this PR. The first was to move some of the shared logic between ActOnArgs and ActOnArgsContainer down a level in the hierarchy to OperationTarget. (Primarily this was to give a common
qubit_map
property rather than having to create one from thequbits
each time it was required subsequently.The second part is the migration from using the existing XYZSimState classes to using the ActOnArgs directly. The root of this is in
StepResultBase._simulator_state
. Previously each XYZStepResult defined its own_simulator_state
property, that created the XYZSimState we're trying to extract. This PR deletes those and replaces them with the newStepResultBase._simulator_state
, which returns theOperationTarget[TActOnArgs]
instead. That bubbles up into_final_simulator_state
, and the various functions in the XYZStepResults and XYZTrialResults have been modified to account for that change.Finally, since the simulators are no longer bound to these
XYZSimulatorStates
anymore,TSimulatorState
is removed from the type parameters everywhere possible.