Commit 1b89e9a5 authored by Nicolas Ollinger's avatar Nicolas Ollinger

qistest

parent a1ddd588
@font-face {
font-family: "FiraSans";
src: url("fonts/FiraSans-Light.woff2") format('woff2');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "FiraSans";
src: url("fonts/FiraSans-SemiBold.woff2") format('woff2');
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: "FiraSans";
src: url("fonts/FiraSans-SemiBoldItalic.woff2") format('woff2');
font-weight: bold;
font-style: italic;
}
@font-face {
font-family: "FiraSans";
src: url("fonts/FiraSans-LightItalic.woff2") format('woff2');
font-weight: normal;
font-style: italic;
}
.reveal {
font-family: FiraSans;
font-weight: normal;
font-style: normal;
}
.reveal h1 {
font-family: FiraSans;
font-weight: bold;
color: #e07;
}
.reveal h2, h3, h4, h5, h6 {
font-family: FiraSans;
}
.reveal p {
font-weight: normal;
}
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"# Qubits et portes quantiques : \n",
"## premiers pas en informatique quantique\n",
"\n",
"### Nicolas Ollinger, LIFO, U. Orléans\n",
"<img style=\"width:15%; height: auto;\" src=\"img/lifo.png\">"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Mesdames et messieurs 🦊\n",
"\n",
"Tout ce que vous avez *toujours* voulu **savoir** sur les **_circuits_** quantiques 💾 sans _jamais_ oser le demander.\n",
"\n",
"Et aussi $x=y+\\sqrt{z}$ !"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Lapin\n",
"\n",
"Write content using inline or external Markdown.\n",
" Instructions and more info available in the [readme](https://github.com/hakimel/reveal.js#markdown).\n",
" \n",
" $$\n",
" x \\otimes y = \\alpha \\left|001\\right> + \\beta \\left|10\\right> \\otimes \\left( \\frac{1}{\\sqrt{2}}\\left|0\\right> + \\frac{1}{\\sqrt{2}}i\\left|0\\right>\\right)\n",
"$$"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## porte TOTO\n",
"$$\n",
"\\operatorname{TOTO}(x \\otimes y) = \\begin{pmatrix}\n",
"0 & 0 & 0 & \\color{red}{e^{i\\theta}} \\\\\n",
"1 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 1 & 0 \\\\\n",
"0 & 1 & 0 & 0\n",
"\\end{pmatrix}\n",
"\\begin{pmatrix}\n",
"x_0 y_0 \\\\\n",
"x_0 y_1 \\\\\n",
"x_1 y_0 \\\\\n",
"x_1 y_1\n",
"\\end{pmatrix}\n",
"$$"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## Mesure quantique (observation)\n",
"\n",
"<img style=\"width=100%; height=auto; margin: auto\" src=\"img/mesure.png\" />"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## Mesure quantique d'un qubit particulier\n",
"\n",
"Partant d'un état $\\left|\\varphi\\right> = \\sum_x \\alpha_x\\left|x\\right>$, si on mesure le qubit numéro $i$, on observe la valeur $r$ avec la probabilité $p_r$ et le système change d'état :\n",
"\n",
"$$\n",
"\\sum_{x\\in\\left\\{0,1\\right\\}^n} \\alpha_x\\left|x\\right> \\underset{\\phantom{blop}p_r\\phantom{blop}}{\\longrightarrow}\n",
"\\frac{1}{\\sqrt{p_r}} \\sum_{x\\in\\left\\{0,1\\right\\}^n | x_i = r} \\alpha_x\\left|x\\right>\n",
"$$\n",
" \n",
"$$\n",
"\\mbox{avec}\\quad p_r = \\sum_{x\\in\\left\\{0,1\\right\\}^n | x_i = r}|\\alpha_x|^2\n",
"$$"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"<img style=\"width: 85%; height: auto; margin: auto;\" src=\"img/qproc.jpg\" />"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Total count are: {'00': 4935, '11': 5065}\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAr4AAADrCAYAAACPW5UYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO3deXRU9f3/8VcWwmLClgQChCUQAiQSEoNKEQMRWpai8GWJslRKoWAILXjoRlsBoaXueKiAUkTa4qE/lojarxb7rRDANQG0YTPSIEloBGSpJCKQyfz+SIMGE5KZZOYzd+7zcQ5HZ+Yu78SPb1755N7PDXA6nU4BAAAAfi7QdAEAAACANxB8AQAAYAsEXwAAANgCwRcAAAC2QPAFAACALRB8AQAAYAsEXwAAANgCwRcAAAC2QPAFAACALRB8AQAAYAsEXwAAANgCwRcAAAC2QPAFAACALRB8AQAAYAsEXwAAANgCwRcAAAC2QPAFAACALRB8AQAAYAsEXwAAANgCwRcAAAC2QPAFAACALRB8AQAAYAsEXwAAANgCwRcAAAC2QPAFAACALRB8AQAAYAvBpgsA7Ojo0aMubf/MM89o7ty5Lu3Tu3dvl7YHYAb9APAeZnwBC1i1apXpEgD4CPoB4D6CLwAAAGyB4AsAAABbIPgCFrB161bTJQDwEfQDwH0EXwAAANgCwRewgAkTJpguAYCPoB8A7iP4AgAAwBYIvgAAALAFgi9gAZmZmaZLAOAj6AeA+wKcTqfTdBGA3bj6pCZ38KQmwBroB4D38MhiNKr5L5quoP6enmK6gvpLTU3V7t27TZdRb1YZB1YaA1bEOPAMq/WDgIAA0yXUC/OA9sClDoAFnDlzxnQJAHwE/QBwH8EXAAAAtkDwBSwgPj7edAkAfAT9AHAfwRewgG3btpkuAYCPoB8A7uPmNsACFi1apKVLl5ouA15Udln65DOp6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ddpvmz59vujxLqHpK24SRgwm9AACgTsz4wrLWbHxZkpjtBQAA9ULwhWWVlztU+sUltW4ZaroUAABgAQRfAAAA2ALLmQEAAMAWCL4AAACwBYIvAAAAbIHgCwAAAFsg+AIAAMAWCL4AAACwBYIvAAAAbIHgCwAAAFsg+AIAAMAWCL4AAACwBYIvAAAAbIHgCwAAAFsg+AIAAMAWCL4AAACwBYIvAAAAbIHgCwAAAFsg+AIAAMAWCL4AAACwBYIvAAAAbIHgCwAAAFsg+AIAAMAWCL4AAACwBYIvAAAAbIHgCwAAAFsg+AIAAMAWCL4AAJUo7eUAAABTSURBVACwBYIvAAAAbIHgCwAAAFsg+AIAAMAWCL4AAACwBYIvAAAAbIHgCwAAAFsg+AIAAMAWCL4AAACwBYIvAAAAbIHgCwAAAFsg+AIAAMAW/j+U6V5p3oWVnwAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 911.6x292.4 with 1 Axes>"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import numpy as np\n",
"from qiskit import QuantumCircuit, execute, Aer\n",
"from qiskit.visualization import plot_histogram\n",
"\n",
"# Use Aer's qasm_simulator\n",
"simulator = Aer.get_backend('qasm_simulator')\n",
"\n",
"# Create a Quantum Circuit acting on the q register\n",
"circuit = QuantumCircuit(2,2)\n",
"\n",
"circuit.h(0)\n",
"circuit.barrier()\n",
"circuit.h(0)\n",
"circuit.h(1)\n",
"circuit.cx(1,0)\n",
"circuit.h(0)\n",
"circuit.h(1)\n",
"circuit.barrier()\n",
"circuit.measure([0,1], [0,1])\n",
"\n",
"# Execute the circuit on the qasm simulator\n",
"job = execute(circuit, simulator, shots=10000)\n",
"\n",
"# Grab results from the job\n",
"result = job.result()\n",
"\n",
"# Returns counts\n",
"counts = result.get_counts(circuit)\n",
"print(\"\\nTotal count are:\",counts)\n",
"\n",
"# Draw the circuit\n",
"circuit.draw(output='mpl',scale=1)\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAc0AAAE8CAYAAACii+qhAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO3de3hddZ3v8feX3mixLU3JlERsS2mJvU0NVBSl5WYRmXGUy8B4ioA3DuIBkfHKcBDnaOccFI+IMggzykVERBlEnY48ULQDqGgJGUpjprXQntJQSimltKWX8D1/7E0nhCRdaXNr+n49z36y92/91trflTyrn661fmutyEwkSdKu7dfbBUiStLcwNCVJKsjQlCSpIENTkqSCDE1JkgoyNCVJKsjQlCSpoB4PzYi4MCKejIiXI2JRRMzaRf/BEfH35Xm2RsTKiLi4VZ/TI2JJefqSiDi1e9dCkrQvGtiTXxYRZwHXABcCD5Z/zo+IKZm5sp3ZfggcApwPLAXGAENbLPNo4A7gi8BdwGnAnRHxzsz8XUf1jB49OseOHbtnKyVJ6lcee+yx5zKzsq1p0ZN3BIqI3wH/kZkfa9G2FPhxZn6hjf4nAXcCh2Xmc+0s8w6gIjPntGi7D1ibmR/oqJ7a2tpcsGDB7q2MJKlfqqioWJSZM9ua1mOHZyNiMHAkcG+rSfcC72hntvcDvwcujYhVEbE0Ir4ZEW9o0efoNpb5yw6WKUnSbunJw7MHAQOANa3a1wDvameeCcAxwFbgdOBA4FqgGjij3OfgdpZ5cFsLjIjzKR3qpaqqikcffRSA6upqhg0bxrJlywAYOXIkEyZMoK6uDoABAwYwY8YMGhsb2bRpEwCTJ0/m+eefZ82a0tcfcsghDB48mOXLlwMwatQoxo4dS319PQCDBg1i+vTpNDQ0sGXLFgCmTJnC2rVrWbt2LQDjxo0jInjqqacAGD16NFVVVSxevBiAIUOGMHXqVJ544gm2bt0KwLRp02hqamLdunUAjB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[
"<Figure size 504x360 with 1 Axes>"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
" # Plot a histogram\n",
"\n",
"plot_histogram(counts)"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"# Algorithme de Bernstein-Vazirani "
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"data": {
"text/plain": [
"<qiskit.circuit.instructionset.InstructionSet at 0x12144b9e8>"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"s = '101101110000110'\n",
"k = len(s)\n",
"\n",
"circuit = QuantumCircuit(2*k+1,k)\n",
"\n",
"circuit.x(k)\n",
"for i in range(k+1):\n",
" circuit.h(i)\n",
"circuit.barrier()\n",
"\n",
"for i in range(k):\n",
" if s[i] == '1':\n",
" circuit.x(k+1+i)\n",
"#circuit.barrier()\n",
"for i in range(k):\n",
" circuit.ccx(i,k+1+i,k)\n",
"#circuit.barrier()\n",
"for i in range(k):\n",
" if s[i] == '1':\n",
" circuit.x(k+1+i)\n",
"circuit.barrier()\n",
"\n",
"for i in range(k):\n",
" circuit.h(i)\n",
" \n",
"circuit.measure(list(range(k)), list(range(k)))\n",
"\n",
"# Execute the circuit on the qasm simulator\n",
"#job = execute(circuit, simulator, shots=1)\n",
"\n",
"# Grab results from the job\n",
"#result = job.result()\n",
"\n",
"# Returns counts\n",
"#counts = result.get_counts(circuit)\n",
"#print(\"\\nTotal count are:\",counts)\n",
"\n",
"# Draw the circuit\n",
"# circuit.draw(output='mpl',scale=1)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'qiskit-terra': '0.10.0',\n",
" 'qiskit-aer': '0.3.2',\n",
" 'qiskit-ignis': '0.2.0',\n",
" 'qiskit-ibmq-provider': '0.3.3',\n",
" 'qiskit-aqua': '0.6.1',\n",
" 'qiskit': '0.13.0'}"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import qiskit\n",
"qiskit.__qiskit_version__"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ibmq_burlington 8\n"
]
}
],
"source": [
"from qiskit import IBMQ\n",
"from qiskit.providers.ibmq import least_busy\n",
"\n",
"# Load local account information\n",
"provider = IBMQ.load_account()\n",
"\n",
"# Get the least busy real quantum system\n",
"backend = least_busy(provider.backends(n_qubits=5, operational=True, simulator=False))\n",
"print(backend, backend.status().pending_jobs)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"realjob = execute(circuit, backend, shots=1024)\n",
"rresult = realjob.result()\n",
"\n",
"# Returns counts\n",
"counts = rresult.get_counts(circuit)\n",
"print(\"\\nTotal count are:\",counts)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ibmq_qasm_simulator 1\n"
]
}
],
"source": [
"simback = provider.get_backend('ibmq_qasm_simulator')\n",
"print(simback, simback.status().pending_jobs)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Total count are: {'011000011101101': 1}\n"
]
}
],
"source": [
"simjob = execute(circuit, simback, shots=1)\n",
"sresult = simjob.result()\n",
"\n",
"# Returns counts\n",
"counts = sresult.get_counts(circuit)\n",
"print(\"\\nTotal count are:\",counts)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"celltoolbar": "Diaporama",
"kernelspec": {
"display_name": "qiskitenv",
"language": "python",
"name": "qiskitenv"
},
"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.6.9"
},
"rise": {
"enable_chalkboard": true,
"scroll": true,
"theme": "white"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment