{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Running the IBMQ and Qiskit " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Preparing the circuit (Quantum Random Number Generator)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The access to IMB Quantum experience is done via *Qiskit* package" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import qiskit\n", "from qiskit.visualization import plot_histogram" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The basic definition of a circuit is given by the number of qubits and the number of classical bits. Let's start with the simplest circuit having one qubit and one classical bit:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "circuit = qiskit.QuantumCircuit(1, 1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Having defined the basic structure of the circuit, you can define a sequence of operations performed on it. For example we might want to apply Hadamard on the qubit and then measure:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "circuit.h(0)\n", "circuit.measure(0,0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "At any point one can draw the circuit using the draw object. Default setting is text output:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
        ┌───┐┌─┐\n",
       "q_0: |0>┤ H ├┤M├\n",
       "        └───┘└╥┘\n",
       " c_0: 0 ══════╩═\n",
       "                
" ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "circuit.draw()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "However, one can obtain a more comprehensible output using the Matplotlib:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAL4AAAB7CAYAAADKUTqaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0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XYGD7ZRHt7O0JCPn6w3bx58xz6+psOee1Mmhr9Lwfwn/Lb+PS3rv91oWzU7/+0cT2CAsw/2+sDk8lkdnVmR/9Vbq74AvPxkiMoQInOnufo7Hk+sv3T7zt7nsNLPnvM6AEgJCQEbW1tI382GAyYO3eufQa3AYYvuO/XxcLtK9dx93GSyfAHTdy4+8TExKCjowOPHz8GAJw/fx6JiYk2m9PWGL7gPD1mQ7Nq+bj7xK1Qw1+pGHcfZ2dnFBcXIzk5GWFhYZDL5UhLS7PlqDbF6+oQ3g4N4fSPpXjxyyuL29xnueFIZgpmu8+SYDL74YpPcHVxwQbNN6Pe9vs10TMueoDhW7h+/To2bdoEf39/uLm5Yf78+UhNTcXDhw+lHs2uli5eiIUhc8y2fe3rg7jfRUg0kX0x/PeGhoawZcsWbN68GQ0NDUhMTMTBgwexfPlylJWVoaOjQ+oR7Uomk2HTd6vw24+L2/RtHJydZ2YiPMZ/LysrC1qtFnv37sXp06fh4eExcpvBYICPjw88PT3t8tgfrlNJX87aa33yBSwAd+/ehVarRXx8PLRarcXHZP72FUmaGbjiA0hKSkJ5eTnq6+sRFRUl9TiS6/65DwETPH053TF8AF5eXvDz80Nra6skj89DHdux9lBnZp65TEJ/fz9evXqFBQsWSD0KTSHhV/y+vj74+voiIiICjx49knocmiLCr/gKhQJhYWHQ6/Worq62uP3JkycSTEX2JvyKDwAlJSVISUmBs7MzEhISoFKp0NPTg7q6OkRERKCiokLqEcnGGP57t2/fxsmTJ6HT6TA4OAh/f3+sXLkSOTk5WLt2rdTjkY0xfBKS8Mf4JCaGT0Ji+CQkhk9CYvgkJIZPQmL4JCSGT0Ji+CQkhk9CYvgkJIZPQmL4JCSGT0Ji+CQkhk9CYvgkJIZPQmL4JCSGT0Ji+CQkhk9CYvgkJIZPQmL4JCSGT0Ji+CSk/wOQRmeqI+NdNQAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "circuit.draw(output=\"mpl\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Simulating the circuit " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To run the circuit, define first the backend for your circuit. You can use start by using a built-in (local) simulator. A standard one is provided in Aer framework called *QASM*. A *QASM* simulator is available also as an IBM cloud service. Finally, you can use also one of the available quantum computers. For now, let us start with the built-in simulator." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "simulator = qiskit.Aer.get_backend('qasm_simulator')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Then you can run the job using the execute command." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "job = qiskit.execute(circuit, simulator, shots=1024)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'0': 517, '1': 507}\n" ] } ], "source": [ "counts = job.result().get_counts()\n", "print(counts)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The result() object is not just results, it contains an extensive information about performed job" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Result(backend_name='qasm_simulator', backend_version='0.3.0', date=datetime.datetime(2019, 10, 3, 13, 27, 7, 780494), header=Obj(backend_name='qasm_simulator', backend_version='0.3.0'), job_id='873936f3-b0ce-4325-a8a1-7eb3b5dadf36', metadata={'max_memory_mb': 8096, 'omp_enabled': True, 'parallel_experiments': 1, 'time_taken': 0.002237686}, qobj_id='431f7fe7-4916-4e2a-a42c-aa08b33b74e2', results=[ExperimentResult(data=ExperimentResultData(counts=Obj(0x0=517, 0x1=507)), header=Obj(clbit_labels=[['c', 0]], creg_sizes=[['c', 1]], memory_slots=1, n_qubits=1, name='circuit0', qreg_sizes=[['q', 1]], qubit_labels=[['q', 0]]), meas_level=2, metadata={'measure_sampling': True, 'method': 'stabilizer', 'parallel_shots': 8, 'parallel_state_update': 1}, seed_simulator=363670589, shots=1024, status='DONE', success=True, time_taken=0.002129734)], status='COMPLETED', success=True, time_taken=0.0029561519622802734)" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "job.result()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "One can use also visualize these results" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "scrolled": true }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAdAAAAE1CAYAAABX1LExAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4wLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvqOYd8AAAIABJREFUeJzt3XuUnXV97/H319xIaAKZOIYZMMSYGCYhjQNZFBRCAKNgS5diluiCgq2Woyi0cpR6BWktbeOlUI8eArblIlJEUeuFAweTFrkoJRlGQsYxaSA5IUMcQgwxgSQM3/PH3omTyUwy+8meSybv11p7zd6/5/f85rsZNh+e5/k9vx2ZiSRJqsyrBroASZIORgaoJEkFGKCSJBVggEqSVIABKklSAQaoJEkFGKCSJBVggEqSVEC/B2hEXBoRT0XESxGxNCJO20//kRHx1+V9tkfE2oi4vEufd0XEivL2FRHxzr59F5KkQ93w/vxlEXE+cD1wKfBg+ec9ETEjM9f2sNsdwGuBS4CVwERgdKcxTwHuBK4G7gbOA+6KiDdn5s/3Vc+ECRNy0qRJB/amJElDyuOPP/5cZtbur1/051J+EfFz4BeZ+eed2lYC387MT3bT/63AXcDrM/O5Hsa8E6jJzPmd2u4H2jPzvfuqp7GxMRcvXlzszUiShqSampqlmTlnf/367RRuRIwETgTu67LpPuBNPez2DuC/gCsiYl1ErIyIf4qI3+vU55Ruxrx3H2NKknTA+vMU7quBYcCGLu0bgLf0sM8U4FRgO/Au4EjgK0A9sKDc56gexjyquwEj4hJKp4Opq6tj2bJlANTX1zNmzBhWrVoFwBFHHMGUKVNoamoCYNiwYcyePZvW1la2bt0KQENDA88//zwb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MQ7I+L1ETG63Gc08M8RMWsASx0yPIWrbkXEyZSWQ3yR0jKKPwGez8ytETEGuBV4KTMvHMAyJZVFxE2UvlxjIXAecDHweqAV+DGlz/B04PrMHDlQdQ4lBqh6FBHHA58F/hjYSmlx/3ZKC/y3AR/IzCcGrkJJABExnNJypuMy8xOd2mdSOipdABwGHAnckpnvH5BChxgDVPtVvqXlD4F3AC9RWm/4rsz85YAWJmm3iBgPTMzMX0bESGBn58lEEXE+cAdwgpP/qsMAVUUi4lWZ+cpA1yFp/8rzFyIzOyLizymdvh0z0HUNFf39dWY6yBme0sGjy+d1LHD1QNUyFHkEKkmHgIgYAXT4P8GmAd/lAAAAKElEQVTVY4BKklSA94FKklSAASpJUgEGqCRJBRigkiQVYIBKklTA/webwHGT/V0SLQAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "plot_histogram(counts)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "in the ideal case, the quantum system provides a physical way of obtaining randomness. Hence, we have created a quantum RNG." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## The Quantum Experience" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To use IBM quantum computer, import IBMQ object from Qiskit package. This object manages account credentials." ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "from qiskit import IBMQ" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you are first-time user, you need to get an API token. Follow the instructions on this page to create your own token. After you obtain it, run the following code, where you replace MY_API_TOKEN with the token you obtained." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "IBMQ.save_account('MY_API_TOKEN')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you have already used the account and the token is stored on your computer, you can load it using" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "IBMQ.load_account()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can chec the active account using code" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": true }, "outputs": [], "source": [ "IBMQ.active_account()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now, to run the job, first select the device that will be used as a backend instead of simulator. First, let us look at available devices." ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[,\n", " ,\n", " ,\n", " ,\n", " ]" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "IBMQ.get_provider().backends()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "These are all the backends you can use. The first one is the *QASM* cloud simulator, and the rest are available quantum computers. Some are more busy than others and we can use the least busy one." ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [], "source": [ "device = qiskit.providers.ibmq.least_busy(IBMQ.get_provider().backends(operational=True, simulator=False))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now you can run the job in the same way as when we used the simulator" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [], "source": [ "job = qiskit.execute(circuit, device, shots=1024)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can monitor the progress of your job, as it can take several minutes to go through the queue and run" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Job Status: job has successfully run\n" ] } ], "source": [ "from qiskit.tools.monitor import job_monitor\n", "job_monitor(job)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now, you can look at the results" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAdAAAAE1CAYAAABX1LExAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4wLCBodHRwOi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ICJGAWMz85mIGAzsa3sxUURcBnwTON2L/7qHAaqKRMRLMvM3fV2HpMMrX78QmdkaER+kZUS+AAAAU0lEQVSgdPp2WF/Xdazo7ceZ6ShneEpHj3b763Dg031Vy7HII1BJOg5ExCCg1f8J7j4GqCRJBXgfqCRJBRigkiQVYIBKklSAASpJUgEGqCRJBfx/NPyM151d0cQAAAAASUVORK5CYII=\n", "text/plain": [ "
" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result = job.result()\n", "counts = result.get_counts()\n", "plot_histogram(counts)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Quantum computer v. QASM simulator " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To see the basic difference between the simulator and the quantum computer, it is enough to just prepare an \"empty\" circuit, in which we just measure the initialized state." ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAJEAAAB7CAYAAAB0B2LHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4wLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvqOYd8AAAB8BJREFUeJzt3G9IVAsax/Hf5IhlpWU4XlvHAs29Wk0NtW236G5rdLOtrZjCRJBeqFsvknoR7VZWvsjYkLB9EeSWSJAsFaPFEhFICUYFRlmW4a3FcBRJN7ISV5oZn32xaZl/8xn3nLn9PjDgnJk58zDn6/HMODMWEREQKUwyegAKfoyI1BgRqTEiUmNEpMaISI0RkRojIjVGRGqMiNQYEakxIlJjRKTGiEiNEZEaIyI1RkRqjIjUGBGpMSJSY0SkxohIjRGRGiMiNUZEaoyI1BgRqVmNHiAYWCwWQ+43WL4mgXsiUmNEpMaISI0RkRojIjVGRGqMyCQiIyONHmHc+DpRgK1cuRJr167FkiVLYLfbYbFY0NHRgQcPHqCmpgbXr1+Hz+cbcBuX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TGiEiNEZEaIyI1RkRqjIjUGBGpMSJSY0SkxohIjRGRGiMiNUZEaoyI1BgRqf0XsSH4lxwEdn0AAAAASUVORK5CYII=\n", "text/plain": [ "
" ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "circuit = qiskit.QuantumCircuit(1, 1)\n", "circuit.measure(0, 0)\n", "circuit.draw(output=\"mpl\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Classical QASM simulation will use the predefined simulator backend." ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [], "source": [ "cjob = qiskit.execute(circuit, simulator, shots=1024)\n", "ccounts = cjob.result().get_counts()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For quantum computation we will use already defined quantum computer in device." ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Job Status: job has successfully run\n" ] } ], "source": [ "qjob = qiskit.execute(circuit, device, shots=1024)\n", "job_monitor(qjob)" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [], "source": [ "qcounts = qjob.result().get_counts()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's plot the results of both runs." ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "scrolled": true }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAh8AAAE1CAYAAABHgoIcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4wLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvqOYd8AAAIABJREFUeJzt3Xl4VdW9//H3FzIISEISAiRgQATTEDCGKBWcwMJFtHotYtULrUOROrV6BRXs9QrVWo0TtlYrDnX8aVFoq164ZQgWBQeIEAVCBCMgJGBMCEGGhIT1++OccA8h04FknyR8Xs9znpy99tr7fDfxwMe9117bnHOIiIiIeKVdqAsQERGR44vCh4iIiHhK4UNEREQ8pfAhIiIinlL4EBEREU8pfIiIiIinFD5ERETEUwofIiIi4imFDxEREfFUWKgLCKW4uDiXlJQU6jJERKQFWb169XfOufjq5ezs7G5hYWHPAwPR/7Q3xkFgTWVl5cSMjIxva+twXIePpKQksrKyQl2GiIi0ILGxsZsDl8PCwp7v0aNHSnx8/M527drpmSQNOHjwoBUVFQ3Yvn3788CltfVRghMREanfwPj4+DIFj8Zp166di4+P34XvTFHtfTysR0REpDVqp+ARHP+fV50ZQ+FDREREPKXwISIiIp46rgecioiIHI0bZpLRnPt/7naym3P/oaYzHyIiIq3cH/7wh7hTTz11QIcOHdK7du2aNmHChKTi4uL2NfuYWcbzzz8fU3P7qVOn9ujZs+egjh07pnfv3v20iy++uG/1uiFDhiSbWcZHH33UIXCbkSNHnmJmGe+9917nYOtV+BAREWnF7rvvvu4zZszo9eCDD24tLS1dvWzZstxvvvkmYsSIEf3Ly8utut/rr78eFx0dXfXaa6/FBW7/xz/+MW727NlxCxYs+HLv3r2rVqxYsW7EiBFlgX169+5d/uKLLx7abvv27e1Xr159YkxMTOXR1KzwISIi0kqVlJS0e+SRRxIffvjhLePGjSuLjIx0ycnJFe+8807+1q1bI2fNmhUL8OWXX0asWLGi88yZMzd9+OGH0d98882hYRcrVqzoNHz48LLU1NRygKSkpMopU6Z8F/g548aNK37nnXdiKyt9WePFF1+MHT169M7w8PCjugtI4UNERKSVysrKOrGioqLdNddcszOwPTo6+uDw4cN3LVy4MArgueeei0tNTd177bXXlvbt23ffCy+8cOgsxllnnfX9nDlz4u69997uS5cu7VgdMAIlJiYe6Nev3765c+dGAbzxxhtdr7vuuuKjrVvhQ0REpJX69ttvw7p06VIZHh5+xLoePXocKC4uDgOYPXt23BVXXFEMcPnll5e88cYbh8LHzTffXPLQQw9tWbx4cfTo0aOTu3btevo999zTo+b+xo8fX/zqq6/G5eTkRO7evbv9yJEj9xxt3QofIiIirVS3bt0qS0tLww4cOHDEuu3bt4fHxcVVLliwoNO2bdsir7322hKA6667rmTDhg0dli9ffmgA6U033VSyfPnyL0tLS1c//vjjmx955JHEOXPmRAXu72c/+1np8uXLox577LHu1UHmaCl8iIiItFIjRozYEx4efvDll18+7A6WsrKydu+//370eeedt/svf/lLV+ccgwcPTu3atWvasGHDUgACB5BWi4yMdNdff/3O5OTkfZ9//vlhd7d07tz54PDhw3e9/vrr8RMnTjym8KF5PkRERFqpuLi4qsmTJxfcfffdSV26dKm65JJLdm/atCl80qRJSTExMZWTJk0q6dmzZ69HH3108+WXX15avd3rr78e8+ijjyY+88wzW5955pm4bt26VY4ePXp3VFTUwTlz5kRt3Lixw7Bhw464rPLYY49tmzRp0nfJyckVx1K3woeIiEiQWtIkYA888MCOuLi4qmnTpp00fvz4yIqKCjvzzDO/X7x48Zdvvvlm9AknnHDw5ptvLo6MjDx0Z8ptt932XWZmZuLbb78dHR0dXZWZmZkwadKkkw8ePGiJiYnlmZmZm0ePHv19zc/q06fPgT59+hx5jSdI5tzx+6yc9PR0l5WVFeoyRESkBYmNjc12zp1RvZyTk7MpLS3tu/q2aUlmzpwZ99BDD/X84IMP1vfv3/+YzlAci5ycnK5paWl9alunMx8iIiJtyO23314cHh7ulixZ0imU4aM+Ch8iIiJtzC233FIS6hrqo7tdRERExFMKHyIiIuIphQ8RERHxlMKHiIiIeErhQ0RERDyl8CEiIiKe0q22Ldytt97KggUL6Nq1K8uXLz9ivXOOadOmsXDhQjp06MCf/vQn0tLSAHjjjTd47LHHAJg8eTJXX301AKtXr+aWW25h//79jBo1it///veYmXcHJSLSyn2VPD2jOfd/St70FjODanPQmY8W7j/+4z9466236ly/aNEivvrqK1auXMkTTzzB5MmTAdi5cyeZmZksXLiQRYsWkZmZSWmpb1r/KVOm8MQTT7By5Uq++uorFi1a5MmxiIhI8/jDH/4Qd+qppw7o0KFDeteuXdMmTJiQVFxc3L56/eeffx45ZsyYvjExMWmdO3c+/dRTTx0wffr07pWVlSGpV+GjhRs2bBgxMTF1rp83bx5XXXUVZsaZZ55JWVkZ27dvJysri+HDhxMTE0OXLl0YPnw4ixcvZvv27ezevZshQ4ZgZlx11VXMmzfPwyNqOosWLWLIkCFkZGQwc+bMI9Z/8803XHbZZZxzzjlccsklbNu27dC66dOnM2zYMIYNG8bcuXMPtU+aNIkhQ4YwbNgwbr31Vmp7TLWISEty3333dZ8xY0avBx98cGtpaenqZcuW5X7zzTcRI0aM6F9eXm5r166NPOecc1J69uxZsXr16nW7d+9e/dZbb32VnZ3dsbS0tH3Dn9D0FD5aucLCQnr27HloOTExkcLCQgoKCo5oLygooLCwkMTExCP6tzZVVVXcddddzJ49m48++og5c+awfv36w/rce++9XHnllXz44Yfceeed3H///QAsWLCAnJwcli5dysKFC3nqqacoKysD4IorruCTTz5h2bJl7N+/n1dffdXzYxMRaaySkpJ2jzzySOLDDz+8Zdy4cWWRkZEuOTm54p133snfunVr5KxZs2LvueeexMGDB3///PPPb+3du/cBgLS0tPJ33333665du1aFom6Fj1autgcDmlnQ7a1NdnY2J598Mn369CEiIoKxY8cyf/78w/rk5eVx3nnnAXDuueceOsOzfv16zj77bMLCwujUqROpqaksXrwYgFGjRmFmmBmDBw+moKDA2wMTEQlCVlbWiRUVFe2uueaanYHt0dHRB4cPH75r4cKFUcuWLYv6yU9+srOufYSCwkcrl5iYeNjlhIKCAnr06EHPnj2PaE9ISDh0BqRm/9amrjM+gQYOHMi7774LwHvvvcf3339PSUkJAwcOZNGiRezdu5fi4mI+/PDDw/6sAA4cOMDs2bP50Y9+1PwHIyJylL799tuwLl26VIaHhx+xrkePHgeKi4vDSktL2/fs2bNFXUNW+GjlxowZw5tvvolzjhUrVhAVFUWPHj244IILWLJkCaWlpZSWlrJkyRIuuOACevTowYknnsiKFStwzvHmm29y0UUXhfowgtaYMzi//e1vWb58Oeeffz7Lli0jISGBsLAwLrjgAkaNGsWFF17IxIkTOfPMMwkLO/zGrylTpjB06FCGDh3arMchInIsunXrVllaWhpW2/i07du3h8fFxVV26dKlatu2bUemkxDSrbYt3MSJE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OBA48NbMrgTeAwRrILa2Nwoc0KzNr55w7GOo6RNoC/3gqc85VmdkN+C65dAx1XSLBCgt1AdK2KXiINJ0a36fOwH2hqkXkWOjMh4hIK2Rm4UCVAr60RgofIiIi4inN8yEiIiKeUvgQERERTyl8iIiIiKcUPkRERMRTCh8iIiLiqf8PmowkOXTgeRQAAAAASUVORK5CYII=\n", "text/plain": [ "
" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "plot_histogram([ccounts, qcounts], legend=[\"QASM\", \"QC\"])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We see that in simulation the initialization to vector $|0\\rangle$ is perfect - out of all 1024 runs all ended with measurement outcome 0. Quantum computers, however, at present have a high faoult rate and so even in this simplest case we can obtain an error - measurement of vector $|0\\rangle$ can give outcome 1." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.7.0" } }, "nbformat": 4, "nbformat_minor": 2 }