pyqrack-complex128 1.70.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. pyqrack_complex128-1.70.2/LICENSE +21 -0
  2. pyqrack_complex128-1.70.2/MANIFEST.in +3 -0
  3. pyqrack_complex128-1.70.2/Makefile +57 -0
  4. pyqrack_complex128-1.70.2/PKG-INFO +93 -0
  5. pyqrack_complex128-1.70.2/README.md +40 -0
  6. pyqrack_complex128-1.70.2/pyproject.toml +6 -0
  7. pyqrack_complex128-1.70.2/pyqrack/__init__.py +20 -0
  8. pyqrack_complex128-1.70.2/pyqrack/neuron_activation_fn.py +21 -0
  9. pyqrack_complex128-1.70.2/pyqrack/pauli.py +19 -0
  10. pyqrack_complex128-1.70.2/pyqrack/qrack_ace_backend.py +1544 -0
  11. pyqrack_complex128-1.70.2/pyqrack/qrack_circuit.py +584 -0
  12. pyqrack_complex128-1.70.2/pyqrack/qrack_neuron.py +262 -0
  13. pyqrack_complex128-1.70.2/pyqrack/qrack_neuron_torch_layer.py +170 -0
  14. pyqrack_complex128-1.70.2/pyqrack/qrack_simulator.py +4498 -0
  15. pyqrack_complex128-1.70.2/pyqrack/qrack_stabilizer.py +58 -0
  16. pyqrack_complex128-1.70.2/pyqrack/qrack_system/__init__.py +9 -0
  17. pyqrack_complex128-1.70.2/pyqrack/qrack_system/qrack_system.py +1351 -0
  18. pyqrack_complex128-1.70.2/pyqrack/quimb_circuit_type.py +17 -0
  19. pyqrack_complex128-1.70.2/pyqrack/stats/__init__.py +6 -0
  20. pyqrack_complex128-1.70.2/pyqrack/stats/load_quantized_data.py +35 -0
  21. pyqrack_complex128-1.70.2/pyqrack/stats/quantize_by_range.py +56 -0
  22. pyqrack_complex128-1.70.2/pyqrack_complex128.egg-info/PKG-INFO +93 -0
  23. pyqrack_complex128-1.70.2/pyqrack_complex128.egg-info/SOURCES.txt +27 -0
  24. pyqrack_complex128-1.70.2/pyqrack_complex128.egg-info/dependency_links.txt +1 -0
  25. pyqrack_complex128-1.70.2/pyqrack_complex128.egg-info/not-zip-safe +1 -0
  26. pyqrack_complex128-1.70.2/pyqrack_complex128.egg-info/requires.txt +3 -0
  27. pyqrack_complex128-1.70.2/pyqrack_complex128.egg-info/top_level.txt +1 -0
  28. pyqrack_complex128-1.70.2/setup.cfg +4 -0
  29. pyqrack_complex128-1.70.2/setup.py +79 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021-2023 vm6502q
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ include pyqrack/qrack_system/qrack_lib/*
2
+ include pyqrack/qrack_system/qrack_cl_precompile/*
3
+ include Makefile
@@ -0,0 +1,57 @@
1
+ PYTHON3 := $(shell which python3 2>/dev/null)
2
+
3
+ PYTHON := python3
4
+
5
+ UNAME_S := $(shell uname -s)
6
+ UNAME_P := $(shell uname -p)
7
+ QRACK_PRESENT := $(wildcard qrack/.)
8
+
9
+ .PHONY: help
10
+ help:
11
+ @echo "Please use \`make <target>' where <target> is one of"
12
+ @echo " build-deps to build PennyLane-Qrack C++ dependencies"
13
+ @echo " install to install PennyLane-Qrack"
14
+ @echo " wheel to build the PennyLane-Qrack wheel"
15
+ @echo " dist to package the source distribution"
16
+
17
+ .PHONY: build-deps
18
+ build-deps:
19
+ rm -rf pyqrack/qrack_system/qrack_lib
20
+ rm -rf pyqrack/qrack_system/qrack_cl_precompile
21
+ ifneq ($(OS),Windows_NT)
22
+ ifeq ($(QRACK_PRESENT),)
23
+ git clone https://github.com/unitaryfund/qrack.git; cd qrack; git checkout 944f418dd5ac4b37f0af20a1ec9e8903ec5e2717; cd ..
24
+ endif
25
+ mkdir -p qrack/build
26
+ ifeq ($(UNAME_S),Linux)
27
+ ifeq ($(UNAME_P),x86_64)
28
+ cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON -DQBCAPPOW=11 -DFPPOW=6 ..; make qrack_pinvoke qrack_cl_precompile
29
+ else
30
+ cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF -DQBCAPPOW=11 -DFPPOW=6 ..; make qrack_pinvoke qrack_cl_precompile
31
+ endif
32
+ endif
33
+ ifeq ($(UNAME_S),Darwin)
34
+ ifeq ($(UNAME_P),x86_64)
35
+ cd qrack/build; cmake -DQBCAPPOW=11 -DFPPOW=6 -DBoost_INCLUDE_DIR=/opt/homebrew/include -DBoost_LIBRARY_DIRS=/opt/homebrew/lib ..; make qrack_pinvoke qrack_cl_precompile
36
+ else
37
+ cd qrack/build; cmake -DENABLE_OPENCL=OFF -DENABLE_RDRAND=OFF -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF -DQBCAPPOW=11 -DFPPOW=6 -DBoost_INCLUDE_DIR=/opt/homebrew/include -DBoost_LIBRARY_DIRS=/opt/homebrew/lib ..; make qrack_pinvoke qrack_cl_precompile
38
+ endif
39
+ endif
40
+ endif
41
+ mkdir pyqrack/qrack_system/qrack_lib; cp qrack/build/libqrack_pinvoke.* pyqrack/qrack_system/qrack_lib/; cd ../../..
42
+ mkdir pyqrack/qrack_system/qrack_cl_precompile; cp qrack/build/qrack_cl_precompile pyqrack/qrack_system/qrack_cl_precompile/; cd ../../..
43
+
44
+ .PHONY: install
45
+ install:
46
+ ifndef PYTHON3
47
+ @echo "To install PyQrack you need to have Python 3 installed"
48
+ endif
49
+ $(PYTHON) setup.py install
50
+
51
+ .PHONY: wheel
52
+ wheel:
53
+ $(PYTHON) setup.py bdist_wheel
54
+
55
+ .PHONY: dist
56
+ dist:
57
+ $(PYTHON) setup.py sdist
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyqrack-complex128
3
+ Version: 1.70.2
4
+ Summary: pyqrack - Pure Python vm6502q/qrack Wrapper
5
+ Home-page: https://github.com/vm6502q/pyqrack
6
+ Author: Daniel Strano
7
+ Author-email: dan@unitary.fund
8
+ License: MIT
9
+ Keywords: pyqrack qrack simulator quantum gpu
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Operating System :: Microsoft :: Windows
14
+ Classifier: Operating System :: MacOS
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Programming Language :: C++
17
+ Classifier: Programming Language :: Python :: 2
18
+ Classifier: Programming Language :: Python :: 2.3
19
+ Classifier: Programming Language :: Python :: 2.4
20
+ Classifier: Programming Language :: Python :: 2.5
21
+ Classifier: Programming Language :: Python :: 2.6
22
+ Classifier: Programming Language :: Python :: 2.7
23
+ Classifier: Programming Language :: Python :: 3
24
+ Classifier: Programming Language :: Python :: 3.0
25
+ Classifier: Programming Language :: Python :: 3.1
26
+ Classifier: Programming Language :: Python :: 3.2
27
+ Classifier: Programming Language :: Python :: 3.3
28
+ Classifier: Programming Language :: Python :: 3.4
29
+ Classifier: Programming Language :: Python :: 3.5
30
+ Classifier: Programming Language :: Python :: 3.6
31
+ Classifier: Programming Language :: Python :: 3.7
32
+ Classifier: Programming Language :: Python :: 3.8
33
+ Classifier: Programming Language :: Python :: 3.9
34
+ Classifier: Programming Language :: Python :: 3.10
35
+ Classifier: Programming Language :: Python :: 3.11
36
+ Classifier: Programming Language :: Python :: 3.12
37
+ Classifier: Topic :: Scientific/Engineering
38
+ Description-Content-Type: text/markdown
39
+ License-File: LICENSE
40
+ Provides-Extra: dev
41
+ Requires-Dist: pytest>=7.3.1; extra == "dev"
42
+ Dynamic: author
43
+ Dynamic: author-email
44
+ Dynamic: classifier
45
+ Dynamic: description
46
+ Dynamic: description-content-type
47
+ Dynamic: home-page
48
+ Dynamic: keywords
49
+ Dynamic: license
50
+ Dynamic: license-file
51
+ Dynamic: provides-extra
52
+ Dynamic: summary
53
+
54
+ # pyqrack
55
+ [![Downloads](https://pepy.tech/badge/pyqrack-complex128)](https://pepy.tech/project/pyqrack-complex128) [![Downloads](https://pepy.tech/badge/pyqrack-complex128/month)](https://pepy.tech/project/pyqrack-complex128) [![Downloads](https://static.pepy.tech/badge/pyqrack-complex128/week)](https://pepy.tech/project/pyqrack-complex128)
56
+
57
+ Pure Python bindings for the pure C++11/OpenCL Qrack quantum computer simulator library
58
+
59
+ (**PyQrack** is just pure Qrack.)
60
+
61
+ **Note: You must also install OpenCL to use this version of Qrack.** (There are also CPU-only and CUDA version.)
62
+
63
+ **If you're looking for Mac ARM support, use the package `pyqrack`, not `pyqrack-cpu`.** Mac officially "deprecated" OpenCL years ago. Hence, accelerator support is not included in ARM-based Mac wheels, and OpenCL installation is **not** required on these systems, but, if you have a CUDA accelerator on ARM-based Mac, you could try the package `pyqrack-cuda` instead.
64
+
65
+ **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)**
66
+
67
+ **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.
68
+
69
+ 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`.
70
+
71
+ 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).
72
+
73
+ 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.
74
+
75
+ `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**.
76
+
77
+ To load the required **unitaryfund/qrack** libraries from a different location, set the `PYQRACK_SHARED_LIB_PATH` environment variable.
78
+
79
+ 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:
80
+
81
+ ```python
82
+ sim = QrackSimulator(pyzxCircuit=c)
83
+ ```
84
+
85
+ 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.
86
+
87
+ See [https://pyqrack.readthedocs.io/en/latest/](https://pyqrack.readthedocs.io/en/latest/) for an API reference.
88
+
89
+ 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.
90
+
91
+ Please feel welcome to open an issue, if you'd like help. 😃
92
+
93
+ **Special thanks go to Zeeshan Ahmed, for bug fixes and design suggestions, Ashish Panigrahi, for documentation and design suggestions, WingCode, for documentation, Or Golan, for CI build pipeline tooling, and to the broader community of Qrack contributors, for years of happy Qracking! You rock!**
@@ -0,0 +1,40 @@
1
+ # pyqrack
2
+ [![Downloads](https://pepy.tech/badge/pyqrack-complex128)](https://pepy.tech/project/pyqrack-complex128) [![Downloads](https://pepy.tech/badge/pyqrack-complex128/month)](https://pepy.tech/project/pyqrack-complex128) [![Downloads](https://static.pepy.tech/badge/pyqrack-complex128/week)](https://pepy.tech/project/pyqrack-complex128)
3
+
4
+ Pure Python bindings for the pure C++11/OpenCL Qrack quantum computer simulator library
5
+
6
+ (**PyQrack** is just pure Qrack.)
7
+
8
+ **Note: You must also install OpenCL to use this version of Qrack.** (There are also CPU-only and CUDA version.)
9
+
10
+ **If you're looking for Mac ARM support, use the package `pyqrack`, not `pyqrack-cpu`.** Mac officially "deprecated" OpenCL years ago. Hence, accelerator support is not included in ARM-based Mac wheels, and OpenCL installation is **not** required on these systems, but, if you have a CUDA accelerator on ARM-based Mac, you could try the package `pyqrack-cuda` instead.
11
+
12
+ **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)**
13
+
14
+ **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.
15
+
16
+ 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`.
17
+
18
+ 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).
19
+
20
+ 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.
21
+
22
+ `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**.
23
+
24
+ To load the required **unitaryfund/qrack** libraries from a different location, set the `PYQRACK_SHARED_LIB_PATH` environment variable.
25
+
26
+ 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:
27
+
28
+ ```python
29
+ sim = QrackSimulator(pyzxCircuit=c)
30
+ ```
31
+
32
+ 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.
33
+
34
+ See [https://pyqrack.readthedocs.io/en/latest/](https://pyqrack.readthedocs.io/en/latest/) for an API reference.
35
+
36
+ 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.
37
+
38
+ Please feel welcome to open an issue, if you'd like help. 😃
39
+
40
+ **Special thanks go to Zeeshan Ahmed, for bug fixes and design suggestions, Ashish Panigrahi, for documentation and design suggestions, WingCode, for documentation, Or Golan, for CI build pipeline tooling, and to the broader community of Qrack contributors, for years of happy Qracking! You rock!**
@@ -0,0 +1,6 @@
1
+ [build-system]
2
+ requires = [
3
+ "setuptools>=42",
4
+ "wheel"
5
+ ]
6
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,20 @@
1
+ # (C) Daniel Strano and the Qrack contributors 2017-2025. All rights reserved.
2
+ #
3
+ # Use of this source code is governed by an MIT-style license that can be
4
+ # found in the LICENSE file or at https://opensource.org/licenses/MIT.
5
+
6
+ from .pauli import Pauli
7
+ from .neuron_activation_fn import NeuronActivationFn
8
+ from .quimb_circuit_type import QuimbCircuitType
9
+ from .qrack_ace_backend import QrackAceBackend
10
+ from .qrack_circuit import QrackCircuit
11
+ from .qrack_neuron import QrackNeuron
12
+ from .qrack_neuron_torch_layer import (
13
+ QrackTorchNeuron,
14
+ QrackNeuronFunction,
15
+ QrackNeuronTorchLayer,
16
+ )
17
+ from .qrack_simulator import QrackSimulator
18
+ from .qrack_stabilizer import QrackStabilizer
19
+ from .qrack_system import QrackSystem, Qrack
20
+ from .stats.quantize_by_range import quantize_by_range
@@ -0,0 +1,21 @@
1
+ # (C) Daniel Strano and the Qrack contributors 2017-2025. All rights reserved.
2
+ #
3
+ # Pauli operators are specified for "b" (or "basis") parameters.
4
+ #
5
+ # Use of this source code is governed by an MIT-style license that can be
6
+ # found in the LICENSE file or at https://opensource.org/licenses/MIT.
7
+
8
+ from enum import IntEnum
9
+
10
+
11
+ class NeuronActivationFn(IntEnum):
12
+ # Default
13
+ Sigmoid = 0
14
+ # Rectified linear
15
+ ReLU = 1
16
+ # Gaussian linear
17
+ GeLU = 2
18
+ # Version of (default) "Sigmoid" with tunable sharpness
19
+ Generalized_Logistic = 3
20
+ # Leaky rectified linear
21
+ LeakyReLU = 4
@@ -0,0 +1,19 @@
1
+ # (C) Daniel Strano and the Qrack contributors 2017-2025. All rights reserved.
2
+ #
3
+ # Pauli operators are specified for "b" (or "basis") parameters.
4
+ #
5
+ # Use of this source code is governed by an MIT-style license that can be
6
+ # found in the LICENSE file or at https://opensource.org/licenses/MIT.
7
+
8
+ from enum import IntEnum
9
+
10
+
11
+ class Pauli(IntEnum):
12
+ # Pauli Identity operator. Corresponds to Q# constant "PauliI."
13
+ PauliI = 0
14
+ # Pauli X operator. Corresponds to Q# constant "PauliX."
15
+ PauliX = 1
16
+ # Pauli Y operator. Corresponds to Q# constant "PauliY."
17
+ PauliY = 3
18
+ # Pauli Z operator. Corresponds to Q# constant "PauliZ."
19
+ PauliZ = 2