pyqrack-cuda 1.34.6__tar.gz → 1.34.7__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.
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/LICENSE +21 -21
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/MANIFEST.in +3 -3
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/Makefile +54 -54
- {pyqrack_cuda-1.34.6/pyqrack_cuda.egg-info → pyqrack_cuda-1.34.7}/PKG-INFO +76 -76
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/README.md +34 -34
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyproject.toml +6 -6
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyqrack/__init__.py +13 -13
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyqrack/neuron_activation_fn.py +21 -21
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyqrack/pauli.py +19 -19
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyqrack/qrack_circuit.py +556 -556
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyqrack/qrack_neuron.py +244 -244
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyqrack/qrack_simulator.py +4019 -4019
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyqrack/qrack_system/__init__.py +9 -9
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyqrack/qrack_system/qrack_system.py +1283 -1283
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyqrack/quimb_circuit_type.py +17 -17
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyqrack/util/__init__.py +8 -8
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyqrack/util/convert_qiskit_circuit_to_qasm_experiment.py +61 -61
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7/pyqrack_cuda.egg-info}/PKG-INFO +76 -76
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyqrack_cuda.egg-info/not-zip-safe +1 -1
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/setup.cfg +4 -4
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/setup.py +79 -79
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyqrack_cuda.egg-info/SOURCES.txt +0 -0
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyqrack_cuda.egg-info/dependency_links.txt +0 -0
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyqrack_cuda.egg-info/requires.txt +0 -0
- {pyqrack_cuda-1.34.6 → pyqrack_cuda-1.34.7}/pyqrack_cuda.egg-info/top_level.txt +0 -0
@@ -1,21 +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.
|
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.
|
@@ -1,3 +1,3 @@
|
|
1
|
-
include pyqrack/qrack_system/qrack_lib/*
|
2
|
-
include pyqrack/qrack_system/qrack_cl_precompile/*
|
3
|
-
include Makefile
|
1
|
+
include pyqrack/qrack_system/qrack_lib/*
|
2
|
+
include pyqrack/qrack_system/qrack_cl_precompile/*
|
3
|
+
include Makefile
|
@@ -1,54 +1,54 @@
|
|
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
|
-
ifneq ($(OS),Windows_NT)
|
20
|
-
ifeq ($(QRACK_PRESENT),)
|
21
|
-
git clone https://github.com/unitaryfund/qrack.git; cd qrack; git checkout
|
22
|
-
endif
|
23
|
-
mkdir -p qrack/build
|
24
|
-
ifeq ($(UNAME_S),Linux)
|
25
|
-
ifeq ($(UNAME_P),x86_64)
|
26
|
-
cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON -DENABLE_OPENCL=OFF -DENABLE_CUDA=ON ..; make all
|
27
|
-
else
|
28
|
-
cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF -DENABLE_OPENCL=OFF -DENABLE_CUDA=ON ..; make all
|
29
|
-
endif
|
30
|
-
endif
|
31
|
-
ifeq ($(UNAME_S),Darwin)
|
32
|
-
ifeq ($(UNAME_P),x86_64)
|
33
|
-
cd qrack/build; cmake -DENABLE_OPENCL=OFF -DENABLE_CUDA=ON ..; make all
|
34
|
-
else
|
35
|
-
cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF -DENABLE_OPENCL=OFF -DENABLE_CUDA=ON ..; make all
|
36
|
-
endif
|
37
|
-
endif
|
38
|
-
endif
|
39
|
-
mkdir pyqrack/qrack_system/qrack_lib; cp qrack/build/libqrack_pinvoke.* pyqrack/qrack_system/qrack_lib/; cd ../../..
|
40
|
-
|
41
|
-
.PHONY: install
|
42
|
-
install:
|
43
|
-
ifndef PYTHON3
|
44
|
-
@echo "To install PyQrack you need to have Python 3 installed"
|
45
|
-
endif
|
46
|
-
$(PYTHON) setup.py install
|
47
|
-
|
48
|
-
.PHONY: wheel
|
49
|
-
wheel:
|
50
|
-
$(PYTHON) setup.py bdist_wheel
|
51
|
-
|
52
|
-
.PHONY: dist
|
53
|
-
dist:
|
54
|
-
$(PYTHON) setup.py sdist
|
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
|
+
ifneq ($(OS),Windows_NT)
|
20
|
+
ifeq ($(QRACK_PRESENT),)
|
21
|
+
git clone https://github.com/unitaryfund/qrack.git; cd qrack; git checkout 9ef8ff14dc70bea2e13b44ef65ff33f6ac36169e; cd ..
|
22
|
+
endif
|
23
|
+
mkdir -p qrack/build
|
24
|
+
ifeq ($(UNAME_S),Linux)
|
25
|
+
ifeq ($(UNAME_P),x86_64)
|
26
|
+
cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON -DENABLE_OPENCL=OFF -DENABLE_CUDA=ON ..; make all
|
27
|
+
else
|
28
|
+
cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF -DENABLE_OPENCL=OFF -DENABLE_CUDA=ON ..; make all
|
29
|
+
endif
|
30
|
+
endif
|
31
|
+
ifeq ($(UNAME_S),Darwin)
|
32
|
+
ifeq ($(UNAME_P),x86_64)
|
33
|
+
cd qrack/build; cmake -DENABLE_OPENCL=OFF -DENABLE_CUDA=ON ..; make all
|
34
|
+
else
|
35
|
+
cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF -DENABLE_OPENCL=OFF -DENABLE_CUDA=ON ..; make all
|
36
|
+
endif
|
37
|
+
endif
|
38
|
+
endif
|
39
|
+
mkdir pyqrack/qrack_system/qrack_lib; cp qrack/build/libqrack_pinvoke.* pyqrack/qrack_system/qrack_lib/; cd ../../..
|
40
|
+
|
41
|
+
.PHONY: install
|
42
|
+
install:
|
43
|
+
ifndef PYTHON3
|
44
|
+
@echo "To install PyQrack you need to have Python 3 installed"
|
45
|
+
endif
|
46
|
+
$(PYTHON) setup.py install
|
47
|
+
|
48
|
+
.PHONY: wheel
|
49
|
+
wheel:
|
50
|
+
$(PYTHON) setup.py bdist_wheel
|
51
|
+
|
52
|
+
.PHONY: dist
|
53
|
+
dist:
|
54
|
+
$(PYTHON) setup.py sdist
|
@@ -1,76 +1,76 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: pyqrack-cuda
|
3
|
-
Version: 1.34.
|
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
|
-
|
43
|
-
# pyqrack
|
44
|
-
[](https://pepy.tech/project/pyqrack) [](https://pepy.tech/project/pyqrack) [](https://pepy.tech/project/pyqrack)
|
45
|
-
|
46
|
-
Pure Python bindings for the pure C++11/OpenCL Qrack quantum computer simulator library
|
47
|
-
|
48
|
-
(**PyQrack** is just pure Qrack.)
|
49
|
-
|
50
|
-
**Note, if building from source**: You must build and install [unitaryfund/qrack](https://github.com/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. **For PyQrack-CUDA, the package is distributed as source-only on PyPi, so that the Qrack build step can do its best to try to automatically detect your available CUDA architectures.**
|
51
|
-
|
52
|
-
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`.
|
53
|
-
|
54
|
-
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).
|
55
|
-
|
56
|
-
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.
|
57
|
-
|
58
|
-
`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**.
|
59
|
-
|
60
|
-
To load the required **unitaryfund/qrack** libraries from a different location, set the `PYQRACK_SHARED_LIB_PATH` environment variable.
|
61
|
-
|
62
|
-
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:
|
63
|
-
|
64
|
-
```python
|
65
|
-
sim = QrackSimulator(pyzxCircuit=c)
|
66
|
-
```
|
67
|
-
|
68
|
-
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.
|
69
|
-
|
70
|
-
See [https://pyqrack.readthedocs.io/en/latest/](https://pyqrack.readthedocs.io/en/latest/) for an API reference.
|
71
|
-
|
72
|
-
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.
|
73
|
-
|
74
|
-
Please feel welcome to open an issue, if you'd like help.
|
75
|
-
|
76
|
-
**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!**
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: pyqrack-cuda
|
3
|
+
Version: 1.34.7
|
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
|
+
|
43
|
+
# pyqrack
|
44
|
+
[](https://pepy.tech/project/pyqrack) [](https://pepy.tech/project/pyqrack) [](https://pepy.tech/project/pyqrack)
|
45
|
+
|
46
|
+
Pure Python bindings for the pure C++11/OpenCL Qrack quantum computer simulator library
|
47
|
+
|
48
|
+
(**PyQrack** is just pure Qrack.)
|
49
|
+
|
50
|
+
**Note, if building from source**: You must build and install [unitaryfund/qrack](https://github.com/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. **For PyQrack-CUDA, the package is distributed as source-only on PyPi, so that the Qrack build step can do its best to try to automatically detect your available CUDA architectures.**
|
51
|
+
|
52
|
+
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`.
|
53
|
+
|
54
|
+
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).
|
55
|
+
|
56
|
+
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.
|
57
|
+
|
58
|
+
`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**.
|
59
|
+
|
60
|
+
To load the required **unitaryfund/qrack** libraries from a different location, set the `PYQRACK_SHARED_LIB_PATH` environment variable.
|
61
|
+
|
62
|
+
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:
|
63
|
+
|
64
|
+
```python
|
65
|
+
sim = QrackSimulator(pyzxCircuit=c)
|
66
|
+
```
|
67
|
+
|
68
|
+
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.
|
69
|
+
|
70
|
+
See [https://pyqrack.readthedocs.io/en/latest/](https://pyqrack.readthedocs.io/en/latest/) for an API reference.
|
71
|
+
|
72
|
+
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.
|
73
|
+
|
74
|
+
Please feel welcome to open an issue, if you'd like help. 😃
|
75
|
+
|
76
|
+
**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!**
|
@@ -1,34 +1,34 @@
|
|
1
|
-
# pyqrack
|
2
|
-
[](https://pepy.tech/project/pyqrack) [](https://pepy.tech/project/pyqrack) [](https://pepy.tech/project/pyqrack)
|
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, if building from source**: You must build and install [unitaryfund/qrack](https://github.com/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. **For PyQrack-CUDA, the package is distributed as source-only on PyPi, so that the Qrack build step can do its best to try to automatically detect your available CUDA architectures.**
|
9
|
-
|
10
|
-
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`.
|
11
|
-
|
12
|
-
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).
|
13
|
-
|
14
|
-
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.
|
15
|
-
|
16
|
-
`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**.
|
17
|
-
|
18
|
-
To load the required **unitaryfund/qrack** libraries from a different location, set the `PYQRACK_SHARED_LIB_PATH` environment variable.
|
19
|
-
|
20
|
-
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:
|
21
|
-
|
22
|
-
```python
|
23
|
-
sim = QrackSimulator(pyzxCircuit=c)
|
24
|
-
```
|
25
|
-
|
26
|
-
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.
|
27
|
-
|
28
|
-
See [https://pyqrack.readthedocs.io/en/latest/](https://pyqrack.readthedocs.io/en/latest/) for an API reference.
|
29
|
-
|
30
|
-
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.
|
31
|
-
|
32
|
-
Please feel welcome to open an issue, if you'd like help. 😃
|
33
|
-
|
34
|
-
**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!**
|
1
|
+
# pyqrack
|
2
|
+
[](https://pepy.tech/project/pyqrack) [](https://pepy.tech/project/pyqrack) [](https://pepy.tech/project/pyqrack)
|
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, if building from source**: You must build and install [unitaryfund/qrack](https://github.com/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. **For PyQrack-CUDA, the package is distributed as source-only on PyPi, so that the Qrack build step can do its best to try to automatically detect your available CUDA architectures.**
|
9
|
+
|
10
|
+
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`.
|
11
|
+
|
12
|
+
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).
|
13
|
+
|
14
|
+
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.
|
15
|
+
|
16
|
+
`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**.
|
17
|
+
|
18
|
+
To load the required **unitaryfund/qrack** libraries from a different location, set the `PYQRACK_SHARED_LIB_PATH` environment variable.
|
19
|
+
|
20
|
+
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:
|
21
|
+
|
22
|
+
```python
|
23
|
+
sim = QrackSimulator(pyzxCircuit=c)
|
24
|
+
```
|
25
|
+
|
26
|
+
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.
|
27
|
+
|
28
|
+
See [https://pyqrack.readthedocs.io/en/latest/](https://pyqrack.readthedocs.io/en/latest/) for an API reference.
|
29
|
+
|
30
|
+
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.
|
31
|
+
|
32
|
+
Please feel welcome to open an issue, if you'd like help. 😃
|
33
|
+
|
34
|
+
**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!**
|
@@ -1,6 +1,6 @@
|
|
1
|
-
[build-system]
|
2
|
-
requires = [
|
3
|
-
"setuptools>=42",
|
4
|
-
"wheel"
|
5
|
-
]
|
6
|
-
build-backend = "setuptools.build_meta"
|
1
|
+
[build-system]
|
2
|
+
requires = [
|
3
|
+
"setuptools>=42",
|
4
|
+
"wheel"
|
5
|
+
]
|
6
|
+
build-backend = "setuptools.build_meta"
|
@@ -1,13 +1,13 @@
|
|
1
|
-
# (C) Daniel Strano and the Qrack contributors 2017-2021. 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 .qrack_system import QrackSystem, Qrack
|
7
|
-
from .qrack_simulator import QrackSimulator
|
8
|
-
from .qrack_neuron import QrackNeuron
|
9
|
-
from .qrack_circuit import QrackCircuit
|
10
|
-
from .pauli import Pauli
|
11
|
-
from .neuron_activation_fn import NeuronActivationFn
|
12
|
-
from .quimb_circuit_type import QuimbCircuitType
|
13
|
-
from .util import convert_qiskit_circuit_to_qasm_experiment
|
1
|
+
# (C) Daniel Strano and the Qrack contributors 2017-2021. 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 .qrack_system import QrackSystem, Qrack
|
7
|
+
from .qrack_simulator import QrackSimulator
|
8
|
+
from .qrack_neuron import QrackNeuron
|
9
|
+
from .qrack_circuit import QrackCircuit
|
10
|
+
from .pauli import Pauli
|
11
|
+
from .neuron_activation_fn import NeuronActivationFn
|
12
|
+
from .quimb_circuit_type import QuimbCircuitType
|
13
|
+
from .util import convert_qiskit_circuit_to_qasm_experiment
|
@@ -1,21 +1,21 @@
|
|
1
|
-
# (C) Daniel Strano and the Qrack contributors 2017-2021. 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
|
1
|
+
# (C) Daniel Strano and the Qrack contributors 2017-2021. 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
|
@@ -1,19 +1,19 @@
|
|
1
|
-
# (C) Daniel Strano and the Qrack contributors 2017-2021. 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
|
1
|
+
# (C) Daniel Strano and the Qrack contributors 2017-2021. 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
|