From 9dc59cf14dc9b4d7da095873ecc3f6d4f2f5635e Mon Sep 17 00:00:00 2001 From: Liwei Yang Date: Tue, 7 Feb 2023 11:54:05 +0800 Subject: [PATCH] Remove the circuit comparison notebook from the quimb support PR --- src/qibotn/qibo2quimb.ipynb | 301 ------------------------------------ 1 file changed, 301 deletions(-) delete mode 100644 src/qibotn/qibo2quimb.ipynb diff --git a/src/qibotn/qibo2quimb.ipynb b/src/qibotn/qibo2quimb.ipynb deleted file mode 100644 index 1a18866..0000000 --- a/src/qibotn/qibo2quimb.ipynb +++ /dev/null @@ -1,301 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 42, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "quimb version: 1.4.0\n" - ] - } - ], - "source": [ - "import argparse\n", - "from timeit import default_timer as timer\n", - "\n", - "import quimb as qu\n", - "from qiskit import QuantumCircuit\n", - "\n", - "from qibo import __version__, gates, tests\n", - "from qibo.models import Circuit, QFT\n", - "from qibo.tests.utils import random_state\n", - "\n", - "print('quimb version:', qu.__version__)" - ] - }, - { - "cell_type": "code", - "execution_count": 45, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Testing for 8 qubits\n", - "qibo QFT circuit:\n", - "q0: ─H─U1─U1─U1─U1─U1─U1─U1─────────────────────────────────────────────── ...\n", - "q1: ───o──|──|──|──|──|──|──H─U1─U1─U1─U1─U1─U1─────────────────────────── ...\n", - "q2: ──────o──|──|──|──|──|────o──|──|──|──|──|──H─U1─U1─U1─U1─U1────────── ...\n", - "q3: ─────────o──|──|──|──|───────o──|──|──|──|────o──|──|──|──|──H─U1─U1─U ...\n", - "q4: ────────────o──|──|──|──────────o──|──|──|───────o──|──|──|────o──|──| ...\n", - "q5: ───────────────o──|──|─────────────o──|──|──────────o──|──|───────o──| ...\n", - "q6: ──────────────────o──|────────────────o──|─────────────o──|──────────o ...\n", - "q7: ─────────────────────o───────────────────o────────────────o─────────── ...\n", - "\n", - "q0: ... ───────────────────────────────x───────\n", - "q1: ... ───────────────────────────────|─x─────\n", - "q2: ... ───────────────────────────────|─|─x───\n", - "q3: ... 1─U1───────────────────────────|─|─|─x─\n", - "q4: ... ──|──H─U1─U1─U1────────────────|─|─|─x─\n", - "q5: ... ──|────o──|──|──H─U1─U1────────|─|─x───\n", - "q6: ... ──|───────o──|────o──|──H─U1───|─x─────\n", - "q7: ... ──o──────────o───────o────o──H─x───────\n", - "\n", - "qiskit QFT circuit:\n" - ] - }, - { - "data": { - "text/html": [ - "
     ┌───┐                                                            »\n",
-       "q_0: ┤ H ├─■──────────────■───────────────────■───────────────────────»\n",
-       "     └───┘ │U1(π/2) ┌───┐ │                   │                       »\n",
-       "q_1: ──────■────────┤ H ├─┼─────────■─────────┼──────────────■────────»\n",
-       "                    └───┘ │U1(π/4)  │U1(π/2)  │        ┌───┐ │        »\n",
-       "q_2: ─────────────────────■─────────■─────────┼────────┤ H ├─┼────────»\n",
-       "                                              │U1(π/8) └───┘ │U1(π/4) »\n",
-       "q_3: ─────────────────────────────────────────■──────────────■────────»\n",
-       "                                                                      »\n",
-       "q_4: ─────────────────────────────────────────────────────────────────»\n",
-       "                                                                      »\n",
-       "q_5: ─────────────────────────────────────────────────────────────────»\n",
-       "                                                                      »\n",
-       "q_6: ─────────────────────────────────────────────────────────────────»\n",
-       "                                                                      »\n",
-       "q_7: ─────────────────────────────────────────────────────────────────»\n",
-       "                                                                      »\n",
-       "«                                                                         »\n",
-       "«q_0: ─■──────────────────────────────■───────────────────────────────────»\n",
-       "«      │                              │                                   »\n",
-       "«q_1: ─┼────────────────────■─────────┼─────────────────────────■─────────»\n",
-       "«      │                    │         │                         │         »\n",
-       "«q_2: ─┼──────────■─────────┼─────────┼───────────────■─────────┼─────────»\n",
-       "«      │          │U1(π/2)  │         │         ┌───┐ │         │         »\n",
-       "«q_3: ─┼──────────■─────────┼─────────┼─────────┤ H ├─┼─────────┼─────────»\n",
-       "«      │U1(π/16)            │U1(π/8)  │         └───┘ │U1(π/4)  │         »\n",
-       "«q_4: ─■────────────────────■─────────┼───────────────■─────────┼─────────»\n",
-       "«                                     │U1(π/32)                 │U1(π/16) »\n",
-       "«q_5: ────────────────────────────────■─────────────────────────■─────────»\n",
-       "«                                                                         »\n",
-       "«q_6: ────────────────────────────────────────────────────────────────────»\n",
-       "«                                                                         »\n",
-       "«q_7: ────────────────────────────────────────────────────────────────────»\n",
-       "«                                                                         »\n",
-       "«                                                                          »\n",
-       "«q_0: ─■─────────────────────────────────────────■─────────────────────────»\n",
-       "«      │                                         │                         »\n",
-       "«q_1: ─┼──────────────────────────────■──────────┼─────────────────────────»\n",
-       "«      │                              │          │                         »\n",
-       "«q_2: ─┼────────────────────■─────────┼──────────┼─────────────────────────»\n",
-       "«      │                    │         │          │                         »\n",
-       "«q_3: ─┼──────────■─────────┼─────────┼──────────┼────────────────■────────»\n",
-       "«      │          │U1(π/2)  │         │          │          ┌───┐ │        »\n",
-       "«q_4: ─┼──────────■─────────┼─────────┼──────────┼──────────┤ H ├─┼────────»\n",
-       "«      │                    │U1(π/8)  │          │          └───┘ │U1(π/4) »\n",
-       "«q_5: ─┼────────────────────■─────────┼──────────┼────────────────■────────»\n",
-       "«      │U1(π/64)                      │U1(π/32)  │                         »\n",
-       "«q_6: ─■──────────────────────────────■──────────┼─────────────────────────»\n",
-       "«                                                │U1(π/128)                »\n",
-       "«q_7: ───────────────────────────────────────────■─────────────────────────»\n",
-       "«                                                                          »\n",
-       "«                                                                         »\n",
-       "«q_0: ────────────────────────────────────────────────────────────────────»\n",
-       "«                                                                         »\n",
-       "«q_1: ────────────■───────────────────────────────────────────────────────»\n",
-       "«                 │                                                       »\n",
-       "«q_2: ─■──────────┼──────────────────────────────■────────────────────────»\n",
-       "«      │          │                              │                        »\n",
-       "«q_3: ─┼──────────┼────────────────────■─────────┼────────────────────────»\n",
-       "«      │          │                    │         │                        »\n",
-       "«q_4: ─┼──────────┼──────────■─────────┼─────────┼───────────────■────────»\n",
-       "«      │          │          │U1(π/2)  │         │         ┌───┐ │        »\n",
-       "«q_5: ─┼──────────┼──────────■─────────┼─────────┼─────────┤ H ├─┼────────»\n",
-       "«      │U1(π/16)  │                    │U1(π/8)  │         └───┘ │U1(π/4) »\n",
-       "«q_6: ─■──────────┼────────────────────■─────────┼───────────────■────────»\n",
-       "«                 │U1(π/64)                      │U1(π/32)                »\n",
-       "«q_7: ────────────■──────────────────────────────■────────────────────────»\n",
-       "«                                                                         »\n",
-       "«                                                                     \n",
-       "«q_0: ──────────────────────────────────────────────────────────────X─\n",
-       "«                                                                   │ \n",
-       "«q_1: ──────────────────────────────────────────────────────────X───┼─\n",
-       "«                                                               │   │ \n",
-       "«q_2: ──────────────────────────────────────────────────X───────┼───┼─\n",
-       "«                                                       │       │   │ \n",
-       "«q_3: ─■───────────────────────────────X────────────────┼───────┼───┼─\n",
-       "«      │                               │                │       │   │ \n",
-       "«q_4: ─┼────────────────────■──────────X────────────────┼───────┼───┼─\n",
-       "«      │                    │                           │       │   │ \n",
-       "«q_5: ─┼──────────■─────────┼──────────────■────────────X───────┼───┼─\n",
-       "«      │          │U1(π/2)  │        ┌───┐ │                    │   │ \n",
-       "«q_6: ─┼──────────■─────────┼────────┤ H ├─┼─────────■──────────X───┼─\n",
-       "«      │U1(π/16)            │U1(π/8) └───┘ │U1(π/4)  │U1(π/2) ┌───┐ │ \n",
-       "«q_7: ─■────────────────────■──────────────■─────────■────────┤ H ├─X─\n",
-       "«                                                             └───┘   
" - ], - "text/plain": [ - " ┌───┐ »\n", - "q_0: ┤ H ├─■──────────────■───────────────────■───────────────────────»\n", - " └───┘ │U1(π/2) ┌───┐ │ │ »\n", - "q_1: ──────■────────┤ H ├─┼─────────■─────────┼──────────────■────────»\n", - " └───┘ │U1(π/4) │U1(π/2) │ ┌───┐ │ »\n", - "q_2: ─────────────────────■─────────■─────────┼────────┤ H ├─┼────────»\n", - " │U1(π/8) └───┘ │U1(π/4) »\n", - "q_3: ─────────────────────────────────────────■──────────────■────────»\n", - " »\n", - "q_4: ─────────────────────────────────────────────────────────────────»\n", - " »\n", - "q_5: ─────────────────────────────────────────────────────────────────»\n", - " »\n", - "q_6: ─────────────────────────────────────────────────────────────────»\n", - " »\n", - "q_7: ─────────────────────────────────────────────────────────────────»\n", - " »\n", - "« »\n", - "«q_0: ─■──────────────────────────────■───────────────────────────────────»\n", - "« │ │ »\n", - "«q_1: ─┼────────────────────■─────────┼─────────────────────────■─────────»\n", - "« │ │ │ │ »\n", - "«q_2: ─┼──────────■─────────┼─────────┼───────────────■─────────┼─────────»\n", - "« │ │U1(π/2) │ │ ┌───┐ │ │ »\n", - "«q_3: ─┼──────────■─────────┼─────────┼─────────┤ H ├─┼─────────┼─────────»\n", - "« │U1(π/16) │U1(π/8) │ └───┘ │U1(π/4) │ »\n", - "«q_4: ─■────────────────────■─────────┼───────────────■─────────┼─────────»\n", - "« │U1(π/32) │U1(π/16) »\n", - "«q_5: ────────────────────────────────■─────────────────────────■─────────»\n", - "« »\n", - "«q_6: ────────────────────────────────────────────────────────────────────»\n", - "« »\n", - "«q_7: ────────────────────────────────────────────────────────────────────»\n", - "« »\n", - "« »\n", - "«q_0: ─■─────────────────────────────────────────■─────────────────────────»\n", - "« │ │ »\n", - "«q_1: ─┼──────────────────────────────■──────────┼─────────────────────────»\n", - "« │ │ │ »\n", - "«q_2: ─┼────────────────────■─────────┼──────────┼─────────────────────────»\n", - "« │ │ │ │ »\n", - "«q_3: ─┼──────────■─────────┼─────────┼──────────┼────────────────■────────»\n", - "« │ │U1(π/2) │ │ │ ┌───┐ │ »\n", - "«q_4: ─┼──────────■─────────┼─────────┼──────────┼──────────┤ H ├─┼────────»\n", - "« │ │U1(π/8) │ │ └───┘ │U1(π/4) »\n", - "«q_5: ─┼────────────────────■─────────┼──────────┼────────────────■────────»\n", - "« │U1(π/64) │U1(π/32) │ »\n", - "«q_6: ─■──────────────────────────────■──────────┼─────────────────────────»\n", - "« │U1(π/128) »\n", - "«q_7: ───────────────────────────────────────────■─────────────────────────»\n", - "« »\n", - "« »\n", - "«q_0: ────────────────────────────────────────────────────────────────────»\n", - "« »\n", - "«q_1: ────────────■───────────────────────────────────────────────────────»\n", - "« │ »\n", - "«q_2: ─■──────────┼──────────────────────────────■────────────────────────»\n", - "« │ │ │ »\n", - "«q_3: ─┼──────────┼────────────────────■─────────┼────────────────────────»\n", - "« │ │ │ │ »\n", - "«q_4: ─┼──────────┼──────────■─────────┼─────────┼───────────────■────────»\n", - "« │ │ │U1(π/2) │ │ ┌───┐ │ »\n", - "«q_5: ─┼──────────┼──────────■─────────┼─────────┼─────────┤ H ├─┼────────»\n", - "« │U1(π/16) │ │U1(π/8) │ └───┘ │U1(π/4) »\n", - "«q_6: ─■──────────┼────────────────────■─────────┼───────────────■────────»\n", - "« │U1(π/64) │U1(π/32) »\n", - "«q_7: ────────────■──────────────────────────────■────────────────────────»\n", - "« »\n", - "« \n", - "«q_0: ──────────────────────────────────────────────────────────────X─\n", - "« │ \n", - "«q_1: ──────────────────────────────────────────────────────────X───┼─\n", - "« │ │ \n", - "«q_2: ──────────────────────────────────────────────────X───────┼───┼─\n", - "« │ │ │ \n", - "«q_3: ─■───────────────────────────────X────────────────┼───────┼───┼─\n", - "« │ │ │ │ │ \n", - "«q_4: ─┼────────────────────■──────────X────────────────┼───────┼───┼─\n", - "« │ │ │ │ │ \n", - "«q_5: ─┼──────────■─────────┼──────────────■────────────X───────┼───┼─\n", - "« │ │U1(π/2) │ ┌───┐ │ │ │ \n", - "«q_6: ─┼──────────■─────────┼────────┤ H ├─┼─────────■──────────X───┼─\n", - "« │U1(π/16) │U1(π/8) └───┘ │U1(π/4) │U1(π/2) ┌───┐ │ \n", - "«q_7: ─■────────────────────■──────────────■─────────■────────┤ H ├─X─\n", - "« └───┘ " - ] - }, - "execution_count": 45, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "num_qubits = 6\n", - "\n", - "print('Testing for {} qubits'.format(num_qubits))\n", - "\n", - "# generate the initial state\n", - "initial_state = random_state(num_qubits)\n", - "\n", - "# get the qibo circuit, convert it to a qasm circuit\n", - "start = timer()\n", - "qibo_qft_circuit = QFT(num_qubits)\n", - "final_state = qibo_qft_circuit(initial_state)\n", - "end = timer()\n", - "\n", - "# print(qibo_qft_circuit.summary())\n", - "print('qibo QFT circuit:')\n", - "print(qibo_qft_circuit.draw())\n", - "# print(final_state.state())\n", - "# print(\"qibo execution time is \" + str(end - start))\n", - "\n", - "# convert the circuit format from qibo to qasm\n", - "qasm_qft_circuit = qibo_qft_circuit.to_qasm()\n", - "\n", - "# convert the circuit format from qasm to qiskit\n", - "qiskit_qft_circuit = QuantumCircuit.from_qasm_str(qasm_qft_circuit)\n", - "print('\\nqiskit QFT circuit:')\n", - "qiskit_qft_circuit.draw()" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3.8.13 64-bit ('3.8.13')", - "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.8.13" - }, - "orig_nbformat": 4, - "vscode": { - "interpreter": { - "hash": "ad6a7ef27ab1ef63a56400052d1dab463d164a7bc59eb0569183e19f112dd87c" - } - } - }, - "nbformat": 4, - "nbformat_minor": 2 -}