{ "info": { "author": "Ben Bartlett", "author_email": "benbartlett@stanford.edu", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Simulator for quantum networks and channels\n\n\n\nThe _Simulator for Quantum Networks and Channels_ (`SQUANCH`) is an open-source Python library for creating parallelized simulations of distributed quantum information processing. The framework includes many features of a general-purpose quantum computing simulator, but it is optimized specifically for simulating quantum networks. It includes functionality to allow users to easily design complex multi-party quantum networks, extensible classes for modeling noisy quantum channels, and a multiprocessed NumPy backend for performant simulations.\n\nA schematic overview of the modules available in `SQUANCH` is shown below. (Refer to the [documentation](https://att-innovate.github.io/squanch/) or the [whitepaper](https://arxiv.org/abs/1808.07047) for more details.)\n\n![Overview of SQUANCH framework structure](https://raw.githubusercontent.com/att-innovate/squanch/master/docs/source/img/moduleOverview.png)\n\n`SQUANCH` is developed as part of the Intelligent Quantum Networks and Technologies ([INQNET](http://inqnet.caltech.edu)) program, a [collaboration](http://about.att.com/story/beyond_quantum_computing.html) between AT&T and the California Institute of Technology. \n\n## Documentation\n\nDocumentation for this package is available at the [documentation website](https://att-innovate.github.io/squanch/) or as a [pdf manual](/docs/SQUANCH.pdf). We encourage interested users to read the whitepaper for the `SQUANCH` platform, \"A distributed simulation framework for quantum networks and channels\" (arXiv: [1808.07047](https://arxiv.org/abs/1808.07047)), which provides an overview of the framework and a primer on quantum information.\n\n## Installation \n\nYou can install SQUANCH directly using the Python package manager, `pip`:\n\n```\npip install squanch\n```\n\nIf you don't have `pip`, you can get it using `easy_install pip`.\n\n## Demonstrations\n\nDemonstrations of various quantum protocols can be found in the [demos](/demos) folder and in the [documentation](https://att-innovate.github.io/squanch/demos.html):\n\n- [Quantum teleportation](https://att-innovate.github.io/squanch/demos/quantum-teleportation.html)\n- [Superdense coding](https://att-innovate.github.io/squanch/demos/superdense-coding.html)\n- [Man-in-the-middle attack](https://att-innovate.github.io/squanch/demos/man-in-the-middle.html)\n- [Quantum error correction](https://att-innovate.github.io/squanch/demos/quantum-error-correction.html)\n\n### Example: quantum interception attack\n\nAs an example to put in this readme, let's consider a scenario where Alice wants to send data to Bob. For security, she transmits her message through [quantum superdense coding](https://en.wikipedia.org/wiki/Superdense_coding). In this scenario, shown below as a circuit diagram, we have four [`Agents`](https://att-innovate.github.io/squanch/getting-started.html#using-agents-in-your-simulations), who act as follows:\n\n\n\n- Charlie generates entangled pairs of qubits, which he sends to Alice and Bob.\n- Alice receives Charlie's qubit. She encodes two bits of her data in it and sends it Bob.\n- Bob receives the qubits from Charlie and Alice. He operates jointly on them and measures them to reconstruct Alice's two bits of information.\n- However, the fourth agent, Eve, wants to know Alice's data. She intercepts every qubit Alice sends to Bob, measures it, and re-transmits it to Bob, hoping he won't notice.\n\nAn implementation of this scenario in `SQUANCH` is given below.\n\n```python\nimport numpy as np\nimport matplotlib.image as image\nfrom squanch import *\n\nclass Charlie(Agent):\n '''Charlie sends Bell pairs to Alice and Bob'''\n def run(self):\n for qsys in self.qstream:\n a, b = qsys.qubits\n H(a)\n CNOT(a, b)\n self.qsend(alice, a)\n self.qsend(bob, b)\n\nclass Alice(Agent):\n '''Alice tries to send data to Bob, but Eve intercepts'''\n def run(self):\n for _ in self.qstream:\n bit1 = self.data.pop(0)\n bit2 = self.data.pop(0)\n q = self.qrecv(charlie)\n if bit2 == 1: X(q)\n if bit1 == 1: Z(q)\n # Alice unknowingly sends the qubit to Eve\n self.qsend(eve, q) \n\nclass Eve(Agent):\n '''Eve naively tries to intercept Alice's data'''\n def run(self):\n bits = [] \n for _ in self.qstream:\n a = self.qrecv(alice)\n bits.append(a.measure())\n self.qsend(bob, a)\n self.output(bits)\n\nclass Bob(Agent):\n '''Bob receives Eve's intercepted data'''\n def run(self):\n bits = []\n for _ in self.qstream:\n a = self.qrecv(eve)\n c = self.qrecv(charlie)\n CNOT(a, c)\n H(a)\n bits.extend([a.measure(), c.measure()])\n self.output(bits)\n\n# Load Alice's data (an image) and serialize it to a bitstream\nimg = image.imread(\"docs/source/img/foundryLogo.bmp\") \nbitstream = list(np.unpackbits(img))\n\n# Prepare an appropriately sized quantum stream\nqstream = QStream(2, int(len(bitstream) / 2))\nout = Agent.shared_output()\n\n# Instantiate agents\nalice = Alice(qstream, out, data=bitstream)\nbob = Bob(qstream, out)\ncharlie = Charlie(qstream, out)\neve = Eve(qstream, out)\n\n# Connect the agents to form the network\nalice.qconnect(bob)\nalice.qconnect(eve)\nalice.qconnect(charlie)\nbob.qconnect(charlie)\nbob.qconnect(eve)\n\n# Run the simulation\nSimulation(alice, eve, bob, charlie).run()\n\n# Display the images Alice sent, Eve intercepted, and Bob received\n# (Plotting code omitted for brevity; results shown below)\n``` \n\n![Images sent by Alice, intercepted by Eve, and received by Bob](https://raw.githubusercontent.com/att-innovate/squanch/master/docs/source/img/man-in-the-middle-results.png)\n\n## Citation\n\nIf you are doing research using `SQUANCH`, please cite our whitepaper:\n\n> B. Bartlett, \"A distributed simulation framework for quantum networks and channels,\" arXiv: 1808.07047 [quant-ph], Aug. 2018.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/att-innovate/squanch", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "SQUANCH", "package_url": "https://pypi.org/project/SQUANCH/", "platform": "", "project_url": "https://pypi.org/project/SQUANCH/", "project_urls": { "Homepage": "https://github.com/att-innovate/squanch" }, "release_url": "https://pypi.org/project/SQUANCH/1.1.0/", "requires_dist": [ "numpy", "tqdm" ], "requires_python": "", "summary": "Simulator for Quantum Networks and Channels", "version": "1.1.0" }, "last_serial": 4194563, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "cd6272baf339bd869e09e84477000bf8", "sha256": "d4c729ce8dfa35dd6b826f8964a3e351b7296136487d0ec0a906dccd6760b719" }, "downloads": -1, "filename": "SQUANCH-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "cd6272baf339bd869e09e84477000bf8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16548, "upload_time": "2018-07-13T00:04:42", "url": "https://files.pythonhosted.org/packages/5d/3d/da3279bc70f72a47a3c6685a7d715eefe16f7eb31822d60005fda6eed4e4/SQUANCH-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "866753915f1690df255dc1ba92d0e1c8", "sha256": "87a09d717e18a9122202191c3513aa10b1a39fd9010e372099be2b3de38f98f9" }, "downloads": -1, "filename": "SQUANCH-1.0.0.tar.gz", "has_sig": false, "md5_digest": "866753915f1690df255dc1ba92d0e1c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15423, "upload_time": "2018-07-13T00:04:44", "url": "https://files.pythonhosted.org/packages/b4/c9/d7f5ef1cf31fab446371ef73c22e6117a48a566b946cc8433a3a3bc58a87/SQUANCH-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "987a1528a9d34ae61167ad43113f299b", "sha256": "a151225c96fa57232e9337043582a8e23508128acc05ad0eb848fe6dffd9accf" }, "downloads": -1, "filename": "SQUANCH-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "987a1528a9d34ae61167ad43113f299b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16683, "upload_time": "2018-08-22T00:49:20", "url": "https://files.pythonhosted.org/packages/5e/9e/cbc63bea6a87b21adab86895d3e477a8ac431f1453a49e96ead98e315825/SQUANCH-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4856c16b44f984f6a5029fba1d23a04b", "sha256": "9c1a6c71d4a43fac5defbed4c164f59ba5635eefc9651d0947b1f806a17278e4" }, "downloads": -1, "filename": "SQUANCH-1.1.0.tar.gz", "has_sig": false, "md5_digest": "4856c16b44f984f6a5029fba1d23a04b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15841, "upload_time": "2018-08-22T00:49:22", "url": "https://files.pythonhosted.org/packages/1c/53/5a039f3c1890ee6448ecc42fb27a405471562683728a5b215675b274bb74/SQUANCH-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "987a1528a9d34ae61167ad43113f299b", "sha256": "a151225c96fa57232e9337043582a8e23508128acc05ad0eb848fe6dffd9accf" }, "downloads": -1, "filename": "SQUANCH-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "987a1528a9d34ae61167ad43113f299b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16683, "upload_time": "2018-08-22T00:49:20", "url": "https://files.pythonhosted.org/packages/5e/9e/cbc63bea6a87b21adab86895d3e477a8ac431f1453a49e96ead98e315825/SQUANCH-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4856c16b44f984f6a5029fba1d23a04b", "sha256": "9c1a6c71d4a43fac5defbed4c164f59ba5635eefc9651d0947b1f806a17278e4" }, "downloads": -1, "filename": "SQUANCH-1.1.0.tar.gz", "has_sig": false, "md5_digest": "4856c16b44f984f6a5029fba1d23a04b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15841, "upload_time": "2018-08-22T00:49:22", "url": "https://files.pythonhosted.org/packages/1c/53/5a039f3c1890ee6448ecc42fb27a405471562683728a5b215675b274bb74/SQUANCH-1.1.0.tar.gz" } ] }