From 97f16779dbcd3b6851b8ca2d058f378004da3332 Mon Sep 17 00:00:00 2001 From: Tobias Stollenwerk Date: Tue, 18 Jun 2024 17:10:21 +0200 Subject: [PATCH] added template for exercise 05 --- template-exercise-05.ipynb | 228 +++++++++++++++++++++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100644 template-exercise-05.ipynb diff --git a/template-exercise-05.ipynb b/template-exercise-05.ipynb new file mode 100644 index 0000000..96f8794 --- /dev/null +++ b/template-exercise-05.ipynb @@ -0,0 +1,228 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "id": "3ad81093-9f6a-4d8d-a85b-7f5e056f42a6", + "metadata": {}, + "outputs": [], + "source": [ + "import qiskit\n", + "# numerics\n", + "import numpy as np\n", + "# functional programmin tools\n", + "import itertools\n", + "import functools\n", + "import operator\n", + "# plotting\n", + "import matplotlib.pyplot as plt\n", + "%matplotlib inline\n", + "plt.rcParams['figure.dpi'] = 125\n", + "import seaborn\n", + "# data analysis\n", + "import pandas as pd\n", + "# qiskit \n", + "from qiskit import QuantumCircuit, transpile, assemble\n", + "from qiskit_aer import QasmSimulator, AerSimulator\n", + "from qiskit.quantum_info import Pauli\n", + "from qiskit.visualization import array_to_latex, plot_histogram\n", + "from qiskit.quantum_info import Kraus, SuperOp, SparsePauliOp, Operator, DensityMatrix, Statevector\n", + "from qiskit_aer.noise import NoiseModel, QuantumError, ReadoutError, depolarizing_error\n", + "from qiskit.circuit import ParameterVector" + ] + }, + { + "cell_type": "markdown", + "id": "473f6a05-7b38-4c95-b4be-3896dce7e718", + "metadata": {}, + "source": [ + "## Exercise 5" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "b4d52ecc-63e2-4064-be7c-022310e0ea9c", + "metadata": {}, + "outputs": [], + "source": [ + "#Circuit 1: Single CNOT gate\n", + "circ_1=list([list((0,3))])\n", + "circ_2=list([list((0,1)), list((2,3)), list((0,3)), list((1,2))])\n", + "\n", + "mapping_1 = [(0,0), (1,1), (2,2), (3,3)]\n", + "\n", + "def create_CNOT_circuit(CNOT_list):\n", + " qc = QuantumCircuit(4)\n", + " \n", + " # Apply the Ising-type gates for each edge\n", + " for item in CNOT_list:\n", + " qc.cx(item[0], item[1])\n", + " return qc" + ] + }, + { + "cell_type": "markdown", + "id": "a758ae9a-6360-4a1a-ac10-a7cf2557db39", + "metadata": {}, + "source": [ + "### 5.1 (a)\n", + "\n", + "Consider the following CNOT gate and the intuitive qubit mapping $q_i \\rightarrow q_i$ :" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "8c8f8a12-c59f-4d35-9c26-4e4f150083e8", + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAN0AAAF7CAYAAABW9o5dAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAABM5AAATOQGPwlYBAAAbb0lEQVR4nO3dfVRUh73u8WdGUBjelENQQy7FBkhCHUJUCJ6MWdrDQVOR2yoXXbYXJk1uGkNiqt6FXk6sOdqkJZyVl1alnMqBjCXxhtaXGAxoNRpIaZZKkWkCQVObUBUTBwUVgQH2+YPFhJcZhJnhNzP4fNZirYHZs+dn69f9NpuoFEVRQERi1K4egOhOw+iIhDE6ImGMjkgYoyMSxuiIhDE6ImGMjkgYoyMSxuiIhDE6ImGMjkgYoyMSxuiIhDE6ImGMjkgYoyMSxuiIhDE6ImGMjkgYoyMSxuiIhDE6ImGMjkgYoyMSxuiIhDE6ImGMjkgYoyMSxuiIhDE6ImGMjkgYoyMSxuiIhDE6ImGMjkgYoyMSxuiIhDE6ImGMjkgYoyMSxuiIhDE6ImGMjkgYoyMSxuiIhDE6ImGMjkgYoyMSxuiIhDE6ImGMjkgYoyMSxuiIhDE6ImGMjkgYoyMSxuiIhDE6ImGMjkgYoyMSxuiIhDE6ImGMjkgYoyMSxuiIhDG62zhy5AjS09MRFh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EZHJIzREQljdETCGB2RMEZHJIzREQljdETCGB2RMEZHJIzREQljdETCGB2RMEZHJIzREQljdETCGB2RMEZHJIzREQljdETCGB2RMEZHJIzREQljdETCGB2RMEZHJIzREQljdETCGB2RMEZHJIzREQljdETCGB2RMEZHJIzREQljdETCGB2RMEZHJIzREQljdKNw5MgRpKenIywsDD4+PggPD0dmZiYaGxsBADqdDiqVComJiS6elDyBl6sHcGft7e3Q6/UoLS0d9POmpiYYDAYcPHgQJ06cQH19PQAgLi7OBVOSp+GWzoaenh4sW7bMElxycjL27NmDU6dOoby8HGlpabh69Sr0ej1aWloAMDoaHW7pbMjJycGxY8cAANu3b0dWVtag5xcvXozly5dj3759lp8xOhoNbumsMBqNyMvLAwCsW7duWHD9cnJyLI/VajViY2NF5iPPxuis2LJlCxRFQUhICLZu3WpzuZiYGMvjqKgoaDQaifHIwzG6IUwmEw4cOAAA0Ov18Pf3t7msRqOBt7c3gOG7lr/73e+wZs0aJCYmQqPRQKVS4cUXXxyvscmD8JhuiPLycvT29gIAUlJSRly2ra0NZrMZwPDoXnjhBXzxxReYNm0a7r77bnz++efjMi95HkY3RE1NjeXxvHnzRly2trbW8nhodLt27UJkZCQiIiJQXFyMxx9/3JljorW1FUaj0anrHE9159oHf19XB7Sfc9E09tFqtQgKCnJ4PYxuiObmZgCAr68v/Pz8Rly2rKzM8nhodElJSU6fbSCj0YgFCxaM63s4lSYSuHeT5dusrCyPi66yshI6nc7h9fCYbohbt24BADo6OtDZ2WlzuWvXrqGwsBAAMH36dMyYMUNkPvJ8jG6I0NBQAICiKJZPmlizfv16mEwmALw+R2PD3cshEhMTUVBQAADIy8tDSUnJoOcVRcHmzZtRVFRk+ZkrotNqtaisrBR/X3vVnWtH1qtNlu937NiB2EjPusSi1Wqdsh5GN8SKFSuwYcMGtLS04K233oKXlxcyMzMRGBiI+vp65Ofno7q6GvHx8Th58iQA10QXFBTklOMLMZpmAN9EFxsbC92cO3OXnNENERAQgKKiIqSlpcFsNsNgMMB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MIYHZEwRkckjNERCWN0RMIYHZEwRkckjNERCWN0RMIYHZEwRkckjNERCWN0RMIYHZEwRkckjNERCWN0RML+G4LwveGXm9AcAAAAAElFTkSuQmCC", + "text/plain": [ + "
" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "qc=create_CNOT_circuit(circ_1)\n", + "qc.draw('mpl')" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "3f35ef37-d8ab-45e2-81e0-b0eb21691723", + "metadata": {}, + "outputs": [], + "source": [ + "#Algorithm:\n", + "def qubit_routing_algorithm(CNOT_list, mapping):\n", + " qc = QuantumCircuit(4)\n", + " cnot_count=0\n", + " #To Do: Write an algrithm that creates the circuit in the given topology using swap gates \n", + " # and evaluates the cnot count of the resulting circuit\n", + " return qc, cnot_count" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "49712309-599f-4ca2-a5c3-1b1e324b3104", + "metadata": {}, + "outputs": [], + "source": [ + "#To Do: Run your algortihm for a single CNOT gate in the given topology" + ] + }, + { + "cell_type": "markdown", + "id": "94286203-8eb2-421c-a8d4-b5dc453a4376", + "metadata": {}, + "source": [ + "## 5.1 (b)\n", + "\n", + "Consider the following CNOT circuit" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "3e3d8260-c60a-4435-ab98-f44f1daeb10e", + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAF7CAYAAADVF+BPAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAABM5AAATOQGPwlYBAAAvhklEQVR4nO3deVxU5f4H8M+w7yiiuGWogImCpqKYYJnmkkq5BHUrwFaVFpffVfNmlnYr895W13slXNJMTDPFQK+mgZGpqKCCoKK5hAbIvg0wvz94MbHNOMzCmZnn8369er1mmPM859vUfObMc57zHJlCoVC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Xu5JVj4msHcPK8Ye/Q1aWjA35cMxYD+vAqXfoLg5+0lpqZjxlLfkZKuv5v5NHJzQ5r3x6BqWM89d63saiS1+CD/57FPzecQXW1/j+Gz03qjc8XDoebq63e+ybTxuAnncjltVgRcxbL1p3R29H/0+N74cu3hsO9fct3MjM3ZzLyELnkZ5y9mK+X/rp0dMC6tx9CyKj79dIfmR8GP+lFTm4ZondlYl1sBm7cLr13gyacHKwRPtkLs0IfQH8N1/g3J7W1CiQcu4E136YjLvE6tPlUDvPriNlhfRE6rifsbHmJDqnG4Ce9qq6uRVzidRw6fgsnz+fizMU8lFfUNNvO0lIG317tMNjXHQ8N6ISw8b3g4mQjQcXG5+rNYmyPv4IT53JxKj0X126VtLhdx/Z2GOzrjkF9O2DqGE+jXUmVjA+DnwyquroWWb8XoaC4EhWVNbCxtoSjvRV87neFgz2PSjWRe7cC2TeLUV5RDQUAe1srdOloj+4ejia1dAUZDwY/EZFgzGuOHBER3RODn4hIMAx+IiLBMPiJiATD4CciEgyDn4hIMAx+IiLBMPiJiATD4CciEgyDn4hIMAx+IiLBMPiJiATD4CciEgyDn4hIMAx+IiLBMPiJiATD4CciEgyDn4hIMAx+IiLBMPiJiATD4CciEgyDn4hIMAx+IiLBMPiJiATD4CciEgyDn4hIMAx+IiLBMPiJiATD4CciEgyDn4hIMAx+IiLBMPiJiATD4CciEgyDn4hIMAx+IiLBMPiJiATD4CciEgyDn4hIMAx+IiLB/D/kNqDdC9EnywAAAABJRU5ErkJggg==", + "text/plain": [ + "
" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "qc=create_CNOT_circuit(circ_2)\n", + "qc.draw('mpl')" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "6bab68ba-0d49-4c2b-adb7-374ca7b0491f", + "metadata": {}, + "outputs": [], + "source": [ + "#To Do: Run your algorithm with the intuitive mapping for the above CNOT circuit" + ] + }, + { + "cell_type": "markdown", + "id": "b0e66068-fe20-4571-98ee-8896a3f94513", + "metadata": {}, + "source": [ + "## 5.1 (c)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "7fd9821e-a2fd-4767-8c48-89f210ddbd87", + "metadata": {}, + "outputs": [], + "source": [ + "mapping_2 = [(0,1), (1,0), (2,2), (3,3)]\n", + "\n", + "#To Do: Run the algorithm with an other mapping" + ] + }, + { + "cell_type": "markdown", + "id": "8cd54e30-0755-42d5-8bef-2d374bf9a986", + "metadata": {}, + "source": [ + "## 5.1 (d)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "c0ca6a90-ef9b-4946-b536-7db9de7ad9a3", + "metadata": {}, + "outputs": [], + "source": [ + "mapping_3 = [(0,0), (1,2), (2,1), (3,3)]\n", + "\n", + "#To Do: Run the algorithm with an other mapping" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.3" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}