-
Notifications
You must be signed in to change notification settings - Fork 982
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
Feature request: state preparation gate #4119
Comments
@dabacon could you assign me to this one? I am considering taking this one up for some time now and want to give it a try. I might need some time before I will be able to open a PR. Also, do you see any potential rabbit holes I could tap into? 🐰🕳️ |
@balopat thanks! 🙂 |
Alright, I had a first look at this and have a few open questions:
I do not have a good answer to this one. I think it would be simpler for me to implement it as a gate, but I am open to discussion!
|
Looking through #4120 and the cirq-custom-channel RFC I get the feeling that this one should be implemented as a channel as well after #4120 is done. That way, it would be more consistent. But it's just a feeling without being deep into the discussion or the code base |
From cirq meeting: cirq's general philosophy is to maintain close correspondence with what is happening on the hardware. From this perspective, the preparation that takes an arbitrary state, as proposed above, is too general. That said, as @dabacon pointed out, some platforms do offer preparations other than |0⟩, some of which are quite powerful (e.g. entangled photon pair preparation using BBO crystals). Therefore, this needs more discussion. Hopefully, we can arrive at a more general preparation than we have at the moment while adhering to the above hardware proximity principle. |
@dabacon , @viathor def ghz_prep(qubit_count: int) -> Circuit:
"""
Create a quantum circuit that loads a GHZ state.
Args:
qubit_count: The number of qubits.
Returns:
The corresponding quantum circuit.
"""
qubits = [cirq.GridQubit(i, 0) for i in range(qubit_count)]
ghz_circuit = cirq.Circuit()
ghz_circuit.append(cirq.H(qubits[0]))
for i in range(qubit_count-1):
ghz_circuit.append(cirq.CNOT(qubits[i], qubits[i+1]))
return ghz_circuit |
Reviving this old thread based on some newly gained information. OverviewAs per feedback from the physics team (cc @Dripto), it's very common for theorists to follow a pattern where they need to Prepare an arbitrary two qubit state
|
@tanujkhattar, Why only 2-qubit states? For example, how do you load the result vector for the HHL algorithm? |
@tanujkhattar, Why only 2-qubit states? For example, how do you load the result vector for the HHL algorithm? |
Other preparation circuits would also be very useful, and any tool which creates provably efficient circuits in larger scales should certainly also be added if they exist. However in this case I've already written up the two qubit case, since that's what I needed. |
Cirq Sync:
|
Implements a new gate to reset on all channels and prepare an arbitrary state over n-qubits by returning the Kraus operator for the same. Associated tests included. Closes #4119.
Implements a new gate to reset on all channels and prepare an arbitrary state over n-qubits by returning the Kraus operator for the same. Associated tests included. Closes quantumlib#4119.
Is your feature request related to a use case or problem? Please describe.
State preparation is a physical process. In some architectures it is even possible to prepare entangled states. In many cases you want to call this during intermediate steps in the circuit. It would be useful to have a state preparation gate.
Describe the solution you'd like
A gate that allows you to pass in a state:
One question is whether this is a channel and if it is a channel is it from dimension 1 to the dimension of the qubits being prepared?
[optional] Describe alternatives/workarounds you've considered
You can combine a cirq.ResetGate with a cirq.MatrixGate
[optional] Additional context (e.g. screenshots)
Arose during discussion of #4048 which asks for the state preparation algorithm, for which there are a ton of different choices.
What is the urgency from your perspective for this issue? Is it blocking important work?
P2 to P3 - we should do it in the next couple of quarters
The text was updated successfully, but these errors were encountered: