6

I am wondering if it is possible to generalize the Hadamard test for computing $\text{Re} \langle \phi | U | \psi \rangle$ (different states for left and right operands).

FDGod
  • 2,901
  • 2
  • 6
  • 31
francler
  • 181
  • 1
  • 8

1 Answers1

4

Yes, it is possible to adapt the Hadamard test to compute the real and imaginary parts of expectation values of the form $\langle \phi | U | \psi \rangle$, as shown in the figure below, where $|\psi \rangle \langle 0|$ corresponds to a unitary operation that prepares the state $|\psi \rangle$ starting from the fiducial state $|0\rangle$ and, as usual, the filled (empty) circle denotes a controlled-operation where the nontrivial action on the target-qubit(s) is triggered when the control-qubit is in state $|1\rangle$ ($|0\rangle$). As in the standard version of the Hadamard test, upon setting $b = 0$ ($b = 1$), the real (imaginary) part is given by $2P_0-1$, where $P_0$ is the probability of measuring the ancillary qubit in state $|0\rangle$. This is valid for an arbitrary number of qubits $n$ in the main register.

enter image description here

P.S.: As @gIS noted in a comment below before I made this update, this circuit does not compute $\textrm{Re}\langle\phi|U|\psi\rangle$ in the same sense that the SWAP test computes $|\langle\phi|\psi\rangle|^2$ or the original Hadamard test computes the real and imaginary parts of $\langle\psi|U|\psi\rangle$. Indeed, this adaptation of the Hadamard test does not take $|\psi\rangle$ and $|\phi\rangle$ as inputs, but rather encodes them via unitaries within the circuit itself. In fact, there cannot be a circuit taking $|\psi\rangle$ and $|\phi\rangle$ and giving as output the real part of $\langle\phi|U|\psi\rangle$, as that quantity would depend on the unphysical global phases of the ket states.

bm442
  • 1,317
  • 1
  • 6
  • 17