{ "info": { "author": "Craig Gidney", "author_email": "craig.gidney@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "Python CHP Stabilizer Simulator\n-------------------------------\n\nA simple reference python implementation of Scott Aaronson and Daniel Gottesman's CHP simulator\nas defined in\n`their 2004 paper \"Improved Simulation of Stabilizer Circuits\" `__.\nThis simulator is capable of simulating quantum stabilizer circuits in polynomial time and space.\nSpecifically, it uses ``O(q^2*m + q*c)`` time and ``O(q^2)`` space where\n``q`` is the number of qubits,\n``m`` is the number of measurements,\nand ``c`` is the number of Hadamard/CNOT/Phase gates.\n\nInstallation\n------------\n\nThe ``chp_sim`` package is available on pypi and can be installed using ``pip``:\n\n.. code-block:: bash\n\n python -m pip install chp_sim\n\nAlternatively, you can just copy paste the ``chp_sim`` directory of the github\nrepository into your project.\nThe only runtime dependency is ``numpy``.\n\nUsage\n-----\n\nHere is an example of simulating\n`a circuit `__:\n\n.. code-block:: python\n\n import chp_sim\n sim = chp_sim.ChpSimulator(num_qubits=3)\n\n # Desired circuit:\n # 0: -------X-------S---H---M---\n # |\n # 1: -------|---X---S---H---M---\n # | |\n # 2: ---H---@---@-------H---M---\n\n sim.hadamard(2)\n sim.cnot(2, 0)\n sim.cnot(2, 1)\n sim.phase(0)\n sim.phase(1)\n sim.hadamard(0)\n sim.hadamard(1)\n sim.hadamard(2)\n\n # Show internal simulator state.\n print(sim, '\\n')\n # prints:\n # -Y..\n # -.Y.\n # +..X\n # ----\n # +X.X\n # +.XX\n # +YYZ\n\n # Perform measurements\n v0 = sim.measure(0)\n v1 = sim.measure(1)\n v2 = sim.measure(2)\n print(v0)\n print(v1)\n print(v2)\n # prints [note: one of four possible results for this circuit]:\n # True (random)\n # False (random)\n # False (determined)\n\n # Check pattern the outputs should satisfy.\n assert not v0.determined\n assert not v1.determined\n assert v2.determined\n assert bool(v0) ^ bool(v1) ^ bool(v2)\n\n\nPackaging\n---------\n\n(Notes to self on how to release a new version.)\n\n1. Edit the source code as needed and run tests.\n\n .. code-block:: bash\n\n pytest\n\n2. Build the wheel.\n\n .. code-block:: bash\n\n python3 setup.py -q bdist_wheel\n ls dist\n\n3. Upload to test pypi.\n\n .. code-block:: bash\n\n twine upload dist/*.whl --repository-url=https://test.pypi.org/legacy/ --username=\"${TEST_TWINE_USERNAME}\" --password=\"${TEST_TWINE_PASSWORD}\"\n\n4. Verify the test package works.\n\n .. code-block:: bash\n\n mkvirtualenv test --python=/usr/bin/python3\n pip install numpy\n pip install chp_sim --index-url=https://test.pypi.org/simple/\n python -c \"import chp_sim; print(chp_sim.__version__); print(chp_sim.ChpSimulator(4))\"\n\n5. Upload to prod pypi.\n\n .. code-block:: bash\n\n twine upload dist/*.whl --username=\"${PROD_TWINE_USERNAME}\" --password=\"${PROD_TWINE_PASSWORD}\"\n\n6. Verify the prod package works.\n\n .. code-block:: bash\n\n mkvirtualenv test --python=/usr/bin/python3\n pip install chp_sim\n python -c \"import chp_sim; print(chp_sim.__version__); print(chp_sim.ChpSimulator(4))\"\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Strilanc/python-chp-stabilizer-simulator", "keywords": "", "license": "Apache 2", "maintainer": "", "maintainer_email": "", "name": "chp-sim", "package_url": "https://pypi.org/project/chp-sim/", "platform": "", "project_url": "https://pypi.org/project/chp-sim/", "project_urls": { "Homepage": "https://github.com/Strilanc/python-chp-stabilizer-simulator" }, "release_url": "https://pypi.org/project/chp-sim/0.1.1/", "requires_dist": [ "numpy" ], "requires_python": ">=3.6.0", "summary": "A reference implementation of Aaronson et al's CHP simulator for efficiently simulating quantum stabilizer circuits.", "version": "0.1.1" }, "last_serial": 5483713, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "dfbe3574b5273bf9fbe8ff8c9a206870", "sha256": "760cbab16cbd6d96923d2a1db790158b0d9f23ceacf1ae56220492b1b5941524" }, "downloads": -1, "filename": "chp_sim-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "dfbe3574b5273bf9fbe8ff8c9a206870", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 11172, "upload_time": "2019-07-03T22:04:49", "url": "https://files.pythonhosted.org/packages/30/7c/8cd37f6f0bf0eae8c63b4366eddf84a7df230930fd5594da538c42810557/chp_sim-0.1.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dfbe3574b5273bf9fbe8ff8c9a206870", "sha256": "760cbab16cbd6d96923d2a1db790158b0d9f23ceacf1ae56220492b1b5941524" }, "downloads": -1, "filename": "chp_sim-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "dfbe3574b5273bf9fbe8ff8c9a206870", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 11172, "upload_time": "2019-07-03T22:04:49", "url": "https://files.pythonhosted.org/packages/30/7c/8cd37f6f0bf0eae8c63b4366eddf84a7df230930fd5594da538c42810557/chp_sim-0.1.1-py3-none-any.whl" } ] }