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日間の利用状況に応じて残り時間が変動するので、それを念頭に量子コンピュータ実機を使わなければならない。これが本来の姿かも知れない。

2025年4月29日火曜日

御礼:ブログページビュー(アクセス数)20万回超え

🔴感謝:本ブログへのアクセス回数が20万回に到達
 2016年末に開設したこのブログ、このほど、20万回webビュー(アクセス)に達した。直近の約130件(これまでの総計は約500件)はほとんど量子コンピューティングに関する記事である。ブログアイコンもそれらしくした。ご愛読、そして、フィードバックしていただいた方々に御礼申し上げたい。


🔴実用的な量子コンピュータへの道は険しい
 最近、国産の256量子ビット(世界最大規模の)コンピュータが開発されたというニュースがあった。素晴らしいことだが、その発表には、実用問題を解くには最低6万量子ビットを要するうえ、現在は達成されていないノイズ耐性が必要ということが含まれていた。すなわち、これで世界が変わった!というわけでは全くない。その先はとてつもなく険しそうだ。

 この業界の巨人IBMのロードマップでも、2025年に156x7 = 1092量子ビットでError suppression and mitigation(誤り抑制と緩和)、2026年以降にError correction(本格的に?誤り訂正)となっている。例えば、Shor's素因数分解アルゴリズムの実用化には、100万量子ビットが必要との情報もある。研究開発は続く... 。私もできるだけ学び、少しづつ前へ進み、ブログ記事も続けたい。

 そんな厳しい状況だが、大手企業やベンチャー、大学などでは多くの人々が活発に量子コンピューティングに関して、論文やSNSでの発信を行なっている。それは、ますます増える傾向にある。私自身も、わずかながら、そういう人たちと何らかのつながりを持とうとしてやっている。

🔴本ブログ記事を査読、引用、掲載して戴いた方々に感謝
 これまでに下記の方々に、量子コンピューティングに関する私のブログ記事を査読参照掲載して戴いた。とてもありがたいことである。すでに、それらに関する記事は個別に掲載済みだが、ここ改めて感謝したい。

(1) Chris Bernhardt (Prof. of Mathematics at Fairfield University)
・掲載サイト:Chris Bernhardt info

(2) Isaac L. Chuang (Prof. of Physics MIT), Selim Tezel (MIT App Inventor Education Team Lead)
・掲載サイト:MIT App Inventor Stories from the Field, 理化学研究所 Q-Potal

(3) Nivio dos Santos (Product Manager at Avalara Brasil)
・掲載サイト:http://www.nivio.com.br/

(4) Javier Mancilla Montero (PhD in Quantum Computing, Quantum Machine Learning Researcher)
・掲載サイト:Linkedin記事
・当方の元記事:Visualizing and Understanding QSVC

(5) Peter Y. Lee (Ph.D. in EE from Princeton, faculty member at Fei Tian College)
・掲載サイト:Polaris QCI Publishing Web site

2025年4月28日月曜日

A Basic Mathematics Book for Learning Quantum Computing

In the previous article, we introduced a new book on quantum computing. However, many people may want to first learn basic mathematics before reading such books. I would like to briefly introduce the following book as one such book. Generally speaking, the relationship between this book and the previous one is as follows:

Peter Y. Lee, James M. Yu, Ran Cheng :Mathematical Foundations of Quantum Computing, Polaris QCI Publishing, 2025.

This book is a large volume of 539 pages. It provides a very thorough explanation of the basics of mathematics related to quantum computing. Parts 1 and 2 are basic mathematics, mainly linear algebra. However, since Dirac Notation (bra-ket) is already used here, it becomes clear that this is not purely basic mathematics, but is aimed at quantum computing. The authors explain that readers who have already mastered the basics of linear algebra can skip these parts and move on to Part 3. Even for such readers, Part 2 is very useful for reviewing points that they may have forgotten. In other words, this book also serves as an encyclopedia.

In the third and fourth parts, the most important operations in quantum computing are explained in detail, with a focus on "Tensor products". Although it is not very noticeable, it is worth noting that the "Change of Basis" introduced in the second part is explained in more detail in this third part. This will be important in many fields,  including quantum key distribution later. You will also see that the "Kronecker Product" is important in simplifying quantum computing. More advanced content such as "Singular Value Decomposition" is also included. Furthermore, one of the outstanding features of this book is that "Probability", another foundation of quantum computing, is dealt with extensively in the fourth part.

