Uncomputation

Uncomputation is a technique, used in reversible circuits, for cleaning up temporary effects on ancilla bits so that they can be re-used.

[1] Uncomputation is a fundamental step in quantum computing algorithms.

Whether or not intermediate effects have been uncomputed affects how states interfere with each other when measuring results.

[2] The process is primarily motivated by the principle of implicit measurement,[3][page needed] which states that discarding a register during computation is physically equivalent to measuring it.

Failure to uncompute garbage registers can have unintentional consequences.

are garbage registers.

Then, if we do not apply any further operations to those registers, according to the principle of implicit measurement, the entangled state has been measured, resulting in a collapse to either

with probability

What makes this undesirable is that wave-function collapse occurs before the program terminates, and thus may not yield the expected result.

This quantum mechanics-related article is a stub.

You can help Wikipedia by expanding it.

Creating a logical conjunction of the five controls out of Toffoli gates and ancilla bits. Uncomputation is used to restore the ancilla bits to their original states before finishing.