I'm trying to implement a gate that does a non-unitary projection $|0\rangle\langle0|$ on Qiskit, but apparently I can't because only unitaries are allowed. Is there a work around? Simulating such a projection is necessary for the type of work I'm trying to do. Thanks!
-
1You cannot create a non-unitary quantum gate. Unitarity is a necessary condition, and the only constraint on what makes a valid quantum gate. https://quantumcomputing.stackexchange.com/a/15805/13991 – ryanhill1 Mar 30 '23 at 14:22
-
@ryanhill1 isn't there a way to perform this operation on a qubit without using a gate? – marcoqc Mar 30 '23 at 15:10
-
2There should be. Maybe this could help? https://quantumcomputing.stackexchange.com/a/13797/13991 – ryanhill1 Mar 30 '23 at 16:06
-
Here I used Stinespring dilation to simulate quantum channels: https://www.researchgate.net/publication/356206180_Witnessing_the_communication_advantage_of_the_Indefinite_Causal_Orders_on_IBM_Quantum_framework – Daniele Cuomo Apr 03 '23 at 14:11
-
Somewhat related: https://quantumcomputing.stackexchange.com/questions/18591/implement-a-projection-operator-as-a-quantum-circuit – jecado Sep 01 '23 at 14:00
2 Answers
It is true that quantum gates must be unitary. However, there is a trick for encoding non-unitary matrices in quantum circuits, called block encoding. See this answer to a similar question. There are a number of papers and software implementations, this is a recent one I am aware of.
- 687
- 3
- 10
I'm trying to do implement a gate that does a non-unitary projection |0><0|...
Other than measurement, quantum computers have to operate reversibly, which means reversible gate operators have to be unitary.
But the projector $P_0 = |0\rangle\langle 0|$ is not unitary since $$ P_0 P_0^\dagger = P_0^\dagger P_0 = P_0 \neq 1\;. $$
Thus $P_0$ is not a reversible quantum computing gate, since such gates are necessarily unitary.
Your $P_0$ should rather be referred to as a "measurement" operator, since it is a measurement operator, or more specifically a "projective measurement" operator.
How to implement such a projector in qiskit has already been discussed on this forum: here is a link.
- 878
- 3
- 13
-
Thanks! However, since there will also be other gates and qubits, isn’t there a way that works without using the statevector and evolve(), so that I can work directly on the single qubits? – marcoqc Mar 31 '23 at 06:31
-