Patent attributes
Systems and techniques that facilitate partitioned template matching and/or symbolic peephole optimization are provided. In various embodiments, a system can comprise a template component, which can perform template matching on a Clifford circuit associated with a set of qubits. In various aspects, the system can comprise a partition component, which can partition, prior to the template matching, the Clifford circuit into a computation stage, a Pauli stage, and a SWAP stage. In various instances, the template matching can be performed on the computation stage. In various embodiments, the system can comprise a symbolic component, which can select a subset of qubits from the set of qubits, rewrite at least one entangling gate in the computation stage such that a target of the at least one entangling gate is in the subset of qubits, and replace the at least one rewired entangling gate with a symbolic Pauli gate. In various cases, the symbolic Pauli gate can be a Pauli gate that is controlled by a symbolic variable. In various aspects, the system can comprise a peephole component, which can perform peephole optimization on the subset of qubits with the symbolic Pauli gate by implementing a dynamic programming algorithm.