2025年5月17日土曜日

Exploring Quantum Entanglement through Visualization

[Abstract]
The Mermin-Peres Magic Square is a well-known example that illustrates quantum entanglement. I have written related articles in the past (in Japanese, available [here]). This time, I aimed to deepen my understanding by visualizing the phenomenon, using four different methods:
(1)Display of a disk shape using my own simulator, (2)3D Qsphere representation with Qiskit, (3)Pauli correlation analysis, and (4)Measurement on IBM Quantum real hardware.

🔴Example: Tiny Mermin-Peres Magic

An explanation of this example is provided [here]. As shown in Fig. 1, Alice and Bob each possess two qubits. In the first half, their qubit pairs are prepared in an entangled quantum state, ǀψ₁⟩. After that, there is no further interaction between them. Nevertheless, when the final state ǀψ₂⟩ is measured, a strong correlation is observed between their outcomes (as shown later in Fig. 2 and Fig. 3). Specifically, the number of "1"s in the 2-bit classical measurement results is always even for one party and odd for the other. This reveals a strong inverse (or anti-) correlation.

🔴Confirmation Using a Homemade Quantum Circuit Simulator

Figure 2 shows the results of verifying the behavior of this example using a homemade quantum circuit simulator. The probability and phase of each basis state are displayed on a disk. In addition, numerical lists of the probability amplitudes, probabilities, and phases are provided.

For example, in the quantum state ǀψ₁⟩, if Alice's qubits are in the state ǀ00⟩, Bob's qubits will definitely be in the state ǀ11⟩. In the final state ǀψ₂⟩, if Alice is in the state ǀ00⟩, Bob's state will be either ǀ01⟩ or ǀ10⟩. It is also possible to confirm whether the total number of "1"s in the measured classical bitstrings is even or odd, as described earlier. In other words, this disk representation allows us to visually understand the quantum entangled state shared between Alice and Bob.

🔴3D display of quantum states using Qiskit's Qsphere

Quantum entanglement cannot be separated into individual qubit states, so quantum states cannot be displayed individually on a Bloch sphere. However, by using Qiskit's Qsphere, it is possible to simultaneously display all possible basis states on a sphere, as shown in Fig. 3. Here, the size of the circle at the tip of the quantum state vector is the probability value, and the color indicates the phase. It matches well with the disk display in Fig. 2.


🔴Indication of the strength of quantum entanglement by Pauli correlation

One way to investigate the quantum entangled state in more detail is the Pauli correlation measurement. This is based on the fact that, for example, the expectation value when the quantum state ǀψ⟩ is measured on the Z axis is calculated as follows: ⟨ZZ⟩ = ⟨ψǀ Z⊗Z ǀψ⟩

As an example, for the Bell state ǀψ⟩ = (ǀ00⟩+ǀ11⟩)/√2, calculations show that ⟨ZZ⟩ = 1, which means that the Z measurements of the two qubits are correlated in exactly the same direction. On the other hand, for the simple tensor product ǀψ⟩ = ǀ01⟩, ⟨ZZ⟩ = -1, which shows a strong correlation in the opposite direction but is not entangled.

In Fig. 4, in addition to the Z measurement, X and Y measurements are also performed. Although the above Pauli measurements can calculate correlations, they do not necessarily fully reflect the "quantum entanglement". Therefore, in some cases, measurements other than the Z measurement may be performed.
In Fig. 4, ZZ(q2,q3) on the horizontal axis is the ⟨ZZ⟩ calculation for Bob's quantum bit, and ZZ(q0,q1) on the vertical axis is the ⟨ZZ⟩ calculation for Alice's quantum bit. The color of the square at the intersection represents the product of their values ​​(expectation values). The darker the red, the closer it is to +1.

In the state ǀψ1⟩, if the Z measurement results of Alice's two qubits are in the same direction, then the Z measurement results of Bob's two qubits will also be in the same direction. If, on the other hand, the Z measurement results of Alice's two qubits are in opposite directions, then the Z measurement results of Bob's two qubits will also be in opposite directions. Such a strong correlation is also observed in ⟨XX⟩ and ⟨YY⟩, so they can be said to be in a fully entangled state.

On the other hand, in the state ǀψ2⟩, the Z measurement of the two qubits will have the same direction for either Alice or Bob, but different directions for the other. Therefore, it makes sense that the squares in the right panel of Fig. 4 are dark blue (the product of the expectations is -1).
 
🔴Measurement results on an actual IBM Quantum computer

Finally, Fig. 5 shows the measurement results on an actual IBM Quantum computer. This is the result of 10,000 shots performed on one of the most advanced machines, ibm_torino (Heron r1). Although there are some errors (likely due to noise) in both the measurements for the quantum states ǀψ1⟩ and ǀψ2⟩, the results well support the calculation results shown in Fig. 2, Fig. 3, and Fig. 4. It is once again amazing how far quantum computers have progressed!

