How to implement the Bernstein-Vazirani Quantum Algorithm With Qiskit
I held my talk on “The Time To Get Started In Quantum Machine Learning Is Now” last week. You can now watch the video on YouTube in case you missed the live event.
My Kickstarter campaign is now entering the home stretch. There is one week left. So take the opportunity to order Hands-On Quantum Machine Learning With Python Volume 2: Combinatorial Optimization now.
In today’s post, we get our hands on the source code of the Bernstein-Vazirani algorithm. We develop it in Qiskit.
This concludes the first step on our journey toward breaking cryptography. We spent quite a few posts understanding why quantum computing threatens cryptography and how it exploits the vulnerability of asymmetric encryption algorithms.
Then, we looked at the algorithm conceptually before finally looking at the code today.
I tried to keep the whole part free from physics and math. But, of course, you may argue that this is inappropriate for a quantum-related post. After all, most textbooks, blog posts, and scientific articles anyway use math as the preferred language to describe quantum algorithms.
I admit math is a beautiful way to describe things. It is unambiguous, concise, and the natural language of quantum physicists. Yet, for most of us, it is a second language—at best.
In that regard, math is like source code. You can’t just read it. You have to work through them thoroughly to understand them. For example, the Bernstein-Vazirani algorithm consists of just 35 lines of code. Yet, it took a series of blog posts to describe it.
I once heard that physics and math students sometimes spend an entire semester at university with one equation. I don’t know whether it is true, exaggerated, or simply made up. Yet, I certainly believe it could be true because working with equations is pretty hard.
Therefore, my goal remains to explain quantum computing and quantum machine learning in a way that most readers can understand. And don’t worry. Every once in a while, I will bother you with an equation, too. Sometimes it is mandatory to learn a little math. But I’ll continue to explain it in an accessible way.