{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Exporting to other frameworks" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Qlasskit implements circuit / gate exporters for Qiskit, Cirq, Qasm, Sympy and Pennylane. " ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from qlasskit import Qint, qlassf\n", "\n", "\n", "@qlassf\n", "def hello_world(a: bool, b: Qint[2]) -> Qint[2]:\n", " return b + (1 if a else 0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Qiskit" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAFvCAYAAABXbEBMAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAntklEQVR4nO3dfVRV953v8fcBVEQgCpocIigQwCgCZkQM5hHHtLHGpGmSNo2xaZdzJ+2qo9PxSjrtapPOvbfW1GnuGGdak7ldvWt1xkue2iaS9CEhnRpjEgghNUokohgOcjRHUB7kQeDcP3Z9IByEczgP/Daf11qsk5y9f/v3xXPOh31++7f3dni9Xi8iImKsqEgXICIiY6MgFxExnIJcRMRwCnIREcMpyEVEDKcgFxExnIJcRMRwCnIREcMpyEVEDKcgFxExnIJcRMRwCnIREcMpyEVEDKcgFxExnIJcRMRwCnIREcMpyEVEDKcgFxExnIJcRMRwCnIREcMpyEVEDKcgFxExnIJcRMRwCnIREcMpyEVEDKcgFxExnIJcRMRwCnIREcMpyEVEDKcgFxExnIJcRMRwCnIREcMpyEVEDKcgFxExnIJcRMRwCnIREcMpyEVEDKcgFxExnIJcRMRwCnIREcMpyEVEDKcgFxExnIJcRMRwCnIREcMpyEVEDKcgFxExnIJcRMRwCnIREcMpyEVEDKcgFxExnIJcRMRwCnIREcNNiCD3eDyUlpaSlZ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OptC+yN2NvWxOzZmlQu5mvv8XHixCh80nYsYp+BseSEbYN8xYoV1NbWsnXrVm677TZycnIAqKysZO3atXg8HiA8JwIF+nUpUPUn4ck/+N/un799L5k/uTf4BYmEWXcbvPE0fs1aAbjra4V84yeukNQUSradtVJaWkpycjKNjY3k5uaSl5dHdnY2RUVFZGZmsnz5cmDo1MMZM2Zw+vTpIdtraWkhKSkpHKWPWeYsSJnuX5uU6ZAxKxTViIRfbCLMusa/NjGxcNW1oakn1Gwb5KmpqezZs4dVq1YRGxtLQ0MDSUlJ7Ny5k/Lycurq6oChQT5//nyfY+EHDx5k/vz5Yal9rBwOWFMMU0b5fWtKjLW+qWe1ifgy769hiu+Zx0M5IHclRE8KaUkhY+szO4fT0dFBYmIiDoeD9vZ24uLiLizbtm0b3/nOdzhy5AipqakAvP3221x//fW88MIL3H333ZEq228NHnj6j5efUz5tCvy3WyF9ZriqEgmfs63W2Z1dp4dfJyoaFt4BV2aHraygm5BBfj6Y582bx4cffjhoWVtbG3l5ecycOZMf/OAHdHd3U1payqxZs9i3bx9RUWZ9iensgcojsPcj+OSSA/lRDrjzOliSaYW5iF31nwP3h+CqgfZLj4E6ION6mJ0PsQmRqi44bHuw83L2798PDB1WAUhMTKSiooKNGzdy//33ExMTwx133METTzxhXIiDFdK3zoebr4W2Ltj2MnT0QPxfnhexu+hJMDsPrl4IvWfhrf8L587C5DgzT/7xRUHuwzXXXMPu3bvDWVLIRTlgehxE/+VvkcbDZaJxOGDKNIiy4WfAvF3MIBgpyEVETDIh98jPX4dFRMQOJuQeuYiInSjIRUQMpyAXETGcglxExHAKchERwynIRUQMpyAXETGcglxExHAKchERwynIRUQMpyAXETGcglxExHAKchERwynIRUQMpyAXETGcglxExHAKchERwynIRUQMpyAXETGcglxExHAKchERwynIRUQMpyAXETGcglxExHAKchERwynIRUQMpyAXETGcglxExHAKchERwynIRUQMpyAXETGcglxExHAKchERwynIRUQMpyAXETGcglxExHAKchERwynIRUQMpyAXETGcglxExHAKch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U32YvgmMROPSUuggc4/D2f7YN8uEcOHAAr9dLTk4OcXEX55/Fx8dz6623+myTnp4+7DIJv6goWJYN5WG+3sYNOeHtT4YXNx2S0+FUQ/j6jJ4EzgXh688fthxauZz9+63bvVzu1HwZ/26aBzP8uJ70WOWnQeas8PUnI8u62ZpGGC6ZN1jj8+PRhNsj9zfIdW/q8Sl2Enz5evi310LfV9xkuG/J+PxKPZElXAkZ18ORMFyX/IrZMGcc37dTe+RirBwn3HKtf23auuD02ZFPHLrUF5dCgh93FJLwSV8KV/h5ALq3E7rbR3fyEFi3d8u9Pbx7//5yeLXLKQYbGID/2AfvNoRm+/cUWsM4Mn71dkF1WWhuNBE9Ca67D6ZfHfxtB5OCXIw3MADPVsK+w8HbZpQD7iuC4qzgbVNCp7cL3n8BzjQHb5uTpsKiL/i/xx8JCnKxjZpjVqB39oxtO1dPhweKIVUn/xhloB8a3oajb1nXURmLWdlw7YqLV0oc7xTkYivt3VBeYw21nPPz5szxsXBzDixfYF0KQMzUfhIO/ymwqYnTkiGjGK6aZ9bBbQW52FJnD7xzxLq/5/HTw19ka0oMzJ0JS6+xTvhRgNvH2VZw1YDniPXfw5kcBzPSYHaB9WhSgJ+nIBfb6+u3wvxkm7WX7sCavpgyA2YlWOPhYm99PdYt2rrbrCGYqCiYFGdNYZwSb2Z4X0pBLiJiuHE8M1JEREZDQS4iYjgFuYiI4RTkIiKGU5CLiBhOQS4iYjgFuYiI4RTkIiKGU5CLiBhOQS4iYjgFuYiI4RTkIiKGU5CLiBhOQS4iYjgFuYiI4RTkIiKGU5CLiBhOQS4iYjgFuYiI4RTkIiKGU5CLiBhOQS4iYjgFuYiI4RTkIiKGU5CLiBhOQS4iYjgFuYiI4RTkIiKGU5CLiBhOQS4iYjgFuYiI4f4/rsFC1rA5DD8AAAAASUVORK5CYII=", "text/plain": [ "
" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "qc = hello_world.export(\"qiskit\")\n", "qc.draw(\"mpl\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## QASM" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OPENQASM 3.0;\n", "\n", "gate hello_world a b.0 b.1 _ret.0 _ret.1 {\n", "\tcx a _ret.0\n", "\tcx b.0 _ret.0\n", "\tcx b.1 _ret.1\n", "\tccx a b.0 _ret.1\n", "}\n", "\n", "hello_world q[0],q[1],q[2],q[3],q[4];\n", "\n" ] } ], "source": [ "qc = hello_world.export(\"qasm\")\n", "print(qc)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Cirq" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
0: ───hello_world───\n",
       "      │\n",
       "1: ───hello_world───\n",
       "      │\n",
       "2: ───hello_world───\n",
       "      │\n",
       "3: ───hello_world───\n",
       "      │\n",
       "4: ───hello_world───
" ], "text/plain": [ "0: ───hello_world───\n", " │\n", "1: ───hello_world───\n", " │\n", "2: ───hello_world───\n", " │\n", "3: ───hello_world───\n", " │\n", "4: ───hello_world───" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import cirq\n", "\n", "qc = hello_world.export(\"cirq\")\n", "qc" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Pennylane" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pennylane as qml\n", "\n", "tape = hello_world.export(\"pennylane\")\n", "tape" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Sympy" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle C_{0,1}{\\left(X_{4}\\right)} \\text{CNOT}_{2,4} \\text{CNOT}_{1,3} \\text{CNOT}_{0,3} {\\left|00000\\right\\rangle }$" ], "text/plain": [ "C((0,1),X(4))*CNOT(2,4)*CNOT(1,3)*CNOT(0,3)*|00000>" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "qc = hello_world.export(\"sympy\")\n", "qc" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Qutip" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "# Disabled on docs for a depencency problem\n", "# qc = hello_world.export(\"qutip\")\n", "# qc.gates" ] } ], "metadata": { "kernelspec": { "display_name": "qlasskit_310-env", "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.10.13" } }, "nbformat": 4, "nbformat_minor": 2 }