2025年5月16日金曜日

可視化で量子もつれの理解を深める

【要旨】量子もつれを利用した例題の一つにMermin-Peres Magicがある。関連記事は過去にも書いてきた。(ここです)今回は、ビジュアル化によってさらに理解を深めたいので、量子状態の表示と分析を4通りの方法で行なってみた。①自作シミュレータでの円盤表示、②QiskitのQsphereによる3D表示、③パウリ相関測定、④IBM Quantumマシンによる実測である。

🔴例題Tiny Mermin-Peres Magic
 この例題の説明はここ示した。Fig.1に示す通り、AliceとBobはそれぞれ2量子ビットを保有している。両者の量子ビット対は、前半で量子もつれの状態 ǀψ1⟩となる。それ以降は両者のインタラクションは無い。それにもかかわらず、最終状態 ǀψ2⟩を測定すると、(後でFig.2やFig.3に示すように)両者に強い相関が見られる。すなわち、両者の測定結果の古典2ビット列に含まれる"1"の個数は、必ずどちらかは偶数個であり、他方は奇数個になる。いわば逆向きの強い相関である。

🔴自作量子回路シミュレータによる確認
 この例題の動作を、自作の量子回路シミュレータで確認した結果をFig.2に示す。起こり得る基底状態の確率と位相が円盤に表示される。また、確率振幅、確率、位相の数値リストも表示されている。
 例えば、量子状態 ǀψ1⟩では、Aliceがǀ00⟩ならばBobは必ずǀ11⟩となる。最終状態 ǀψ2⟩では、例えば、Aliceがǀ00⟩ならばBobはǀ01⟩か又はǀ10⟩となり、上述した測定古典ビットでの"1"の個数が偶数か奇数も確認できる。すなわち、この円盤表示から、両者の量子もつれの状況を掴むことができる。

🔴QiskitのQsphereによる量子状態の3D表示
 量子もつれ状態は、個々の量子ビット状態に分離できないので、Bloch球に個別に量子状態を表示することはできない。しかし、QiskitのQsphereを利用すると、Fig.3に示す通り、起こり得る基底状態を同時に球面に表示することができる。ここで、量子状態ベクトルの先端の円の大きさは確率の値であり、色は位相を示す。Fig.2の円盤表示と良く合致している。

🔴パウリ相関による量子もつれの強さの表示
 量子もつれ状態をさらに詳しく調べる方法の一つはパウリ相関測定である。これは、例えば、量子状態 ǀψ⟩をZ軸測定した場合の期待値が以下のように計算されることに基づく。
⟨ZZ⟩ = ⟨ψǀ Z⊗Z ǀψ⟩
 一例として、ǀψ⟩ = (ǀ00⟩+ǀ11⟩)/√2というベル状態の場合は、計算してみると、⟨ZZ⟩ =1となる。これは2つの量子ビットのZ測定結果が確実に同じ方向になる相関を意味する。一方、ǀψ⟩= ǀ01⟩という単なるテンソル積ならば、⟨ZZ⟩ = -1となり、逆向きの強い相関を示すが、量子もつれではない。
 Fig.4では、Z測定に加えて、X測定とY測定も行なっている。上記のような各パウリ測定は、相関を計算できるが、必ずしも「量子もつれ」を完全に反映したものではない。そのため、場合によっては、Z測定以外の測定を行うことがある。
 Fig.4の横軸のZZ(q2,q3) は、Bobの量子ビット状態に対する⟨ZZ⟩ であり、縦軸のZZ(q0,q1) は、Aliceの量子ビット状態に対する⟨ZZ⟩ である。そして、その交点に示された正方形の色は、それらの値(期待値)の積を表現している。濃い赤色ほど+1に近い。
 状態 ǀψ1⟩においては、Aliceの2量子ビットのZ測定結果が同一方向ならば、Bobの2量子ビットのZ測定結果も同一方向となる。あるいは、AliceとBobのZ測定結果は、ともに異なる方向となる。そのような強い相関が、⟨XX⟩ と⟨YY⟩ でも観測されるので、両者は完全なもつれ状態にあると言える。
 一方、状態 ǀψ2⟩では、2量子ビットのZ測定結果は、AliceとBobのどちらかでは同じ方向となり、他方では異なる方向となる。したがって、Fig.4の右側の図の正方形は濃い青色(期待値の積は-1)になることは納得できる。
 
