Previous Next

Quantum Machine Learning With Python Using Cirq from Google Research and IBM Qiskit (Santanu Pattanayak) (z-library.sk, 1lib.sk, z-lib.sk)

Author: Santanu Pattanayak

技术

Quickly scale up to Quantum computing and Quantum machine learning foundations and related mathematics and expose them to different use cases that can be solved through Quantum based algorithms.This book explains Quantum Computing, which leverages the Quantum mechanical properties sub-atomic particles. It also examines Quantum machine learning, which can help solve some of the most challenging problems in forecasting, financial modeling, genomics, cybersecurity, supply chain logistics, cryptography among others. You'll start by reviewing the fundamental concepts of Quantum Computing, such as Dirac Notations, Qubits, and Bell state, followed by postulates and mathematical foundations of Quantum Computing. Once the foundation base is set, you'll delve deep into Quantum based algorithms including Quantum Fourier transform, phase estimation, and HHL (Harrow-Hassidim-Lloyd) among others. You'll then be introduced to Quantum machine learning and Quantum deep learning-based algorithms, along with advanced topics of Quantum adiabatic processes and Quantum based optimization. Throughout the book, there are Python implementations of different Quantum machine learning and Quantum computing algorithms using the Qiskit toolkit from IBM and Cirq from Google Research. What You'll Learn • Understand Quantum computing and Quantum machine learning • Explore varied domains and the scenarios where Quantum machine learning solutions can be applied • Develop expertise in algorithm development in varied Quantum computing frameworks • Review the major challenges of building large scale Quantum computers and applying its various techniques Who This Book Is For Machine Learning enthusiasts and engineers who want to quickly scale up to Quantum Machine Learning

📄 File Format: PDF
💾 File Size: 9.7 MB
11
Views
0
Downloads
0.00
Total Donations

📄 Text Preview (First 20 pages)

ℹ️

Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

