Preparing problems for execution on quantum computers can require many compilation steps. Automated compilation software is useful not only for easier and faster problem execution, but also for facilitating the comparison between different algorithmic choices. Here we describe mat2qubit, a Python package for encoding several classes of classical and quantum problems into qubit representations. It is intended for use especially on Hamiltonians and functions defined over variables (e.g. particles) with cardinality larger than 2. More specifically, mat2qubit may be used to compile bosonic, phononic/vibrational, and spin-
s problems, as well as classical problems such as graph coloring, routing, scheduling, and classical linear algebra more generally. In order to facilitate numerical analyses and ease of programmability, a built-in computer algebra system (CAS) allows for fully symbolic preparation and manipulation of problems (with symbolic operators, symbolic coefficients, and symbolic particle labels) before the final compilation into qubits is performed. We expect this code to be useful in the preparation and analysis of various classes of physics, chemistry, materials, and optimization problems for execution on digital quantum computers.
• This work proposes a practical initial layout method that utilizes matrix formulation to determine enhanced qubit assignments, without iterative optimization techniques and combinatorial search. • The proposed method computes the gradient of the objective function through a single matrix differentiation to obtain assignment suitability information between logical and physical qubits. • The gradient matrix encodes the interaction between physical-qubit centrality and logical-qubit connectivity, enabling direct mapping decisions that minimize error costs while satisfying hardware constraints. • Simulation results show that the proposed method improves computational efficiency while maintaining comparable execution reliability compared to existing qubit mapping methods. Qubit mapping is a crucial compilation process that assigns logical qubits from quantum circuits to physical qubits on quantum hardware, ensuring efficient and reliable execution on noisy intermediate-scale quantum (NISQ) computers. However, as the scale of quantum computers and circuit complexity increase, existing mapping approaches face significant computational complexity and suboptimal mapping quality. This work formulates the logic-to-physical qubit mapping problem as a matrix-form optimization problem to address scalability and computational efficiency challenges. The proposed method computes the gradient of the matrix-formulated problem through a single matrix differentiation and uses it as guidance to determine the enhanced qubit assignment, without the need for iterative combinatorial exploration and optimization solvers. Simulation results show that the proposed method achieves comparable execution reliability while significantly reducing the compilation time, even for multi-programming scenarios and large-scale quantum computers.
This paper considers the problem of quantum compilation from an optimization perspective by fixing a circuit structure of CNOTs and rotation gates then optimizing over the rotation angles. We solve the optimization problem classically and consider algorithmic tools to scale it to higher numbers of qubits. We investigate stochastic gradient descent and two sketchand-solve algorithms. For all three algorithms, we compute the gradient efficiently using matrix-vector instead of matrix-matrix computations. Allowing for a runtime on the order of one hour, our implementation using either sketch-and-solve algorithm is able to compile 9 qubit, 27 CNOT circuits; 12 qubit, 24 CNOT circuits; and 15 qubit, 15 CNOT circuits. Without our algorithmic tools, standard optimization does not scale beyond 9 qubit, 9 CNOT circuits, and, beyond that, is theoretically dominated by barren plateaus.