pyqrack-cuda 1.75.1__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.
Potentially problematic release.
This version of pyqrack-cuda might be problematic. Click here for more details.
- pyqrack_cuda-1.75.1/LICENSE +21 -0
- pyqrack_cuda-1.75.1/MANIFEST.in +3 -0
- pyqrack_cuda-1.75.1/Makefile +67 -0
- pyqrack_cuda-1.75.1/PKG-INFO +93 -0
- pyqrack_cuda-1.75.1/README.md +40 -0
- pyqrack_cuda-1.75.1/pyproject.toml +6 -0
- pyqrack_cuda-1.75.1/pyqrack/__init__.py +20 -0
- pyqrack_cuda-1.75.1/pyqrack/neuron_activation_fn.py +21 -0
- pyqrack_cuda-1.75.1/pyqrack/pauli.py +19 -0
- pyqrack_cuda-1.75.1/pyqrack/qrack_ace_backend.py +1544 -0
- pyqrack_cuda-1.75.1/pyqrack/qrack_circuit.py +584 -0
- pyqrack_cuda-1.75.1/pyqrack/qrack_neuron.py +262 -0
- pyqrack_cuda-1.75.1/pyqrack/qrack_neuron_torch_layer.py +170 -0
- pyqrack_cuda-1.75.1/pyqrack/qrack_simulator.py +4533 -0
- pyqrack_cuda-1.75.1/pyqrack/qrack_stabilizer.py +58 -0
- pyqrack_cuda-1.75.1/pyqrack/qrack_system/__init__.py +9 -0
- pyqrack_cuda-1.75.1/pyqrack/qrack_system/qrack_system.py +1357 -0
- pyqrack_cuda-1.75.1/pyqrack/quimb_circuit_type.py +17 -0
- pyqrack_cuda-1.75.1/pyqrack/stats/__init__.py +6 -0
- pyqrack_cuda-1.75.1/pyqrack/stats/load_quantized_data.py +35 -0
- pyqrack_cuda-1.75.1/pyqrack/stats/quantize_by_range.py +56 -0
- pyqrack_cuda-1.75.1/pyqrack_cuda.egg-info/PKG-INFO +93 -0
- pyqrack_cuda-1.75.1/pyqrack_cuda.egg-info/SOURCES.txt +27 -0
- pyqrack_cuda-1.75.1/pyqrack_cuda.egg-info/dependency_links.txt +1 -0
- pyqrack_cuda-1.75.1/pyqrack_cuda.egg-info/not-zip-safe +1 -0
- pyqrack_cuda-1.75.1/pyqrack_cuda.egg-info/requires.txt +3 -0
- pyqrack_cuda-1.75.1/pyqrack_cuda.egg-info/top_level.txt +1 -0
- pyqrack_cuda-1.75.1/setup.cfg +4 -0
- pyqrack_cuda-1.75.1/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,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 db595914b394e8ef2327df3a09c50dc8b264181e; 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 -DENABLE_CUDA=ON -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 -DENABLE_CUDA=ON -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 -DENABLE_OPENCL=OFF -DENABLE_CUDA=ON -DQBCAPPOW=8 ..; make qrack_pinvoke qrack_cl_precompile
|
|
46
|
+
else
|
|
47
|
+
cd qrack/build; cmake -DENABLE_OPENCL=OFF -DENABLE_CUDA=ON -DENABLE_RDRAND=OFF -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF -DQBCAPPOW=8 ..; 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,93 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyqrack-cuda
|
|
3
|
+
Version: 1.75.1
|
|
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 :: 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
|
+
[](https://pepy.tech/project/pyqrack) [](https://pepy.tech/project/pyqrack) [](https://pepy.tech/project/pyqrack)
|
|
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
|
+
**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.**
|
|
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 only an integrated graphics accelerator, like the Intel HD, you probably can't use this CUDA version of PyQrack.** Use the **OpenCL** version of PyQrack instead (by uninstalling all other versions of PyQrack, then installing from `main` branch or with `pip install pyqrack`).
|
|
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
|
+
[](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
|
+
**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
|
+
**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 only an integrated graphics accelerator, like the Intel HD, you probably can't use this CUDA version of PyQrack.** Use the **OpenCL** version of PyQrack instead (by uninstalling all other versions of PyQrack, then installing from `main` branch or with `pip install pyqrack`).
|
|
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,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
|