At the beginning, there is a "Level Indicator" explanation, which is useful for understanding the level of difficulty of the content. However, it would be even better if it had a marking to indicate which of the minimum necessary knowladge is required to read the second book, "Quantum Computing & Information." This is because this book contains a huge amount of content, and some people want to study efficiently. For example, it may be okay to skip "Discrete Fourier Transform" and "Markov Chains" for the time being.

2025年4月24日木曜日

Visualizing and Understanding QSVC

[Abstract] 
QSVC (Quantum Support Vector Classifier) ​​can sometimes produce new classification decision boundaries that are different from those of classical SVC. An example of this was reported in a previous article. This time, we visualized (part of) the QSVC process that leads to this point. Visualization is not simply beautiful or easy to understand. While it can help us understand the mechanism in concrete terms, it can also be a trigger for new questions to arise, encouraging progress. Javier's book “QML Unlocked” was very useful, and is mentioned at the end of this article.

🔴What to visualize
A small dataset for visualization, 16 samples of Gaussian Parity, was prepared. It consists of two features and a label. The parts to be visualized in the overall flow of QSVC are shown below.
  1. Normalization (scaling) of input data: No need for visualization.
  2. Reduction of input data dimension: Not necessary in this case, since it is two-dimensional (2 features).
  3. Display of input data: Draw data samples in a 2D scatter plot. → Figure 1
  4. Convert input data to quantum state: Display quantum state on Bloch sphere. → Figure 2
  5. Create quantum kernel matrix: Represented as a heat map. → Figure 3
  6. Perform SVC learning: Display the resulting classification decision boundary in 2D. → Figure 4

🔴Visualization of Quantum Feature Map

Here, we use ZZFeatureMap, which is equipped in Qiskit, to convert each sample of the input data in Figure 1 into a quantum state (feature vector). The result is plotted on two Bloch spheres, as shown in Figure 2. As shown in the figure, ZZFeatureMap is a system (considered to be four-dimensional) that includes two quantum bits of entanglement and phase shift, so quantum states are displayed in both q0 and q1.

🔴Visualization of Quantum Kernel Matrix

Next, we create a quantum kernel matrix using the results of the feature map. Each element is the fidelity calculated by the inner product of two combinations of quantum states. Figure 3 shows this matrix as a heat map. The brighter it is, the higher the similarity.
Classical SVC also implicitly calculates the corresponding similarity using a kernel function during training. On the other hand, quantum QSVC calculates all similarities in advance to create a kernel matrix, which is then passed to classical SVC training. SVC training has the option kernel='precomputed'. QSVC repeatedly runs the quantum circuit for all combinations of inputs to create a quantum kernel matrix.

Now, this quantum kernel matrix does not contain any original label information. Therefore, classification cannot be performed using this matrix alone. Learning  (SVC learning) using this matrix and label information is required. However, even with just Figure 3, it is possible to predict whether two samples are likely to fall into the same class or into different classes.

For example, the similarity between the vectors of sample numbers 0 and 2 is quite low, as shown in [A] in Figure 3. As shown in Figure 2, the two are almost orthogonal. And they have different labels. Therefore, it is highly likely that they will be placed in different classes.
Furthermore, the similarity between the vectors of sample numbers 4 and 8 is quite high, as shown in [B] in Figure 3. As shown in Figure 2, the two are also heading in a similar direction. And they have the same label. Therefore, it can be predicted that they will be highly likely to be placed in the same class.

🔴Visualization of classification decision boundary

Next, using the quantum kernel matrix in Figure 3 and the original label information, classification training is performed. This training is the same as classical SVC training. The resulting decision boundary is shown in Figure 4. The relationship between data points 0 and 2 [A] and the relationship between 4 and 8 [B] are as expected above.

🔴The decisive difference between quantum QSVC and classical SVC

The decisive difference between QSVC and classical SVC is not whether the kernel matrix is ​​calculated in advance, but in which space the vector inner product (similarity) is calculated. In classical SVC, the input data is also classified after mapping it to a high-dimensional space using a kernel function. However, the properties and structure of that space are different from QSVC.
In QSVC, it is important to know what kind of quantum feature map is used to convert the input into a quantum state. Whether or not QSVC's superiority is demonstrated depends on whether the feature map can realize a mapping that is difficult to realize classically.

🔴[Reference book] Introduction to Javier's "QML Unlocked"

There are few books in Japanese to learn quantum machine learning. The ones already published have a strong theoretical aspect and are not very suitable for beginners. In the meantime, the English book by Javier Mancilla Montero, shown in Figure 5, has very easy-to-understand explanations. Although the above example is my own original work, I obtained very useful information from this book, so I would like to briefly introduce the contents of this book.
It is a compact book (228 pages in total) with 10 chapters. Chapters 1-3 are an overview of quantum computing and machine learning. Chapters 4-7 cover QSVC, and chapters 8-10 cover more advanced topics such as VQC (Variational Quantum Classifier).

Overall, the book focuses on the explanation of QSVC. Although there are few mathematical expressions, the description is precise and quite deep. The explanation of creating a quantum kernel using several types of feature maps is excellent. Going further, it also attempts to combine them for SVC learning (multi-kernel learning). It explains this concretely using quantum platforms such as Qiskit and PennyLane. All the codes provided were able to run perfectly in my local environment.

Those who reach Chapter 4 for the first time may be a little confused. This is because the chapter explains code that demonstrates (1) MinMaxScaling, (2) dimensionality reduction using principal component analysis, (3) quantum state generation using ZZFeatureMap, (4) quantum kernel matrix generation, and (5) SVC learning all at once for a large dataset consisting of 1,000 samples with 20 features. However, there is no need to worry, because the following chapters explain dimensionality reduction in detail in Chapter 5, FeatureMap in Chapter 6, and SVC learning using quantum kernels in Chapter 7. In other words, the overall picture is shown first, followed by specific discussions.

For large-scale input data, creating feature maps and quantum kernel matrices, and training using them takes a lot of time in simulation. Although this book is not a programming book, as a countermeasure, it also provides multi-core parallel processing code using the PennyLane library and Python joblib. In fact, on my M1-mac-mini (8 cores), I was able to achieve a speedup of more than four times.

----------------------------------------------------------
🟢Special thanks to Javier Mancilla Montero, Ph.D. for posting this article of mine on Linkedin, see below.
----------------------------------------------------------

2025年4月23日水曜日

量子サポートベクタ分類QSVCのビジュアル化

【要旨】QSVC(Quantum Support Vector Classifier)により、古典SVCの場合とは異なる新たな分類決定境界が得られる場合がある。その一例を先の記事で報告した。今回は、そこに至るQSVCの過程(の一部)をビジュアル化してみた。ビジュアル化は、単に、美しい、分かり易いではない。具体的に仕組みを納得できる一方、新たな疑問が湧くきっかけともなり、進歩を促す。

🔴何をビジュアル化するのか
 ビジュアル化のための小さなデータセット、Gaussian Parityの16サンプルを用意した。2つのfeatureとラベルから成る。QSVC全体の流れにおいて、ビジュアル化する箇所を以下に示す。
  1. 入力データの正規化(スケーリング):ビジュアル化の必要は特になし。
  2. 入力データの次元削減:今回は2次元(2 features)なので不要。
  3. 入力データの表示:データサンプルを2D散布図に描く。→図2
  4. 入力データを量子状態に変換:ブロッホ球に量子状態を表示。→図3
  5. 量子カーネル行列の作成:ヒートマップとして表現。→図4
  6. SVC学習を行う:結果としての分類決定境界を2D表示。→図5

🔴Quantum Feature Mapの可視化
 ここでは、Qiskitに装備されているZZFeatureMapによって、図2の入力データを量子状態(特徴ベクトル)に変換する。その結果を、図3の示すとおり、2つのブロッホ球に描いた。ZZFeatureMapは、図の通り、2量子ビットのEntanglementとPhase Shiftを含む一つの(4次元と見做せる)システムであるため、q0とq1の両方に量子状態を表示する。

🔴Quantum Kernel Matrixの可視化
 次に、Feature Mapの結果を使って量子カーネル行列を作る。その各要素は、2つの量子状態の組合わせについて、その内積で計算された類似度(fidelity)である。この行列を、ヒートマップとして表現したものが図4である。明るいほど、類似度が高い。

 古典SVCでも、これに該当する類似度を学習中に暗黙にカーネル関数で計算する。一方、量子QSVCの場合は、予め全部の類似度を計算してカーネル行列を作り、古典SVCの学習へ渡すのである。SVCの学習には、kernel='precomputed'というオプションがある。QSVCでは、入力の全ての組み合わせについて、量子回路を繰り返し実行し、量子カーネル行列を作る。

 さて、この量子カーネル行列には、元のラベル情報は一切入っていない。したがって、これだけで分類を行うことはできない。この行列とラベル情報を使った学習(SVC学習)が必要である。だが、図4だけでも、2つのサンプルが同じクラスに入り易いか、または別々のクラスになり易いかを予想することはできる。

 例えば、サンプル番号0と2のベクトルの類似度は図4の[A]の通りかなり低い。図3でも両者はほぼ直交している。そして、両者は異なるラベルを持っている。したがって、両者は別々のクラスに入る可能性が高いであろう。
 また、サンプル番号4と8のベクトルの類似度は図4の[B]の通りかなり高い。図3でも両者の向きは近い。そして、両者は同一ラベルを持っている。したがって、両者は同じクラスに入る可能性が高いと予想できる。

🔴分類の決定境界の可視化
 次に、図4の量子カーネル行列と元のラベル情報を使って、クラス分けの学習が行われる。この学習は、古典SVCの学習と同じものである。その結果としての決定境界を図5に示した。データポイント0と2の関係[A]、4と8の関係[B]は、上述の予想通りである。

🔴量子QSVCと古典SVCの決定的な違い
 QSVCと古典SVCの決定的な違いは、カーネル行列を事前に計算するか否かではなく、どの空間においてベクトルの内積(類似度)を計算するかである。古典SVCにおいても、カーネル関数を用いることで入力データを高次元空間へ写像した後に分類を行う。しかし、その空間の性質や構造はQSVCとは異なる。
 QSVCでは、どのような量子Feature Mapによって入力を量子状態に変換するかが重要である。QSVCの優位性が発揮されるか否かは、そのFeature Mapが古典的には実現困難な写像を実現できるか否かによる。

🔴[参考書] "QML Unlocked"(量子機械学習の扉を開く)の紹介
 量子機械学習を学ぶための日本語の書籍は少ない。既刊のものは理論的側面が強く初心者にはあまり向かない。そんななか、図6に示した、Javier Mancilla Montero氏による英語の書籍は説明がとてもわかりやすい。今回の上述の事例は私のオリジナルではあるが、この書籍から大いに参考になる情報を得たので、簡単に本書の内容を紹介したい。
 小型本(全228ページ)で、10章からなる。第1〜3章は、量子コンピューティングと機械学習の概説である。第4〜7章はQSVCを、また、第8〜10章はより進んだVQC(Variational Quantum Classifier)などを扱っている。

 全体的に見て、QSVCの解説に重点が置かれている。数式はほとんど出てこないが、叙述は精緻であり、かなり深い。いくつかの種類のFeature Mapを使って量子カーネルを作る説明が優れている。さらに進んで、それらを組み合わせてSVC学習させること(Multi Kernel Learning)も試みている。それを、QiskitやPennyLaneなどの量子プラットフォームを用いて具体的に説明している。提供されている全てのコードは、私のローカル環境で完全に動かすことができた。

 初めてChapter4に達した人は、ちょっと戸惑うかもしれない。そこでは、20 featuresの1000サンプルからなる大きなデータセットに対して、(1)MinMaxScaling、(2)主成分分析による次元削減、(3)ZZFeatureMapによる量子状態生成、(4)量子カーネル行列の生成、(5)SVC学習、の全てを一気にデモするコードを解説しているからである。しかし、心配ご無用である。続くChapter5では次元削減が、Chapter6ではFeatureMapが、Chapter7では量子カーネルを使ったSVC学習が、詳細に説明されているからである。つまり、先に全体像が示され、その後、各論が続いている。

 大規模入力データの場合、Feature Mapと量子カーネル行列の作成、およびそれを用いた学習には、シミュレーションでは多くの時間を要する。本書は、プログラミングの本ではないが、その対策として、PennyLaneのライブラリとPythonのjoblibを使って、マルチコア向け並列処理コードも提供している。実際、私のM1-mac-mini(8コア)では、4倍を超える高速化が実現できた。

