{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Exercise 2: Quantum Logic Gates" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Prerequisite\n", "- [Qiskit basics](https://qiskit.org/documentation/tutorials/circuits/1_getting_started_with_qiskit.html)\n", "- [Ch.1.2 The Atoms of Computation](https://qiskit.org/textbook/ch-states/atoms-computation.html)\n", "\n", "Other relevant materials\n", "- [Access IBM Quantum Systems](https://qiskit.org/documentation/install.html#access-ibm-quantum-systems)\n", "- [IBM Quantum Systems Configuration](https://quantum-computing.ibm.com/docs/manage/backends/configuration)\n", "- [Transpile](https://qiskit.org/documentation/apidoc/transpiler.html)\n", "- [IBM Quantum account](https://quantum-computing.ibm.com/docs/manage/account/ibmq)\n", "- [Quantum Circuits](https://qiskit.org/documentation/apidoc/circuit.html) " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from qiskit import *\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": [ "
ibmqx2 with the triangle connectivity📓 Assign your choice of layout to the list variable layout in the cell below