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!
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.
- 746
- 4
- 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.
- 1,113
- 4
- 13