pyqrack-cpu-complex128 1.82.3__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_cpu_complex128-1.82.3/LICENSE +21 -0
  2. pyqrack_cpu_complex128-1.82.3/MANIFEST.in +3 -0
  3. pyqrack_cpu_complex128-1.82.3/Makefile +67 -0
  4. pyqrack_cpu_complex128-1.82.3/PKG-INFO +91 -0
  5. pyqrack_cpu_complex128-1.82.3/README.md +38 -0
  6. pyqrack_cpu_complex128-1.82.3/pyproject.toml +6 -0
  7. pyqrack_cpu_complex128-1.82.3/pyqrack/__init__.py +20 -0
  8. pyqrack_cpu_complex128-1.82.3/pyqrack/neuron_activation_fn.py +21 -0
  9. pyqrack_cpu_complex128-1.82.3/pyqrack/pauli.py +19 -0
  10. pyqrack_cpu_complex128-1.82.3/pyqrack/qrack_ace_backend.py +1518 -0
  11. pyqrack_cpu_complex128-1.82.3/pyqrack/qrack_circuit.py +595 -0
  12. pyqrack_cpu_complex128-1.82.3/pyqrack/qrack_neuron.py +382 -0
  13. pyqrack_cpu_complex128-1.82.3/pyqrack/qrack_neuron_torch_layer.py +275 -0
  14. pyqrack_cpu_complex128-1.82.3/pyqrack/qrack_simulator.py +4464 -0
  15. pyqrack_cpu_complex128-1.82.3/pyqrack/qrack_stabilizer.py +58 -0
  16. pyqrack_cpu_complex128-1.82.3/pyqrack/qrack_system/__init__.py +9 -0
  17. pyqrack_cpu_complex128-1.82.3/pyqrack/qrack_system/qrack_system.py +1366 -0
  18. pyqrack_cpu_complex128-1.82.3/pyqrack/quimb_circuit_type.py +17 -0
  19. pyqrack_cpu_complex128-1.82.3/pyqrack/stats/__init__.py +6 -0
  20. pyqrack_cpu_complex128-1.82.3/pyqrack/stats/load_quantized_data.py +33 -0
  21. pyqrack_cpu_complex128-1.82.3/pyqrack/stats/quantize_by_range.py +52 -0
  22. pyqrack_cpu_complex128-1.82.3/pyqrack_cpu_complex128.egg-info/PKG-INFO +91 -0
  23. pyqrack_cpu_complex128-1.82.3/pyqrack_cpu_complex128.egg-info/SOURCES.txt +27 -0
  24. pyqrack_cpu_complex128-1.82.3/pyqrack_cpu_complex128.egg-info/dependency_links.txt +1 -0
  25. pyqrack_cpu_complex128-1.82.3/pyqrack_cpu_complex128.egg-info/not-zip-safe +1 -0
  26. pyqrack_cpu_complex128-1.82.3/pyqrack_cpu_complex128.egg-info/requires.txt +3 -0
  27. pyqrack_cpu_complex128-1.82.3/pyqrack_cpu_complex128.egg-info/top_level.txt +1 -0
  28. pyqrack_cpu_complex128-1.82.3/setup.cfg +4 -0
  29. pyqrack_cpu_complex128-1.82.3/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,67 @@
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
+ ifeq ("$(wildcard /usr/local/bin/cmake)", "/usr/local/bin/cmake")
10
+ CMAKE_L := /usr/local/bin/cmake
11
+ else
12
+ ifeq ("$(wildcard /usr/bin/cmake)", "/usr/bin/cmake")
13
+ CMAKE_L := /usr/bin/cmake
14
+ else
15
+ CMAKE_L := cmake
16
+ endif
17
+ endif
18
+
19
+ .PHONY: help
20
+ help:
21
+ @echo "Please use \`make <target>' where <target> is one of"
22
+ @echo " build-deps to build PennyLane-Qrack C++ dependencies"
23
+ @echo " install to install PennyLane-Qrack"
24
+ @echo " wheel to build the PennyLane-Qrack wheel"
25
+ @echo " dist to package the source distribution"
26
+
27
+ .PHONY: build-deps
28
+ build-deps:
29
+ rm -rf pyqrack/qrack_system/qrack_lib
30
+ rm -rf pyqrack/qrack_system/qrack_cl_precompile
31
+ ifneq ($(OS),Windows_NT)
32
+ ifeq ($(QRACK_PRESENT),)
33
+ git clone https://github.com/unitaryfund/qrack.git; cd qrack; git checkout d47b3ac7c87fbe79bddf679dd626f5c40cd66811; cd ..
34
+ endif
35
+ mkdir -p qrack/build
36
+ ifeq ($(UNAME_S),Linux)
37
+ ifneq ($(filter $(UNAME_P),x86_64 i386),)
38
+ cd qrack/build; $(CMAKE_L) -DENABLE_OPENCL=OFF -DFPPOW=6 -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON -DQBCAPPOW=8 ..; make qrack_pinvoke qrack_cl_precompile
39
+ else
40
+ cd qrack/build; $(CMAKE_L) -DENABLE_OPENCL=OFF -DFPPOW=6 -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF -DQBCAPPOW=8 ..; make qrack_pinvoke qrack_cl_precompile
41
+ endif
42
+ endif
43
+ ifeq ($(UNAME_S),Darwin)
44
+ ifneq ($(filter $(UNAME_P),x86_64 i386),)
45
+ cd qrack/build; cmake -DFPPOW=6 -DENABLE_OPENCL=OFF -DQBCAPPOW=8 -DBoost_INCLUDE_DIR=/opt/homebrew/include -DBoost_LIBRARY_DIRS=/opt/homebrew/lib ..; make qrack_pinvoke qrack_cl_precompile
46
+ else
47
+ cd qrack/build; cmake -DFPPOW=6 -DENABLE_OPENCL=OFF -DENABLE_RDRAND=OFF -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF -DQBCAPPOW=8 -DBoost_INCLUDE_DIR=/opt/homebrew/include -DBoost_LIBRARY_DIRS=/opt/homebrew/lib ..; make qrack_pinvoke qrack_cl_precompile
48
+ endif
49
+ endif
50
+ endif
51
+ mkdir pyqrack/qrack_system/qrack_lib; cp qrack/build/libqrack_pinvoke.* pyqrack/qrack_system/qrack_lib/; cd ../../..
52
+ mkdir pyqrack/qrack_system/qrack_cl_precompile; cp qrack/build/qrack_cl_precompile pyqrack/qrack_system/qrack_cl_precompile/; cd ../../..
53
+
54
+ .PHONY: install
55
+ install:
56
+ ifndef PYTHON3
57
+ @echo "To install PyQrack you need to have Python 3 installed"
58
+ endif
59
+ $(PYTHON) setup.py install
60
+
61
+ .PHONY: wheel
62
+ wheel:
63
+ $(PYTHON) setup.py bdist_wheel
64
+
65
+ .PHONY: dist
66
+ dist:
67
+ $(PYTHON) setup.py sdist
@@ -0,0 +1,91 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyqrack-cpu-complex128
3
+ Version: 1.82.3
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.5
19
+ Classifier: Programming Language :: Python :: 2.6
20
+ Classifier: Programming Language :: Python :: 2.7
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.0
23
+ Classifier: Programming Language :: Python :: 3.1
24
+ Classifier: Programming Language :: Python :: 3.2
25
+ Classifier: Programming Language :: Python :: 3.3
26
+ Classifier: Programming Language :: Python :: 3.4
27
+ Classifier: Programming Language :: Python :: 3.5
28
+ Classifier: Programming Language :: Python :: 3.6
29
+ Classifier: Programming Language :: Python :: 3.7
30
+ Classifier: Programming Language :: Python :: 3.8
31
+ Classifier: Programming Language :: Python :: 3.9
32
+ Classifier: Programming Language :: Python :: 3.10
33
+ Classifier: Programming Language :: Python :: 3.11
34
+ Classifier: Programming Language :: Python :: 3.12
35
+ Classifier: Programming Language :: Python :: 3.13
36
+ Classifier: Programming Language :: Python :: 3.14
37
+ Classifier: Topic :: Scientific/Engineering :: Quantum Computing
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-cpu-complex128)](https://pepy.tech/project/pyqrack-cpu-complex128) [![Downloads](https://pepy.tech/badge/pyqrack-cpu-complex128/month)](https://pepy.tech/project/pyqrack-cpu-complex128) [![Downloads](https://static.pepy.tech/badge/pyqrack-cpu-complex128/week)](https://pepy.tech/project/pyqrack-cpu-complex128)
56
+
57
+ Pure Python bindings for the pure C++11 Qrack quantum computer simulator library
58
+
59
+ (**PyQrack** is just pure Qrack.)
60
+
61
+ This is the **purely CPU-based** variant of PyQrack (with module name `pyqrack-cpu`). This alternate build of PyQrack is provided so that systems that won't use OpenCL or CUDA anyway (such as because they lack any GPUs or other accelerators like the Intel HD) do not need to install the OpenCL library in order to use PyQrack. In this form, both the PyQrack module and the underlying C++ Qrack library are entirely external **dependency-free.**
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
+ 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`.
68
+
69
+ 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).
70
+
71
+ 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.
72
+
73
+ `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**.
74
+
75
+ To load the required **unitaryfund/qrack** libraries from a different location, set the `PYQRACK_SHARED_LIB_PATH` environment variable.
76
+
77
+ 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:
78
+
79
+ ```python
80
+ sim = QrackSimulator(pyzxCircuit=c)
81
+ ```
82
+
83
+ 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.
84
+
85
+ See [https://pyqrack.readthedocs.io/en/latest/](https://pyqrack.readthedocs.io/en/latest/) for an API reference.
86
+
87
+ 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.
88
+
89
+ Please feel welcome to open an issue, if you'd like help. 😃
90
+
91
+ **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,38 @@
1
+ # pyqrack
2
+ [![Downloads](https://pepy.tech/badge/pyqrack-cpu-complex128)](https://pepy.tech/project/pyqrack-cpu-complex128) [![Downloads](https://pepy.tech/badge/pyqrack-cpu-complex128/month)](https://pepy.tech/project/pyqrack-cpu-complex128) [![Downloads](https://static.pepy.tech/badge/pyqrack-cpu-complex128/week)](https://pepy.tech/project/pyqrack-cpu-complex128)
3
+
4
+ Pure Python bindings for the pure C++11 Qrack quantum computer simulator library
5
+
6
+ (**PyQrack** is just pure Qrack.)
7
+
8
+ This is the **purely CPU-based** variant of PyQrack (with module name `pyqrack-cpu`). This alternate build of PyQrack is provided so that systems that won't use OpenCL or CUDA anyway (such as because they lack any GPUs or other accelerators like the Intel HD) do not need to install the OpenCL library in order to use PyQrack. In this form, both the PyQrack module and the underlying C++ Qrack library are entirely external **dependency-free.**
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
+ 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`.
15
+
16
+ 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).
17
+
18
+ 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.
19
+
20
+ `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**.
21
+
22
+ To load the required **unitaryfund/qrack** libraries from a different location, set the `PYQRACK_SHARED_LIB_PATH` environment variable.
23
+
24
+ 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:
25
+
26
+ ```python
27
+ sim = QrackSimulator(pyzxCircuit=c)
28
+ ```
29
+
30
+ 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.
31
+
32
+ See [https://pyqrack.readthedocs.io/en/latest/](https://pyqrack.readthedocs.io/en/latest/) for an API reference.
33
+
34
+ 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.
35
+
36
+ Please feel welcome to open an issue, if you'd like help. 😃
37
+
38
+ **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
+ QrackNeuronTorch,
14
+ QrackNeuronTorchFunction,
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