  Efficient overlap estimation of high-dimensional quantum states is an
important task in quantum information and a core element in computational
speedups of quantum machine learning. Here we experimentally demonstrate the
SWAP test that measures the overlap of two motional states in a system of
trapped $^{171}\mathrm{Yb}^+$ ions. To illustrate the versatility of our
implementation, we report the overlap measurement of a variety of quantum
states: Fock states, coherent states, squeezed vacuum states, and cat states.
We highlight applications of the SWAP test by measuring the purity of mixed
states. Our results enable quantum information processing with high dimensional
quantum states.
