-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add cirq.sample_final_state_vector method #1740
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
Comments
Good first issue for the ambitious. |
I'm no expert, but I would like to try to give one of these issues a try. How difficult do you think this will be to resolve @vtomole? |
@Lucaman99 I encourage you to try it out and let us know when you get stuck (if you do). Note: there are other easier issues here:
good first issue
|
@vtomole Great, I'll give it a shot! Thank you! |
|
@Strilanc Awesome, I'll try doing that |
Hey @vtomole @Strilanc, sorry, this is irrelevant to the actual issue, but I've been trying to setup the virtual environment for Cirq development for a few hours now and for some the reason the virtualenvwrapper library is just not working. It doesn't recognize commands when I try to create a new virtual environment. Would you happen to have any suggestions for resolving this issue? |
Sometimes you need to open a new terminal after installing. virtualenvwrapper is a system dependency, so pip installing cirq or its python dependencies won't install it. |
@Strilanc Yeah I installed all of the requirements.txt and restarted the terminal, still not recognizing the command. |
In that case I'm not sure what to do. You can always fall back to using virtual envs in the standard way, with a |
Ok, I'll give that a try, thanks! |
Hey @Strilanc, I've been playing around with the cirq.final_wavefunction method and it is making sense. I was wondering though, when you say you don't want this new method to allow "fully general channels", what exactly do you mean by that? |
Hey @Strilanc - So to construct the cirq.sample_final_wavefunction I took the cirq.final_wavefunction method and removed the condition that all gates have to be unitary. I tested it with a bit flip method acting on a qubit in a small circuit, and it seemed to work (it outputted the correct wavefunction). The issue is that I can only call this new method as cirq.sim.mux.sample_final_wavefunction. If I simply try to call cirq.sample_final_wavefunction, it doesn't work. Do you know why that would be happening? |
Also @Strilanc, how would one differentiate between mixtures and fully-general channels? (Sorry for all the questions 😂) |
In addition, I tried using the cirq.has_mixture as opposed to cirq.has_unitary method, but for some reason, this didn't work (it kept throwing the same error, meaning that cirq.has_mixture(arg) = False for an argument that should return True). |
Hey @Lucaman99 ,
A fully general channel is an operation that implements
You have to import it within
This is likely a bug in |
Hey @Strilanc Thank you for your response! For the |
On the other hand, the |
Yes, please open an issue. That's a serious bug. |
@Strilanc Will do! Any idea what could be causing the bug? |
Probably something silly like checking for |
I can try this out |
An example of a channel to test mixtures with can be created using |
Is help still needed on this? I see that the final_wavefunction is being deprecated for final_state_vector. |
Yes @satw1knandala, we'd love to see this implemented, yes, I renamed the issue to state_vector. |
Sure, I will get started on this one. You can assign me. Thanks! |
update: still working on this. should be done by end of week |
@Strilanc @balopat i was able to create the function sample_final_state_vector, but I am writing tests and have a few questions -
Thanks! |
@balopat are we still tracking this? thank you |
@artvandalay404 Feel free to post a PR with what you have. My knee jerk reaction is that similar test should be fine, but would have to see the actual code. Maybe there's a middle ground. Testing against a channel, I'd just use an existing channel like phase damp. I don't see a need to make a custom matrix. |
@Strilanc Does this issue mean (a) sample a result efficiently from the union of possible final state vectors, or (b) run a simulation to get a single sample final state vector in its entirety?
|
When a circuit has noise, it does not have a well defined final wavefunction. But as long as the noise is all in the form of mixtures, it is still possible to sample from the possible final wavefunctions as efficiently as if you were running a unitary simulation.
Things this issue involves:
The text was updated successfully, but these errors were encountered: