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!
-
1$\begingroup$ You cannot create a non-unitary quantum gate. Unitarity is a necessary condition, and the only constraint on what makes a valid quantum gate. quantumcomputing.stackexchange.com/a/15805/13991 $\endgroup$– ryanhill1Commented Mar 30, 2023 at 14:22
-
$\begingroup$ @ryanhill1 isn't there a way to perform this operation on a qubit without using a gate? $\endgroup$– marcoqcCommented Mar 30, 2023 at 15:10
-
2$\begingroup$ There should be. Maybe this could help? quantumcomputing.stackexchange.com/a/13797/13991 $\endgroup$– ryanhill1Commented Mar 30, 2023 at 16:06
-
$\begingroup$ Here I used Stinespring dilation to simulate quantum channels: researchgate.net/publication/… $\endgroup$– Daniele CuomoCommented Apr 3, 2023 at 14:11
-
$\begingroup$ Somewhat related: quantumcomputing.stackexchange.com/questions/18591/… $\endgroup$– jecadoCommented Sep 1, 2023 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.
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.
-
$\begingroup$ 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? $\endgroup$– marcoqcCommented Mar 31, 2023 at 6:31
-
$\begingroup$ Especially when using real devices. $\endgroup$– marcoqcCommented Mar 31, 2023 at 6:40