Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
A Practical Guide to Quantum Machine Learning and Quantum Optimization

You're reading from  A Practical Guide to Quantum Machine Learning and Quantum Optimization

Product type Book
Published in Mar 2023
Publisher Packt
ISBN-13 9781804613832
Pages 680 pages
Edition 1st Edition
Languages
Authors (2):
Elías F. Combarro Elías F. Combarro
Profile icon Elías F. Combarro
Samuel González-Castillo Samuel González-Castillo
Profile icon Samuel González-Castillo
View More author details

Table of Contents (27) Chapters

Preface 1. Part I: I, for One, Welcome our New Quantum Overlords
2. Chapter 1: Foundations of Quantum Computing 3. Chapter 2: The Tools of the Trade in Quantum Computing 4. Part II: When Time is Gold: Tools for Quantum Optimization
5. Chapter 3: Working with Quadratic Unconstrained Binary Optimization Problems 6. Chapter 4: Adiabatic Quantum Computing and Quantum Annealing 7. Chapter 5: QAOA: Quantum Approximate Optimization Algorithm 8. Chapter 6: GAS: Grover Adaptive Search 9. Chapter 7: VQE: Variational Quantum Eigensolver 10. Part III: A Match Made in Heaven: Quantum Machine Learning
11. Chapter 8: What Is Quantum Machine Learning? 12. Chapter 9: Quantum Support Vector Machines 13. Chapter 10: Quantum Neural Networks 14. Chapter 11: The Best of Both Worlds: Hybrid Architectures 15. Chapter 12: Quantum Generative Adversarial Networks 16. Part IV: Afterword and Appendices
17. Chapter 13: Afterword: The Future of Quantum Computing
18. Assessments 19. Bibliography
20. Index
21. Other Books You May Enjoy Appendix A: Complex Numbers
1. Appendix B: Basic Linear Algebra 2. Appendix C: Computational Complexity 3. Appendix D: Installing the Tools 4. Appendix E: Production Notes

5.3 Using QAOA with PennyLane

As we mentioned in Chapter 2, The Tools of the Trade in Quantum Computing, PennyLane is a quantum programming library focused mainly on quantum machine learning. As such, it doesn’t include as many tools for quantum optimization algorithms — such as QAOA — as Qiskit does. However, it does provide some interesting features such as automatic differentiation — that is, analytical computation of gradients — that may make it an appealing alternative to Qiskit in some circumstances.

Let’s begin by explaining how to declare and work with Hamiltonians in PennyLane. For that, we will use the Hamiltonian class. It provides a constructor that accepts a list of coefficients and a list of products of Pauli matrices. For instance, if you want to define , you will pass [2,-1,3.5] as the first argument and [PauliZ(0)@PauliZ(1),PauliZ(0)@PauliZ(2),PauliZ(1)] as the second one. As we know from Chapter 2, The Tools of the Trade in...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}