Building Quantum Software in Python: A developer's guide
Book information
Description
A developer-centric look at quantum computing. The demand for developers who can implement solutions with quantum resources is growing larger every day. Building Quantum Software with Python gives you the foundation you need to build the software for the quantum age, and apply quantum computing to real-world business and research problems. In Building Quantum Software with Python you will learn about: • Quantum states, gates, and circuits • A practical introduction to quantum algorithms • Running quantum software on classical simulators and quantum hardware • Quantum search, phase estimation, and quantum counting • Quantum solutions to optimization problems Building Quantum Software with Python lays out the math and programming techniques you’ll need to apply quantum solutions to real challenges like sampling from classically intractable probability distributions and large-scale optimization problems. You will learn which quantum algorithms and patterns apply to different types of problems and how to build your first quantum applications. All the simulator code you write can be easily converted to run on real quantum hardware. Foreword by Heather Higgins. About the technology Large-scale optimization problems, complex financial and scientific simulations, cryptographic calculations, and certain types of machine learning require unreasonably long times to run on classical computers. Quantum computers can perform some operations like these almost instantaneously! Don’t wait to get started. This book will prime you on quantum applications, implementations, and hybrid quantum-classic designs so you’ll be ready to join the quantum revolution. About the book Building Quantum Software with Python teaches you how to build working applications that run on a simulator or real quantum hardware. By relating QC to classical computing concepts you already know, this book’s intuitive visualizations and code implementations make quantum computing easy to grasp even if you don’t have a background in advanced math. As you go, you’ll discover and implement quantum techniques for truly random sampling, optimization solutions, unstructured search, and more—all using easy-to-follow Python code. What's inside • Hype-free discussions of when, where, and why QC makes sense • Solving complex optimization problems • Quantum search using Grover’s Algorithm • Fourier transform, phase estimation, and probability distribution sampling About the reader For developers who know Python. No advanced math knowledge required. About the author Constantin Gonciulea leads the Advanced Technology group at Wells Fargo and has worked in quantum computing since 2018. Charlee Stefanski is a senior software engineer at Wells Fargo, where she leads the development of the internal quantum computing platform. Building Quantum Software with Python brief contents contents foreword preface acknowledgments about this book Who should read this book How this book is organized: A road map About the code liveBook discussion forum Other online resources about the authors about the cover illustration Part 1 Foundations 1 Advantages and challenges of programming quantum computers 1.1 Why quantum computing? 1.2 Becoming quantum ready 1.3 The superpowers of quantum computing 1.3.1 The power of quantum parallelism 1.3.2 The random nature of quantum measurement 1.4 The anatomy of a quantum computation 1.4.1 Computing with a single classical bit 1.4.2 Computing with a single quantum bit 1.4.3 Computing with multiple quantum bits 1.4.4 Putting it together 1.5 Patterns of quantum computations 1.5.1 Sampling from probability distributions 1.5.2 Searching for specific outcomes 1.5.3 Estimating the probability of specific outcomes Summary 2 A first look at quantum computations: The knapsack problem 2.1 A quick overview of optimization problems 2.1.1 The knapsack problem 2.1.2 Problem setup 2.2 The steps of a quantum computation 2.2.1 Outcomes as binary strings 2.2.2 Quantum state and probabilities 2.3 A quantum solution to the knapsack problem 2.3.1 Encoding the problem 2.3.2 Knapsack problem solution 2.4 Tools for programming a quantum solution Summary 3 Single-qubit states and gates 3.1 Single-qubit state: A pair of complex numbers 3.1.1 Visualizing single-qubit states with tables 3.1.2 The general form of a single-qubit state 3.1.3 Programmatically encoding single-qubit states with lists 3.1.4 Implementing a single-qubit quantum computing simulator in Python 3.2 Changing amplitudes with single-qubit gates 3.2.1 Rotation is multiplication 3.2.2 Basic single-qubit gates 3.2.3 The general form of a single-qubit gate 3.2.4 More basic single-qubit gates 3.2.5 Single-qubit gate inverses 3.3 Simulating changing amplitudes with gates 3.3.1 Printing and visualizing the state 3.3.2 Transforming a single-qubit state 3.3.3 Single-qubit circuits 3.4 Simulating measurement of single-qubit states 3.4.1 Encoding the uniform distribution in a single-qubit quantum state 3.5 Applications of single-qubit computations 3.5.1 Encoding a Bernoulli distribution in a single-qubit quantum state 3.5.2 Encoding a number with a single qubit Summary 4 Quantum state and circuits: Beyond one qubit 4.1 Computing with more than one qubit 4.1.1 Measurement counts 4.1.2 Sampling from a probability distribution 4.1.3 Understanding quantum computations with a simple Python simulator 4.2 A quantum state is a list of complex numbers 4.2.1 Two-qubit states 4.2.2 Multi-qubit states 4.2.3 Simulating multi-qubit states in Python 4.3 Changing amplitudes with quantum transformations 4.3.1 Selecting pairs of amplitudes based on the target qubit 4.3.2 Pair selection in Python 4.3.3 Simulating amplitude changes 4.3.4 Encoding a uniform distribution in a multi-qubit quantum system 4.4 Controlled quantum transformations 4.4.1 Simulating controlled gate transformations in Python 4.4.2 Simulating multicontrol gate transformations in Python 4.5 Simulating quantum circuits 4.5.1 Simulating measurement of multi-qubit states 4.5.2 Quantum registers and circuits in code 4.5.3 Reimplementing the uniform distribution with registers and circuits 4.5.4 Encoding the binomial distribution in a multi-qubit state 4.5.5 Implementing the Bell states Summary Part 2 Fundamental algorithms and patterns 5 Selecting outcomes with quantum oracles 5.1 Describing outcomes with quantum oracles: Intuition and classical implementation 5.1.1 Phase oracles 5.1.2 Bit oracles 5.2 Quantum implementation of oracles 5.2.1 Creating quantum circuits from building blocks 5.2.2 Phase oracle 5.2.3 Bit oracle 5.3 Converting between phase and bit quantum oracles 5.3.1 Converting a phase oracle to a bit oracle 5.3.2 Converting a bit oracle to a phase oracle 5.4 Fibonacci numbers and the golden ratio with good outcomes Summary 6 Quantum search and probability estimation 6.1 Amplitude amplification: Intuition and classical implementation 6.1.1 Finding good outcomes with oracles 6.1.2 Computing similarity with inner products 6.1.3 The inversion operator 6.1.4 Putting it together: The Grover iterate 6.1.5 A classical but quantum-friendly implementation of the inversion operator 6.2 Magnitude amplification: Quantum circuit implementation 6.2.1 Quantum oracle 6.2.2 The inversion operator 6.2.3 Grover iterate 6.2.4 Putting it all together: Grover’s algorithm Summary 7 The quantum Fourier transform 7.1 Periodic patterns in sound waves and quantum states 7.1.1 Periodic patterns in sound waves 7.1.2 Periodic patterns in quantum states 7.1.3 Roots of unity and their geometric sequences 7.2 Converting from phase to magnitude encoding with the Hadamard gate 7.3 From classical to quantum Fourier transforms 7.3.1 The classical (discrete) Fourier transform 7.3.2 Introducing the QFT and IQFT 7.4 Quantum circuits for the QFT and IQFT 7.4.1 Understanding the effect of the IQFT on a geometric sequence state Summary 8 Using the quantum Fourier transform 8.1 The single-slit experiment: Wave diffraction 8.1.1 Introducing the discrete sinc function 8.2 Encoding a periodic signal using discrete sinc quantum states 8.2.1 Phase-to-magnitude frequency encoding with the IQFT 8.2.2 Some useful numerical forms of the frequency encoding pattern 8.2.3 Reversed qubit implementation of phased discrete sinc quantum states 8.3 Discrete sinc as a sequence of coin flips 8.4 Encoding trigonometric distributions in a quantum state 8.4.1 Raised cosine 8.4.2 Other trigonometric functions Summary 9 Quantum phase estimation 9.1 Estimating the frequency of a periodic quantum state 9.1.1 Getting better angle estimates with more qubits 9.1.2 Reading between the ticks: Getting better estimates with interpolation 9.2 Quantum circuits as rotations with eigenstates and eigenvalues 9.3 The quantum phase estimation algorithm 9.4 Circuit-level implementation of the quantum phase estimation algorithm 9.5 An alternative implementation of the phase estimation circuit without qubit swaps 9.6 Amplitude estimation and quantum counting 9.6.1 Amplitude estimation 9.6.2 Estimating the number of good outcomes with quantum counting 9.6.3 Estimating the probability of good outcomes with amplitude estimation Summary Part 3 Quantum solutions: Optimization and beyond 10 Encoding functions in quantum states 10.1 Encoding function inputs and outputs 10.1.1 Encoding a simple function 10.1.2 Encoding the knapsack problem 10.1.3 Encoding polynomials of binary variables 10.1.4 Complexity of polynomial-encoding circuits 10.1.5 Representing negative values 10.2 Searching for function values 10.3 Finding zeros of polynomial functions Summary 11 Search-based quantum optimization 11.1 Finding desired outcomes with Grover adaptive search 11.2 Finding optimal outcomes with the Grover optimizer 11.3 Solving the knapsack problem with a Grover optimizer 11.3.1 Preparing the state 11.3.2 Encoding constraints 11.3.3 Defining the parameters of the Grover optimizer Summary 12 Conclusions and outlook 12.1 Quantum concepts in review 12.1.1 Quantum readiness 12.1.2 Quantum advantage and its limitations 12.2 Building quantum software and running on real quantum computers 12.2.1 The importance of a fast, flexible quantum simulator 12.2.2 Source-level compatibility between Hume and Qiskit 12.2.3 Running on real quantum hardware 12.2.4 Quantum assistant 12.3 Revisiting quantum gates and the butterfly pattern 12.3.1 Another look at single-qubit gates and the butterfly pattern 12.4 Quantum states as an image 12.4.1 Visualizing quantum state evolution 12.5 Combinatorial optimization problems 12.5.1 Encoding polynomials with noninteger coefficients 12.5.2 Shor’s factorization algorithm Summary appendix A Math refresher A.1 Diving deeper into binary strings A.1.1 Converting between binary and decimal values A.1.2 Adding a digit to a binary string A.1.3 Visualizing binary strings with binary trees A.1.4 Joining and splitting binary strings with prefixes and suffixes A.1.5 Encoding negative integers A.2 Using complex numbers to represent amplitudes A.2.1 Amplitudes as arrows inside the unit circle A.2.2 Amplitudes as complex numbers: The algebraic form A.2.3 Amplitudes as complex numbers: The trigonometric (polar) form A.2.4 Conjugates of complex numbers A.2.5 Combining amplitude pairs A.2.6 Amplitudes as colored bars appendix B More about quantum states and gates B.1 The Bloch sphere B.2 Building any gate from Hadamard and phase gates B.2.1 Example: The Z gate B.2.2 Example: The X gate appendix C Outcome pairing strategies C.1 Additional strategies for pair selection in Python C.1.1 Recognizing pairs by checking the digit for the target qubit C.1.2 Generating pairs by concatenating the prefix, target, and suffix index A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Similar books
MySQL® Notes for Professionals book
2018 · PDF
MrExcel 2022: Boosting Excel
2022 · PDF
MrExcel 2022: Boosting Excel
2022 · PDF
Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36
2010 · PDF
THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.
1858 · PDF
Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.
2022 · PDF
The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians
1809 · PDF
Professional Linux kernel architecture ''Wrox programmer to programmer''--Cover. - ''What you are reading right now is the result of an evolution over more than seven years: After two years of writing, the first edition was published in German by Carl Hanser Verlag in 2003. It then described kernel 2.6.0. The test was used as a basis for the low-level design documentation for the EAL4+ security evaluation of Red Hat Enterprise Linux 5, requiring to update it to kernel 2.6.18 (if the EAL acronym does not mean anything to you, then Wikipedia is once more your friend). Hewlett-Packard sponsored the translation into English and has, thankfully, granted the rights to publish the result. Updates to kernel 2.6.24 were then performed specifically for this book''--P. ix
2008 · PDF