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

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.32.15.tar.gz (33.6 kB view details)

Uploaded Source

Built Distributions

pyqrack-1.32.15-py3-none-win_amd64.whl (867.9 kB view details)

Uploaded Python 3 Windows x86-64

pyqrack-1.32.15-py3-none-manylinux_2_39_x86_64.whl (2.7 MB view details)

Uploaded Python 3 manylinux: glibc 2.39+ x86-64

pyqrack-1.32.15-py3-none-manylinux_2_35_x86_64.whl (2.7 MB view details)

Uploaded Python 3 manylinux: glibc 2.35+ x86-64

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

Uploaded Python 3 manylinux: glibc 2.31+ x86-64

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

Uploaded Python 3 macOS 15.0+ ARM64

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

Uploaded Python 3 macOS 14.0+ ARM64

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

Uploaded Python 3 macOS 13.0+ x86-64

pyqrack-1.32.15-py3-none-macosx_12_0_x86_64.whl (2.1 MB view details)

Uploaded Python 3 macOS 12.0+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pyqrack-1.32.15.tar.gz
Algorithm Hash digest
SHA256 6e635089396eb9d37f4c981d378dce2e6c61a4a6d390ec244b9e932fec619614
MD5 a2206ef21c59377fffe3096b7266400f
BLAKE2b-256 b6248e7ac821aa974a7e6f4217972aef2001a67ed973dea1cfcf1cfef6266ac1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqrack-1.32.15-py3-none-win_amd64.whl
  • Upload date:
  • Size: 867.9 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.32.15-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 0a756a3c3c7ea5c944f00188fbd4c4e8d4771defa9c6ad2672b7f4352ccf1777
MD5 5fa1b07b9dd581367240095a0d0e67c2
BLAKE2b-256 846265961f41f4fbba488dd1ff0b316bb092cf5e5899fb679a6fc55faf285b5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.15-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 2473a99e8aa46be1d148dbc3b0705aa9efe3446c72d899c3e29cbeff0f5ce1d2
MD5 d117fa62b846a271c5b586d741811991
BLAKE2b-256 691c58c38f33f8758c72d34911d4278ef6d7ac9e25e48b538b90647d8e1df208

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.15-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 853531c88c76bdb06cd21fa86f9e9bfedd3c104f771c6a6332a4436db4b8c6bb
MD5 2ef6a6f1ccede8c3e6731a53234d3808
BLAKE2b-256 f096282275fce83dc32f0e453dbce79d4dc4eae65bd69bdce7e12d110d6a838b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.15-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 21bf3b8a7cd7bec09dd38affd2c0fc1d7afd927d0eeb39954d9a2ce301c3b497
MD5 cc0c7352badc68be7746abc37eb389cb
BLAKE2b-256 55a62af7a8ba61a84d0329d9494e5e1a10efb30413caab91351905b2733b2bf9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.15-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 fe5200c719d72da4af0725417828eaaee0cf80124fc9e7c227bf251973f2548b
MD5 40e81572330a2888e96e55e7160d24b6
BLAKE2b-256 ca8b2ec50f4cb29afb160945a4a3006a5e80a8de93e31038b0dec04327d8a24a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.15-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 8f4f280050e98916ee367e4602b5e8f07a6ea72ae71c9a56b74ebdc70be9a4a1
MD5 8b9eb5ae602ef044437f9123c1cfd076
BLAKE2b-256 20e657885c6c5e25350b169986706b916eb6b76ed3d31a373316da60e825dde6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.15-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 8e62cff1d2abaf26138ebab32b857577f0e7eb08eaa2191fe65e7127c36f214a
MD5 d4e27abb503639acc9aae3b22b108abf
BLAKE2b-256 c0d47023162f06bd250235a3113e88e253a55b5c9a4f9dd99193d0bbcdcb09e7

See more details on using hashes here.

File details

Details for the file pyqrack-1.32.15-py3-none-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-1.32.15-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 8c805276f79e37d049db44f7af7f18c734f2b912f8f8862a111141b437ec34ae
MD5 01c42899708893675106a60fdfa346f6
BLAKE2b-256 84859e62dcb1b3f59eced02e35b4482ee050684165d89efdd3a1558393cdb62b

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