1
$\begingroup$

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!

$\endgroup$
5

2 Answers 2

2
$\begingroup$

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.

$\endgroup$
0
$\begingroup$

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.

$\endgroup$
2
  • $\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$
    – marcoqc
    Mar 31, 2023 at 6:31
  • $\begingroup$ Especially when using real devices. $\endgroup$
    – marcoqc
    Mar 31, 2023 at 6:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.