  We consider the quantum analogue of the pattern matching problem, which
consists of classifying a given unknown system according to certain predefined
pattern classes. We address the problem of quantum template matching in which
each pattern class ${\cal C}_i$ is represented by a known quantum state $\hat
g_i$ called a template state, and our task is to find a template which
optimally matches a given unknown quantum state $\hat f$. We set up a precise
formulation of this problem in terms of the optimal strategy for an associated
quantum Bayesian inference problem. We then investigate various examples of
quantum template matching for qubit systems, considering the effect of allowing
a finite number of copies of the input state $\hat f$. We compare quantum
optimal matching strategies and semiclassical strategies and demonstrate an
entanglement assisted enhancement of performance in the general quantum optimal
strategy.