📄 Page 1
Quantum Machine Learning with Python Using Cirq from Google Research and IBM Qiskit — Santanu Pattanayak
📄 Page 2
Quantum Machine Learning with Python Using Cirq from Google Research and IBM Qiskit Santanu Pattanayak
📄 Page 3
Quantum Machine Learning with Python ISBN-13 (pbk): 978-1-4842-6521-5 ISBN-13 (electronic): 978-1-4842-6522-2 https://doi.org/10.1007/978-1-4842-6522-2 Copyright © 2021 by Santanu Pattanayak This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein. Managing Director, Apress Media LLC: Welmoed Spahr Acquisitions Editor: Celestin Suresh John Development Editor: James Markham Coordinating Editor: Aditee Mirashi Cover designed by eStudioCalamar Cover image designed by Freepik (www.freepik.com) Distributed to the book trade worldwide by Springer Science+Business Media New York, 1 New York Plaza, Suite 4600, New York, NY 10004-1562, USA. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders- ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation. For information on translations, please e-mail booktranslations@springernature.com; for reprint, paperback, or audio rights, please e-mail bookpermissions@springernature.com. Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales web page at www.apress.com/bulk-sales. Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the book’s product page, located at www.apress.com/978-1-4842-6521-5. For more detailed information, please visit www.apress.com/source-code. Printed on acid-free paper Santanu Pattanayak Bangalore, Karnataka, India
📄 Page 4
To my wife, Sonia
📄 Page 5
v Chapter 1: Introduction to Quantum Computing ������������������������������������������������������� 1 Quantum Bit ���������������������������������������������������������������������������������������������������������������������������������� 2 Realization of a Quantum Bit ��������������������������������������������������������������������������������������������������� 4 Bloch Sphere Representation of a Qubit ���������������������������������������������������������������������������������� 5 Stern–Gerlach Experiment ���������������������������������������������������������������������������������������������������������� 10 Multiple Qubits ���������������������������������������������������������������������������������������������������������������������������� 14 Bell State ������������������������������������������������������������������������������������������������������������������������������������� 14 Multiple-Qubit State �������������������������������������������������������������������������������������������������������������� 15 Dirac Notation ����������������������������������������������������������������������������������������������������������������������������� 16 Ket Vector ������������������������������������������������������������������������������������������������������������������������������ 17 Bra Vector ������������������������������������������������������������������������������������������������������������������������������ 17 Inner Product ������������������������������������������������������������������������������������������������������������������������� 17 Magnitude of a Vector������������������������������������������������������������������������������������������������������������ 18 Outer Product ������������������������������������������������������������������������������������������������������������������������ 19 Tensor Product����������������������������������������������������������������������������������������������������������������������� 20 Single-Qubit Gates ���������������������������������������������������������������������������������������������������������������������� 21 Quantum NOT Gate ���������������������������������������������������������������������������������������������������������������� 21 Hadamard Gate ���������������������������������������������������������������������������������������������������������������������� 24 Quantum Z Gate ��������������������������������������������������������������������������������������������������������������������� 25 Table of Contents About the Author ����������������������������������������������������������������������������������������������������� xi About the Technical Reviewer ������������������������������������������������������������������������������� xiii Acknowledgments ���������������������������������������������������������������������������������������������������xv Introduction �����������������������������������������������������������������������������������������������������������xvii
📄 Page 6
vi Multiple-Qubit Gates ������������������������������������������������������������������������������������������������������������������� 25 CNOT Gate������������������������������������������������������������������������������������������������������������������������������ 25 Controlled-U Gate ������������������������������������������������������������������������������������������������������������������ 28 Copying a Qubit: No Cloning Theorem ����������������������������������������������������������������������������������������� 29 Measurements in Different Basis ������������������������������������������������������������������������������������������������ 31 Bell States with Quantum Gates ������������������������������������������������������������������������������������������������� 32 Quantum Teleportation ���������������������������������������������������������������������������������������������������������������� 35 Quantum Parallelism Algorithms ������������������������������������������������������������������������������������������������� 38 Quantum Interference ����������������������������������������������������������������������������������������������������������������� 42 Summary������������������������������������������������������������������������������������������������������������������������������������� 43 Chapter 2: Mathematical Foundations and Postulates of Quantum Computing ����� 45 Topics from Linear Algebra ��������������������������������������������������������������������������������������������������������� 45 Linear Independence of Vectors �������������������������������������������������������������������������������������������� 46 Basis Vectors ������������������������������������������������������������������������������������������������������������������������������� 47 Orthonormal Basis ���������������������������������������������������������������������������������������������������������������������� 48 Linear Operators ������������������������������������������������������������������������������������������������������������������������� 48 Interpretation of a Linear Operator as a Matrix ��������������������������������������������������������������������������� 49 Linear Operator in Terms of Outer Product ��������������������������������������������������������������������������������� 51 Pauli Operators and Their Outer Product Representation ����������������������������������������������������������� 52 Eigenvectors and Eigenvalues of a Linear Operator ������������������������������������������������������������������� 53 Diagonal Representation of an Operator ������������������������������������������������������������������������������������� 54 Adjoint of an Operator ����������������������������������������������������������������������������������������������������������������� 55 Self-Adjoint or Hermitian Operators �������������������������������������������������������������������������������������������� 55 Normal Operators ������������������������������������������������������������������������������������������������������������������������ 56 Unitary Operators ������������������������������������������������������������������������������������������������������������������������ 56 Spectral Decomposition of Linear Operators ������������������������������������������������������������������������������ 57 Trace of Linear Operators ������������������������������������������������������������������������������������������������������������ 58 Linear Operators on a Tensor Product of Vectors ������������������������������������������������������������������������ 59 Functions of Normal Operators ��������������������������������������������������������������������������������������������������� 61 Commutator and Anti-commutator Operators ����������������������������������������������������������������������������� 62 Table of ConTenTs
📄 Page 7
vii Postulates of Quantum Mechanics ��������������������������������������������������������������������������������������������� 63 Postulate 1: Quantum State ��������������������������������������������������������������������������������������������������� 63 Postulate 2: Quantum Evolution ��������������������������������������������������������������������������������������������� 64 Postulate 3: Quantum Measurement ������������������������������������������������������������������������������������� 65 General Measurement Operators������������������������������������������������������������������������������������������� 66 Projective Measurement Operators ��������������������������������������������������������������������������������������� 68 General Heisenberg Uncertainty Principle ����������������������������������������������������������������������������� 70 POVM Operators �������������������������������������������������������������������������������������������������������������������� 74 Density Operator �������������������������������������������������������������������������������������������������������������������� 76 Hamiltonian Simulation and Trotterization ���������������������������������������������������������������������������������� 91 Summary������������������������������������������������������������������������������������������������������������������������������������� 94 Chapter 3: Introduction to Quantum Algorithms ���������������������������������������������������� 95 Cirq ���������������������������������������������������������������������������������������������������������������������������������������������� 96 Simulation in Cirq with a Hadamard Gate ����������������������������������������������������������������������������������� 96 Qiskit ����������������������������������������������������������������������������������������������������������������������������������������� 100 Bell State Creation and Measurement �������������������������������������������������������������������������������������� 103 Quantum Teleportation �������������������������������������������������������������������������������������������������������������� 105 Quantum Random Number Generator ��������������������������������������������������������������������������������������� 109 Deutsch–Jozsa Algorithm Implementation ������������������������������������������������������������������������������� 113 Bernstein–Vajirani Algorithm ���������������������������������������������������������������������������������������������������� 120 Bell’s Inequality Test ����������������������������������������������������������������������������������������������������������������� 126 Simon’s Algorithm ��������������������������������������������������������������������������������������������������������������������� 133 Grover’s Algorithm �������������������������������������������������������������������������������������������������������������������� 139 Summary����������������������������������������������������������������������������������������������������������������������������������� 149 Chapter 4: Quantum Fourier Transform and Related Algorithms ������������������������� 151 Fourier Series ���������������������������������������������������������������������������������������������������������������������������� 152 Fourier Transform ���������������������������������������������������������������������������������������������������������������������� 154 Discrete Fourier Transform ������������������������������������������������������������������������������������������������������� 155 Kronecker Delta Function ���������������������������������������������������������������������������������������������������������� 156 Table of ConTenTs
📄 Page 8
viii Motivating the Quantum Fourier Transform Using the Kronecker Delta Function ��������������������� 157 Quantum Fourier Transform ������������������������������������������������������������������������������������������������������ 159 QFT Implementation in Cirq ������������������������������������������������������������������������������������������������������ 165 Hadamard Transform as a Fourier Transform���������������������������������������������������������������������������� 170 Quantum Phase Estimation ������������������������������������������������������������������������������������������������������� 171 Quantum Phase Estimation Illustration in Cirq �������������������������������������������������������������������������� 176 Error Analysis in the Quantum Phase Estimation ���������������������������������������������������������������������� 180 Shor’s Period Finding Algorithm and Factoring ������������������������������������������������������������������������� 184 Modular Exponentiation Function ���������������������������������������������������������������������������������������� 184 Motivating the Order Finding Problem as a Quantum Phase Estimation Problem ��������������� 185 Continued Fractions Algorithm �������������������������������������������������������������������������������������������� 190 Period Finding Implementation in Cirq �������������������������������������������������������������������������������� 192 Implementing the Unitary Operator Through Quantum Circuits ������������������������������������������ 200 Factoring Algorithm ������������������������������������������������������������������������������������������������������������� 204 Factoring Implementation in Cirq ���������������������������������������������������������������������������������������� 206 Hidden Subgroup Problem �������������������������������������������������������������������������������������������������������� 210 Definition of a Group ������������������������������������������������������������������������������������������������������������ 210 Abelian Group ���������������������������������������������������������������������������������������������������������������������� 212 Subgroups ��������������������������������������������������������������������������������������������������������������������������� 212 Cosets ���������������������������������������������������������������������������������������������������������������������������������� 212 Normal Subgroup ���������������������������������������������������������������������������������������������������������������� 214 Group Homomorphism ��������������������������������������������������������������������������������������������������������� 215 Kernel of Homomorphism ���������������������������������������������������������������������������������������������������� 217 Hidden Subgroup Problem ��������������������������������������������������������������������������������������������������� 218 Summary����������������������������������������������������������������������������������������������������������������������������������� 220 Chapter 5: Quantum Machine Learning ���������������������������������������������������������������� 221 HHL Algorithm ��������������������������������������������������������������������������������������������������������������������������� 222 Initializing the Registers ������������������������������������������������������������������������������������������������������ 224 Performing Quantum Phase Estimation ������������������������������������������������������������������������������� 225 Inverting the Eigenvalues ���������������������������������������������������������������������������������������������������� 225 Table of ConTenTs
📄 Page 9
ix Uncomputing the Work Registers ���������������������������������������������������������������������������������������� 227 Measuring the Ancilla Qubit ������������������������������������������������������������������������������������������������ 227 HHL Algorithm Implementation Using Cirq �������������������������������������������������������������������������������� 228 Quantum Linear Regression ������������������������������������������������������������������������������������������������������ 238 Quantum Swap Test Subroutine ������������������������������������������������������������������������������������������������ 241 Initial State �������������������������������������������������������������������������������������������������������������������������� 242 Hadamard Gate on the Ancilla Qubit ������������������������������������������������������������������������������������ 242 Controlled Swap Operation �������������������������������������������������������������������������������������������������� 242 Hadamard Gate on the Control Qubit ����������������������������������������������������������������������������������� 242 Swap Test Implementation �������������������������������������������������������������������������������������������������������� 243 Quantum Euclidean Distance Calculation ��������������������������������������������������������������������������������� 247 Creating the Initial States Without QRAM ���������������������������������������������������������������������������� 249 Quantum Euclidean Distance Compute Routine Implementation���������������������������������������������� 250 Quantum K-Means Clustering ��������������������������������������������������������������������������������������������������� 255 Quantum K-Means Clustering Using Cosine Distance �������������������������������������������������������������� 256 Quantum Principal Component Analysis ����������������������������������������������������������������������������������� 261 Preprocessing and Transforming the Classical Data to Quantum States ���������������������������� 262 The Mixed Density Matrix or the Covariance Matrix Creation���������������������������������������������� 263 Density Matrix as a Hamiltonian ������������������������������������������������������������������������������������������ 264 Quantum Phase Estimation for Spectral Decomposition of the Unitary Operator ��������������� 264 Extracting the Principal Components ���������������������������������������������������������������������������������� 266 Quantum Support Vector Machines������������������������������������������������������������������������������������������� 267 Quantum Least Square SVM ����������������������������������������������������������������������������������������������������� 273 SVM Implementation Using Qiskit ��������������������������������������������������������������������������������������������� 276 Summary����������������������������������������������������������������������������������������������������������������������������������� 279 Chapter 6: Quantum Deep Learning ���������������������������������������������������������������������� 281 Hybrid Quantum-Classical Neural Networks ����������������������������������������������������������������������������� 282 Backpropagation in the Quantum Layer ������������������������������������������������������������������������������������ 283 MNIST Classification Using Hybrid Quantum- Classical Neural Network ����������������������������������� 284 Gradient in the Quantum Layer �������������������������������������������������������������������������������������������� 285 Table of ConTenTs
📄 Page 10
x Quantum Neural Network for Classification on Near- Term Processors ������������������������������������ 294 MNIST Classification Using TensorFlow Quantum ��������������������������������������������������������������������� 297 Summary����������������������������������������������������������������������������������������������������������������������������������� 306 Chapter 7: Quantum Variational Optimization and Adiabatic Methods ���������������� 307 Variational Quantum Eigensolver ���������������������������������������������������������������������������������������������� 308 Defining the Hamiltonian ����������������������������������������������������������������������������������������������������� 310 Preparing the Ansatz State Based on the Expectation Optimization ����������������������������������� 312 Expectation Computation ���������������������������������������������������������������������������������������������������������� 313 Isling Model and Its Hamiltonian ����������������������������������������������������������������������������������������������� 314 Isling Model for a Quantum System ������������������������������������������������������������������������������������������ 317 Implementation of the VQE Algorithm ��������������������������������������������������������������������������������������� 319 Quantum Max-Cut Graph Clustering ����������������������������������������������������������������������������������������� 324 Max-Cut Clustering Implementation Using VQE ������������������������������������������������������������������������ 327 Quantum Adiabatic Theorem ����������������������������������������������������������������������������������������������������� 332 Proof of the Adiabatic Theorem ������������������������������������������������������������������������������������������������� 333 Quantum Approximate Optimization Algorithm ������������������������������������������������������������������������� 337 Evolving the Quantum System to the Objective Hamiltonian����������������������������������������������� 337 Starting Hamiltonian for QAOA �������������������������������������������������������������������������������������������� 341 Starting Hamiltonian and Initial Eigenstate ������������������������������������������������������������������������� 342 Implementation of QAOA ����������������������������������������������������������������������������������������������������������� 343 Quantum Random Walk ������������������������������������������������������������������������������������������������������������� 349 Quantum Random Walk Implementation ����������������������������������������������������������������������������������� 351 Summary����������������������������������������������������������������������������������������������������������������������������������� 355 Index ��������������������������������������������������������������������������������������������������������������������� 357 Table of ConTenTs
📄 Page 11
xi About the Author Santanu Pattanayak currently works as a staff machine learning researcher at Qualcomm Corp R&D and is the author of the deep learning book Pro Deep Learning with TensorFlow: A Mathematical Approach to Advanced Artificial Intelligence in Python. He has about 12 years of work experience, with 8 of those years in the data analytics/data science field. Prior to joining Qualcomm, Santanu worked at GE, RBS, Capgemini, and IBM. He graduated with a degree in electrical engineering from Jadavpur University, Kolkata, and has a master’s degree in data science from Indian Institute of Technology (IIT), Hyderabad. Santanu is an avid math enthusiast and enjoys participating in Kaggle competitions where he ranks within the top 500 across the world. Santanu was born and raised in West Bengal, India, and currently resides in Bangalore, India, with his wife.
📄 Page 12
xiii About the Technical Reviewer Santanu Ganguly has been working in the fields of quantum technologies, cloud computing, data networking, and security covering research and customer delivery for more than 20 years in Switzerland and the United Kingdom (UK) for various Silicon Valley vendors. He has two postgraduate degrees, one in mathematics and the other in observational astrophysics; has researched and published articles on quantum optics; and is currently leading global projects out of the UK related to quantum computing and quantum machine learning.
📄 Page 13
xv Acknowledgments I am grateful to my wife, Sonia, for encouraging me at every step while writing this book. I would like to thank my mom for her unconditional love and my dad for instilling in me a love for mathematics. I would also like to thank my brother, Atanu, and my friend, Partha, for their constant support. Thanks to Santanu Ganguly for his technical input while reviewing this book. I would like to express my gratitude to my mentors, colleagues, and friends from current and previous organizations for their input, inspiration, and support. Sincere thanks to the Apress team, especially Aditee and Celestin, for their constant support and help.
📄 Page 14
xvii Introduction Alan Turing laid the mathematical foundations of computing around 80 years ago, followed by John von Neumann, who made computing practical a decade later. Since then there has been rapid development in information technology fueled by core technological advancements. This rapid development in computing can be described by Moore’s law. In 1965 Moore predicted that the number of transistors we can squeeze into a microchip would double every 24 months. However, 40 years after the publication of Moore’s law, Moore observed that this law of exponentials cannot continue forever since the size of the transistors we would have in 20 years from now would be as small as the size of an atom, which provides a fundamental barrier to the reduction of transistor size. Hence, after 50 years of extraordinary growth, we now find ourselves at the twilight of Moore’s law where we need to reinvent the core technologies to sustain the computational needs of the world. As data continues to double every two years, we need new computing platforms and an inversion in computing ideologies to process such a massive amount of data. Breakthroughs such as specialized chips for machine learning and distributed computing as opposed to server farms are already making headways in the computing arena. The next big advancement in computing is supposed to come from our ability to build infrastructure that can probe the quantum nature of fundamental particles as opposed to the classical paradigm of computing that we rely on currently. In this book, we are going to explore quantum computing and quantum machine learning with an emphasis on the latter. Quantum computing, which leverages the quantum mechanical properties of subatomic particles such as electrons and photons, can be efficiently used to provide an exponential boost in compute over its traditional classical counterpart. Quantum machine learning is an upcoming research area at the intersection of quantum mechanics, machine learning, and computer science that has the potential to change the way we do compute today and help us solve some of the most challenging problems in forecasting, financial modeling, genomics, cybersecurity, supply chain logistics, and cryptography, among others. With quantum computing already in the proof-of-concept phase in organizations such as Microsoft, Google, IBM, and others, the enterprise-level quantum-based deployment is not too far away. This book will help readers to quickly scale up to quantum computing and quantum machine
📄 Page 15
xviii learning foundations and related mathematics and expose them to different problems that can be solved through quantum-based algorithms. The initial part of the book introduces readers to the fundamental concepts of quantum mechanics such as superposition, entanglement, and interference followed by postulates and the mathematical foundations of quantum computing. In this regard, we touch upon all the important topics of linear algebra required to understand quantum states and their transformation under the influence of various quantum gates. Note that the transformation of the gates on the quantum states is linear and unitary in nature. Once the foundational base is set, we delve deep into quantum-based algorithms such as quantum teleportation, Deutsch–Jozsa, the Bernstein–Vazirani algorithm, Simon’s algorithm, and Grover’s search algorithm, among others. We follow this up with more advanced algorithms pertaining to quantum Fourier transforms such as quantum phase estimation, quantum period finding, and Shor’s algorithm. Quantum Fourier transform algorithms are the building blocks for several quantum machine learning algorithms, and hence we dedicate an entire chapter to them. Finally, the book introduces quantum machine learning and quantum deep learning–based algorithms and ends with the advanced topics of quantum adiabatic processes and quantum-based optimization, which are critical aspects for advancements in machine learning and data sciences. When discussing machine learning, we initially start with the matrix inversion routine of Harrow, Hassidim, and Lloyd, popularly known as the HHL algorithm, since it is a key component of several machine learning optimization routines relying on matrix inversion for its parametric solution. We follow this topic with quantum algorithms for regression, support vector machines, quantum principal component analysis, and quantum-based clustering. In this regard, we discuss and implement quantum algorithms such as the swap test for computing dot product and Euclidean distance between quantum state vectors. After working through the quantum implementation of the traditional machine learning algorithms, we look at quantum deep learning and some of the subtleties associated with it such as backpropagation through the quantum layers. The final chapter of the book exposes readers to advanced optimization techniques such as a variational quantum eigensolver and adiabatic optimization-based routines such as the quantum approximate optimization algorithm (QAOA). These algorithms can be used to optimize complex objective functions expressed in terms of the Hamiltonian of a quantum system. In this regard, we discuss in detail the Isling model InTroduCTIon
📄 Page 16
xix for Hamiltonian objectives and solve algorithms such as maximum cut graph clustering problems using these advanced techniques. Throughout the book there are Python implementations of different quantum machine learning and quantum computing algorithms using Cirq from Google Research and the Qiskit toolkit from IBM. This book will bring readers up to speed on the latest research developments in quantum computing and quantum machine learning around the world. All the practical aspects of quantum machine learning that are currently relevant are presented in this book so that readers can easily relate to this evolving field and at the same time use these prototypes to build new quantum machine learning solutions with ease. Also, the mathematical and technical rigor of quantum computing and quantum machine learning presented in the book will enable readers to engage in research and optimization of quantum-based algorithms and help them transition to this emerging field. I wish readers all the best. InTroduCTIon
📄 Page 17
1 © Santanu Pattanayak 2021 S. Pattanayak, Quantum Machine Learning with Python, https://doi.org/10.1007/978-1-4842-6522-2_1 CHAPTER 1 Introduction to Quantum Computing I think I can safely say that nobody understands quantum physics. —Richard Feynman Present-day computers work on the principles of classical mechanics. Imagine a coin in the classical regime. When we toss the coin, it can take up either of these two states: “head” (H) or “tail” (T). However, in a quantum world, a coin, or rather a quantum one, can exist in both the states “head” and “tail” simultaneously. This property of quantum mechanical objects—existing in multiple states simultaneously—is known as superposition. Similarly, quantum mechanical objects can exhibit a much stronger correlation than their classical counterparts through the phenomenon of entanglement. Using entanglement, two or more quantum particles can be linked in perfect unison, even when they are placed at opposite ends of the universe. Quantum computing harnesses and exploits the laws of quantum mechanics, especially superposition, entanglement, and interference, to process information. An important idea in quantum computing is to collapse a probability distribution toward specific measurement states. Quantum interference is a by-product of quantum superposition, and it helps bias quantum measurement toward specific quantum states. Returning to our quantum coin, when we observe the state of the quantum coin in superposition, it will mysteriously reveal only the classical information of either “head” or “tail.” The process of observing the state of a quantum mechanical object is called quantum measurement. Quantum measurement interacts with the state of the quantum object and collapses the superposition state. If a classical coin represents a bit in the classical computing paradigm, then the quantum coin represents a qubit in the quantum computing. Qubit stands for a quantum bit—the smallest unit of computation in quantum computing.
📄 Page 18
2 In classical computing, n bits can represent only one of the 2n possibilities. A quantum system of n qubits, on the other hand, can be in a superposition of all the 2n possibilities. This quantum behavior opens up the possibility of exponential speedups in many computation tasks that would take ages for classical algorithms to compute. All fundamental particles such as electrons and photons in this universe are quantum objects. The states and the properties of these fundamental quantum particles are leveraged to build quantum mechanical systems. These quantum mechanical systems, in theory, are much more powerful than their classical counterparts for several complex and compute-intensive tasks, as we will see in a while. Quantum computing deals with the information processing tasks that can be accomplished using quantum mechanical systems. Quantum mechanics is a mathematical framework that helps explain physical processes at a microscopic level. When we try to observe the macroscopic properties of a system, classical mechanics turns out to be enough. These macroscopic systems, however, when viewed at a microscopic level, still behave as per the rules of quantum mechanics. With this little preface, we will get started with the key concepts of quantum computing. Quantum Bit A bit is the fundamental unit of information in classical computing. A bit at a given instance of time can be in one of these two states: “on”(1) or “off” (0). The quantum counterpart of a bit is called a quantum bit (or qubit) as we briefly discussed earlier. A qubit can also take up two fundamental states: 0 and 1. However, a qubit can exist as the superposition of these two fundamental states, while a classical bit cannot. In the realm of quantum mechanics, the states corresponding to 0 and 1 are represented by the two-dimensional vectors  0 and  1 where  0 1 0         1 0 1        (1-1) Chapter 1 IntroduCtIon to Quantum ComputIng
📄 Page 19
3 Before we go any further, we will discuss Dirac notation, where we represent a vector  v as ∣v⟩. The Dirac notations for linear algebra concepts are convenient for quantum mechanics, and we will follow them throughout this book. So, a qubit that exists as a superposition of the states 0 and 1 assumes a state |ψ⟩. The state ∣ψ⟩ can be expressed as a linear combination of the basis states |0⟩ and |1⟩, as shown here:    0 1 (1-2) The linear coefficients α and β are complex numbers, i.e., α, β ∈ ℂ. Hence, the state |ψ⟩ belongs to a two-dimensional complex plane where the states |0⟩ and |1⟩ form an orthonormal basis often referred to as computational basis states. In this computation basis, |ψ⟩ can be expressed as follows:           (1-3) Let’s now try to interpret what the complex numbers α, β represent. When we probe a classical bit, we get either a 0 or an 1 based on the exact state it is in. However, if we try to fetch the state of a qubit, we would not be able to retrieve the values of α, β. A qubit on measurement would reveal either of the computational basis states of |0⟩ or |1⟩. Quantum mechanics cannot predict which of the computational basis states would appear when making a measurement on the qubit. It tells us that the qubit in state |ψ⟩ = α|0⟩ + β|1⟩ has a probability of |α|2 of appearing in state |0⟩ and a probability of |β|2 of appearing in state |1⟩. Hence, for a qubit,  2 2 1  (1-4) The sum of the probabilities of appearing in either one of the computational basis states should sum to 1 since the states are mutually exclusive and exhaustive. Just to brush up on elementary probability theory, n events are mutually exclusive if the occurrence of one event prohibits the other (n − 1) events from happening. Similarly, n events are exhaustive if at least one of them will occur. So, for n mutually exclusive and exhaustive events A1, A2. …An, we have the following: P A P Aii n i n i       1 1 1  (1-5) Chapter 1 IntroduCtIon to Quantum ComputIng
📄 Page 20
4 The linear coefficients α, β are called probability amplitudes. These probability amplitudes being complex numbers can take up even negative values unlike probabilities, which are strictly non-negative. A qubit, which is in an equal superposition of |0⟩ and |1⟩, can be represented by the following state:    1 2 1 2 0 1 (1-6) The |+⟩ state, also known as the Hadamard state, plays an important role in quantum computing, as we will see later. The contrast between the unobservable state of the qubit and the observations we make using measurement lies at the heart of quantum computing and quantum information. Since we are so much tuned to the classical world where an abstract model correlates directly with the physical world, we find the collapse of an unobservable state on measurement counterintuitive. However, the qubit states can be manipulated in ways using superposition, entanglement, and interference so as the measurement outcomes correlate uniquely to the unobservable state. This property of the quantum states renders power to quantum computation, as we will see in various quantum algorithms. Realization of a Quantum Bit There are several ways we can realize a qubit. We can use an electron as a qubit (see Figure 1-1). As per the atomic model, the electron can exist either in the ground state, which is the lowest energy state, or in the one of the remaining energy states, which we collectively call the excited state. The ground state of the electron is denoted by the state |0⟩, while the excited state is denoted by the state |1⟩. By projecting light on an atom for an appropriate duration of time, an electron in the ground state |0⟩ can be moved to the state |1⟩, and vice versa. An electron can be moved to a superposition state of |0⟩ and |1⟩ by reducing the duration of time that light is projected on an atom. Chapter 1 IntroduCtIon to Quantum ComputIng
The above is a preview of the first 20 pages. Register to read the complete e-book.

💝 Support Author

0.00
Total Amount (¥)
0
Donation Count

Login to support the author

Login Now

Recommended for You

Loading recommended books...
Failed to load, please try again later
Back to List