-
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
Always return 1D vector from final_state_vector #5793
Conversation
Currently there is a special case for 0-qubit tensors, which causes the state vector to be returned as a scalar instead of a 1D vector of length 2**num_qubits == 1. Also change the `final_state_vector` property to use `_compat.cached_property`.
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
Optional: I'd add a unit test to ensure this "optimization" isn't added back in in future.
Automerge cancelled: A required status check is not present. Missing statuses: ['Pytest Windows (3.7)', 'Pytest Windows (3.8)', 'Pytest Windows (3.9)', 'Typescript lint check', 'Typescript tests', 'Typescript tests coverage'] |
Currently there is a special case for 0-qubit tensors, which causes the state vector to be returned as a scalar instead of a 1D vector of length 2**num_qubits == 1. Also change the `final_state_vector` property to use `_compat.cached_property`.
Currently there is a special case for 0-qubit tensors, which causes the state vector to be returned as a scalar instead of a 1D vector of length 2**num_qubits == 1. Also change the `final_state_vector` property to use `_compat.cached_property`.
Currently there is a special case for 0-qubit tensors, which causes the state vector to be returned as a scalar instead of a 1D vector of length 2**num_qubits == 1.
Also change the
final_state_vector
property to use_compat.cached_property
.