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

Uploaded Source

Built Distributions

pyqrack-1.32.19-py3-none-win_amd64.whl (867.7 kB view details)

Uploaded Python 3 Windows x86-64

pyqrack-1.32.19-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.19-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.19-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.19-py3-none-macosx_15_0_arm64.whl (1.6 MB view details)

Uploaded Python 3 macOS 15.0+ ARM64

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

Uploaded Python 3 macOS 14.0+ ARM64

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

Uploaded Python 3 macOS 13.0+ x86-64

pyqrack-1.32.19-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.19.tar.gz.

File metadata

  • Download URL: pyqrack-1.32.19.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.19.tar.gz
Algorithm Hash digest
SHA256 f615c72760c04cfe32b3b0779ffcb08be896e7b96841340334179d2c149dadb5
MD5 2cd7612d2080cded00005262cd07edac
BLAKE2b-256 45e320386eff115cda46bbff3ee2e2e8cb30dc984554c18b496af06cee886c61

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqrack-1.32.19-py3-none-win_amd64.whl
  • Upload date:
  • Size: 867.7 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.19-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 c51a82d417c452fde4416b735de003a9852a3559df18242b46f437ac280e31d1
MD5 925b6801e41f2b2fc753b287c5a7a196
BLAKE2b-256 c381e7d30460bfdfcf16c182194b7ef8b8b4538a141104dcf33b9eeb3c117a79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.19-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 3a82ed476f1b82987723199b82e7cac07bd84649de2220b86203e513b5ac202c
MD5 f0f0adc759a3e2183052a3465f13df7a
BLAKE2b-256 fb60f9eafe6276bfefd4d31c384698c7abfcc15e230166cee0659a8fa06456db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.19-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 e9337d30a82622fd56b67c683566c9602ba2b135c92362e531045622057c8235
MD5 0585e0e11ca3b22ec7d48c70171ad265
BLAKE2b-256 fd4faebe3cbfda3d39462d6cb225b30c7438472fcf4b32a4dd8bffca3ec1b34a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.19-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 262478d3176f1af879da2e1e52aca0eb8df6ed84e4c6969bf5e5b5547612239a
MD5 499c942e6ae9e923d2d9d9fe18d42323
BLAKE2b-256 e9c00bc101c0502c915db6f37c11242ff1dd2040f2ab4733661f2c501b45320b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.19-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 b8c0cdbc44c7b76f1359d8a467513b7cf50dd2d723e8e5253e62b05c9bdbf613
MD5 e737958123e53cb5ee94ed2a5a061b55
BLAKE2b-256 49334b5fd6f6b1cf4e328077ac60690e2347e2e04bab5fbe35da07272c4465fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.19-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 384be9c00e01e14471870429537fd39ba2e77b9a4df8695aef66a480abeb0e1e
MD5 8e22f376085a1c33c4cc0ed507791591
BLAKE2b-256 923cba2df589045a63dc59c2ef93c65a4d4f7e0f50306dd921a9be7e45706c04

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.19-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 870b98e7f79eca8e5a7ab8bd74d4500575fb7ce12fd37f16dc53fa25b4f90a5b
MD5 75cc2796d84329aae3874e928976baf3
BLAKE2b-256 d94717205e6a57cd40f20549607f1d303873c492dc458368e765faed664790be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.19-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 0deb533f1cff107eb16a33fabcdf6e69e3c158b172be416e6d76c26721be622c
MD5 5b2963ae936ccb7247b4b4397243bebf
BLAKE2b-256 60067e5e83c1d0da9018084655051a4c4bdf16a0a3cebb55a8d211a76c4f8c2e

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