question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `cirq.state_vector_to_probabilities`

See original GitHub issue

Is 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:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mpharrigancommented, Aug 18, 2021

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.

1reaction
vtomolecommented, Aug 17, 2021

@ishmum123 It seems like @Patil2099 hasn’t responded to my ping. Feel free to look at this issue.

@prathameshbhole Yeah, that’s right.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found