Simulation of a computable diagonal Hamiltonian (source code)

= Simulation of a computable diagonal Hamiltonian

Let $A|x\rangle=a(x)|x\rangle$, where a <reversible circuit> $C$ computes $a(x)$ into a clean register. Then applying $e^{-ita(x)}$ as a phase on that register and performing <uncomputation> implements $e^{-itA}$ on the data register. For $a(x)=(-1)^{f(x)}$, a Boolean output qubit suffices: $C^\dagger(I\otimes e^{-itZ})C$ acts as $e^{-itA}$ when that qubit starts in $|0\rangle$. This exact construction avoids a <Lie-Trotter product formula> because the eigenvalue is computed directly.