3

In connection to this question, I am wondering how to calculate value $\langle \psi|\phi \rangle$ for arbitrary quantum states $|\psi\rangle$ and $|\phi\rangle$.

A swap test is able to return only $|\langle \psi|\phi \rangle|^2$ which means that sign of the product is forgotten in case the inner product is real. Moreover, information about real and imaginary parts is lost in case of complex result.

Do you know about any more general method how to calculate the inner product than swap test?

Martin Vesely
  • 13,891
  • 4
  • 28
  • 65
  • 2
    A method for finding $\langle\psi|\phi\rangle$ would let us observe the global phase which is unobservable. To see this set $|\psi\rangle = |0\rangle$ and $|\phi\rangle=e^{i\theta}|0\rangle$. Therefore, no such method exists. – Adam Zalcman May 28 '21 at 18:14
  • There are methods to estimate the inner product see https://quantumcomputing.stackexchange.com/q/6339/11793 which shows how to get the real part. You can use a similar trick to estimate the imaginary part of the inner product, thus giving you an estimate of the whole thing. Though you would need to be able to prepare the states and run the circuit over and over again. – Condo May 28 '21 at 18:31
  • @Condo That only works if you are given a state that already incorporates $|\psi\rangle$ and $|\phi\rangle$ with a fixed phase relationship. If all you have is two separate states, your quoted method won't work. – Quantum Mechanic May 28 '21 at 18:41
  • I don't know what you mean by "fixed phase relationship", but I'm thinking about $|\psi\rangle$ and $|\phi\rangle$ as elements of a projective Hilbert space i.e. where $\lambda|\psi\rangle$ and $|\psi\rangle$ for $\lambda\in \mathbb{C}$ are the same physical state. – Condo May 28 '21 at 18:53
  • I'm thinking of the two states as elements of different Hilbert spaces. If you're given two different qubits (or whatever) with unknown physical states, the method to which you linked will not work. That's because we cannot have a procedure that takes $|0,\phi,\psi\rangle$ to $|0,\psi,a\rangle+|1,\phi,b\rangle$. – Quantum Mechanic May 28 '21 at 19:09
  • So your method will work if you begin with $|\psi\rangle+\lambda|\phi\rangle$, if you begin with $|0,\psi\rangle+\lambda|1,\phi\rangle$, etc., but it won't work if you are actually given two separate physical states. – Quantum Mechanic May 28 '21 at 19:10
  • @AdamZalcman Since the Hadamard test allows us to measure $\langle ψ|U|ψ \rangle$. What if you perform a Hadmard test with $U=A∗B$ and let $|ψ\rangle=|0 \rangle$ then $\langle ψ|U|ψ⟩=⟨0|AB|0 \rangle=\langle a|b \rangle$ with assumption that $A|0 \rangle =|a \rangle$ and $B|0 \rangle=b \rangle$ ? – KAJ226 Feb 09 '22 at 23:49
  • @KAJ226 Good question! Hadamard test is insensitive to global phase, because the phase factor attached to the state cancels out when the state appears both as a ket and as a bra. Any phase factor you do measure in the test actually comes from $U$ which, if you look at the test's quantum circuit, is actually a controlled-$U$. In a controlled-$U$ gate, any global phase factor attached to $U$ (or $A$ or $B$) is in fact a relative phase between the branches formed by the control qubit's $|0\rangle$ and $|1\rangle$ states. – Adam Zalcman Feb 10 '22 at 00:01
  • 1
    BTW: It's also interesting to consider how this plays out in the swap test where the measurable quantity is the absolute value of $\langle\psi|\phi\rangle$. – Adam Zalcman Feb 10 '22 at 00:12
  • 1
    The existence of global phase is really an artifact of using kets to represent quantum states. In a sense, it is more appropriate to use a tensor product of a ket $|\psi\rangle$ and its adjoint $\langle\psi|$. When we apply some $M$ to $|\psi\rangle$, its adjoint $M^\dagger$ is automatically applied to $\langle\psi|$. This is clear in density matrix formalism where e.g. unitary evolution is $U\rho U^\dagger$ and which avoids the issue of the unobservable global phase. – Adam Zalcman Feb 10 '22 at 00:13

1 Answers1

3

I doubt that this is possible. Given a state $|\phi\rangle$, we have no method for distinguishing it from $e^{i\varphi}|\phi\rangle$ for any phase $\varphi$. This means that we have no way of distinguishing between $$\langle\psi|\phi\rangle\qquad \mathrm{vs.}\qquad e^{i\varphi}\langle\psi|\phi\rangle.$$ Specifically, we can choose $\varphi$ such that $$e^{i\varphi}\langle\psi|\phi\rangle=|\langle\psi|\phi\rangle|.$$ We thus should be precluded from measuring anything other than this absolute value.


To get around this constraint, we would need to set up a superposition of $|\phi\rangle$ and $|\psi\rangle$ like $$|\Psi\rangle\propto |\psi\rangle+|\phi\rangle.$$ Only then could we get around the global phase problem. I would be interested in seeing a circuit that can take $$|0\rangle|\psi\rangle|\phi\rangle\to|\Psi\rangle|a\rangle|b\rangle$$ for any generalized ancilla $|0\rangle$ and final states $|a\rangle$ and $|b\rangle$. If I had to guess, I would say that it is impossible to perform this transformation with a fixed relative phase in $|\Psi\rangle$. We might be happy saying that $$|0\rangle|\psi\rangle|\phi\rangle\to\frac{|\psi\rangle+|\phi\rangle}{\mathcal{N}}|a\rangle|b\rangle$$ for some normalization constant $\mathcal{N}$, but then we would need to also be happy with the transformation $$|0\rangle|\psi\rangle e^{i\varphi}|\phi\rangle\to\frac{|\psi\rangle+e^{i\varphi}|\phi\rangle}{\mathcal{N}}|a\rangle|b\rangle,$$ but that is nonsensical for the same deterministic transformation, because the initial states $|0\rangle|\psi\rangle |\phi\rangle$ and $|0\rangle|\psi\rangle e^{i\varphi}|\phi\rangle$ are indistinguishable.

Quantum Mechanic
  • 4,244
  • 3
  • 25