We use cookies to distinguish you from other users and to provide you with a better experience on our websites. Close this message to accept cookies or find out how to manage your cookie settings.
To save content items to your account,
please confirm that you agree to abide by our usage policies.
If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account.
Find out more about saving content to .
To save content items to your Kindle, first ensure [email protected]
is added to your Approved Personal Document E-mail List under your Personal Document Settings
on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part
of your Kindle email address below.
Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations.
‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi.
‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
This brief chapter discusses the minimum mathematical background required to understand the mathematical derivations in this text fully. A basic familiarity with matrices and vectors is assumed. The chapter introduces and reviews key properties of complex numbers, the Dirac notation with inner and outer products, the Kronecker product, unitary and Hermitian matrices, eigenvalues and eigenvectors, the matrix trace, and how to construct the Hermitian adjoint of matrix-vector expressions.
The basic infrastructure developed so far is sufficient for small-scale quantum algorithms. It is also a great learning tool. However, for complex algorithms with many more qubits and gates, this matrix-based infrastructure does not scale. This chapter improves the infrastructure to scale to problems with up to 30 qubits and tens of thousands of gates.
First, the chapter introduces an elegant circuit abstraction. A method to apply operators with linear complexity comes next, which is a significant improvement over the cubic or quadratic methods presented previously. Acceleration with C++ enables another 100x speedup. Finally, a sparse state representation is being discussed at length, which can be the best-performing implementation for many circuits.
This chapter introduces the fundamental concepts and rules of quantum computing. In parallel, it develops an initial, easy-to-understand codebase in Python for building and simulating small-scale quantum circuits and algorithms.
The chapter details single qubits, superposition, quantum states with many qubits, operators, including a sizable set of important single-qubit gates and controlled gates. The Bloch sphere and the quantum circuit notation are introduced. Entanglement follows, that fascinating “spooky action at a distance,” as Einstein called it. With this background, the chapter discusses maximally entangled Bell states, the no-cloning theorem, the noneffect of global phases, the partial trace and reduced density matrix, and uncomputation. The quantum postulates are discussed in a nonphilosophical way, leading to measurement and how to simulate it.
Armed with the knowledge and infrastructure from the previous chapters, the first set of quantum algorithms is introduced. The algorithms in this chapter are typically shorter and require less preparation than those in later chapters. Additionally, the mathematical derivations are developed with great detail.
The chapter starts with the simplest possible algorithm: a quantum random number generator. This is followed by several gate equivalences, a classical full adder implemented with quantum gates, and the Swap Test to measure similarity between states. Two algorithms that utilize entanglement come next: quantum teleportation and superdense coding. After this, three so-called oracle algorithms are discussed,the Bernstein–Vazirani algorithm, Deutsch’s algorithm, and Deutsch–Jozsa’s algorithm. These are the first quantum algorithms that perform better than their classical counterparts. Oracle construction itself is discussed at great length.
This chapter details many of the fundamental quantum algorithms with full mathematical derivations and code. It discusses the quantum Fourier transform (QFT), arithmetic in the Fourier domain quantum phase estimation,Shor’s famous factorization algorithm and its quantum order-finding component, Grover’s search algorithm, amplitude amplification, and quantum counting, as well as quantum random walks.
From the field of quantum simulation, the chapter discusses the variational quantum eigensolver, measurement in the Pauli bases, the quantum approximate optimization algorithm (QAOA), the NP-complete graph Max-Cut problem, and the related Subset Sum problem. The chapter concludes with an in-depth discussion of the elegant Solovay–Kitaev algorithm for gate approximation.
This book is an introduction to quantum computing from the perspective of a classical programmer. Most concepts are explained with code, based on the insight that much of the complicated-looking math typically found in quantum computing may look quite simple in code. For many programmers, reading code is faster than reading complex math notation. Coding also allows experimentation, which helps with building intuition and understanding of the fundamental mechanisms of quantum computing.
This introductory chapter details the methodology used in this book and provides an overview of the major chapters. It suggests two alternative paths through the text, one with a focus on algorithms, the other focusing on infrastructure and simulation.
At this point, we understand the principles of quantum computing, the important foundational algorithms, and the basics of quantum error correction. We have developed a compact infrastructure for exploration and experimentation, but it is at the gate level.
Higher levels of abstraction are needed to scale to much larger programs. The chapter discusses several quantum programming languages, including their specific tooling, such as hierarchical program representations or entanglement analysis. General challenges for compilation are discussed, as well as compiler optimization techniques.
The chapter finishes with transpilation, a powerful compilation-based technique. It allows seamless porting of circuits to other frameworks, enabling the use of their advanced error models or distributed simulation capabilities. The underlying (simple) compiler technology would further enable implementation of several of the features found in programming languages, such as automatic uncomputation, entanglement analysis, and conditional blocks.
The term Beyond Classical is now the preferred term to describe computation that can be run efficiently on a quantum computer but would be intractable to run on a classical computer. A seminal paper by Google claimed to have reached this goal by computing a result in 200 seconds that a supercomputer would need 10,000 years to compute. Soon after publication, IBM claimed that the same computation could be done in just a few days on the Summit supercomputer. In this chapter, we analyze this disagreement. We discuss the proposition, implement and simulate the circuit, estimate simulation time for 53 qubits, and contrast Google’s claim against our implementation and IBM’s estimation result.
The Appendix contains additional interesting material. Specifically, it contains a detailed description of the implementation of the sparse simulation infrastructure, including failed and successful attempts at optimization.
This chapter discusses quantum noise and techniques for quantum error correction, a necessity for quantum computing. It discusses bit-flip errors, phase-flip errors, and their combination. The formalism of quantum operations is introduced, along with the operator-sum representation, and Krauss operators. With this, the chapter discusses the depolarization channel and imprecise gates, as well as (briefly) amplitude and phase damping. For error correction, repetition codes are introduced to motivate Shor’s 9-qubit error correction technique.
This introduction to quantum computing from a classical programmer's perspective is meant for students and practitioners alike. Over 25 fundamental algorithms are explained with full mathematical derivations and classical code for simulation, using an open-source code base developed from the ground up in Python and C++. After presenting the basics of quantum computing, the author focuses on algorithms and the infrastructure to simulate them efficiently, beginning with quantum teleportation, superdense coding, and Deutsch-Jozsa. Coverage of advanced algorithms includes the quantum supremacy experiment, quantum Fourier transform, phase estimation, Shor's algorithm, Grover's algorithm with derivatives, quantum random walks, and the Solovay–Kitaev algorithm for gate approximation. Quantum simulation is explored with the variational quantum eigensolver, quantum approximate optimization, and the Max-Cut and Subset-Sum algorithms. The book also discusses issues around programmer productivity, quantum noise, error correction, and challenges for quantum programming languages, compilers, and tools, with a final section on compiler techniques for transpilation.