2024年10月16日水曜日

Testing my mobile quantum circuit simulator

[Abstract] This article tests the applicability of the mobile quantum circuit simulator Qsim_multi that I have developed so far with MIT App Inventor. As examples, I have taken the inverse Quantum Fourier transform and the order finding problems that appear in a recently published book. These form the basis of Shor's prime factorization algorithm. In conclusion, I have confirmed that my simulator Qsim_multi can handle these problems successfully.

🔴 A new book on quantum computing
Recently, I bought a new book (FIg.1) by Nivio Dos Santos. The title is "How to code for Quantum Computers", but it is not a so-called how-to book, but a compact summary of basic concepts. As soon as you open the book, you get the feeling that something fun is written in it. In the second half, the quantum Fourier transform, quantum phase estimation, and Shor's algorithm calculations are explained in detail. Therefore, I would say that this is a book for beginners to intermediate level.
Although the main text does not include any program code, the Python code (Jupyter Notebook) for the Google Cirq environment is publicly available on the Web, which is useful.

I ran the following two examples from the book on my mobile quantum simulator. However, I noticed something important here. That is the order of the quantum bits. My simulator is the same as IBM Qiskit, but in Cirq, the order is reversed. Therefore, it was necessary to reverse it. However, even if I did that, for example, the results of the quantum Fourier transform would have different phases even if the probabilities of each basis were the same. If you keep that in mind, there is no problem.

🔴 Example1: Using Inverse-QFT
First, here is an example using the inverse quantum Fourier transform. Fig.2 shows the circuit diagram and quantum state consisting of 16 bases explained in this book. The inverse quantum Fourier transform invQFT is shown in its expanded form. The small filled circles in each circle indicate the probability, and the slope of the red line indicates the phase.
The result of converting this to my simulator and running it is shown in Fig. 3. This simulator has a built-in inverse quantum Fourier transform (IQFT), so I used it as is. Comparing the quantum state with Fig. 2, the probability is the same, and the phase is a mirror image. This result shows that my simulator is operating normally.

🔴 Example2: Finding the order of [gk mod N = 1]
Next, we will look at the order-finding problem, which is important in Shor's algorithm. Here, we find the order of the specific example "7k mod 15 = 1", that is, the smallest integer k that satisfies this equation.

The quantum circuit and the order discovery results are shown below. Fig. 4 is from the Cirq environment, and Fig. 5 is from my simulator. The measurement results after applying "7k mod 15 " and invQFT were consistent for both in a 3-qubit system. That is, out of the eight possibilities, only 010, 100, 000, and 110 were measured with equal probability. By approximating the result to a rational number, we obtained 1/4, and found that the order was 4. The details of why we can say this and its relationship to Shor's algorithm are shown below:

 2024年7月9日火曜日
 Shor's Algorithm:量子コンピューティングの学びの最高峰
In Fig. 4, the measurement results are shown as the frequency of occurrence in 1000 trials, and in Fog.5 they are shown as probability calculation results.

In addition, in my simulator in Fig. 5, the measured values ​​for the four cases (3-qubit) are divided into four. This is a little difficult to see, so it would be better to summarize it as shown in Fig. 4. I would like to address this in the next version update.

🔴Conclusions
For simple cases of the inverse quantum Fourier transform and the order finding problem, my mobile quantum circuit simulator gave identical results to those run in the Google Cirq environment, confirming the applicability of the simulator to a certain extent.

0 件のコメント:

コメントを投稿