-
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
Add a classical simulator to Cirq #5822
Comments
xref: #3079 |
Note we've got a very basic implementation already in the test case for custom_simulator: https://github.com/quantumlib/Cirq/blob/master/cirq-core/cirq/contrib/custom_simulators/custom_state_simulator_test.py I recommend starting there, copying it to its own non-test file, and then fleshing out the |
I have a student who can do this project. |
@daxfohl the example custom simulator doesn't support things like e.g. CNOT. Do we have to switch on the gate type in |
Correct, @cduck's implementation has the proper state transition logic. My example shows how to integrate into the custom simulator infrastructure so that you get subcircuit traversal, classical control, etc. for free. So the actual implementation needs to combine these two things. |
How though? Is |
I was imagining having methods on classical gates that could express their classical action on a bitstring without tensoring up a unitary |
I see, yeah you could make a new protocol like if cirq.has_application_to_bitstring(op):
state = cirq.apply_to_bitstring(op, state, indices)
elif cirq.has_unitary(op):
self._simulate_unitary(op, state, indices)
else:
self._simulate_mixture(op, state, indices) or something along those lines. That way you get the |
From Cirq sync: reverting back to accepted. @viathor let us know if there's anything you'd like to discuss |
Oh, I think I added triage/discuss by accident (probably missed that the issue already had a triage/* label). |
@mpharrigan As discussed offline, can you write a brief comment / code piece describing how the simulator using the protocol to act on a numpy array and falling back to the unitary application would look like? And potential advantages and challenges in using the protocol to act on 2D numpy arrays for sampling multiple classical input states in a vectorized fashion? @dstrain115 How's the progress on this with the student? Are there any roadblocks in the initial exploration? |
Hello, I'd like to take a stab at this issue. I was not involved before. Will read through current implementation and comment history and then provide a comment with my understanding and strategy for the implementation. |
@navaro1 Thanks! I've assigned the issue to you. Looking forward to your follow up summary comment. |
Here are some key points from the discussion and potential strategy:
Questions (cc: @tanujkhattar):
|
I can see that there is PR for classical simulator already - #6124. I think it would make sense to reassign this issue to author of that PR for now. I am still interested in helping, but do not want to duplicate the work. |
This has been completed. |
The feature request is to add a classical simulator which can simulate X / CNOT and multi-controlled X gates, similar to
ToffoliSimulator
in Q#See https://docs.microsoft.com/en-us/azure/quantum/machines/toffoli-simulator
cc @mpharrigan to add more context
P2 - we should do it in the next couple of quarters
cc @augustehirth This would need documentation once we get this done.
The text was updated successfully, but these errors were encountered: