This device is not compatible.

PROJECT

# Optimize a Quantum Circuit Using PennyLane

In this project, we’ll optimize a quantum circuit using a machine learning approach with PennyLane. This will introduce us to the fundamental concepts of quantum machine learning as well as provide a hands-on learning experience with PennyLane.

You will learn to:

Get started with PennyLane.

Visualize the optimization results using dedicated packages.

Optimize a quantum circuit using a machine learning approach.

Create and simulate a quantum circuit using Pennylane.

Skills

Quantum Computing

Data Visualization

Quantum Machine Learning

Data Plotting

Prerequisites

Python language basics

Basic concepts of linear algebra

Basic concepts of quantum computing

Basic concepts of machine learning

Optimization theory basics

Technologies

NumPy

PennyLane

Matplotlib

Project Description

**Quantum entanglement**, one of the fundamental properties of quantum computing, is when the state of one particle is dependent on the state of another, no matter how far they are in space.
For instance, if Alice is in the Milky Way galaxy with a qubit $q_A$ and Bob is in the Andromeda galaxy with a qubit $q_B$ entangled with $q_A$. In that case, the results of Alice’s measurement affect the state of Bob’s qubit. This is what Einstein called “Spukhafte Fernwirkung” or “spooky action at a distance.”

In this project, we’ll implement and optimize the following two-qubit quantum circuit:

With the right values of $\theta_1$ and $\theta_2$, this circuit can be used to achieve the entangled quantum state of $\cfrac{\vert00\rangle + \vert11\rangle}{\sqrt 2}$. We’ll use machine learning to find the optimal values of the parameters, which can be used to entangle the qubits.

Project Tasks

1

Getting Started

Task 1: Import Libraries

2

Construct the Quantum Circuit

Task 2: Load a Quantum Device

Task 3: Create a Quantum Circuit

Task 4: Apply the Ry Gate

Task 5: Apply the CRx Gate

Task 6: Measure the Quantum Circuit

Task 7: Create a Quantum Node

Task 8: Visualize the Circuit

Task 9: Simulate the Circuit

3

Optimize the Quantum Circuit

Task 10: Create the Cost Function

Task 11: Initialize the Optimizer

Task 12: Optimize the Circuit

Task 13: Visualize the Optimization Process

Congratulations!