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

2024年5月27日月曜日

量子ビットの位相の波の生成とその表示

【要旨】量子ビットの状態ベクトルの確率振幅は、確率と位相を含む。それぞれ独立したプロパティである。その両方をビジュアル化するにはいくつか方法がある。IBM QuantumのComposerでは、確率を棒グラフで、位相をカラーマップで示している。一方、小生が開発したモバイル量子回路シミュレータでは(他の多くのシミュレータに習って)確率は塗りつぶし円の面積で、位相は直線の傾きで表示している。どちらが使いやすいかは人それぞれだが、以下に比較のために図を載せた。(続編は→こちら

🔴位相回転角の計算式

🔴位相の波のビジュアル化
  Fig.1は、3-qubitの場合の、周波数=1の位相の波の生成である。全てのqubitにアダマール変換Hを施した後、上のqubitから順にそれぞれの位相(|0>に対する|1> の相対位相)を、45°、90°、180°に設定している。位相ゲートφを使っても良いのだが、ここでは、TゲートとSゲートを利用している。

 一方、Fig.2は、周波数=2の位相の波の生成である。アダマール変換後、今度は、上のqubitから順にそれぞれの位相を、90°、180°に設定している。最後のqubitの位相は360°なので何も設定していない。

 最初に見た時は、カラーマップにちょっと戸惑ったが、目が慣れてくると、位相の波の周期が識別しやすくなってきた。(a)、(b)どちらが使いやすいかは状況次第かもしれない。

🔴Composerのカスタムゲートを利用
  もう少し量子ビットを増やした場合も見てみる。Fig.3は、6-qubitの場合であるが、ここでは、Custum gate機能を使ってみた。Composerのビジュアル操作と連動するQASMのコードも表示される。場合によっては、QASMコードを編集する方が効率的かも知れない。ただし、QASMではラムダ式(ラムダ関数)がサポートされていないので、ちょっと使いにくかもしれないが。FIg.4には、このカスタムゲートのパラメータ(引数)を変えることで、周波数を変更させた結果を示す。あまり意味はないかもしれないが、単純に美しい。

2023年12月25日月曜日

Try Deutsch's and Grover's algorithms in my quantum circuit simulator

I wrote about the quantum circuit application (simulator) that I created using three mobile phones in previous articles. This time, I confirmed that Deutsch's and Grover's algorithms work correctly with this simulator. Note that in the diagram below, Alice's qubit (q0) and Bob's qubit (q1) are assigned to different mobile phones. The effects of each quantum gate are sent via CloudBD to a mobile phone for control.

Deutsch's algorithm

Many explanations regarding this have already been published, so I will omit the details. The Deutsch algorithm determines whether a function whose inputs are all 0 or 1 and whose function value also takes 0 or 1 is a constant function or a balanced function. Its feature is that by creating a special mechanism called Oracle, the judgment can be made with only one function evaluation.

Fig.1 and Fig.2 show that the Deutsch algorithm works correctly when the input is one variable using my quantum circuit simulator.

Grover's algorithm

Grover's algorithm searches for specific data in an unstructured data set. In the first stage of this algorithm, the data to be searched is first marked. In a quantum bit system, this means inverting the phase of the probability amplitude of the corresponding basis vector. This is achieved by creating a circuit called Oracle, just as in the case of Deutsch. Next, in the subsequent stage, a quantum circuit for amplifying the probability amplitude is assembled and executed. As a result, only the probability of the corresponding basis vector becomes 100%, so a search result can be obtained.

Figures 3 to 6 show that, using my quantum circuit simulator, the Grover algorithm works correctly in the case of classical 2-bit information (4 pieces of data) and obtains the desired results.

2023年12月5日火曜日

Final version of my single-qubit apps

I recently completed the final versions of two apps for single-qubit manipulation!

These apps were developed in a short period of time using MIT App Inventor. Although many existing blocks could be used effectively, some ingenuity was required to represent the qubit states on the Bloch sphere. The problem was to project 3D coordinate data (x, y, z) onto a 2-dimensional plane, and I was able to solve this problem by using the isometric projection method.

(1) Displaying the results of successive application of quantum gates
Five types of quantum gates (Z, X, Y, H, T) can be used. The figure below (b) shows the result of successively applying H, T, and H to the quantum bit |0>. The final qubit state is shown as a big red dot on the Bloch sphere on the left. Small disks are also shown to the right. The area of the filled disk indicates the probability of each basis (|0>, |1>). A straight line coming out from the center of the circle indicates the phase. At the bottom of the Bloch sphere, some numerical values indicating quantum states are also shown.

(2) Conversion to make the phase of α 0 in qubit α|0>+β|1>
In order to represent a quantum bit on a Bloch sphere, the phase of α needs to be 0, and the phase of β needs to be the relative phase (φ) to it. The app shown below achieves this functionality. This is also a transformation that makes the imaginary part of the complex number α 0. Figure (b) below confirms that this conversion function is working correctly.