Efficient template matching in quantum circuits
Given a large and a small quantum circuit, we are interested in finding all maximal matches of the small circuit, called template, in the large circuit under consideration of pairwise commutation relations between quantum gates. In this work we present a classical algorithm for this task that provably finds all maximal matches with a running time that is polynomial in the number of gates and the number of qubits of the circuit for a fixed template size. Such an algorithm finds direct applications in quantum circuit optimization. Given a template circuit for which a lower-cost implementation is known, we may search for all instances of the template in a large circuit and replace them with their optimized version.
READ FULL TEXT