Book Image

A Practical Guide to Quantum Machine Learning and Quantum Optimization

By : Elías F. Combarro, Samuel González-Castillo
4.5 (2)
Book Image

A Practical Guide to Quantum Machine Learning and Quantum Optimization

4.5 (2)
By: Elías F. Combarro, Samuel González-Castillo

Overview of this book

This book provides deep coverage of modern quantum algorithms that can be used to solve real-world problems. You’ll be introduced to quantum computing using a hands-on approach with minimal prerequisites. You’ll discover many algorithms, tools, and methods to model optimization problems with the QUBO and Ising formalisms, and you will find out how to solve optimization problems with quantum annealing, QAOA, Grover Adaptive Search (GAS), and VQE. This book also shows you how to train quantum machine learning models, such as quantum support vector machines, quantum neural networks, and quantum generative adversarial networks. The book takes a straightforward path to help you learn about quantum algorithms, illustrating them with code that’s ready to be run on quantum simulators and actual quantum computers. You’ll also learn how to utilize programming frameworks such as IBM’s Qiskit, Xanadu’s PennyLane, and D-Wave’s Leap. Through reading this book, you will not only build a solid foundation of the fundamentals of quantum computing, but you will also become familiar with a wide variety of modern quantum algorithms. Moreover, this book will give you the programming skills that will enable you to start applying quantum methods to solve practical problems right away.
Table of Contents (27 chapters)
1
Part I: I, for One, Welcome our New Quantum Overlords
4
Part II: When Time is Gold: Tools for Quantum Optimization
10
Part III: A Match Made in Heaven: Quantum Machine Learning
16
Part IV: Afterword and Appendices
17
Chapter 13: Afterword: The Future of Quantum Computing
19
Bibliography
20
Index
Appendix A: Complex Numbers
Appendix E: Production Notes

1.2 The basics of the quantum circuit model

We have mentioned that quantum computing relies on quantum phenomena such as superposition, entanglement, and interference to perform computations. But what does this really mean? To make this explicit, we need to define a particular computational model that allow us to describe mathematically how to take advantage of all these properties.

There are many such models, including quantum Turing machines, measurement-based quantum computing (also known as one-way quantum computing), or adiabatic quantum computing, and all of them are equivalent in power. However, the most popular one — and the one that we will be using for the most part in the book — is the quantum circuit model.

To learn more

In addition to the quantum circuit model, sometimes we will also use the adiabatic model. All the necessary concepts will be introduced in Chapter 4, Quantum Adiabatic Computing and Quantum Annealing.

Every computation has three elements: data, operations, and output. In the quantum circuit model, these correspond to some concepts that you may have already heard about: qubits, quantum gates, and measurements. Through the remainder of this chapter, we will briefly review all of them, highlighting some special details that will be of particular importance when talking about quantum machine learning and quantum optimization algorithms; at the same time, we will show the notation that will be used throughout the book. But before committing to that, let us have a quick overview of what a quantum circuit is.

Let's have a look at Figure 1.1. It shows a simple quantum circuit. The three horizontal lines that you see are sometimes called wires, and they represent the qubits that we are working with. Thus, in this case, we have three qubits. The circuit is meant to be read from left to right, and it represents all the different operations that are performed on the qubits. It is customary to assume that, at the very beginning, all the qubits are in state \left| 0 \right\rangle. You do not need to worry yet about what \left| 0 \right\rangle means, but please notice how we have indicated that this is indeed the initial state of all the wires by writing \left| 0 \right\rangle to the left of each of them.

Figure 1.1: An example of a simple quantum circuit.

In that circuit, we start by applying an operation called a Z gate on the top qubit; we will explain in the next section what all of these operations do, but note that we represent them with little boxes with the name of the operation inside. After that initial Z gate, we apply individual gates X, H, and Y on the top, middle, and bottom qubits and, then, a two-qubit gate on the top and middle qubits followed by a three-qubit gate, which acts on all the qubits at the same time. Finally, we measure the top and bottom qubits (we will get to measurements in the next section, don't worry), and we represent this in the circuit using the gauge symbol. Notice that, after these measurements, the wires are represented with double lines, to indicate that we have obtained a result — technically, we say that the state of the qubit has collapsed to a classical value. This means that, from this point on, we do not have quantum data anymore, only classical bits. This collapse may seem a little bit mysterious (it is!), but don't worry. In the next section, we will explain in detail the process by which quantum information (qubits) is transformed into classical data (bits).

As you may have noticed, quantum circuits are somewhat similar to digital ones, in which we have wires representing bits and different logical gates such as AND, OR, and NOT acting on them. However, our qubits, quantum gates, and measurements obey the rules of quantum mechanics and show some properties that are not found in classical circuits. The rest of this chapter is devoted to explaining all of this in detail, starting with the simplest of cases, that of a single qubit, but growing all the way up to fully-fledged quantum circuits that can use as many qubits and gates as desired.

Ready? Let's start, then!