Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
A Practical Guide to Quantum Computing

You're reading from   A Practical Guide to Quantum Computing Hands-on approach to quantum computing with Qiskit

Arrow left icon
Product type Paperback
Published in Jul 2025
Last Updated in Aug 2025
Publisher Packt
ISBN-13 9781835885949
Length 512 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Elías F. Combarro Fernández-Combarro Álvarez Elías F. Combarro Fernández-Combarro Álvarez
Author Profile Icon Elías F. Combarro Fernández-Combarro Álvarez
Elías F. Combarro Fernández-Combarro Álvarez
Samuel González Castillo Samuel González Castillo
Author Profile Icon Samuel González Castillo
Samuel González Castillo
Arrow right icon
View More author details
Toc

Table of Contents (29) Chapters Close

Preface
1. Part 1 One Qubit to Rule Them All: Working with One Qubit FREE CHAPTER
2. Chapter 1 What Is (and What Is Not) a Quantum Computer 3. Chapter 2 Qubits, Gates, and Measurements 4. Chapter 3 Applications and Protocols with One Qubit 5. Chapter 4 Coding One-Qubit Protocols in Qiskit 6. Part 2 Qubit Meets Qubit: Two Qubits and Entanglement
7. Chapter 5 How to Work with Two Qubits 8. Chapter 6 Applications and Protocols with Two Qubits 9. Chapter 7 Coding Two-Qubit Algorithms in Qiskit 10. Part 3 Working with Many Qubits
11. Chapter 8 How to Work with Many Qubits 12. Chapter 9 The Full Power of Quantum Algorithms 13. Chapter 10 Coding with Many Qubits in Qiskit 14. Part 4 The Stars of the Show: Main Quantum Algorithms
15. Chapter 11 Finding the Period and Factoring Numbers 16. Chapter 12 Searching and Counting with a Quantum Computer 17. Chapter 13 Coding Shor and Grover’s Algorithms in Qiskit 18. Part 5 Ad Astra: The Road to Quantum Utility and Advantage
19. Chapter 14 Quantum Error Correction and Fault Tolerance 20. Chapter 15 Experiments for Quantum Advantage 21. Bibliography
22. Solutions 23. Index
Appendix A Mathematical Tools 1. Appendix B The Bra-Ket Notation and Other Foundational Notions 2. Appendix C Measuring the Complexity of Algorithms
3. Appendix D Installing the Tools 4. Appendix E Production Notes

13.3 Grover’s algorithm

In Chapter  12, we studied Grover’s algorithm in detail, and, as you surely remember, there are two main ingredients that it relies on: a Boolean function oracle that encodes the elements that we want to find and Grover’s diffusion operator. In Section  10.3.1, we gave a general (but not necessarily efficient) way of implementing oracles, so we will just focus on coding Grover’s diffusion operator.

Grover’s diffusion operator is in charge of performing the inversion about the mean operation. As we discussed in Section  12.2.3, this can be implemented with the following circuit:

HXXHHXXH............HXZXH

We already know how to write Qiskit code for every gate in the circuit with the only exception being the multi-controlled Z gate. In order to implement it, we will just use a ZGate object (which will instantiate a Z gate) and add to it a bunch of controls with the ZGate (). control ( n -1) instruction. Thus, we can use the following function...

lock icon The rest of the chapter is locked
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
A Practical Guide to Quantum Computing
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 $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon