Skip to content

YuanjianLi/Xanadu-Codebook-Solutions

Repository files navigation

←←Back to Homepage

This repository contains complete solutions to the Xanadu Quantum Codebook, which is an open source, free resource for learning the fundamentals of quantum computing using the PennyLane python library!

Material Bread logo

XANADU QUANTUM CODEBOOK

Introduction

The Xanadu Quantum Codebook was written, developed, and reviewed by members of the Xanadu team.

This resource will help you learn quantum computing by using Xanadu's quantum software framework PennyLane..

What is the Xanadu Quantum Codebook?

The Codebook is an experimental, exercise-based introduction to quantum computing. Rather than just reading a textbook or tutorial, or executing some pre-written code cells, the Codebook is an active learning resource in which you will learn by doing.

Is the Codebook for me?

This resource is intended for people who:

  1. know how to program in Python and use numpy
  2. know some basic linear algebra
  3. You do not need to know any physics or quantum computing!

Below we list the specific concepts you should be familiar with.

Python

  1. basic control flow (for, if, while, etc.)
  2. basic NumPy usage (creating arrays, adding/subtracting/multiplying arrays, manipulating them; the NumPy documentation is the best resource for this)
  3. decorators
  4. conceptual knowledge of functional programming is beneficial, but not a requirement
  5. Familiarity with PennyLane is not required, and will be taught by this resource.

Linear algebra

  1. vectors
  2. matrices
  3. complex numbers (in both rectangular and polar form)
  4. eigenvalues/eigenvectors
  5. linear combinations
  6. inner products
  7. matrix exponentials
  8. Cartesian and polar coordinates

A few other mathematical concepts that will be useful are

  1. basic trigonometry
  2. basic probability theory (probability, conditional probability, and marginal probability)
  3. Khan Academy is an excellent resource for learning about the above. Interactive Linear Algebra is also another great option.

How do I use the Codebook?

The content is divided up into a graph of modules, each containing a graph of multiple nodes, like this one. (Note: modules are sometimes referred to as chapters, and nodes as sections). The main screen provides three panels: a graph view, coding challenges (codercises), and the textbook content.

Xanadu Codebook

  • Xanadu: Xanadu is a leading company in the field of quantum computing, providing a full-stack platform for quantum software development. Their platform, "Strawberry Fields" is a powerful tool for creating and running quantum algorithms. It provides a high-level interface for working with quantum systems, making it easy to create and run quantum circuits on real quantum hardware.

Introduction

This folder contains solutions to the introductory module of the Xanadu Quantum Codebook. The solutions are written in python and aim to provide a solid understanding of the concepts of quantum computing.

Serial Number Title Links Medium
I1 All About Qubits Open In Colab Medium
I2 Quantum Circuits Open In Colab Medium
I3 Unitary Matrix Open In Colab Medium
I4 X and H Open In Colab Medium
I5 It's just a Phase Open In Colab Medium
I6 From a different angle Open In Colab Medium
I7 Universal gate sets Open In Colab Medium
I8 Prepare Yourself Open In Colab Medium
I9 Measurements Open In Colab Medium
I10 What did you expect? Open In Colab Medium
I11 Multi-Qubit Systems Open In Colab Medium
I12 All tied up Open In Colab Medium
I13 We've got it under control Open In Colab Medium
I14 Multi-qubit gate challenge Open In Colab Medium
I15 Quantum Teleportation Open In Colab Medium

Algorithms

Introduction to quantum Algorithms

Serial Number Title Links Medium
A1 No exponential Magic Open In Colab Medium
A2 The Magic 8-ball Open In Colab Medium
A3 Pair Programming Open In Colab Medium
A4 Making and breaking promises Open In Colab Medium
A5 Hadamard Transform Open In Colab Medium
A6 Deutsch Josza Open In Colab Medium

Fourier

In this node, we will change gears and discuss the basics of the classical Discrete Fourier transform (DFT), which has made a significant impact in the field of signal processing for transforming data from the time domain to the frequency domain and back. The DFT is a unitary transformation, which makes it a good candidate for quantum computers

Serial Number Title Links Medium
F1 Changing Perspectives Open In Colab Medium
F2 Quantum Fourier Transform Open In Colab Medium
F3 Connecting the Dots Open In Colab Medium

Quantum Phase Estimation

In this module we are going to learn about an algorithm that helps us estimate the eigenvalue of a given unitary operator. The eigenvectors of a unitary operator form an orthonormal basis set. Applying the unitary operator on one of its eigenvectors multiplies it by a global phase (the eigenvalue). For unitary operators, the eigenvalues have magnitude and can be written in the form , where is called the eigenphase corresponding to the eigenvalue.

Serial Number Title Links Medium
P1 Catch the Phase Open In Colab Medium
P2 It's not just a Phase Open In Colab Medium
P3 Let's be rational Open In Colab Medium
P4 A mixed bag Open In Colab Medium

Shor's algorithm

Modular arithmetic is a fundamental concept of basic mathematics. We say that two integers are equivalent modulo if the difference between them is a multiple of , that is, there exists an integer such that . In order to understand this type of equivalence it is common to work with a "clock"-like picture, which will have hours instead of . We will say that two numbers are equivalent if they mark the same hour on the clock.

Serial Number Title Links Medium
S1 Modular arithmetic Open In Colab Medium
S2 Classical factorization Open In Colab Medium
S3 Period finding Open In Colab Medium
S4 Shor's algorithm Open In Colab Medium
S5 The RSA system Open In Colab Medium

G, Grover's algorithm

In module A, we sped up the lock-breaking process by testing states in pairs. This told us when the solution was present, but not which state it was. Our goal now will be to try and figure out the state directly, and our broad strategy will be to start in the uniform superposition and somehow "pump" amplitude from the other states into , so that we measure the solution with high probability. This strategy is called amplitude amplification. Let's start by exploring what happens to amplitudes when we apply the oracle.

Serial Number Title Links Medium
G1 Introduction to Grover Search Open In Colab Medium
G2 Searching with Geometry Open In Colab Medium
G3 Searching with circuits Open In Colab Medium
G4 Steps and SpeedUps Open In Colab Medium

H, Hamiltonian simulation

Fundamentally, quantum computing is different from classical computing because of the physical laws working "under the hood" of the computer. To understand quantum computing in this light, it's useful to treat Nature as a sort of black box. It takes an initial condition as an input, evolves it using physical laws, and outputs experimental data (aka measurements) at the end. We can try to infer the laws of Nature from looking at the pattern of input conditions and output measurements.

Serial Number Title Links Medium
H1 Simulating Nature Open In Colab Medium
H2 Unitaries Open In Colab Medium
H3 Hamiltonians Open In Colab Medium
H4 Energy in quantum systems Open In Colab Medium
H5 Approximating Exponentials Open In Colab Medium
H6 Linear Combination of Unitaries Open In Colab Medium
H7 Generalizing PREPARE and SELECT Open In Colab Medium
H8 Comparing Methods Open In Colab Medium
H9 Qubitization Open In Colab Medium

E, Error Correction

Serial Number Title Links Medium
E1 Got Errors? Open In Colab Medium
E2 No Flip Flopping Allowed Open In Colab Medium
E3 Are you Shor this works? Open In Colab Medium

About

This repo contains the online xanadu quantum codebooks solutions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors