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!
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..
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.
This resource is intended for people who:
- know how to program in Python and use numpy
- know some basic linear algebra
- You do not need to know any physics or quantum computing!
Below we list the specific concepts you should be familiar with.
- basic control flow (for, if, while, etc.)
- basic NumPy usage (creating arrays, adding/subtracting/multiplying arrays, manipulating them; the NumPy documentation is the best resource for this)
- decorators
- conceptual knowledge of functional programming is beneficial, but not a requirement
- Familiarity with PennyLane is not required, and will be taught by this resource.
- vectors
- matrices
- complex numbers (in both rectangular and polar form)
- eigenvalues/eigenvectors
- linear combinations
- inner products
- matrix exponentials
- Cartesian and polar coordinates
- basic trigonometry
- basic probability theory (probability, conditional probability, and marginal probability)
- Khan Academy is an excellent resource for learning about the above. Interactive Linear Algebra is also another great option.
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: 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.
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.
Introduction to quantum Algorithms
| Serial Number | Title | Links | Medium |
|---|---|---|---|
| A1 | No exponential Magic | ||
| A2 | The Magic 8-ball | ||
| A3 | Pair Programming | ||
| A4 | Making and breaking promises | ||
| A5 | Hadamard Transform | ||
| A6 | Deutsch Josza |
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 | ||
| F2 | Quantum Fourier Transform | ||
| F3 | Connecting the Dots |
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 | ||
| P2 | It's not just a Phase | ||
| P3 | Let's be rational | ||
| P4 | A mixed bag |
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 | ||
| S2 | Classical factorization | ||
| S3 | Period finding | ||
| S4 | Shor's algorithm | ||
| S5 | The RSA system |
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 | ||
| G2 | Searching with Geometry | ||
| G3 | Searching with circuits | ||
| G4 | Steps and SpeedUps |
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 |
|---|---|---|---|
| E1 | Got Errors? | ||
| E2 | No Flip Flopping Allowed | ||
| E3 | Are you Shor this works? |
