Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Quantum Computing Algorithms

You're reading from  Quantum Computing Algorithms

Product type Book
Published in Sep 2023
Publisher Packt
ISBN-13 9781804617373
Pages 342 pages
Edition 1st Edition
Languages
Author (1):
Barry Burd Barry Burd
Profile icon Barry Burd

Table of Contents (19) Chapters

Preface Introduction to Quantum Computing Part 1 Nuts and Bolts
Chapter 1: New Ways to Think about Bits Chapter 2: What Is a Qubit? Chapter 3: Math for Qubits and Quantum Gates Chapter 4: Qubit Conspiracy Theories Part 2 Making Qubits Work for You
Chapter 5: A Fanciful Tale about Cryptography Chapter 6: Quantum Networking and Teleportation Part 3 Quantum Computing Algorithms
Chapter 7: Deutsch’s Algorithm Chapter 8: Grover’s Algorithm Chapter 9: Shor’s Algorithm Part 4 Beyond Gate-Based Quantum Computing
Chapter 10: Some Other Directions for Quantum Computing Assessments Index Other Books You May Enjoy

Coding the teleportation circuitry

In this section, we will provide code to teleport qubits and test the results. We’ve divided the code into three parts:

  • Creating registers
  • Adding gates to the registers
  • Running the quantum circuit

Creating registers

We start with the imports:

from qiskit import QuantumCircuit, QuantumRegister, \    ClassicalRegister, Aer
import random
import numpy as np
from qiskit.result import marginal_counts

In this chapter, the only new import is marginal_counts. We will describe that function later in this section.

The following function defines a circuit:

def create_registers():    alice_q = QuantumRegister(1, 'alice (q)')
    peter_alice_q = \
        QuantumRegister(1, 'peter/alice (q)')
    peter_bob_q = QuantumRegister(1, 'peter/bob (q)')
    ...
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 $15.99/month. Cancel anytime}