2025年4月18日金曜日

量子機械学習の第一歩QSVC(Quantum Support Vector Classifier)

【要旨】古典的手法では見つけられなかった(or できなかった)ことが、量子的手法では可能になったという事例があれば勇気付けられる。その一つとして、量子計算を用いたQSVC(Quantum Support Vector Classifier)が、古典SVCよりも高い精度で分類できる一つの例を示す。この例に対しては、古典SVCでは見つからなかった、新たな分類決定境界が、量子QSVCで見つけられたと言える。これは、量子機械学習に取り組む上で意義がある事例と思われる。

🔴対象としたデータセットGaussian-Parity
 今回用いたデータセットGaussian-Parityの一例を図1に示す。右側の表は、その内容である。2つの特徴量(Feature1、Feature2)とラベル(0 or 1)で構成される300サンプルが含まれる。これをMiniMax(0〜π)スケーリングして散布図にしたものが左側の図である。ラベル0とラベル1のデータが、斜めに交差して分布しているので、境界線を引くのは難しそうに見える。

🔴古典的SVCによるクラス分け
 
このデータセットに対して、まず、古典SVCでクラス分けした。300サンプルの7割を訓練用として学習させた結果を、残り3割のサンプルをテスト用として評価した分類の精度は81%であった。学習結果を反映した分類の決定境界を図2に示した。かなりよく分類できていると思われる。SVCの威力が感じられた。(SVCに与える種々のパラメータの値で結果は変動するが。)

🔴量子的QSVCによるクラス分け
 次に、量子的QSVCでクラス分けした。今回は、Qiskitに装備されているライブラリQSVCを量子回路シミュレーションで実行した。学習の条件はSVCの場合と同じである。分類精度は、90%となり、SVCの場合よりもかなり高まった。それは、図3に示す通り、図2とは異なる決定境界が得られたことによる。このように、SVCでは見つからなかった新たな決定境界が得られた理由は、(技術詳細は略すが)少ない量子ビットnでも、2のn乗次元の広い量子状態の空間を探索できることによるのであろう。すなわち、多様なカーネル行列と呼ばれる情報を古典的なSVCの仕組みに与えることができる。


🔴古典的SVCと量子的QSVCとの関係
 詳細は、別のブログ記事で後日議論したいが、図4に両者の関係の概要を示した。Javier Mancilla M.氏の著書"QML Unlocked"が非常に参考になったので、その中のFigure 16を引用し、加筆した。(この書籍のレビュー結果の記事も別途書く予定である。)

 QSVMも、学習(訓練)には、古典SVMの仕組みをそのまま使う。それができるようにするため、量子回路を用いて計算する所が2箇所ある。1箇所目は、元の入力数値データを量子状態にマッピングするQuantum Feature Mapである。さらにその前に、次元削減(主成分分析PCAなど)を施す必要がある。なぜなら、一つの特性(Feature)につき1量子ビットが必要なため、利用量子ビット数を抑えるためである。2箇所目は、マップされた量子状態同士の類似度を計算してKernel Matrixと呼ばれるものを作る部分である。このカーネル行列を従来のSVMの仕組みに与える。

🔴今後の予定
  1. Quantum Feature MapやKernel Matrixを構成する方法はいくつかあるので、それらも調査し、試行する。
  2. 量子コンピュータ実機で動かす。現状では、性能(計算速度)は古典コンピュータに及ばないが、実機での試行で得られる知見は貴重である。
🔴追加情報
 図2(SVC)に対する図3(QSVC)の優越性は、ある特殊なデータセットに関する偶然の結果なのか?そうではないことを願って、少なくとももう一例、優越性を示す必要があると考え、以下に別のケースも示した。先の例と同様に、QSVCの優越性が見られた!

2025年4月9日水曜日

Reduction of error occurrence in IBM quantum computer (Heron processor)

