qadence 1.6.1__tar.gz → 1.7.0__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.
- {qadence-1.6.1 → qadence-1.7.0}/PKG-INFO +15 -4
- {qadence-1.6.1 → qadence-1.7.0}/README.md +11 -0
- {qadence-1.6.1 → qadence-1.7.0}/mkdocs.yml +1 -0
- {qadence-1.6.1 → qadence-1.7.0}/pyproject.toml +63 -65
- {qadence-1.6.1 → qadence-1.7.0}/qadence/__init__.py +2 -2
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/gpsr.py +15 -3
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/pyqtorch/backend.py +28 -43
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/pyqtorch/convert_ops.py +44 -227
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/utils.py +45 -4
- {qadence-1.6.1 → qadence-1.7.0}/qadence/blocks/matrix.py +2 -2
- {qadence-1.6.1 → qadence-1.7.0}/qadence/blocks/primitive.py +1 -1
- {qadence-1.6.1 → qadence-1.7.0}/qadence/constructors/__init__.py +2 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/constructors/hamiltonians.py +38 -1
- {qadence-1.6.1 → qadence-1.7.0}/qadence/draw/utils.py +1 -1
- {qadence-1.6.1 → qadence-1.7.0}/qadence/engines/torch/differentiable_expectation.py +1 -1
- {qadence-1.6.1 → qadence-1.7.0}/qadence/ml_tools/__init__.py +11 -3
- qadence-1.7.0/qadence/ml_tools/config.py +347 -0
- qadence-1.7.0/qadence/ml_tools/constructors.py +774 -0
- qadence-1.6.1/qadence/models/qnn.py → qadence-1.7.0/qadence/ml_tools/models.py +183 -40
- {qadence-1.6.1 → qadence-1.7.0}/qadence/ml_tools/saveload.py +7 -10
- {qadence-1.6.1 → qadence-1.7.0}/qadence/ml_tools/train_grad.py +3 -7
- {qadence-1.6.1 → qadence-1.7.0}/qadence/ml_tools/utils.py +2 -8
- qadence-1.6.1/qadence/models/quantum_model.py → qadence-1.7.0/qadence/model.py +14 -8
- {qadence-1.6.1 → qadence-1.7.0}/qadence/overlap.py +1 -1
- {qadence-1.6.1 → qadence-1.7.0}/qadence/parameters.py +1 -1
- {qadence-1.6.1 → qadence-1.7.0}/qadence/serialization.py +6 -6
- {qadence-1.6.1 → qadence-1.7.0}/qadence/states.py +7 -8
- {qadence-1.6.1 → qadence-1.7.0}/qadence/types.py +42 -0
- qadence-1.6.1/qadence/backends/adjoint.py +0 -163
- qadence-1.6.1/qadence/finitediff.py +0 -47
- qadence-1.6.1/qadence/ml_tools/config.py +0 -72
- qadence-1.6.1/qadence/ml_tools/models.py +0 -320
- qadence-1.6.1/qadence/models/__init__.py +0 -7
- {qadence-1.6.1 → qadence-1.7.0}/.coveragerc +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/.github/dependabot.yml +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/.github/workflows/build_docs.yml +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/.github/workflows/dependabot.yml +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/.github/workflows/lint.yml +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/.github/workflows/test_all.yml +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/.github/workflows/test_examples.yml +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/.github/workflows/test_fast.yml +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/.gitignore +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/.pre-commit-config.yaml +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/LICENSE +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/MANIFEST.in +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/analog/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/analog/addressing.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/analog/constants.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/analog/device.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/analog/hamiltonian_terms.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/analog/parse_analog.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backend.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/api.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/braket/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/braket/backend.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/braket/config.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/braket/convert_ops.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/horqrux/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/horqrux/backend.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/horqrux/config.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/horqrux/convert_ops.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/jax_utils.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/pulser/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/pulser/backend.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/pulser/channels.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/pulser/cloud.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/pulser/config.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/pulser/convert_ops.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/pulser/devices.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/pulser/pulses.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/pulser/waveforms.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/pyqtorch/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/backends/pyqtorch/config.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/blocks/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/blocks/abstract.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/blocks/analog.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/blocks/block_to_tensor.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/blocks/composite.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/blocks/embedding.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/blocks/manipulate.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/blocks/utils.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/circuit.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/constructors/ansatze.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/constructors/daqc/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/constructors/daqc/daqc.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/constructors/daqc/gen_parser.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/constructors/daqc/utils.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/constructors/feature_maps.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/constructors/iia.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/constructors/qft.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/constructors/rydberg_feature_maps.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/constructors/rydberg_hea.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/constructors/utils.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/decompose.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/divergences.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/draw/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/draw/assets/dark/measurement.png +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/draw/assets/dark/measurement.svg +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/draw/assets/light/measurement.png +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/draw/assets/light/measurement.svg +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/draw/themes.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/draw/vizbackend.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/engines/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/engines/differentiable_backend.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/engines/jax/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/engines/jax/differentiable_backend.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/engines/jax/differentiable_expectation.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/engines/torch/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/engines/torch/differentiable_backend.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/exceptions/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/exceptions/exceptions.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/execution.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/extensions.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/libs.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/log_config.yaml +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/logger.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/measurements/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/measurements/protocols.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/measurements/samples.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/measurements/shadow.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/measurements/tomography.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/measurements/utils.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/mitigations/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/mitigations/analog_zne.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/mitigations/protocols.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/mitigations/readout.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/ml_tools/data.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/ml_tools/optimize_step.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/ml_tools/parameters.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/ml_tools/printing.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/ml_tools/tensors.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/ml_tools/train_no_grad.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/noise/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/noise/protocols.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/noise/readout.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/operations/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/operations/analog.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/operations/control_ops.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/operations/ham_evo.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/operations/parametric.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/operations/primitive.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/protocols.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/py.typed +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/qubit_support.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/register.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/serial_expr_grammar.peg +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/transpile/__init__.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/transpile/apply_fn.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/transpile/block.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/transpile/circuit.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/transpile/digitalize.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/transpile/flatten.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/transpile/invert.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/transpile/transpile.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/qadence/utils.py +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/renovate.json +0 -0
- {qadence-1.6.1 → qadence-1.7.0}/setup.py +0 -0
@@ -1,8 +1,8 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: qadence
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.7.0
|
4
4
|
Summary: Pasqal interface for circuit-based quantum computing SDKs
|
5
|
-
Author-email: Aleksander Wennersteen <aleksander.wennersteen@pasqal.com>, Gert-Jan Both <gert-jan.both@pasqal.com>, Niklas Heim <niklas.heim@pasqal.com>, Mario Dagrada <mario.dagrada@pasqal.com>, Vincent Elfving <vincent.elfving@pasqal.com>, Dominik Seitz <dominik.seitz@pasqal.com>, Roland Guichard <roland.guichard@pasqal.com>, "Joao P. Moutinho" <joao.moutinho@pasqal.com>, Vytautas Abramavicius <vytautas.abramavicius@pasqal.com>, Gergana Velikova <gergana.velikova@pasqal.com>, Eduardo Maschio <eduardo.maschio@pasqal.com>
|
5
|
+
Author-email: Aleksander Wennersteen <aleksander.wennersteen@pasqal.com>, Gert-Jan Both <gert-jan.both@pasqal.com>, Niklas Heim <niklas.heim@pasqal.com>, Mario Dagrada <mario.dagrada@pasqal.com>, Vincent Elfving <vincent.elfving@pasqal.com>, Dominik Seitz <dominik.seitz@pasqal.com>, Roland Guichard <roland.guichard@pasqal.com>, "Joao P. Moutinho" <joao.moutinho@pasqal.com>, Vytautas Abramavicius <vytautas.abramavicius@pasqal.com>, Gergana Velikova <gergana.velikova@pasqal.com>, Eduardo Maschio <eduardo.maschio@pasqal.com>, Smit Chaudhary <smit.chaudhary@pasqal.com>
|
6
6
|
License: Apache 2.0
|
7
7
|
License-File: LICENSE
|
8
8
|
Classifier: License :: OSI Approved :: Apache Software License
|
@@ -22,7 +22,7 @@ Requires-Dist: matplotlib
|
|
22
22
|
Requires-Dist: nevergrad
|
23
23
|
Requires-Dist: numpy
|
24
24
|
Requires-Dist: openfermion
|
25
|
-
Requires-Dist: pyqtorch==1.1
|
25
|
+
Requires-Dist: pyqtorch==1.2.1
|
26
26
|
Requires-Dist: pyyaml
|
27
27
|
Requires-Dist: rich
|
28
28
|
Requires-Dist: scipy
|
@@ -53,7 +53,7 @@ Requires-Dist: qadence-libs; extra == 'libs'
|
|
53
53
|
Provides-Extra: protocols
|
54
54
|
Requires-Dist: qadence-protocols; extra == 'protocols'
|
55
55
|
Provides-Extra: pulser
|
56
|
-
Requires-Dist: pasqal-cloud==0.
|
56
|
+
Requires-Dist: pasqal-cloud==0.10.1; extra == 'pulser'
|
57
57
|
Requires-Dist: pulser-core==0.18.1; extra == 'pulser'
|
58
58
|
Requires-Dist: pulser-simulation==0.18.1; extra == 'pulser'
|
59
59
|
Provides-Extra: visualization
|
@@ -149,6 +149,15 @@ brew install graphviz
|
|
149
149
|
conda install python-graphviz
|
150
150
|
```
|
151
151
|
|
152
|
+
On Windows Linux Subsystem (WSL2) it has been reported that in some cases "wslutilities" must be installed.
|
153
|
+
Please follow instructions [here](https://wslutiliti.es/wslu/install.html) for your flavour.
|
154
|
+
For example on Ubuntu 22.04 LTS and later you must run:
|
155
|
+
```
|
156
|
+
sudo add-apt-repository ppa:wslutilities/wslu
|
157
|
+
sudo apt update
|
158
|
+
sudo apt install wslu
|
159
|
+
```
|
160
|
+
|
152
161
|
## Contributing
|
153
162
|
|
154
163
|
Before making a contribution, please review our [code of conduct](docs/getting_started/CODE_OF_CONDUCT.md).
|
@@ -179,6 +188,8 @@ install it from source using `pip`:
|
|
179
188
|
python -m pip install -e .
|
180
189
|
```
|
181
190
|
|
191
|
+
Users also report problems running Hatch on Windows, we suggest using WSL2.
|
192
|
+
|
182
193
|
## Citation
|
183
194
|
|
184
195
|
If you use Qadence for a publication, we kindly ask you to cite our work using the following BibTex entry:
|
@@ -87,6 +87,15 @@ brew install graphviz
|
|
87
87
|
conda install python-graphviz
|
88
88
|
```
|
89
89
|
|
90
|
+
On Windows Linux Subsystem (WSL2) it has been reported that in some cases "wslutilities" must be installed.
|
91
|
+
Please follow instructions [here](https://wslutiliti.es/wslu/install.html) for your flavour.
|
92
|
+
For example on Ubuntu 22.04 LTS and later you must run:
|
93
|
+
```
|
94
|
+
sudo add-apt-repository ppa:wslutilities/wslu
|
95
|
+
sudo apt update
|
96
|
+
sudo apt install wslu
|
97
|
+
```
|
98
|
+
|
90
99
|
## Contributing
|
91
100
|
|
92
101
|
Before making a contribution, please review our [code of conduct](docs/getting_started/CODE_OF_CONDUCT.md).
|
@@ -117,6 +126,8 @@ install it from source using `pip`:
|
|
117
126
|
python -m pip install -e .
|
118
127
|
```
|
119
128
|
|
129
|
+
Users also report problems running Hatch on Windows, we suggest using WSL2.
|
130
|
+
|
120
131
|
## Citation
|
121
132
|
|
122
133
|
If you use Qadence for a publication, we kindly ask you to cite our work using the following BibTex entry:
|
@@ -41,6 +41,7 @@ nav:
|
|
41
41
|
- Variational quantum algorithms:
|
42
42
|
- tutorials/qml/index.md
|
43
43
|
- Training tools: tutorials/qml/ml_tools.md
|
44
|
+
- Configuring a QNN: tutorials/qml/config_qnn.md
|
44
45
|
- Quantum circuit learning: tutorials/qml/qcl.md
|
45
46
|
- Solving MaxCut with QAOA: tutorials/qml/qaoa.md
|
46
47
|
- Solving a 1D ODE: tutorials/qml/dqc_1d.md
|
@@ -14,15 +14,16 @@ authors = [
|
|
14
14
|
{ name = "Vincent Elfving", email = "vincent.elfving@pasqal.com" },
|
15
15
|
{ name = "Dominik Seitz", email = "dominik.seitz@pasqal.com" },
|
16
16
|
{ name = "Roland Guichard", email = "roland.guichard@pasqal.com" },
|
17
|
-
{ name = "Joao P. Moutinho", email = "joao.moutinho@pasqal.com"},
|
17
|
+
{ name = "Joao P. Moutinho", email = "joao.moutinho@pasqal.com" },
|
18
18
|
{ name = "Vytautas Abramavicius", email = "vytautas.abramavicius@pasqal.com" },
|
19
19
|
{ name = "Gergana Velikova", email = "gergana.velikova@pasqal.com" },
|
20
20
|
{ name = "Eduardo Maschio", email = "eduardo.maschio@pasqal.com" },
|
21
|
+
{ name = "Smit Chaudhary", email = "smit.chaudhary@pasqal.com" },
|
21
22
|
]
|
22
23
|
requires-python = ">=3.9"
|
23
|
-
license = {text = "Apache 2.0"}
|
24
|
-
version = "1.
|
25
|
-
classifiers=[
|
24
|
+
license = { text = "Apache 2.0" }
|
25
|
+
version = "1.7.0"
|
26
|
+
classifiers = [
|
26
27
|
"License :: OSI Approved :: Apache Software License",
|
27
28
|
"Programming Language :: Python",
|
28
29
|
"Programming Language :: Python :: 3",
|
@@ -44,7 +45,7 @@ dependencies = [
|
|
44
45
|
"jsonschema",
|
45
46
|
"nevergrad",
|
46
47
|
"scipy",
|
47
|
-
"pyqtorch==1.1
|
48
|
+
"pyqtorch==1.2.1",
|
48
49
|
"pyyaml",
|
49
50
|
"matplotlib",
|
50
51
|
"Arpeggio==2.0.2",
|
@@ -55,13 +56,17 @@ allow-direct-references = true
|
|
55
56
|
allow-ambiguous-features = true
|
56
57
|
|
57
58
|
[project.optional-dependencies]
|
58
|
-
pulser = [
|
59
|
+
pulser = [
|
60
|
+
"pulser-core==0.18.1",
|
61
|
+
"pulser-simulation==0.18.1",
|
62
|
+
"pasqal-cloud==0.10.1",
|
63
|
+
]
|
59
64
|
braket = ["amazon-braket-sdk<1.71.2"]
|
60
65
|
visualization = [
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
66
|
+
"graphviz",
|
67
|
+
# FIXME: will be needed once we support latex labels
|
68
|
+
# "latex2svg @ git+https://github.com/Moonbase59/latex2svg.git#egg=latex2svg",
|
69
|
+
# "scour",
|
65
70
|
]
|
66
71
|
horqrux = [
|
67
72
|
"horqrux==0.6.0",
|
@@ -70,35 +75,30 @@ horqrux = [
|
|
70
75
|
"optax",
|
71
76
|
"jaxopt",
|
72
77
|
"einops",
|
73
|
-
"sympy2jax"
|
78
|
+
"sympy2jax",
|
79
|
+
]
|
74
80
|
protocols = ["qadence-protocols"]
|
75
81
|
libs = ["qadence-libs"]
|
76
82
|
dlprof = ["nvidia-pyindex", "nvidia-dlprof[pytorch]"]
|
77
|
-
all = [
|
78
|
-
"pulser",
|
79
|
-
"braket",
|
80
|
-
"visualization",
|
81
|
-
"protocols",
|
82
|
-
"libs",
|
83
|
-
]
|
83
|
+
all = ["pulser", "braket", "visualization", "protocols", "libs"]
|
84
84
|
|
85
85
|
[tool.hatch.envs.default]
|
86
86
|
dependencies = [
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
87
|
+
"flaky",
|
88
|
+
"hypothesis",
|
89
|
+
"pytest",
|
90
|
+
"pytest-cov",
|
91
|
+
"pytest-mypy",
|
92
|
+
"pytest-xdist",
|
93
|
+
"types-PyYAML",
|
94
|
+
"ipykernel",
|
95
|
+
"pre-commit",
|
96
|
+
"black",
|
97
|
+
"isort",
|
98
|
+
"ruff",
|
99
|
+
"pydocstringformatter",
|
100
100
|
]
|
101
|
-
features = ["pulser", "braket","visualization", "horqrux"]
|
101
|
+
features = ["pulser", "braket", "visualization", "horqrux"]
|
102
102
|
|
103
103
|
[tool.hatch.envs.default.scripts]
|
104
104
|
test = "pytest -n auto --cov-report lcov --cov-config=pyproject.toml --cov=qadence --cov=tests --ignore=./tests/test_examples.py {args}"
|
@@ -108,34 +108,32 @@ test-docs = "mkdocs build --clean --strict"
|
|
108
108
|
test-all = "pytest -n auto {args} && mkdocs build --clean --strict"
|
109
109
|
|
110
110
|
[tool.pytest.ini_options]
|
111
|
-
markers = [
|
112
|
-
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
|
113
|
-
]
|
111
|
+
markers = ["slow: marks tests as slow (deselect with '-m \"not slow\"')"]
|
114
112
|
testpaths = ["tests"]
|
115
113
|
addopts = """-vvv"""
|
116
114
|
xfail_strict = true
|
117
115
|
filterwarnings = [
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
116
|
+
"ignore:Call to deprecated create function FieldDescriptor",
|
117
|
+
"ignore:Call to deprecated create function Descriptor",
|
118
|
+
"ignore:Call to deprecated create function EnumDescriptor",
|
119
|
+
"ignore:Call to deprecated create function EnumValueDescriptor",
|
120
|
+
"ignore:Call to deprecated create function FileDescriptor",
|
121
|
+
"ignore:Call to deprecated create function OneofDescriptor",
|
122
|
+
"ignore:distutils Version classes are deprecated.",
|
123
|
+
"ignore::DeprecationWarning",
|
126
124
|
]
|
127
125
|
|
128
126
|
|
129
127
|
[tool.hatch.envs.docs]
|
130
128
|
dependencies = [
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
129
|
+
"mkdocs",
|
130
|
+
"mkdocs-material",
|
131
|
+
"mkdocstrings",
|
132
|
+
"mkdocstrings-python",
|
133
|
+
"mkdocs-section-index",
|
134
|
+
"mkdocs-exclude",
|
135
|
+
"markdown-exec",
|
136
|
+
"mike",
|
139
137
|
]
|
140
138
|
features = ["pulser", "braket", "horqrux", "visualization"]
|
141
139
|
|
@@ -151,12 +149,12 @@ features = ["all"]
|
|
151
149
|
|
152
150
|
[tool.hatch.build.targets.sdist]
|
153
151
|
exclude = [
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
152
|
+
"/.gitignore",
|
153
|
+
"/.gitlab-ci-yml",
|
154
|
+
"/.pre-commit-config.yml",
|
155
|
+
"/tests",
|
156
|
+
"/docs",
|
157
|
+
"/examples",
|
160
158
|
]
|
161
159
|
|
162
160
|
[tool.hatch.build.targets.wheel]
|
@@ -167,15 +165,11 @@ branch = true
|
|
167
165
|
parallel = true
|
168
166
|
|
169
167
|
[tool.coverage.report]
|
170
|
-
exclude_lines = [
|
171
|
-
"no cov",
|
172
|
-
"if __name__ == .__main__.:",
|
173
|
-
"if TYPE_CHECKING:",
|
174
|
-
]
|
168
|
+
exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]
|
175
169
|
|
176
170
|
[tool.ruff]
|
177
171
|
select = ["E", "F", "I", "Q"]
|
178
|
-
extend-ignore = ["F841","F403"]
|
172
|
+
extend-ignore = ["F841", "F403"]
|
179
173
|
line-length = 100
|
180
174
|
|
181
175
|
[tool.ruff.isort]
|
@@ -183,8 +177,12 @@ required-imports = ["from __future__ import annotations"]
|
|
183
177
|
|
184
178
|
[tool.ruff.per-file-ignores]
|
185
179
|
"__init__.py" = ["F401", "E402"]
|
186
|
-
"qadence/operations/primitive.py" = [
|
187
|
-
"
|
180
|
+
"qadence/operations/primitive.py" = [
|
181
|
+
"E742",
|
182
|
+
] # Avoid ambiguous class name warning for identity.
|
183
|
+
"qadence/backends/horqrux/convert_ops.py" = [
|
184
|
+
"E741",
|
185
|
+
] # Avoid ambiguous class name warning for 0.
|
188
186
|
"examples/*" = ["E402"] # Allow torch seed to be set before qadence imports
|
189
187
|
|
190
188
|
[tool.ruff.mccabe]
|
@@ -49,7 +49,7 @@ from .exceptions import *
|
|
49
49
|
from .execution import *
|
50
50
|
from .measurements import *
|
51
51
|
from .ml_tools import *
|
52
|
-
from .
|
52
|
+
from .model import *
|
53
53
|
from .noise import *
|
54
54
|
from .operations import *
|
55
55
|
from .overlap import *
|
@@ -82,7 +82,7 @@ list_of_submodules = [
|
|
82
82
|
".execution",
|
83
83
|
".measurements",
|
84
84
|
".ml_tools",
|
85
|
-
".
|
85
|
+
".model",
|
86
86
|
".operations",
|
87
87
|
".overlap",
|
88
88
|
".parameters",
|
@@ -48,7 +48,13 @@ def single_gap_psr(
|
|
48
48
|
Returns:
|
49
49
|
Tensor: tensor containing derivative values
|
50
50
|
"""
|
51
|
-
|
51
|
+
device = torch.device("cpu")
|
52
|
+
try:
|
53
|
+
device = [v.device for v in param_dict.values()][0]
|
54
|
+
except Exception:
|
55
|
+
pass
|
56
|
+
spectral_gap = spectral_gap.to(device=device)
|
57
|
+
shift = shift.to(device=device)
|
52
58
|
# + pi/2 shift
|
53
59
|
shifted_params = param_dict.copy()
|
54
60
|
shifted_params[param_name] = shifted_params[param_name] + shift
|
@@ -89,11 +95,17 @@ def multi_gap_psr(
|
|
89
95
|
|
90
96
|
# get shift values
|
91
97
|
shifts = shift_prefac * torch.linspace(PI / 2 - PI / 5, PI / 2 + PI / 5, n_eqs)
|
92
|
-
|
98
|
+
device = torch.device("cpu")
|
99
|
+
try:
|
100
|
+
device = [v.device for v in param_dict.values()][0]
|
101
|
+
except Exception:
|
102
|
+
pass
|
103
|
+
spectral_gaps = spectral_gaps.to(device=device)
|
104
|
+
shifts = shifts.to(device=device)
|
93
105
|
# calculate F vector and M matrix
|
94
106
|
# (see: https://arxiv.org/pdf/2108.01218.pdf on p. 4 for definitions)
|
95
107
|
F = []
|
96
|
-
M = torch.empty((n_eqs, n_eqs))
|
108
|
+
M = torch.empty((n_eqs, n_eqs)).to(device=device)
|
97
109
|
n_obs = 1
|
98
110
|
for i in range(n_eqs):
|
99
111
|
# + shift
|
@@ -31,10 +31,10 @@ from qadence.transpile import (
|
|
31
31
|
transpile,
|
32
32
|
)
|
33
33
|
from qadence.types import BackendName, Endianness, Engine
|
34
|
-
from qadence.utils import infer_batchsize
|
34
|
+
from qadence.utils import infer_batchsize
|
35
35
|
|
36
36
|
from .config import Configuration, default_passes
|
37
|
-
from .convert_ops import convert_block
|
37
|
+
from .convert_ops import convert_block
|
38
38
|
|
39
39
|
logger = getLogger(__name__)
|
40
40
|
|
@@ -77,8 +77,13 @@ class Backend(BackendInterface):
|
|
77
77
|
scale_primitive_blocks_only,
|
78
78
|
]
|
79
79
|
block = transpile(*transpilations)(observable) # type: ignore[call-overload]
|
80
|
-
|
81
|
-
|
80
|
+
operations = convert_block(block, n_qubits, self.config)
|
81
|
+
obs_cls = (
|
82
|
+
pyq.DiagonalObservable
|
83
|
+
if block._is_diag_pauli and not block.is_parametric
|
84
|
+
else pyq.Observable
|
85
|
+
)
|
86
|
+
native = obs_cls(n_qubits=n_qubits, operations=operations)
|
82
87
|
return ConvertedObservable(native=native, abstract=block, original=observable)
|
83
88
|
|
84
89
|
def run(
|
@@ -99,7 +104,7 @@ class Backend(BackendInterface):
|
|
99
104
|
validate_state(state, n_qubits)
|
100
105
|
# pyqtorch expects input shape [2] * n_qubits + [batch_size]
|
101
106
|
state = pyqify(state, n_qubits) if pyqify_state else state
|
102
|
-
state = circuit.native.run(state, param_values)
|
107
|
+
state = circuit.native.run(state=state, values=param_values)
|
103
108
|
state = unpyqify(state) if unpyqify_state else state
|
104
109
|
state = invert_endianness(state) if endianness != self.native_endianness else state
|
105
110
|
return state
|
@@ -208,46 +213,26 @@ class Backend(BackendInterface):
|
|
208
213
|
noise: Noise | None = None,
|
209
214
|
mitigation: Mitigations | None = None,
|
210
215
|
endianness: Endianness = Endianness.BIG,
|
216
|
+
pyqify_state: bool = True,
|
211
217
|
) -> list[Counter]:
|
212
|
-
if
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
)
|
227
|
-
|
228
|
-
with torch.no_grad():
|
229
|
-
wf = self.run(circuit=circuit, param_values=param_values, state=state)
|
230
|
-
probs = torch.abs(torch.pow(wf, 2))
|
231
|
-
samples = list(
|
232
|
-
map(
|
233
|
-
lambda _probs: _sample(
|
234
|
-
_probs=_probs,
|
235
|
-
n_shots=n_shots,
|
236
|
-
endianness=endianness,
|
237
|
-
n_qubits=circuit.abstract.n_qubits,
|
238
|
-
),
|
239
|
-
probs,
|
240
|
-
)
|
218
|
+
if state is None:
|
219
|
+
state = circuit.native.init_state(batch_size=infer_batchsize(param_values))
|
220
|
+
elif state is not None and pyqify_state:
|
221
|
+
n_qubits = circuit.abstract.n_qubits
|
222
|
+
state = pyqify(state, n_qubits) if pyqify_state else state
|
223
|
+
samples: list[Counter] = circuit.native.sample(
|
224
|
+
state=state, values=param_values, n_shots=n_shots
|
225
|
+
)
|
226
|
+
samples = invert_endianness(samples) if endianness != Endianness.BIG else samples
|
227
|
+
if noise is not None:
|
228
|
+
samples = apply_noise(noise=noise, samples=samples)
|
229
|
+
if mitigation is not None:
|
230
|
+
logger.warning(
|
231
|
+
"Mitigation protocol is deprecated. Use qadence-protocols instead.",
|
241
232
|
)
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
logger.warning(
|
246
|
-
"Mitigation protocol is deprecated. Use qadence-protocols instead.",
|
247
|
-
)
|
248
|
-
assert noise
|
249
|
-
samples = apply_mitigation(noise=noise, mitigation=mitigation, samples=samples)
|
250
|
-
return samples
|
233
|
+
assert noise
|
234
|
+
samples = apply_mitigation(noise=noise, mitigation=mitigation, samples=samples)
|
235
|
+
return samples
|
251
236
|
|
252
237
|
def assign_parameters(self, circuit: ConvertedCircuit, param_values: dict[str, Tensor]) -> Any:
|
253
238
|
raise NotImplementedError
|