# pyqrack
[![Downloads](https://pepy.tech/badge/pyqrack-cpu)](https://pepy.tech/project/pyqrack-cpu) [![Downloads](https://pepy.tech/badge/pyqrack-cpu/month)](https://pepy.tech/project/pyqrack-cpu) [![Downloads](https://static.pepy.tech/badge/pyqrack-cpu/week)](https://pepy.tech/project/pyqrack-cpu)
Pure Python bindings for the pure C++11 Qrack quantum computer simulator library
(**PyQrack** is just pure Qrack.)
<<<<<<< HEAD
This is the **purely CPU-based** variant of PyQrack (with module name `pyqrack-cpu`). This alternate build of PyQrack is provided so that systems that won't use OpenCL anyway (such as because they lack any GPUs or other accelerators like the Intel HD) do not need to install the OpenCL library in order to use PyQrack. In this form, both the PyQrack module and the underlying C++ Qrack library are entirely external **dependency-free.**
(**If you installing from source,** it doesn't matter whether you use `pyqrack` or `pyqrack-cpu`, because the build version of C++ Qrack you intend to use must already be installed locally.)
=======
**Note, if building from source**: You must build and install [unitaryfund/qrack](https://github.com/unitaryfund/qrack) to build the `main` branch from source. CI/CD builds wheels that contain pre-compiled Qrack binaries, and that is the form published on PyPi. **You must also install OpenCL.**
>>>>>>> main
Import and instantiate [`QrackSimulator`](https://github.com/unitaryfund/pyqrack/blob/main/pyqrack/qrack_simulator.py) instances. This simulator can perform arbitrary single qubit and controlled-single-qubit gates, as well as other specific gates like `SWAP`.
Any 2x2 bit operator matrix is represented by a list of 4 `complex` floating point numbers, in [**row-major order**](https://en.wikipedia.org/wiki/Row-_and_column-major_order).
Single and array "`b`" parameters represent [**Pauli operator bases**](https://en.wikipedia.org/wiki/Pauli_matrices). They are specified according to the enumeration of the [`Pauli`](https://github.com/unitaryfund/pyqrack/blob/main/pyqrack/pauli.py) class.
`MC[x]` and `MAC[x]` methods are controlled single bit gates, with as many control qubits as you specify via Python list `c` argument. `MCX` is multiply-controlled Pauli X, and `MACX` is "anti-"controlled Pauli X, i.e. "anti-control" activates the gate if all control bits are specifically **off**, as opposed to **on**.
To load the required **unitaryfund/qrack** libraries from a different location, set the `PYQRACK_SHARED_LIB_PATH` environment variable.
PyQrack has experimental support for [PyZX](https://github.com/Quantomatic/pyzx) `Circuit` definitions as an intermediate representation for `QrackSimulator`. To try this, load a `Circuit` in PyZX, (use that module to optimize your circuit, as you like,) and create a `QrackSimulator()` instance using the `pyzxCircuit` named argument of the constructor, like so:
```python
sim = QrackSimulator(pyzxCircuit=c)
```
where `c` is a PyZX circuit object. The circuit will automatically be simulated in the constructed `QrackSimulator` instance. This also allows loading from QASM and other intermediate representations supported by PyZX.
See [https://pyqrack.readthedocs.io/en/latest/](https://pyqrack.readthedocs.io/en/latest/) for an API reference.
For custom Qrack build floating-point precision, where options are `half`, `float`, `double`, and `quad`, set an environment variable via `export QRACK_FPPOW=[n]` (or as appropriate to your shell) where `[n]` is the logarithm base 2 of the number of bits in the systemic floating point type (`4`, `5`, `6`, or `7`, with `5` or `float` as default, i.e. `2**5=32` for 32-bit `float`). Your Qrack installation floating-point build option must match this specific value, which might require a custom Qrack build.
Please feel welcome to open an issue, if you'd like help. 😃
**Special thanks go to Zeeshan Ahmed, for bug fixes and design suggestions, Ashish Panigrahi, for documentation and design suggestions, WingCode, for documentation, and to the broader community of Qrack contributors, for years of happy Qracking! You rock!**
Raw data
{
"_id": null,
"home_page": "https://github.com/vm6502q/pyqrack",
"name": "pyqrack-cpu",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "pyqrack qrack simulator quantum gpu",
"author": "Daniel Strano",
"author_email": "dan@unitary.fund",
"download_url": "https://files.pythonhosted.org/packages/0d/4b/4c74286af8cc8538f8cede83a68881adaad6d8363ef09f101b92721188e3/pyqrack_cpu-1.34.9.tar.gz",
"platform": null,
"description": "# pyqrack\n[![Downloads](https://pepy.tech/badge/pyqrack-cpu)](https://pepy.tech/project/pyqrack-cpu) [![Downloads](https://pepy.tech/badge/pyqrack-cpu/month)](https://pepy.tech/project/pyqrack-cpu) [![Downloads](https://static.pepy.tech/badge/pyqrack-cpu/week)](https://pepy.tech/project/pyqrack-cpu)\n\nPure Python bindings for the pure C++11 Qrack quantum computer simulator library\n\n(**PyQrack** is just pure Qrack.)\n\n<<<<<<< HEAD\nThis is the **purely CPU-based** variant of PyQrack (with module name `pyqrack-cpu`). This alternate build of PyQrack is provided so that systems that won't use OpenCL anyway (such as because they lack any GPUs or other accelerators like the Intel HD) do not need to install the OpenCL library in order to use PyQrack. In this form, both the PyQrack module and the underlying C++ Qrack library are entirely external **dependency-free.**\n\n(**If you installing from source,** it doesn't matter whether you use `pyqrack` or `pyqrack-cpu`, because the build version of C++ Qrack you intend to use must already be installed locally.)\n=======\n**Note, if building from source**: You must build and install [unitaryfund/qrack](https://github.com/unitaryfund/qrack) to build the `main` branch from source. CI/CD builds wheels that contain pre-compiled Qrack binaries, and that is the form published on PyPi. **You must also install OpenCL.**\n>>>>>>> main\n\nImport and instantiate [`QrackSimulator`](https://github.com/unitaryfund/pyqrack/blob/main/pyqrack/qrack_simulator.py) instances. This simulator can perform arbitrary single qubit and controlled-single-qubit gates, as well as other specific gates like `SWAP`.\n\nAny 2x2 bit operator matrix is represented by a list of 4 `complex` floating point numbers, in [**row-major order**](https://en.wikipedia.org/wiki/Row-_and_column-major_order).\n\nSingle and array \"`b`\" parameters represent [**Pauli operator bases**](https://en.wikipedia.org/wiki/Pauli_matrices). They are specified according to the enumeration of the [`Pauli`](https://github.com/unitaryfund/pyqrack/blob/main/pyqrack/pauli.py) class.\n\n`MC[x]` and `MAC[x]` methods are controlled single bit gates, with as many control qubits as you specify via Python list `c` argument. `MCX` is multiply-controlled Pauli X, and `MACX` is \"anti-\"controlled Pauli X, i.e. \"anti-control\" activates the gate if all control bits are specifically **off**, as opposed to **on**.\n\nTo load the required **unitaryfund/qrack** libraries from a different location, set the `PYQRACK_SHARED_LIB_PATH` environment variable.\n\nPyQrack has experimental support for [PyZX](https://github.com/Quantomatic/pyzx) `Circuit` definitions as an intermediate representation for `QrackSimulator`. To try this, load a `Circuit` in PyZX, (use that module to optimize your circuit, as you like,) and create a `QrackSimulator()` instance using the `pyzxCircuit` named argument of the constructor, like so:\n\n```python\nsim = QrackSimulator(pyzxCircuit=c)\n```\n\nwhere `c` is a PyZX circuit object. The circuit will automatically be simulated in the constructed `QrackSimulator` instance. This also allows loading from QASM and other intermediate representations supported by PyZX.\n\nSee [https://pyqrack.readthedocs.io/en/latest/](https://pyqrack.readthedocs.io/en/latest/) for an API reference.\n\nFor custom Qrack build floating-point precision, where options are `half`, `float`, `double`, and `quad`, set an environment variable via `export QRACK_FPPOW=[n]` (or as appropriate to your shell) where `[n]` is the logarithm base 2 of the number of bits in the systemic floating point type (`4`, `5`, `6`, or `7`, with `5` or `float` as default, i.e. `2**5=32` for 32-bit `float`). Your Qrack installation floating-point build option must match this specific value, which might require a custom Qrack build.\n\nPlease feel welcome to open an issue, if you'd like help. \ud83d\ude03\n\n**Special thanks go to Zeeshan Ahmed, for bug fixes and design suggestions, Ashish Panigrahi, for documentation and design suggestions, WingCode, for documentation, and to the broader community of Qrack contributors, for years of happy Qracking! You rock!**\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "pyqrack - Pure Python vm6502q/qrack Wrapper",
"version": "1.34.9",
"project_urls": {
"Homepage": "https://github.com/vm6502q/pyqrack"
},
"split_keywords": [
"pyqrack",
"qrack",
"simulator",
"quantum",
"gpu"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b09c93b3884f07b72cfa712050ab9ccd4c1423656a1b9e34cabf7a9fd50650a8",
"md5": "af2a50a41816cf416909b9446d665ac4",
"sha256": "bd0bbf3b5431cf013a03487dfcd6f8b7766a6126c5a74eb1704ec44a5670c090"
},
"downloads": -1,
"filename": "pyqrack_cpu-1.34.9-py3-none-macosx_13_0_x86_64.whl",
"has_sig": false,
"md5_digest": "af2a50a41816cf416909b9446d665ac4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 1673755,
"upload_time": "2024-12-09T12:25:38",
"upload_time_iso_8601": "2024-12-09T12:25:38.664803Z",
"url": "https://files.pythonhosted.org/packages/b0/9c/93b3884f07b72cfa712050ab9ccd4c1423656a1b9e34cabf7a9fd50650a8/pyqrack_cpu-1.34.9-py3-none-macosx_13_0_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "95fa252b14a6ebe0a09c80e676f0e22ea2517a22925895572c348d5b810658cd",
"md5": "e411c0bb5e3907fef6fd454850de1249",
"sha256": "40c3410f3553ae9d7db741154e24654e51f56e4a67e2810c4f3be3485a42704b"
},
"downloads": -1,
"filename": "pyqrack_cpu-1.34.9-py3-none-manylinux_2_31_x86_64.whl",
"has_sig": false,
"md5_digest": "e411c0bb5e3907fef6fd454850de1249",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 2122082,
"upload_time": "2024-12-09T12:25:42",
"upload_time_iso_8601": "2024-12-09T12:25:42.500818Z",
"url": "https://files.pythonhosted.org/packages/95/fa/252b14a6ebe0a09c80e676f0e22ea2517a22925895572c348d5b810658cd/pyqrack_cpu-1.34.9-py3-none-manylinux_2_31_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e56587dde2d8fa036b1ef05bb595dbcb7d3876e7b9d1abc10eb9c456d156ae5a",
"md5": "332aea903c1f78d8fd4d06c7737bfe25",
"sha256": "364de9d78dd9aacfce286f6c279acf943ccddb8253b356331a13d4d5fd481b2f"
},
"downloads": -1,
"filename": "pyqrack_cpu-1.34.9-py3-none-manylinux_2_35_x86_64.whl",
"has_sig": false,
"md5_digest": "332aea903c1f78d8fd4d06c7737bfe25",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 2194709,
"upload_time": "2024-12-09T12:25:45",
"upload_time_iso_8601": "2024-12-09T12:25:45.530797Z",
"url": "https://files.pythonhosted.org/packages/e5/65/87dde2d8fa036b1ef05bb595dbcb7d3876e7b9d1abc10eb9c456d156ae5a/pyqrack_cpu-1.34.9-py3-none-manylinux_2_35_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7a5e50038e0c778c3cb20e9754d4564e1bb89bece95e7c29d4b1a85793097371",
"md5": "84aedba3b884fce783d5b291e160970c",
"sha256": "5ac6d31c9b26d4e248c046287e0b838bcf8b052e6ba78b08579fcd16dba9b29c"
},
"downloads": -1,
"filename": "pyqrack_cpu-1.34.9-py3-none-manylinux_2_39_x86_64.whl",
"has_sig": false,
"md5_digest": "84aedba3b884fce783d5b291e160970c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 2202695,
"upload_time": "2024-12-09T12:25:49",
"upload_time_iso_8601": "2024-12-09T12:25:49.026088Z",
"url": "https://files.pythonhosted.org/packages/7a/5e/50038e0c778c3cb20e9754d4564e1bb89bece95e7c29d4b1a85793097371/pyqrack_cpu-1.34.9-py3-none-manylinux_2_39_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9db944979a9e1f4397331e416fe90e4a6350a6c61a4beeff949c627e8a3422e9",
"md5": "8a6d413d4af529dc214a148b4d906d25",
"sha256": "f8c25a55256491ef78ee5897e3e73632b094ffdc36bf87e5a3977e26a16aff53"
},
"downloads": -1,
"filename": "pyqrack_cpu-1.34.9-py3-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "8a6d413d4af529dc214a148b4d906d25",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 678206,
"upload_time": "2024-12-09T12:25:50",
"upload_time_iso_8601": "2024-12-09T12:25:50.576255Z",
"url": "https://files.pythonhosted.org/packages/9d/b9/44979a9e1f4397331e416fe90e4a6350a6c61a4beeff949c627e8a3422e9/pyqrack_cpu-1.34.9-py3-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0d4b4c74286af8cc8538f8cede83a68881adaad6d8363ef09f101b92721188e3",
"md5": "a2386a444d0b072afc688d6db44cc6a2",
"sha256": "b3adec5c6bdaecb02cf961a3e5546c37182245e1668524f50d8b07c4de5696d5"
},
"downloads": -1,
"filename": "pyqrack_cpu-1.34.9.tar.gz",
"has_sig": false,
"md5_digest": "a2386a444d0b072afc688d6db44cc6a2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 35241,
"upload_time": "2024-12-09T12:25:51",
"upload_time_iso_8601": "2024-12-09T12:25:51.673861Z",
"url": "https://files.pythonhosted.org/packages/0d/4b/4c74286af8cc8538f8cede83a68881adaad6d8363ef09f101b92721188e3/pyqrack_cpu-1.34.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-09 12:25:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vm6502q",
"github_project": "pyqrack",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyqrack-cpu"
}