# pyqrack
[![Downloads](https://pepy.tech/badge/pyqrack)](https://pepy.tech/project/pyqrack) [![Downloads](https://pepy.tech/badge/pyqrack/month)](https://pepy.tech/project/pyqrack) [![Downloads](https://static.pepy.tech/badge/pyqrack/week)](https://pepy.tech/project/pyqrack)
Pure Python bindings for the pure C++11/OpenCL Qrack quantum computer simulator library
(**PyQrack** is just pure Qrack.)
**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.**
**Performance can benefit greatly from following the [Qrack repository "Quick Start" and "Power user considerations."](https://github.com/unitaryfund/qrack/blob/main/README.md#quick-start)**
**If you use an integrated graphics accelerator, like the Intel HD,** setting environment variable `PYQRACK_HOST_POINTER_DEFAULT_ON=1` (or to any "truthy" value) will automatically set the default of `isHostPointer` option of `QrackSimulator` to `True`, to engage "zero-copy" mode by default.
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",
"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/94/68/17e6589885bf1c768233353ec867e79622879beee70945e8ca3845fabdae/pyqrack-1.35.0.tar.gz",
"platform": null,
"description": "# pyqrack\n[![Downloads](https://pepy.tech/badge/pyqrack)](https://pepy.tech/project/pyqrack) [![Downloads](https://pepy.tech/badge/pyqrack/month)](https://pepy.tech/project/pyqrack) [![Downloads](https://static.pepy.tech/badge/pyqrack/week)](https://pepy.tech/project/pyqrack)\n\nPure Python bindings for the pure C++11/OpenCL Qrack quantum computer simulator library\n\n(**PyQrack** is just pure Qrack.)\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\n**Performance can benefit greatly from following the [Qrack repository \"Quick Start\" and \"Power user considerations.\"](https://github.com/unitaryfund/qrack/blob/main/README.md#quick-start)**\n\n**If you use an integrated graphics accelerator, like the Intel HD,** setting environment variable `PYQRACK_HOST_POINTER_DEFAULT_ON=1` (or to any \"truthy\" value) will automatically set the default of `isHostPointer` option of `QrackSimulator` to `True`, to engage \"zero-copy\" mode by default.\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.35.0",
"project_urls": {
"Homepage": "https://github.com/vm6502q/pyqrack"
},
"split_keywords": [
"pyqrack",
"qrack",
"simulator",
"quantum",
"gpu"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f44d0e9f02d8eb88f124781c06ecd8551572a75a5034bc8f04ea56e538c17ba7",
"md5": "7e760d754a74caea3d561712efb2dcd1",
"sha256": "9e59d3d9bf57c8e8347af61116582d2119fb1bbb85004f7789b2efe425eae453"
},
"downloads": -1,
"filename": "pyqrack-1.35.0-py3-none-macosx_13_0_x86_64.whl",
"has_sig": false,
"md5_digest": "7e760d754a74caea3d561712efb2dcd1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 2150572,
"upload_time": "2024-12-22T18:51:44",
"upload_time_iso_8601": "2024-12-22T18:51:44.800139Z",
"url": "https://files.pythonhosted.org/packages/f4/4d/0e9f02d8eb88f124781c06ecd8551572a75a5034bc8f04ea56e538c17ba7/pyqrack-1.35.0-py3-none-macosx_13_0_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7de7112797359f75d0289b229c72b55a78df96efccd6d440bab9f398ab769428",
"md5": "67b35563f780438c92194dcca9a3bdd8",
"sha256": "74fa13f1c6d1b1c4f5b6fd3bb325bf208cd5ef2a60c7cc453b86d6c1b283d169"
},
"downloads": -1,
"filename": "pyqrack-1.35.0-py3-none-macosx_14_0_arm64.whl",
"has_sig": false,
"md5_digest": "67b35563f780438c92194dcca9a3bdd8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 1515491,
"upload_time": "2024-12-22T18:51:47",
"upload_time_iso_8601": "2024-12-22T18:51:47.893987Z",
"url": "https://files.pythonhosted.org/packages/7d/e7/112797359f75d0289b229c72b55a78df96efccd6d440bab9f398ab769428/pyqrack-1.35.0-py3-none-macosx_14_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f42c525686786035698a0cfd1c6db0ee29f5de0e11e36d188f75bf9319759987",
"md5": "1c8d6c827198c85bb7b2daf98272281d",
"sha256": "d795a555365e6c8d19d3c664f28e8c15b55176ccfd901ddb45ffd345913988a8"
},
"downloads": -1,
"filename": "pyqrack-1.35.0-py3-none-macosx_15_0_arm64.whl",
"has_sig": false,
"md5_digest": "1c8d6c827198c85bb7b2daf98272281d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 1530776,
"upload_time": "2024-12-22T18:51:50",
"upload_time_iso_8601": "2024-12-22T18:51:50.887521Z",
"url": "https://files.pythonhosted.org/packages/f4/2c/525686786035698a0cfd1c6db0ee29f5de0e11e36d188f75bf9319759987/pyqrack-1.35.0-py3-none-macosx_15_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "afb21d85cf14a18f21d41d11f538ad3ba128638b2e7d07fb48e534ba1ff6c434",
"md5": "0f1cf44b8f9ee618ac62c76cc7603672",
"sha256": "b66f7bcc6f6c777fca2423b6d9ddf02fc74013a247c8556b8dc04d76afc596f0"
},
"downloads": -1,
"filename": "pyqrack-1.35.0-py3-none-manylinux_2_31_x86_64.whl",
"has_sig": false,
"md5_digest": "0f1cf44b8f9ee618ac62c76cc7603672",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 2669951,
"upload_time": "2024-12-22T18:51:54",
"upload_time_iso_8601": "2024-12-22T18:51:54.441221Z",
"url": "https://files.pythonhosted.org/packages/af/b2/1d85cf14a18f21d41d11f538ad3ba128638b2e7d07fb48e534ba1ff6c434/pyqrack-1.35.0-py3-none-manylinux_2_31_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c29248cb6d8055d16fba892ffcd6178b030887865ffe5d1219b019e623287f87",
"md5": "9cfc1cfaf8f5f4e7906ae9eda736de7d",
"sha256": "2cfb5d84fd81d248a390cbf6b9bc93161b071556446152317dd86232beb3bc57"
},
"downloads": -1,
"filename": "pyqrack-1.35.0-py3-none-manylinux_2_35_x86_64.whl",
"has_sig": false,
"md5_digest": "9cfc1cfaf8f5f4e7906ae9eda736de7d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 2761778,
"upload_time": "2024-12-22T18:51:58",
"upload_time_iso_8601": "2024-12-22T18:51:58.069340Z",
"url": "https://files.pythonhosted.org/packages/c2/92/48cb6d8055d16fba892ffcd6178b030887865ffe5d1219b019e623287f87/pyqrack-1.35.0-py3-none-manylinux_2_35_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6d7dfb809468b5793282cc1cb5085aaae28a36420703841b6969abfe6199f70f",
"md5": "d085ae3e03268b0cc1c1696094ea8738",
"sha256": "4153e1a144d25ba9be1fbf53604bf9af26099d305373e2a332b7c55110440199"
},
"downloads": -1,
"filename": "pyqrack-1.35.0-py3-none-manylinux_2_39_x86_64.whl",
"has_sig": false,
"md5_digest": "d085ae3e03268b0cc1c1696094ea8738",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 2765741,
"upload_time": "2024-12-22T18:52:01",
"upload_time_iso_8601": "2024-12-22T18:52:01.968719Z",
"url": "https://files.pythonhosted.org/packages/6d/7d/fb809468b5793282cc1cb5085aaae28a36420703841b6969abfe6199f70f/pyqrack-1.35.0-py3-none-manylinux_2_39_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2728b26a4ec65e379ff1bc542126bd48dc0d613e926109a0bab0fc5c37e1cfa1",
"md5": "5ea05bf042b8a6c229668990fe725a3b",
"sha256": "91f040dc8af3d531570561a5fd98a6c8eaf0757885dc3b7a45afa96b90e77459"
},
"downloads": -1,
"filename": "pyqrack-1.35.0-py3-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "5ea05bf042b8a6c229668990fe725a3b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 858991,
"upload_time": "2024-12-22T18:52:04",
"upload_time_iso_8601": "2024-12-22T18:52:04.903884Z",
"url": "https://files.pythonhosted.org/packages/27/28/b26a4ec65e379ff1bc542126bd48dc0d613e926109a0bab0fc5c37e1cfa1/pyqrack-1.35.0-py3-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "946817e6589885bf1c768233353ec867e79622879beee70945e8ca3845fabdae",
"md5": "65b4d0ff120b2b960da1c62215c6f312",
"sha256": "500b5f39ce89f7746b0bf6f72e78e9ad8ad30749459cd7700feeca68ea83a79b"
},
"downloads": -1,
"filename": "pyqrack-1.35.0.tar.gz",
"has_sig": false,
"md5_digest": "65b4d0ff120b2b960da1c62215c6f312",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 35126,
"upload_time": "2024-12-22T18:52:07",
"upload_time_iso_8601": "2024-12-22T18:52:07.736341Z",
"url": "https://files.pythonhosted.org/packages/94/68/17e6589885bf1c768233353ec867e79622879beee70945e8ca3845fabdae/pyqrack-1.35.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-22 18:52:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vm6502q",
"github_project": "pyqrack",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyqrack"
}