An out-of-place implementation computes a result in additional storage while preserving the input values. This is useful when later calculations still need the original inputs or intermediate values. section 6.4.1
For the Boolean NOT function, the reversible out-of-place transformation is:
- F_NOT(x, y) = (x, y ⊕ NOT x) = (x, y ⊕ x ⊕ 1). section 6.4.1
- Apply a CNOT from the input qubit to the output qubit, then apply X to the output qubit. section 6.4.1
- The input remains x while the target becomes y ⊕ x ⊕ 1; X and CNOT may be reversed because they commute here. section 6.4.1
