Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Quantum Computing Experimentation with Amazon Braket

You're reading from   Quantum Computing Experimentation with Amazon Braket Explore Amazon Braket quantum computing to solve combinatorial optimization problems

Arrow left icon
Product type Paperback
Published in Jul 2022
Publisher Packt
ISBN-13 9781800565265
Length 420 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Alex Khan Alex Khan
Author Profile Icon Alex Khan
Alex Khan
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Introduction
2. Section 1: Getting Started with Amazon Braket FREE CHAPTER
3. Chapter 1: Setting Up Amazon Braket 4. Chapter 2: Braket Devices Explained 5. Chapter 3: User Setup, Tasks, and Understanding Device Costs 6. Chapter 4: Writing Your First Amazon Braket Code Sample 7. Section 2: Building Blocks for Real-World Use Cases
8. Chapter 5: Using a Quantum Annealer – Developing a QUBO Function and Applying Constraints 9. Chapter 6: Using Gate-Based Quantum Computers – Qubits and Quantum Circuits 10. Chapter 7: Using Gate Quantum Computers – Basic Quantum Algorithms 11. Chapter 8: Using Hybrid Algorithms – Optimization Using Gate-Based Quantum Computers 12. Chapter 9: Running QAOA on Simulators and Amazon Braket Devices 13. Section 3: Real-World Use Cases
14. Chapter 10: Amazon Braket Hybrid Jobs, PennyLane, and other Braket Features 15. Chapter 11: Single-Objective Optimization Use Case 16. Chapter 12: Multi-Objective Optimization Use Case 17. Other Books You May Enjoy Appendix: Knapsack BQM Derivation

Experimentally validating QAOA concepts

So far, we have seen how specific gate rotations can be used to increase the probability of the qubit states that produce the lowest cost. We have also seen that we apply the X gate first and then the Hadamard gate to all the qubits to bring them to the |-⟩ state. From there, we apply RZ and ZZ rotations to individual qubits and pairs of qubits, respectively. Finally, we apply the RX gates to bring the information into the measurement basis. Let’s implement this in code:

  1. First, let’s look at the effect that RZ rotations have on the linear terms. We will begin by defining the objective function, as follows:
    objective=np.array([[-1,-1],[0,2]])
    eq=matrix_to_polynomial(objective)

Output:

-1x²+2x²-1xx

  1. We want to see the effect of the coefficient on x0, which is -1, and on x1, which is 2 on the qubit vectors. In the following code, we will create a combined circuit...
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 $19.99/month. Cancel anytime