-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bf36011
Showing
145 changed files
with
15,836 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 1b90b7a87d83483e91aa630c474b09cf | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+22.7 KB
.doctrees/generated/qlasskit.qcircuit.qcircuitwrapper.QCircuitWrapper.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file added
BIN
+11.5 KB
_images/083b7f9738d21d72944d1ba5a828d6def5474c56bf56dc007f42976720d63fde.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.8 KB
_images/18da646c905ecbbabade2933b32d33141624835efe4bc3d00deb9641993228fc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.01 KB
_images/1be99e37f13150ae81db33daa1ab2beb28fb6ea6b341a213e05f0f61f52f1d0c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.4 KB
_images/27a749800d923fb69b5d38e7722422621f8acf4ee5c2b6f517f89d74a936444a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.8 KB
_images/293285b423513d39c4a73e871f2211a526039c0ce9d988d5f7d9abe704adabc2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.89 KB
_images/44c9a3aa43eda23fe096518b175fdade8ee74a3e2c36a0a34f565ca369046c0b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.5 KB
_images/491cb9b1407c5f41003d5da03c7ef3a35fa8acf294c42364e650599ca92ede80.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.9 KB
_images/5174bb0c6ea65db88c99511f9658fc0a3c9afceb5058f8a187fa4d462337954a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+46.2 KB
_images/642fa811702d720260ecca7dc2f819674d1abd91223b3474a21deba2feece93f.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+23.1 KB
_images/88f6128cb7268b9f8349a56993fd71f9ee62517d0a58ac7473631660cb73d790.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.09 KB
_images/8e1bf07bbbab0c0a595d9144710a8af6c22cf9a2661a42ccd01e899e85ffb12e.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+20.2 KB
_images/9e03acffd40589efa6cc71186a8bc1f1aea3d62456512759cd969708d390d524.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+45.5 KB
_images/b05e4f779a0b4670c648fd32d723f5b20c77402dfdbb9e21f6f2d293de8c4fa6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.1 KB
_images/be3abba3958dd65682b17997972df3f803e8698846e140e95797a368e23e2236.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11 KB
_images/beafab15f915183b637909d537345580eba0f3a7fb66329311dd39909074d252.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.8 KB
_images/c11daf869c135eac3524304f0b40bd3d1ae514f73d769f0de4a9d577f9da51ba.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+51.6 KB
_images/c61f0020a11bce0f8fef9354f59809c3c53c5165257cba0fa8792fb8d3fec6ee.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+33.6 KB
_images/c7ef1f01b80363cad58e444c34d85d42122df00d7131ad1f1fec37e2b481452c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+54.9 KB
_images/dfc7149f9f736dd8dbab09d66cceabc2e0c50c4b400b30c258c0d613f622e582.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+22.3 KB
_images/f1c3cd6d5629f66e596fb097a417910a30016687ce3afb093fe39738d6ea5c09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.6 KB
_images/f3b3957c4548aaf8d56ce1f0541c259dddd1458d1a1e74443a16ae7a87e145f7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.01 KB
_images/f988cf8271837cb1b9caf21c4d307e4857aa36b6b8b9f774cf372dec22e57051.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+163 KB
_images/fc1d93821ee269bc89af7272200aae50aed37301baea1590dd42a82a9a297029.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Algorithms | ||
==================================== | ||
|
||
Qlasskit implements high level representation of quantum algorithms that relies on black boxes functions and oracles. | ||
|
||
Grover search | ||
----------------- | ||
|
||
|
||
Simon periodicity | ||
---------------------- | ||
|
||
|
||
|
||
Deutsch Jozsa | ||
---------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
API | ||
=== | ||
|
||
.. autosummary:: | ||
:toctree: generated | ||
:recursive: | ||
|
||
qlasskit.qlassfun.qlassf | ||
qlasskit.qlassfun.qlassfa | ||
qlasskit.qlassfun.QlassF | ||
qlasskit.algorithms.qalgorithm | ||
qlasskit.algorithms.grover.Grover | ||
qlasskit.qcircuit.qcircuit.QCircuit | ||
qlasskit.qcircuit.qcircuitwrapper.QCircuitWrapper | ||
qlasskit.qcircuit.gates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Working with big circuits" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Qlasskit is capable of producing large circuit without any issue. The only thing that you have to do, is to use the `fastOptimizer`, since running CSE is too slow on large expressions lists.\n", | ||
"\n", | ||
"In the next example we are going to create a quantum circuit with 32 `Qint8` in input, and one `Qint8` in output, resulting on a circuit of ~527 qubits and ~8000 gates in around 8 seconds." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from qlasskit import Qint8, Qlist, boolopt, qlassfa\n", | ||
"\n", | ||
"\n", | ||
"@qlassfa(bool_optimizer=boolopt.fastOptimizer)\n", | ||
"def test(message: Qlist[Qint8, 32]) -> Qint8:\n", | ||
" h_val = Qint8(0)\n", | ||
" for c in message:\n", | ||
" h_val = ((h_val >> 4) + c) & 0xFF\n", | ||
" return h_val" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"QCircuit<test>(8248 gates, 527 qubits)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print(test.circuit())" | ||
] | ||
} | ||
], | ||
"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 | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Unitary of qlasskit function\n", | ||
"\n", | ||
"In qlasskit, we can exploit external low-level frameworks to perform operations on the resulting quantum circuit. In this example, we use qiskit in order to obtain the unitary matrix of our `QlassF` function." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"\n", | ||
"QlassF<f>(a:bool, b:bool) -> bool:\n", | ||
"\t_ret = a ^ ~b\n", | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"data": { | ||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAATEAAAEvCAYAAAAtufaDAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAbfElEQVR4nO3de3RU5b3/8feeBHKPEAIN5AIECIRb8CRSw6lCqBcoolK1aim1/vits6xaspYcYi/LRbu6Vike1FP0tIWKP6tdYlqLlhI5ehQ8RkQNN0tN5B7MbdCRQEhIIJnZvz9GkEgCyWRuz+TzWmtWYPbl+e4k88mzn/3MHsu2bRsREUM5Ql2AiEhfKMRExGgKMRExmkJMRIymEBMRoynERMRoCjERMZpCTESMphATEaMpxETEaAoxETGaQkxEjKYQExGjKcRExGgKMRExmkJMRIymEBMRoynERMRoCjERMZpCTESMphATEaMpxETEaAoxETGaQkxEjKYQExGjKcRExGgKMRExmkJMRIymEBMRoynERMRoCjERMZpCTESMphATEaMpxETEaAoxETGaQkxEjKYQExGjKcRExGgKMRExmkJMRIymEBMRoynERMRoCjERMZpCTESMphATEaMpxETEaAoxETGaQkxEjKYQExGjKcRExGgKMRExmkJMRIzWL0LM5XJRUlLC2LFjiY2NJTMzk+LiYlpaWli8eDGWZfHUU0+FusyA63BDyxnvV5FIER3qAgJtz549zJ07F6fTSUJCAhMnTqS+vp7Vq1dz6NAhjh8/DsC0adNCW2iAtLthz1F45wAcdX35/MhU+MY4mDYSBkSFrj6RvrJs27ZDXUSguFwurrzySmpra1m6dCnLly8nKSkJgEcffZSHH36Y6Oho3G43J06cIDk5OcQV+1fDCVj7FjS2dL/O4AT4t1kwfFBwahLxt4gOse9+97usX7+eBx98kCeffPKi5dOmTePDDz9k9OjRHD58OAQVBs6nTfCb172nj5eTEAPFN8CwyMpw6ScidkysqqqK0tJSUlNTWbFiRZfr5OfnA5CXl9fp+SNHjnDzzTeTlJTE4MGD+f73v8/nn38e8Jr96U/v9izAwLven94NbD0igRKxIbZ+/Xo8Hg8LFy4kMTGxy3Xi4uKAziF26tQpioqKqK2tZf369axdu5by8nJuuukmPB5PUGrvq08+9z4CvY1IOIjYgf0tW7YAUFRU1O06tbW1QOcQW7t2LXV1dbz99ttkZWUBkJGRwYwZM9i4cSO33npr4Ir2k3cP+L5d1hD/1iISaBE7JpaZmUltbS27d+/u8spjR0cHw4cPx+VycejQIbKzs4EvQ2/r1q2d1h8zZgyzZs1i3bp1va6loKAAp9PZ+4PwUdH9f2PIyPxeb/f50R1s/e2t/i9I5DLS0tLYsWOHT9tGbE+spcV7Sa61tbXL5aWlpbhcLpKSkhg9evT55ysrK7njjjsuWn/SpElUVlb6VIvT6aSurs6nbX3hti2ftuvwWEGtU8QfIjbE0tLSaGxsZNeuXRQWFnZa1tDQwLJlywCYOnUqlvXli76xsZFBgwZdtL+UlBT27dvncy3BZJ895dt27adIT0/3czUil9eX10jEhth1111HVVUVK1eu5PrrrycnJweAiooKFi1ahMvlnfkZjEmuvnaTffXuAfjzB73frnjRLF78Ra3/CxIJoIi9OllSUsKQIUOoqalh0qRJTJkyhXHjxjF9+nSys7OZPXs2cPH0isGDB3PixImL9nf8+HFSUlKCUXqf5Y+G2AG92yZ2APzLqICUIxJQERtiGRkZlJeXM2/ePGJjY6muriYlJYU1a9ZQVlbG/v37gYtDLDc3t8uxr8rKSnJzc4NSe1/FRMONU3q3zY1TvNuJmCZir05eSnNzM8nJyViWxalTp4iPjz+/bNWqVfz0pz/l8OHDZGRkAPD+++9z9dVXs2HDBhYsWBCqsnvFtmHjbthadfl1i3Lh5ivB8u16gEhI9csQOxdK48eP5+OPP+60rKmpiSlTppCamsovfvEL2traKCkpYejQoWzfvh2Hw6zOa8Vh2FIJDScvXjZ8EMzOhauyg16WiN/0yxOIvXv3AhefSgIkJyezZcsWiouLueuuu4iOjuamm27iiSeeMC7AwBtQBaPhyGdw8Bi8UQlnOyBhIJR8S70vMZ9CrAtjxoxh06ZNwSwpoCwLsod5H9sOeEMsOkoBJpHBvK6FH1wuxETEHP2yJ3bufZUiYr5+2RMTkcihEBMRoynERMRoCjERMZpCTESMphATEaMpxETEaAoxETGaQkxEjKYQExGjKcRExGgKMRExmkJMRIymEBMRoynERMRoCjERMZpCTESMphATEaMpxETEaAoxETGaQkxEjKYQExGjKcRExGgKMRExmkJMRIymEBMRoynERMRoCjERMZpCTESMphATEaMpxETEaAoxETGaQkxEjKYQExGjKcRExGgKMRExmkJMRIymEBMRoynERMRoCjERMZpCTESMphATEaMpxETEaAoxETGaQkxEjNYvQszlclFSUsLYsWOJjY0lMzOT4uJiWlpaWLx4MZZl8dRTT4W6TBHxQXSoCwi0PXv2MHfuXJxO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1bx6xZszh9+jQffvghDoeDG2+8kXXr1pGUlBTwOnbu3c+JpmbNzhfpAfXEwtDujw6w+a0PmPn1PPXCRC5DIRam2js6sLCIjo4KdSkiYU0hJiJG05iYiBhNISYiRlOIiYjRFGIiYjSFmIgYTSEmIkZTiImI0RRiImI0hZiIGE0hJiJGU4iJiNEUYiJiNIWYiBhNISYiRlOIiYjRFGIiYjSFmIgYTSEmIkZTiImI0RRiImI0hZiIGE0hJiJGU4iJiNEUYiJiNIWYiBhNISYiRlOIiYjRFGIiYjSFmIgYTSEmIkZTiImI0RRiImI0hZiIGE0hJiJGU4iJiNEUYiJiNIWYiBhNISYiRlOIiYjR/j8N3ztAInu47AAAAABJRU5ErkJggg==", | ||
"text/plain": [ | ||
"<Figure size 371.107x367.889 with 1 Axes>" | ||
] | ||
}, | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"from qiskit import Aer, QuantumCircuit, transpile, execute\n", | ||
"from qiskit.visualization import array_to_latex\n", | ||
"from qlasskit import qlassf\n", | ||
"\n", | ||
"\n", | ||
"@qlassf\n", | ||
"def f(a: bool, b: bool) -> bool:\n", | ||
" return a ^ (not b)\n", | ||
"\n", | ||
"\n", | ||
"print(f\"\\n{f}\\n\")\n", | ||
"\n", | ||
"qc = QuantumCircuit(f.num_qubits, f.num_qubits)\n", | ||
"qc.append(f.gate(), f.qubits)\n", | ||
"\n", | ||
"qc.decompose().draw(\"mpl\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/latex": [ | ||
"$$\n", | ||
"\n", | ||
"\\begin{bmatrix}\n", | ||
"0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\\\\n", | ||
" 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\\\\n", | ||
" 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\\\\n", | ||
" 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\\\\n", | ||
" 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\\n", | ||
" 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\\\\n", | ||
" 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\\\\n", | ||
" 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\\\\n", | ||
" \\end{bmatrix}\n", | ||
"$$" | ||
], | ||
"text/plain": [ | ||
"<IPython.core.display.Latex object>" | ||
] | ||
}, | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"simulator = Aer.get_backend(\"unitary_simulator\")\n", | ||
"job = execute(qc, simulator, shots=8192)\n", | ||
"result = job.result()\n", | ||
"array_to_latex(result.get_unitary(qc, 3), max_size=16)" | ||
] | ||
} | ||
], | ||
"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 | ||
} |
Oops, something went wrong.