Skip to main content

pyqrack - Pure Python vm6502q/qrack Wrapper

Project description

pyqrack

Downloads Downloads Downloads

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 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.

Import and instantiate QrackSimulator 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.

Single and array "b" parameters represent Pauli operator bases. They are specified according to the enumeration of the Pauli 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 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:

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/ 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!

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyqrack-1.33.0.tar.gz (34.4 kB view details)

Uploaded Source

Built Distributions

pyqrack-1.33.0-py3-none-win_amd64.whl (869.4 kB view details)

Uploaded Python 3 Windows x86-64

pyqrack-1.33.0-py3-none-manylinux_2_39_x86_64.whl (2.8 MB view details)

Uploaded Python 3 manylinux: glibc 2.39+ x86-64

pyqrack-1.33.0-py3-none-manylinux_2_35_x86_64.whl (2.8 MB view details)

Uploaded Python 3 manylinux: glibc 2.35+ x86-64

pyqrack-1.33.0-py3-none-manylinux_2_31_x86_64.whl (2.7 MB view details)

Uploaded Python 3 manylinux: glibc 2.31+ x86-64

pyqrack-1.33.0-py3-none-macosx_15_0_arm64.whl (1.6 MB view details)

Uploaded Python 3 macOS 15.0+ ARM64

pyqrack-1.33.0-py3-none-macosx_14_0_arm64.whl (1.5 MB view details)

Uploaded Python 3 macOS 14.0+ ARM64

pyqrack-1.33.0-py3-none-macosx_13_0_x86_64.whl (2.2 MB view details)

Uploaded Python 3 macOS 13.0+ x86-64

File details

Details for the file pyqrack-1.33.0.tar.gz.

File metadata

  • Download URL: pyqrack-1.33.0.tar.gz
  • Upload date:
  • Size: 34.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyqrack-1.33.0.tar.gz
Algorithm Hash digest
SHA256 047915eccc6693cf6d2fbd1b01993d5847f62ebe785965b83a3c8ff37e7cfde1
MD5 86266c8ef8d5ce3a56f27513d8afd263
BLAKE2b-256 88b97e4a988bea5e3de49d9bbcca26b0aa4daf72c8be085247fa865689b3f43d

See more details on using hashes here.

File details

Details for the file pyqrack-1.33.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: pyqrack-1.33.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 869.4 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyqrack-1.33.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 fc21b9b4c12a0dd7b406a7f76973068cd6e4deeedf5306a071ec48a12b0b23b8
MD5 d4b104d8088f3f717656231b517eee15
BLAKE2b-256 d360ca77e802e434fbe233ff831fa051f22c3d45753bb2e1b403f489293686e1

See more details on using hashes here.

File details

Details for the file pyqrack-1.33.0-py3-none-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-1.33.0-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 26435c9ddd26ac7b7e28e4663025397628ab1166138ce077ec2bf8b976760479
MD5 34a7902972c3072a4b13303ff17a18b7
BLAKE2b-256 7a0ebca98f062af36cb028081fedf4b057e364a77f75a8a05c74a78423dfbcda

See more details on using hashes here.

File details

Details for the file pyqrack-1.33.0-py3-none-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-1.33.0-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 e74a55e2c8c9ab5de38cbbfbc4d1267440aecd2131ad061f224da601622eeebb
MD5 67f83b9cb1608357e4f69b25c23a26ec
BLAKE2b-256 5a393c29ffe5d6cff0771dd3605d5422c051934c703a59d51602631f8c78bb01

See more details on using hashes here.

File details

Details for the file pyqrack-1.33.0-py3-none-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-1.33.0-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 6b97264e266e7d957fe0e9d2394edfe4b538c8ecdb9762e11b53607c6bab14ac
MD5 b5cbf26b07b16ceb4b643458d15459ee
BLAKE2b-256 0c934bc7168139145c6801b93cc72a62022968131def5ea3fc43ce7049e56201

See more details on using hashes here.

File details

Details for the file pyqrack-1.33.0-py3-none-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack-1.33.0-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 2959c7a8818b8f58af7e25ab536be88ef2ab5b1da579836f2ae394736347d9d3
MD5 e7fb0c9ccb4b0c83ed0aa00b943032d4
BLAKE2b-256 6f306d813ea85b24cae83cda9961301192d7631225d40126f02e8cc775f8e1ee

See more details on using hashes here.

File details

Details for the file pyqrack-1.33.0-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack-1.33.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 c9301c39ed15b46abe6e9a1e9db3bedb550e6e2e9765f65455b233cdb8cc20b2
MD5 c110911fc9ae37186da5cd363bc23c95
BLAKE2b-256 fba0f43f7ab6b3b28321b4422bc6d29a4910e4f8364734b3f12261885e8088a8

See more details on using hashes here.

File details

Details for the file pyqrack-1.33.0-py3-none-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-1.33.0-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 9bff7ab95414b173abeb1679a7071a38331a78d879a0c71f64fc1927030776d9
MD5 ef2eae3a430b4f7dee1cdfc86c89dc6f
BLAKE2b-256 d3339edcac1570ff8cc621db30279fe8e266d0ed825fda41a2e90bd224fe4ecf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page