🔴IBM Quantum コンピュータ実機での測定結果
 最後に、IBM Quantum実機での測定結果をFig.5に示す。最新鋭機の一つibm_torino(Heron r1)で、10,000 ショット実行した結果である。量子状態 ǀψ1⟩と ǀψ2⟩での測定とも、若干のエラー(ノイズによると思われる)が生じているが、Fig.2、Fig.3、Fig.4で示した計算結果をよく裏付ける結果となっている。量子コンピュータが、ここまで進歩してきたことに改めて驚く次第である!

2025年5月9日金曜日

最新版Qiskit2.0を利用した量子コンピューティングの解説書

 IBMの量子コンピューティング開発プラットフォームQiskitは、頻繁に改訂されることで有名だ。研究開発が活発な証しではあるが、時として以前に書いたコードが動かなくなる状況が発生し、困ることも多い。直近では、かなり大幅な改訂版となったQiskit2.0が公開されている。IBMのサイトに関連ドキュメントはあるが、これを取り上げた書籍は(和書、洋書とも)まだ見当たらないと思っていた。ところが、以下の和書が早くも出版されていることを知り驚いた!
中山茂、Qiskit2.0 量子コンピューティング入門、2025年5月
🔴本書の特徴(深い理論も実際に動くコードでイメージを掴みやすい)
 著者の中山茂教授は、これまでもタイムリーに量子関連書籍を多数執筆されている。彼の著書では、量子コンピューティングに関するかなり深い理論も、量子回路シミュレータや量子コンピュータ実機で実際に動くコードを示して、分かりやすく説明している。それが最大の特徴と言える。それによって、読者はイメージを掴みやすく、より深く理解しようという意欲が湧く。

 本書(全214頁)の内容は、量子コンピューティングの基本から始まり、量子テレポーテーション、グローバー探索、量子フーリエ変換、ショアの因数分解といった重要なアルゴリズムをカバーしている。そして、ショアの因数分解に等に現れる量子/古典のハイブリッドアルゴリズムが、現状では実際的であることを強調している。実際、ショアの因数分解では、古典的には困難なモジュロ冪函数の周期発見を量子アルゴリズムで、そして、その後のユークリッド互除法を古典的に行う方法を、実際に動くコードを使って詳細に説明している。

 実は、さらに素晴らしいと感じたのが第4章(量子非局所性と期待値計算)である。ここでも、Qiskitコードを使って、量子物理学の根幹に関わる量子非局所性を説明している。すなわち、ベル状態でのテンソル積の期待値測定の量子回路を組んで、その測定結果を示しながら量子非局所性を実験的に証明している。

🔴量子状態 ∣ψ⟩に対する演算子Aの期待値 ⟨ψ∣A∣ψ⟩
 上に述べた「ベル状態でのテンソル積の期待値測定」の一つを具体的に見てみよう。
 例えば、ベル状態の一つを ψ = (1/√2)(∣01⟩+∣10⟩)とする。その時、⟨ZZ⟩=⟨ψ∣Z⊗Z∣ψ⟩は、パウリZ演算のテンソル積(行列)の期待値を与える。その値は、(具体的な展開計算は略すが)-1となる。これは、2つの量子ビットに対するZ基底測定が、それぞれ異なる値(0 or 1)となることが確実なことを意味する。そのような逆向きの強い相関である。
 このことを、QiskitのStatevectorクラスを使ったQiskitコードを作り確認している。すなわち、それを実行させると測定値が-1となり、手計算の結果と合致すること分かる。
(以下の図は、本書に載っているものではなく、私が用意した参考図である。)

2025年5月5日月曜日

IBM Quantum無料枠の利用可能時間の計算が変更になった!

 IBM Quantum無料利用枠の新しい計算方法:最近気付いたことだが、私にとってはちょっと重要事項なので書き留める!

 IBM Quantumの無料プラン(Open Plan)における利用時間の計算方法は、これまでの「28日毎にリセットされる固定制」から、「直近28日間のローリングウィンドウ制」に変更さた!ただし、IBM Quantum の新しいプラットフォーム(early access)の場合である。6月末まで利用可能な旧プラットフォームはそのままのようだが。
Here’s the image illustrating the change in IBM Quantum’s free usage calculation method.
An example

🟢変更前:固定制(28日毎に自動リセット)
 これまでは、Open Planの利用時間は28日毎に0:00 UTCにリセットされ、28日あたり最大10分間の量子計算時間が提供されていた。

🟢変更後:ローリングウィンドウ制(直近28日間)
 現在は、直近28日間の累積利用時間が10分間に制限される「ローリングウィンドウ制」が採用されている。28日経過しても、自動的にまた10分間使えるようにリセットされることはない!

 この変更により、過去28日間の利用状況に応じて残り時間が変動するので、それを念頭に量子コンピュータ実機を使わなければならない。これが本来の姿かも知れない。