This device is not compatible.


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.

Optimize a Quantum Circuit Using 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.


Quantum Computing

Data Visualization

Quantum Machine Learning

Data Plotting


Python language basics

Basic concepts of linear algebra

Basic concepts of quantum computing

Basic concepts of machine learning

Optimization theory basics





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 qAq_A and Bob is in the Andromeda galaxy with a qubit qBq_B entangled with qAq_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 θ1\theta_1 and θ2\theta_2, this circuit can be used to achieve the entangled quantum state of 00+112\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


Getting Started

Task 1: Import Libraries


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


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