Add `cirq.state_vector_to_probabilities`
See original GitHub issueIs your feature request related to a use case or problem? Please describe.
I need a function that takes in a state_vector
and returns the probabilities of it’s amplitudes.
Describe the solution you’d like
Add a def state_vector_to_probabilities()
to
https://github.com/quantumlib/Cirq/blob/master/cirq-core/cirq/value/probability.py
[optional] Describe alternatives/workarounds you’ve considered Defined my own:
from cirq.value.probability import validate_probability
def state_vector_to_probabilities(state_vector: np.ndarray) -> np.ndarray:
probabilities = np.abs(state_vector) ** 2
validate_probability(probabilities, "sum of the amplitudes of the state vector")
return probabilities
What is the urgency from your perspective for this issue? Is it blocking important work? P3 - I’m not really blocked by it, it is an idea I’d like to discuss / suggestion based on principle
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Cirq basics | Google Quantum AI
This tutorial will teach the basics of how to use Cirq. It will walk through how to use qubits, gates, and operations to...
Read more >Get started with Cirq on IonQ Hardware
In this guide: How to install Cirq and use it to run a quantum circuit on IonQ hardware. Time: 15–30 Minutes.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, I believe my comment https://github.com/quantumlib/Cirq/issues/4322#issuecomment-888539664 was me hastily transcribing notes from the Cirq Cync call that requested exactly that.
@ishmum123 It seems like @Patil2099 hasn’t responded to my ping. Feel free to look at this issue.
@prathameshbhole Yeah, that’s right.