ラベル Superdense coding の投稿を表示しています。 すべての投稿を表示
ラベル Superdense coding の投稿を表示しています。 すべての投稿を表示

2024年1月23日火曜日

Development of scientific calculator-like quantum circuit simulator V2

(This is an English translation of a previous Japanese article)

I have been developing a quantum circuit simulator that is as easy to use as a scientific calculator. As a single smartphone app, you can try out various quantum algorithms and apps within the 3-qubit range. This time, version 2 has been completed. I also added a little bit of play.

If you shake your smartphone lightly, one of five icons will randomly appear. It's a little fun. Of the five images, one was created by me, while the other four were created by ChatGPT.
Of course, this is not the only thing. Added a playback function that applies quantum gates. That is, by recording the steps of an algorithm (which quantum gates were applied to which registers (qubits)) in sequence, and pressing one or two buttons, the algorithm can be played back. I found this to be very useful when showing a demo to someone or when running under different conditions myself. Although details are omitted, three algorithm playback examples recorded in this manner are shown below.

Superdense Coding
In Fig.1, Alice has the top two qubits (q0 and q1), and Bob has q2. Both qubits are in a state of quantum entanglement. Just like that, Bob went away. Alice wants to send any of the classical 3-bit information (000, 001, 010, ..., 111) to Bob. In other words, she wants to send "101" out of eight, for example, in (a). However, there are only two qubits that can be sent. This is not enough!
Nevertheless, with this wonderful Superdense Coding, Bob can always obtain any information from Alice simply by operating a predetermined quantum gate! Fig.1(b) shows this.
Grover's Algorithm
For example, assume that eight pieces of information (000, 001, ..., 111) are arranged randomly. The problem is finding specific information from among them. Fig.2 is an example of searching for "101". First, mark the information in (a). This is achieved by inverting the phase of the corresponding basis vector |101>. This is not a scam! It simply tells you what to look for. Without such information, the search itself is meaningless.
In (b), when the button Amp3step is pressed, the probability amplitude amplification is activated, and only the probability amplitude of the basis vector whose phase was inverted in (a) is amplified, and the desired information "101" is obtained. In this example, we only needed to perform the phase inversion and amplification pair once!
Quantum Fourier Transform
This is an application example of quantum Fourier transform QFT. One of the characteristics of QFT is that it can be applied to states of quantum superposition. In Fig.3(a), we created a superposition of two certain quantum states. Next, in (b), when the button QFT is pressed, the phase waves that are the results of each QFT in both states interfere and appear as separate phase waves. The wave swell can be seen from the phase angle and amplitude (area of the disk filled in red) in the lower part of (b).
Although omitted here, you can restore the original quantum superposition state by pressing the button next to it, IQFT. IQFT is the inverse quantum Fourier transform.

2024年1月21日日曜日

関数電卓型の量子回路シミュレータV2

 関数電卓のような使い勝手の量子回路シミュレータを目指し、独自に開発を進めてきた。1台のスマホのアプリとして、3-qubitの範囲で、種々の量子アルゴリズムやアプリをこれで試すことができる。今回、バージョン2を完成させた。遊びもちょっと入れてみた。
 スマホを軽く振れば、4つのアイコンのいずれかがランダムに現れる。ちょっと楽しい。4つのイメージのうち、1つは自作したが、他の3つはChatGPT氏によるものである。

 もちろん、これだけではない。目玉は、量子ゲート適用の再生機能を追加したことだ。すなわち、あるアルゴリズムの手順(どのレジスタ(量子ビット)にどの量子ゲート適用したか)を順に記録して、ボタン1つか2つを押すと、そのアルゴリズムが再生できる。これは、人にデモを見せたり、自分でも条件を変えて実行する場合に非常に便利であることが分かった。詳細は略すが、そのようにして記録した3つのアルゴリズム再生例を以下に示した。

Superdense Coding(超高密度符号化)
 Fig.1において、Aliceは上段の2つのqubit(q0とq1)を持ち、Bobは下段のq2を保有する。両者のqubitは量子もつれの状態にしてある。その後、Bobは遠方へ行ってしまった。もつれは保持されたままである。Aliceは古典3ビット情報(000, 001, 010, ... , 111)のどれかをBobに送りたい。つまり、8個のうちから、例えば、(a)では"101"を送たい。だが、送れるqubitは2つしかない。これでは足りない!
 それにも拘らず、この素晴らしいSuperdense Codingでは、Bobは常に予め決められた量子ゲートを操作するだけで、Aliceからのどの情報でも得られる!(b)はそれを示している。