Theoretically, the success rate of Mermin-Peres magic, a 4-qubit application using quantum entanglement, is 100%. When this was executed on ibm_torino (Heron r1), the success rate was 92% due to errors caused by noise. This is a big improvement from the 86% success rate on ibm_brisbane (Eagle r3) a while ago. The reason for this is that the error rate was 14% on ibm_brisbane, but was reduced to 7.9% on ibm_torino. Figure 1 shows the details.


2025年4月8日火曜日

IBM量子コンピュータ(Heronプロセッサ)におけるエラー発生の低減

【要旨】量子もつれを用いた例題Mermin-Peres-Magicを、IBM量子コンピュータ新鋭機ibm_torino (Heron r1プロセッサ)で実行させた結果、ノイズ等によるエラーの発生率が、以前のibm_brisbane (Eagle r3プロセッサ)に比べて、ほぼ半減することが分かった。これにより、所望の正解が得られる成功率は、86%から92%に大きく改善された。今後出現するであろう華々しい成果は、このような長年の地道な研究開発によるものなのだと実感できた気がする。

🔴誤り低減を目指す量子コンピュータの進展
 Eagle(鷲)は攻撃的で強く、Heron(鷺)はしなやかで強いというイメージがあるという。IBMがそれを念頭において量子コンピュータに命名したのかは定かではない。IBMはこれまで、無償で量子プロセッサEagle r3(マシン名 ibm_kyiv, ibm_brisbane)を提供してきたが、この3月から、新鋭機Heron r1(マシン名 ibm_torino)を追加した。Heronは、Eaglelよりも、大幅にエラー発生率が低減されて強力になったという。そのハードウェアの仕組みは私には分からないが、最大の難題の一つであるエラー低減に向けて着実に進展していることが窺える。

🔴量子コンピューティングプラットフォームQiskitの更新
 IBMは量子コンピューティング開発環境Qiskitを頻繁にバージョンアップしているが、今回、Heronプロセッサの無償公開に合わせて、さらに大幅な改訂を行なった。そのための移行説明会もオンラインで行われた。実際、これまでの量子プログラムは環境を色々と修正しないと動かない状況である。だが、そこを何とか調べて、Heronプロセッサもようやく使えるようになった!!!

🔴量子もつれの例題「Mermin-Peres-Magic」をHeronプロセッサで動かす
 このHeronプロセッサの性能を十分に発揮できるような量子アプリを見つけることは容易ではない。しかし、自分がやれるアプリを少しづつ動かして、自分のスキルを高めることができるだろう。そういう思いで、量子もつれが本質的に効いている「Mermin-Peres-Magic」をやってみた。それがどんな問題かは、過去に書いたこちらの記事をご覧いただきたい。
 ごく簡単に言えば、この問題に対しては、古典的には100%成功する方法は無いが、量子的方法(量子もつれ)では、必ず100%成功させることができる。ただし、実際の量子コンピュータでは、ノイズ等による誤り発生のため、失敗するケースも出てくる。

🔴Heronプロセッサではエラー発生が着実に低減されていた!
 詳しいことは省略するが、図1をご覧いただきたい。この例題を実行した場合のエラーの発生率が、Eagleプロセッサに対して、約半減されることが分かった。すなわち、本来の得たい正解を得る場合の失敗率は、14.0%から7.9%に大幅に低減されたのである。これによって、正解を得る成功率は、86%から92%に上昇した。私自身の、しかも一つの例題の実測結果に過ぎないのだが、これによってモチベーションは確実に高まった!こうして、技術は進歩するものなのだと。


2025年3月26日水曜日

Introduction to two books on quantum computing

The number of books on quantum computing has been steadily increasing. Here, I’d like to briefly introduce two books I recently purchased, both of which I found to be excellent.

🔴Peter Y. Lee, Huiwen Ji, Ran Cheng: Quantum Computing and Information, Polaris QCI Pub., 2nd edition, Feb. 2025

First off, I was excited to see the publication date listed as 2025—and the book certainly lives up to that excitement! With 502 pages, its thickness alone hints at the density of its content. The material ranges from beginner to intermediate levels and is presented with numerous illustrations, making it a great choice for those who want to study carefully and in depth.

Published in February 2025, 502 pages total, chapter titles provided by me

The book begins by explaining the basic concept of quantum bits using photon polarization. It then progresses through topics such as quantum superposition, measurement, quantum gates, and quantum circuits. At this stage, it derives BB84, one of the foundational protocols for quantum key distribution.

Next, it devotes around 80 pages to a detailed discussion of quantum entanglement, including a thorough explanation of Bell's inequality. It also covers E91 (Ekert’s protocol), another important technique in quantum key distribution, as well as quantum teleportation—with clear examples using IBM Qiskit code.

Impressively, the book also ventures into applications from the NISQ era, including hybrid algorithms such as the Variational Quantum Eigensolver (VQE) and Adiabatic Quantum Computation (AQC), as well as quantum error correction techniques like the Bit-Flip, Phase-Flip, and Shor Code.

On the other hand, since it does not cover the Quantum Fourier Transform (QFT) or Shor’s algorithm for prime factorization, it may be a bit lacking for intermediate to advanced readers. That said, the co-authors are reportedly preparing a follow-up book focusing on more advanced applications, to be published by the same publisher. I’m very much looking forward to that release as well.

One important point worth mentioning: in many newer books, the example programs often contain errors or fail to run in readers’ environments, largely due to frequent updates in quantum computing platforms. However, the code provided in this book is carefully updated to match the latest Qiskit environment, and every example worked flawlessly in my local setup! This is incredibly important, as it motivates deeper exploration of the book’s contents.
Qiskit quantum app worked perfectly on my local environment

🔴Jack D. Hidary: Quantum Computing - An Applied Approach, 2nd edition, Springer, Aug. 2021

This second book is also a thick, full-color hardcover with a total of 422 pages, targeting beginners to intermediate learners. The latter 170 pages provide a detailed introduction to the basics under the section titled Mathematical Tools for Quantum Computing, so it may be a good idea to review this part first.

The quantum algorithm section in the first half overlaps somewhat with the content of the aforementioned book by Lee et al., but I was happy to see that it includes QFT (Quantum Fourier Transform) and Shor’s Algorithm, which were not covered in that book. For instance, it walks through the entire process (quantum + classical parts) of factoring the small integer 15 (= 3×5), which greatly enhances reader's understanding of the Shor algorithm. Moreover, the second edition includes new content related to Quantum Machine Learning, which is a big plus.

(Note) Factoring a slightly larger integer like 184573 (= 487×379) is considered difficult in simulations due to memory limitations, and on current quantum computers due to limitations in qubit count and error rates. However, simulation is still possible by replacing "quantum order finding" with "classical order finding."

Published in August 2021, 422 pages total

By the way, when you open this book, the Schrödinger equation appears right at the beginning—in other words, the wave function and the Hamiltonian. Since most books on quantum computing are computer science–oriented, this equation is rarely mentioned, which is a bit surprising. However, this is actually a very good thing, because both the quantum gate model and the quantum annealing method are said to originate from the time-dependent Schrödinger equation. Though the explanation spans only four pages, it clearly demonstrates, with a few equations, that “to understand the time evolution of a wave function, one must consider the total energy of the system.” Specifically, it derives the case of a harmonic oscillator potential, as shown below.

Schrödinger Equation – Harmonic Oscillator Potential

Also, please note that the quantum algorithm programs provided in the book are written in Google’s Cirq, not IBM’s Qiskit as mentioned earlier. These programs were created in an older Cirq environment than mine, and I encountered various errors when trying to run them. However, the official Google Cirq site provides examples very similar to those in the book, and I was able to run them perfectly in my Cirq setup! Using those as a reference, you should be able to run the remaining examples in the book as needed.

Examples from Google Cirq

🔴Note the differences between IBM and Google machines

Lastly, there's something important to keep in mind: the bit order in quantum registers is reversed in IBM Qiskit (Little Endian) and Google Cirq (Big Endian)! This is an easy mistake to make and can cause all sorts of confusion. For example, if the initial state of three qubits is |000⟩, applying X gates to q1 and q2 results in q0q1q2 → 011 in Cirq, but q2q1q0 → 110 in Qiskit. For more details, please refer to my earlier article, Testing My Mobile Quantum Circuit Simulator.


tinyurl-------   https://tinyurl.com/eaacxan2   -------