{ "cells": [ { "cell_type": "markdown", "metadata": { "tags": [ "remove_cell" ] }, "source": [ "# Exercise Sheet 1: Quantum Logic Gates" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To run this notebook you'll need to [install `qiskit`](https://docs.quantum.ibm.com/guides/install-qiskit), `qiskit-aer` and `qiskit-ibm-runtime`." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from qiskit import QuantumCircuit, transpile\n", "from qiskit_aer import AerSimulator\n", "from qiskit.visualization import plot_histogram\n", "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## **Exercise 1**\n", "\n", "See 'Part 1' below, and find the circuits required for the:\n", "* (a) `XOR` gate;\n", "* (b) `AND` gate;\n", "* (c) `NAND` gate;\n", "* (d) `OR` gate.\n", "\n", "## **Exercise 2**\n", "\n", "See 'Part 2' below, and find a `layout` for which the AND gate compiles to 6 non-local gates for `ibmqx2`. Note that there is some randomness in the compiling process. So you might need to try a few times." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
📓 Assign your choice of layout to the list variable layout in the cell below