Grover's Algorithm(グローバーの探索アルゴリズム)
 これは、例えば、8個の情報(000, 001, ... , 111)がランダムに並んでいるとする。その中から特定の情報を探し当てる問題である。Fig.2は、"101"を探す例である。まず、(a)で、その情報に印をつける。それは、対応するbasis vector |101>の位相を反転させることで実現させている。これはイカサマではない!単に、何を探すべきかの情報を与えているだけである。そもそも、そのような情報がなければ、探すこと自体が意味をなさない。
 (b)において、ボタンAmp3stepを押すと、確率振幅増幅が作動して、(a)で位相反転したbasis vectorの確率振幅だけが増幅されて、求める情報"101"が得られた。この例では、位相反転と増幅のペアをただ1回実行するだけで解決した!
Quantum Fourier Transform(量子フーリエ変換)
 これは、量子フーリエ変換QFTの適用例である。QFTの特徴の一つは、量子重ね合わせの状態に適用できることである。Fig.3(a)で、ある2つの量子状態の重ね合わせを作った。次に、(b)で、ボタンQFTを押すと、両方の状態のそれぞれのQFTの結果である位相の波が干渉して、別の位相波として現れる。(b)の下段の位相角度と振幅の大きさ(赤で塗り潰した円盤の面積)から、波のうねりが分かる。
 なお、ここでは省略したが、隣のボタンIQFTを押すと、元の量子重ね合わせ状態を復元できる。IQFTは、逆量子フーリエ変換である。

2023年12月19日火曜日

Superdense coding using my mobile quantum simulator

Japanese abstract
前のポストにおいて、2量子ビットシステムを3台のモバイルフォンで探究するためのアプリ(量子回路シミュレータ)を開発した。今回これを利用して、Superdense codingを実装してみた。Superdense codingは、少ない量子ビットを送ることでたくさんの古典ビット情報を送ることができるアルゴリズムである。このアルゴリズムは、量子重ね合わせと量子もつれを巧みに利用しており、これによって、私の開発したモバイルフォンアプリが正しく動作することを確認できた。

English abstract
In the previous post, I developed an app (quantum circuit simulator) to explore a two-qubit system using three mobile phones. This time I used this to implement Superdense coding. Superdense coding is an algorithm that can send many classical bits of information by sending fewer qubits. This algorithm makes clever use of quantum superposition and entanglement, and I was able to confirm that the mobile phone app I developed worked correctly. 

Superdense coding that sends classical 2-bit information with 1 qubit
Here, we will deal with Superdense coding, which allows you to send classical 2-bit information (any of 00, 01, 10, 11) by just sending one qubit. The details of the theory are carefully described in reference [1]. I implemented this algorithm with reference to that description. This will be explained specifically using Fig.1 and Fig.2.

Fig.1 shows the preparation phase. In the left column of Fig.1, Alice and Bob each have one qubit. Each is assigned to one mobile phone. The various quantum gates shown in the figure can be applied to freely change the qubit state. Here, (1) Alice applies Hadamard gate H to the initial state |0> to create a superposition state. On the other hand, (2) Bob applied the Pauli X gate to the initial state |1> and changed the state to |0>. These quantum states are transmitted to the control mobile phone on the right side via the real-time database CloudBD. Then, (3) tensor product is calculated to consider these two qubits as one system. Next, (4) Applying the CNOT gate creates a quantum entangled state. In other words, notice that the ”Entangled?” label has changed from false to true.

In Fig.2, (5)Alice applies  Pauli gate Y. As we will see later, applying this Y gate actually means selecting the classical 2-bit information "11". It then sends this qubit to Bob. On the other hand, at this point,  (6) Bob does not take any new action. The control mobile device on the right side of the figure (7)updates the tensor product to reflect Alice's application of the Y gate, but the entangled state is maintained. At this point, Bob will have a total of two qubits: the qubit sent by Alice and the qubit he originally had. Next, Bob has the control mobile device (8)apply the reverse Bell circuit. As a result, the quantum entanglement disappears ("Entangled?" false), and the probability of the basis vector |11> becomes 100%. In other words, if Bob makes a measurement here, he will get the classical bit information "11".

The most important point here is that Bob has no idea what Alice sent him before taking the measurements. Nevertheless, no matter which classical 2-bit information Alice sends, Bob can always simply apply the reverse Bell circuit. That way, Bob can get the information that Alice sent! This is the great thing about Superdense coding.

When sending classical bit information other than "11", it is shown in Fig.3. If Alice would like to send "00", she applies the I gate (no action). If she sends "01" she applies the X gate, and if she sends "10" she applies the Z gate. In any of these cases, as mentioned above, Bob only needs to perform the measurement after applying the reverse Bell circuit.

References
[1] Chris Bernhardt: Quantum Computing for Everyone, The MIT Press, 2020.
https://www.chrisbernhardt.info/