-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Consistent final_state_vector #5267
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
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Shout-out to @tanujkhattar for the Transformers API - it massively simplified the process of migrating drop-terminal-measurements behavior from in-simulation to pre-simulation. Thanks Tanuj! |
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.
Some initial comments on the newly added transformer.
Also, glad to see more uses of the transformer api infra :)
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.
LGTM % one final concern around a breaking change
Fixes quantumlib#3693. This pushes `Circuit.final_state_vector` and `mux.final_state_vector` towards a shared API of: ```python def final_state_vector( program: 'cirq.CIRCUIT_LIKE', *, initial_state: 'cirq.STATE_VECTOR_LIKE' = 0, param_resolver: 'cirq.ParamResolverOrSimilarType' = None, qubit_order: 'cirq.QubitOrderOrList' = ops.QubitOrder.DEFAULT, ignore_terminal_measurements: bool = False, dtype: Type[np.number] = np.complex64, seed: 'cirq.RANDOM_STATE_OR_SEED_LIKE' = None, ) -> 'np.ndarray': ``` Additionally, calls to `Circuit.final_state_vector` will now pass through the simulator instead of using `apply_unitary`. Notable changes in `Circuit`: - `qubits_that_should_be_present` is deprecated - Use of positional args is deprecated - The default of `ignore_terminal_measurements` will change to `False` in v0.16 - The default of `dtype` has directly changed to `np.complex64` Notable changes in `mux`: - Addition of `ignore_terminal_measurements` parameter Other changes: - Added `drop_terminal_measurements` transformer
Fixes quantumlib#3693. This pushes `Circuit.final_state_vector` and `mux.final_state_vector` towards a shared API of: ```python def final_state_vector( program: 'cirq.CIRCUIT_LIKE', *, initial_state: 'cirq.STATE_VECTOR_LIKE' = 0, param_resolver: 'cirq.ParamResolverOrSimilarType' = None, qubit_order: 'cirq.QubitOrderOrList' = ops.QubitOrder.DEFAULT, ignore_terminal_measurements: bool = False, dtype: Type[np.number] = np.complex64, seed: 'cirq.RANDOM_STATE_OR_SEED_LIKE' = None, ) -> 'np.ndarray': ``` Additionally, calls to `Circuit.final_state_vector` will now pass through the simulator instead of using `apply_unitary`. Notable changes in `Circuit`: - `qubits_that_should_be_present` is deprecated - Use of positional args is deprecated - The default of `ignore_terminal_measurements` will change to `False` in v0.16 - The default of `dtype` has directly changed to `np.complex64` Notable changes in `mux`: - Addition of `ignore_terminal_measurements` parameter Other changes: - Added `drop_terminal_measurements` transformer
Fixes #3693.
This pushes
Circuit.final_state_vector
andmux.final_state_vector
towards a shared API of:Additionally, calls to
Circuit.final_state_vector
will now pass through the simulator instead of usingapply_unitary
.Notable changes in
Circuit
:qubits_that_should_be_present
is deprecatedignore_terminal_measurements
will change toFalse
in v0.16dtype
has directly changed tonp.complex64
Notable changes in
mux
:ignore_terminal_measurements
parameterOther changes:
drop_terminal_measurements
transformer