{ "cells": [ { "cell_type": "markdown", "id": "26c21ec5", "metadata": {}, "source": [ "# Example for execution of multiple circuits in QPUs" ] }, { "cell_type": "markdown", "id": "df8dc942", "metadata": {}, "source": [ "In this notebook, some examples of simple execution without communications will be shown. The scheme followed is going to be the similar in every case, even for the most complex ones. First, the `cunqa` module imports will be done." ] }, { "cell_type": "markdown", "id": "82e8596c", "metadata": {}, "source": [ "
┌───┐┌──────┐┌───────┐ ░ ┌─┐ \n",
" q_0: ┤ X ├┤0 ├┤0 ├─░─┤M├────────────\n",
" └───┘│ ││ │ ░ └╥┘┌─┐ \n",
" q_1: ─────┤1 ├┤1 ├─░──╫─┤M├─────────\n",
" │ ││ │ ░ ║ └╥┘┌─┐ \n",
" q_2: ─────┤2 QFT ├┤2 IQFT ├─░──╫──╫─┤M├──────\n",
" ┌───┐│ ││ │ ░ ║ ║ └╥┘┌─┐ \n",
" q_3: ┤ X ├┤3 ├┤3 ├─░──╫──╫──╫─┤M├───\n",
" ├───┤│ ││ │ ░ ║ ║ ║ └╥┘┌─┐\n",
" q_4: ┤ X ├┤4 ├┤4 ├─░──╫──╫──╫──╫─┤M├\n",
" └───┘└──────┘└───────┘ ░ ║ ║ ║ ║ └╥┘\n",
"meas: 5/══════════════════════════╩══╩══╩══╩══╩═\n",
" 0 1 2 3 4 "
],
"text/plain": [
" ┌───┐┌──────┐┌───────┐ ░ ┌─┐ \n",
" q_0: ┤ X ├┤0 ├┤0 ├─░─┤M├────────────\n",
" └───┘│ ││ │ ░ └╥┘┌─┐ \n",
" q_1: ─────┤1 ├┤1 ├─░──╫─┤M├─────────\n",
" │ ││ │ ░ ║ └╥┘┌─┐ \n",
" q_2: ─────┤2 QFT ├┤2 IQFT ├─░──╫──╫─┤M├──────\n",
" ┌───┐│ ││ │ ░ ║ ║ └╥┘┌─┐ \n",
" q_3: ┤ X ├┤3 ├┤3 ├─░──╫──╫──╫─┤M├───\n",
" ├───┤│ ││ │ ░ ║ ║ ║ └╥┘┌─┐\n",
" q_4: ┤ X ├┤4 ├┤4 ├─░──╫──╫──╫──╫─┤M├\n",
" └───┘└──────┘└───────┘ ░ ║ ║ ║ ║ └╥┘\n",
"meas: 5/══════════════════════════╩══╩══╩══╩══╩═\n",
" 0 1 2 3 4 "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from qiskit import QuantumCircuit\n",
"from qiskit.circuit.library import QFT\n",
"\n",
"n = 5 # number of qubits\n",
"\n",
"qc = QuantumCircuit(n)\n",
"\n",
"qc.x(0); qc.x(n-1); qc.x(n-2)\n",
"qc.append(QFT(n), range(n))\n",
"qc.append(QFT(n).inverse(), range(n))\n",
"qc.measure_all()\n",
"\n",
"display(qc.draw())"
]
},
{
"cell_type": "markdown",
"id": "bf2f0f88",
"metadata": {},
"source": [
"### Executing the circuit in the vQPUs\n",
"It is time to execute and display the results by following these steps:\n",
"\n",
"1. Calling the `run` function with: the circuit, the QPU and the run parameters. This method will return a `qjob.QJob` object.\n",
"