qadence 1.5.1__tar.gz → 1.6.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.5.1 → qadence-1.6.0}/.pre-commit-config.yaml +2 -1
- {qadence-1.5.1 → qadence-1.6.0}/PKG-INFO +45 -36
- {qadence-1.5.1 → qadence-1.6.0}/README.md +27 -27
- qadence-1.6.0/mkdocs.yml +171 -0
- {qadence-1.5.1 → qadence-1.6.0}/pyproject.toml +17 -8
- {qadence-1.5.1 → qadence-1.6.0}/qadence/__init__.py +33 -5
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backend.py +2 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/adjoint.py +8 -4
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/braket/backend.py +3 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/braket/config.py +2 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/gpsr.py +1 -1
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/horqrux/backend.py +4 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/horqrux/config.py +2 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/pulser/backend.py +71 -45
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/pulser/config.py +0 -28
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/pulser/pulses.py +2 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/pyqtorch/backend.py +3 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/pyqtorch/config.py +2 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/blocks/block_to_tensor.py +4 -4
- {qadence-1.5.1 → qadence-1.6.0}/qadence/blocks/matrix.py +2 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/blocks/utils.py +2 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/circuit.py +5 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/constructors/__init__.py +1 -10
- {qadence-1.5.1 → qadence-1.6.0}/qadence/constructors/ansatze.py +1 -65
- {qadence-1.5.1 → qadence-1.6.0}/qadence/constructors/daqc/daqc.py +3 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/constructors/daqc/gen_parser.py +3 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/constructors/daqc/utils.py +3 -3
- {qadence-1.5.1 → qadence-1.6.0}/qadence/constructors/feature_maps.py +2 -90
- {qadence-1.5.1 → qadence-1.6.0}/qadence/constructors/hamiltonians.py +2 -6
- {qadence-1.5.1 → qadence-1.6.0}/qadence/constructors/rydberg_feature_maps.py +2 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/decompose.py +2 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/engines/torch/differentiable_expectation.py +7 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/extensions.py +4 -15
- qadence-1.6.0/qadence/log_config.yaml +24 -0
- qadence-1.6.0/qadence/logger.py +17 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/ml_tools/models.py +10 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/ml_tools/saveload.py +14 -5
- {qadence-1.5.1 → qadence-1.6.0}/qadence/ml_tools/train_grad.py +3 -3
- {qadence-1.5.1 → qadence-1.6.0}/qadence/ml_tools/train_no_grad.py +2 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/models/quantum_model.py +13 -6
- {qadence-1.5.1 → qadence-1.6.0}/qadence/noise/readout.py +2 -3
- {qadence-1.5.1 → qadence-1.6.0}/qadence/operations/__init__.py +0 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/operations/analog.py +2 -12
- {qadence-1.5.1 → qadence-1.6.0}/qadence/operations/control_ops.py +3 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/operations/ham_evo.py +2 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/operations/parametric.py +3 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/operations/primitive.py +2 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/parameters.py +2 -2
- qadence-1.6.0/qadence/serial_expr_grammar.peg +11 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/serialization.py +192 -67
- {qadence-1.5.1 → qadence-1.6.0}/qadence/transpile/block.py +2 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/types.py +2 -2
- {qadence-1.5.1 → qadence-1.6.0}/qadence/utils.py +10 -4
- {qadence-1.5.1 → qadence-1.6.0}/renovate.json +7 -4
- qadence-1.5.1/mkdocs.yml +0 -161
- qadence-1.5.1/qadence/logger.py +0 -35
- {qadence-1.5.1 → qadence-1.6.0}/.coveragerc +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/.github/dependabot.yml +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/.github/workflows/build_docs.yml +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/.github/workflows/dependabot.yml +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/.github/workflows/lint.yml +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/.github/workflows/test_all.yml +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/.github/workflows/test_examples.yml +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/.github/workflows/test_fast.yml +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/.gitignore +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/LICENSE +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/MANIFEST.in +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/analog/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/analog/addressing.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/analog/constants.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/analog/device.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/analog/hamiltonian_terms.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/analog/parse_analog.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/api.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/braket/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/braket/convert_ops.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/horqrux/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/horqrux/convert_ops.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/jax_utils.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/pulser/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/pulser/channels.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/pulser/cloud.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/pulser/convert_ops.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/pulser/devices.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/pulser/waveforms.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/pyqtorch/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/pyqtorch/convert_ops.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/backends/utils.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/blocks/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/blocks/abstract.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/blocks/analog.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/blocks/composite.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/blocks/embedding.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/blocks/manipulate.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/blocks/primitive.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/constructors/daqc/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/constructors/iia.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/constructors/qft.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/constructors/rydberg_hea.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/constructors/utils.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/divergences.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/draw/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/draw/assets/dark/measurement.png +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/draw/assets/dark/measurement.svg +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/draw/assets/light/measurement.png +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/draw/assets/light/measurement.svg +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/draw/themes.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/draw/utils.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/draw/vizbackend.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/engines/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/engines/differentiable_backend.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/engines/jax/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/engines/jax/differentiable_backend.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/engines/jax/differentiable_expectation.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/engines/torch/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/engines/torch/differentiable_backend.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/exceptions/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/exceptions/exceptions.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/execution.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/finitediff.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/libs.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/measurements/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/measurements/protocols.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/measurements/samples.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/measurements/shadow.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/measurements/tomography.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/measurements/utils.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/mitigations/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/mitigations/analog_zne.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/mitigations/protocols.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/mitigations/readout.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/ml_tools/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/ml_tools/config.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/ml_tools/data.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/ml_tools/optimize_step.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/ml_tools/parameters.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/ml_tools/printing.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/ml_tools/tensors.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/ml_tools/utils.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/models/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/models/qnn.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/noise/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/noise/protocols.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/overlap.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/protocols.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/py.typed +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/qubit_support.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/register.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/states.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/transpile/__init__.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/transpile/apply_fn.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/transpile/circuit.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/transpile/digitalize.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/transpile/flatten.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/transpile/invert.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/qadence/transpile/transpile.py +0 -0
- {qadence-1.5.1 → qadence-1.6.0}/setup.py +0 -0
@@ -20,9 +20,10 @@ repos:
|
|
20
20
|
- id: black
|
21
21
|
|
22
22
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
23
|
-
rev: v1.
|
23
|
+
rev: v1.9.0
|
24
24
|
hooks:
|
25
25
|
- id: mypy
|
26
|
+
args: [--install-types, --non-interactive]
|
26
27
|
exclude: examples|docs
|
27
28
|
|
28
29
|
- repo: https://github.com/DanielNoord/pydocstringformatter
|
@@ -1,8 +1,8 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: qadence
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.6.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>
|
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>
|
6
6
|
License: Apache 2.0
|
7
7
|
License-File: LICENSE
|
8
8
|
Classifier: License :: OSI Approved :: Apache Software License
|
@@ -11,29 +11,37 @@ Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.9
|
12
12
|
Classifier: Programming Language :: Python :: 3.10
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
14
15
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
15
16
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
16
|
-
Requires-Python:
|
17
|
+
Requires-Python: >=3.9
|
18
|
+
Requires-Dist: arpeggio==2.0.2
|
17
19
|
Requires-Dist: deepdiff
|
18
20
|
Requires-Dist: jsonschema
|
19
21
|
Requires-Dist: matplotlib
|
20
22
|
Requires-Dist: nevergrad
|
21
23
|
Requires-Dist: numpy
|
22
24
|
Requires-Dist: openfermion
|
23
|
-
Requires-Dist: pyqtorch==1.1.
|
25
|
+
Requires-Dist: pyqtorch==1.1.2
|
26
|
+
Requires-Dist: pyyaml
|
24
27
|
Requires-Dist: rich
|
25
28
|
Requires-Dist: scipy
|
26
29
|
Requires-Dist: sympytorch>=0.1.2
|
27
30
|
Requires-Dist: tensorboard>=2.12.0
|
28
31
|
Requires-Dist: torch
|
29
32
|
Provides-Extra: all
|
30
|
-
Requires-Dist: amazon-braket-sdk; extra == 'all'
|
33
|
+
Requires-Dist: amazon-braket-sdk<1.71.2; extra == 'all'
|
31
34
|
Requires-Dist: graphviz; extra == 'all'
|
32
35
|
Requires-Dist: libs; extra == 'all'
|
36
|
+
Requires-Dist: pasqal-cloud==0.8.1; extra == 'all'
|
33
37
|
Requires-Dist: protocols; extra == 'all'
|
34
|
-
Requires-Dist: pulser
|
38
|
+
Requires-Dist: pulser-core==0.18.0; extra == 'all'
|
39
|
+
Requires-Dist: pulser-simulation==0.18.0; extra == 'all'
|
35
40
|
Provides-Extra: braket
|
36
|
-
Requires-Dist: amazon-braket-sdk
|
41
|
+
Requires-Dist: amazon-braket-sdk<1.71.2; extra == 'braket'
|
42
|
+
Provides-Extra: dlprof
|
43
|
+
Requires-Dist: nvidia-dlprof[pytorch]; extra == 'dlprof'
|
44
|
+
Requires-Dist: nvidia-pyindex; extra == 'dlprof'
|
37
45
|
Provides-Extra: horqrux
|
38
46
|
Requires-Dist: einops; extra == 'horqrux'
|
39
47
|
Requires-Dist: flax; extra == 'horqrux'
|
@@ -47,25 +55,28 @@ Requires-Dist: qadence-libs; extra == 'libs'
|
|
47
55
|
Provides-Extra: protocols
|
48
56
|
Requires-Dist: qadence-protocols; extra == 'protocols'
|
49
57
|
Provides-Extra: pulser
|
50
|
-
Requires-Dist: pasqal-cloud
|
51
|
-
Requires-Dist: pulser
|
58
|
+
Requires-Dist: pasqal-cloud==0.8.1; extra == 'pulser'
|
59
|
+
Requires-Dist: pulser-core==0.18.0; extra == 'pulser'
|
60
|
+
Requires-Dist: pulser-simulation==0.18.0; extra == 'pulser'
|
52
61
|
Provides-Extra: visualization
|
53
62
|
Requires-Dist: graphviz; extra == 'visualization'
|
54
63
|
Description-Content-Type: text/markdown
|
55
64
|
|
56
|
-
<
|
57
|
-
<
|
58
|
-
|
59
|
-
|
60
|
-
|
65
|
+
<p align="center">
|
66
|
+
<picture>
|
67
|
+
<source media="(prefers-color-scheme: dark)" srcset="./docs/extras/assets/logo/qadence_logo_white.svg" width="75%">
|
68
|
+
<source media="(prefers-color-scheme: light)" srcset="./docs/extras/assets/logo/qadence_logo.svg" width="75%">
|
69
|
+
<img alt="Qadence logo" src="./docs/assets/logo/qadence_logo.svg" width="75%">
|
70
|
+
</picture>
|
71
|
+
</p>
|
72
|
+
|
73
|
+
**Qadence** is a Python package that provides a simple interface to build **digital-analog quantum
|
74
|
+
programs** with tunable qubit interactions and arbitrary register topologies realizable on neutral atom devices.
|
61
75
|
|
62
76
|
**For a high-level overview of Qadence features, [check out our white paper](https://arxiv.org/abs/2401.09915).**
|
63
77
|
|
64
78
|
**For more detailed information, [check out the documentation](https://pasqal-io.github.io/qadence/latest/).**
|
65
79
|
|
66
|
-
**Qadence** is a Python package that provides a simple interface to build _**digital-analog quantum
|
67
|
-
programs**_ with tunable qubit interaction defined on _**arbitrary register topologies**_ realizable on neutral atom devices.
|
68
|
-
|
69
80
|
[](https://github.com/pasqal-io/qadence/actions/workflows/lint.yml)
|
70
81
|
[](https://github.com/pasqal-io/qadence/actions/workflows/test_fast.yml)
|
71
82
|
[](https://pasqal-io.github.io/qadence/latest)
|
@@ -74,27 +85,26 @@ programs**_ with tunable qubit interaction defined on _**arbitrary register topo
|
|
74
85
|
|
75
86
|
## Feature highlights
|
76
87
|
|
77
|
-
<
|
78
|
-
<
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
88
|
+
<p align="center">
|
89
|
+
<picture>
|
90
|
+
<source media="(prefers-color-scheme: dark)" srcset="./docs/extras/assets/qadence_arch.svg" width="75%">
|
91
|
+
<source media="(prefers-color-scheme: light)" srcset="./docs/extras/assets/qadence_arch.svg" width="75%">
|
92
|
+
<img alt="Qadence architecture" src="./docs/assets/qadence_arch.svg" width="75%">
|
93
|
+
</picture>
|
94
|
+
<p align="center">
|
83
95
|
|
84
|
-
* A [block-based system](docs/
|
96
|
+
* A [block-based system](docs/content/block_system.md) for composing _**complex digital-analog
|
85
97
|
programs**_ in a flexible and scalable manner, inspired by the Julia quantum SDK
|
86
98
|
[Yao.jl](https://github.com/QuantumBFS/Yao.jl) and functional programming concepts.
|
87
99
|
|
88
|
-
*
|
89
|
-
using [arbitrary registers topologies](docs/tutorials/register.md).
|
90
|
-
|
91
|
-
* An intuitive [expression-based system](docs/tutorials/parameters.md) developed on top of the symbolic library [Sympy](https://www.sympy.org/en/index.html) to construct _**parametric quantum programs**_ easily.
|
92
|
-
|
93
|
-
* [High-order generalized parameter shift rules](docs/advanced_tutorials/differentiability.md) for _**differentiating parametrized quantum operations**_.
|
100
|
+
* An intuitive [expression-based system](docs/content/parameters.md) developed on top of the symbolic library [Sympy](https://www.sympy.org/en/index.html) to construct _**parametric quantum programs**_ easily.
|
94
101
|
|
95
102
|
* Out-of-the-box _**automatic differentiability**_ of quantum programs with [PyTorch](https://pytorch.org/) integration.
|
96
103
|
|
97
|
-
*
|
104
|
+
* [High-order generalized parameter shift rules](docs/tutorials/advanced_tutorials/differentiability.md) for _**differentiating parametrized quantum operations**_.
|
105
|
+
|
106
|
+
* A [simple interface](docs/tutorials/digital_analog_qc/analog-basics.md) to work with _**interacting neutral-atom qubit systems**_
|
107
|
+
using [arbitrary registers topologies](docs/content/register.md).
|
98
108
|
|
99
109
|
## Installation guide
|
100
110
|
|
@@ -106,11 +116,10 @@ pip install qadence
|
|
106
116
|
|
107
117
|
The default, pre-installed backend for Qadence is [PyQTorch](https://github.com/pasqal-io/pyqtorch), a differentiable state vector simulator for digital-analog simulation based on `PyTorch`. It is possible to install additional, `PyTorch` -based backends and the circuit visualization library using the following extras:
|
108
118
|
|
109
|
-
* `pulser`: The [Pulser](https://github.com/pasqal-io/Pulser) backend for composing, simulating and executing pulse sequences for neutral-atom quantum devices.
|
110
|
-
* `braket`: The [Braket](https://github.com/amazon-braket/amazon-braket-sdk-python) backend, an open source library that provides a framework for interacting with quantum computing hardware devices through Amazon Braket.
|
111
119
|
* `visualization`: A visualization library to display quantum circuit diagrams.
|
112
120
|
* `protocols`: A collection of [protocols](https://github.com/pasqal-io/qadence-protocols) for error mitigation in Qadence.
|
113
121
|
* `libs`: A collection of [functionalities](https://github.com/pasqal-io/qadence-libs) for graph machine learning problems build on top of Qadence.
|
122
|
+
* `pulser`: The [Pulser](https://github.com/pasqal-io/Pulser) backend for composing, simulating and executing pulse sequences for neutral-atom quantum devices (experimental).
|
114
123
|
|
115
124
|
Qadence also supports a `JAX` engine which is currently supporting the [Horqrux](https://github.com/pasqal-io/horqrux) backend. `horqrux` is currently only available via the [low-level API](examples/backends/low_level/horqrux_backend.py).
|
116
125
|
|
@@ -118,7 +127,7 @@ Qadence also supports a `JAX` engine which is currently supporting the [Horqrux]
|
|
118
127
|
To install individual extras, use the following syntax (**IMPORTANT** Make sure to use quotes):
|
119
128
|
|
120
129
|
```bash
|
121
|
-
pip install "qadence[
|
130
|
+
pip install "qadence[pulser,visualization]"
|
122
131
|
```
|
123
132
|
|
124
133
|
To install all available extras, simply do:
|
@@ -144,10 +153,10 @@ conda install python-graphviz
|
|
144
153
|
|
145
154
|
## Contributing
|
146
155
|
|
147
|
-
Before making a contribution, please review our [code of conduct](docs/CODE_OF_CONDUCT.md).
|
156
|
+
Before making a contribution, please review our [code of conduct](docs/getting_started/CODE_OF_CONDUCT.md).
|
148
157
|
|
149
158
|
- **Submitting Issues:** To submit bug reports or feature requests, please use our [issue tracker](https://github.com/pasqal-io/qadence/issues).
|
150
|
-
- **Developing in qadence:** To learn more about how to develop within `qadence`, please refer to [contributing guidelines](docs/CONTRIBUTING.md).
|
159
|
+
- **Developing in qadence:** To learn more about how to develop within `qadence`, please refer to [contributing guidelines](docs/getting_started/CONTRIBUTING.md).
|
151
160
|
|
152
161
|
### Setting up qadence in development mode
|
153
162
|
|
@@ -1,16 +1,18 @@
|
|
1
|
-
<
|
2
|
-
<
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<p align="center">
|
2
|
+
<picture>
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="./docs/extras/assets/logo/qadence_logo_white.svg" width="75%">
|
4
|
+
<source media="(prefers-color-scheme: light)" srcset="./docs/extras/assets/logo/qadence_logo.svg" width="75%">
|
5
|
+
<img alt="Qadence logo" src="./docs/assets/logo/qadence_logo.svg" width="75%">
|
6
|
+
</picture>
|
7
|
+
</p>
|
8
|
+
|
9
|
+
**Qadence** is a Python package that provides a simple interface to build **digital-analog quantum
|
10
|
+
programs** with tunable qubit interactions and arbitrary register topologies realizable on neutral atom devices.
|
6
11
|
|
7
12
|
**For a high-level overview of Qadence features, [check out our white paper](https://arxiv.org/abs/2401.09915).**
|
8
13
|
|
9
14
|
**For more detailed information, [check out the documentation](https://pasqal-io.github.io/qadence/latest/).**
|
10
15
|
|
11
|
-
**Qadence** is a Python package that provides a simple interface to build _**digital-analog quantum
|
12
|
-
programs**_ with tunable qubit interaction defined on _**arbitrary register topologies**_ realizable on neutral atom devices.
|
13
|
-
|
14
16
|
[](https://github.com/pasqal-io/qadence/actions/workflows/lint.yml)
|
15
17
|
[](https://github.com/pasqal-io/qadence/actions/workflows/test_fast.yml)
|
16
18
|
[](https://pasqal-io.github.io/qadence/latest)
|
@@ -19,27 +21,26 @@ programs**_ with tunable qubit interaction defined on _**arbitrary register topo
|
|
19
21
|
|
20
22
|
## Feature highlights
|
21
23
|
|
22
|
-
<
|
23
|
-
<
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
<p align="center">
|
25
|
+
<picture>
|
26
|
+
<source media="(prefers-color-scheme: dark)" srcset="./docs/extras/assets/qadence_arch.svg" width="75%">
|
27
|
+
<source media="(prefers-color-scheme: light)" srcset="./docs/extras/assets/qadence_arch.svg" width="75%">
|
28
|
+
<img alt="Qadence architecture" src="./docs/assets/qadence_arch.svg" width="75%">
|
29
|
+
</picture>
|
30
|
+
<p align="center">
|
28
31
|
|
29
|
-
* A [block-based system](docs/
|
32
|
+
* A [block-based system](docs/content/block_system.md) for composing _**complex digital-analog
|
30
33
|
programs**_ in a flexible and scalable manner, inspired by the Julia quantum SDK
|
31
34
|
[Yao.jl](https://github.com/QuantumBFS/Yao.jl) and functional programming concepts.
|
32
35
|
|
33
|
-
*
|
34
|
-
using [arbitrary registers topologies](docs/tutorials/register.md).
|
35
|
-
|
36
|
-
* An intuitive [expression-based system](docs/tutorials/parameters.md) developed on top of the symbolic library [Sympy](https://www.sympy.org/en/index.html) to construct _**parametric quantum programs**_ easily.
|
37
|
-
|
38
|
-
* [High-order generalized parameter shift rules](docs/advanced_tutorials/differentiability.md) for _**differentiating parametrized quantum operations**_.
|
36
|
+
* An intuitive [expression-based system](docs/content/parameters.md) developed on top of the symbolic library [Sympy](https://www.sympy.org/en/index.html) to construct _**parametric quantum programs**_ easily.
|
39
37
|
|
40
38
|
* Out-of-the-box _**automatic differentiability**_ of quantum programs with [PyTorch](https://pytorch.org/) integration.
|
41
39
|
|
42
|
-
*
|
40
|
+
* [High-order generalized parameter shift rules](docs/tutorials/advanced_tutorials/differentiability.md) for _**differentiating parametrized quantum operations**_.
|
41
|
+
|
42
|
+
* A [simple interface](docs/tutorials/digital_analog_qc/analog-basics.md) to work with _**interacting neutral-atom qubit systems**_
|
43
|
+
using [arbitrary registers topologies](docs/content/register.md).
|
43
44
|
|
44
45
|
## Installation guide
|
45
46
|
|
@@ -51,11 +52,10 @@ pip install qadence
|
|
51
52
|
|
52
53
|
The default, pre-installed backend for Qadence is [PyQTorch](https://github.com/pasqal-io/pyqtorch), a differentiable state vector simulator for digital-analog simulation based on `PyTorch`. It is possible to install additional, `PyTorch` -based backends and the circuit visualization library using the following extras:
|
53
54
|
|
54
|
-
* `pulser`: The [Pulser](https://github.com/pasqal-io/Pulser) backend for composing, simulating and executing pulse sequences for neutral-atom quantum devices.
|
55
|
-
* `braket`: The [Braket](https://github.com/amazon-braket/amazon-braket-sdk-python) backend, an open source library that provides a framework for interacting with quantum computing hardware devices through Amazon Braket.
|
56
55
|
* `visualization`: A visualization library to display quantum circuit diagrams.
|
57
56
|
* `protocols`: A collection of [protocols](https://github.com/pasqal-io/qadence-protocols) for error mitigation in Qadence.
|
58
57
|
* `libs`: A collection of [functionalities](https://github.com/pasqal-io/qadence-libs) for graph machine learning problems build on top of Qadence.
|
58
|
+
* `pulser`: The [Pulser](https://github.com/pasqal-io/Pulser) backend for composing, simulating and executing pulse sequences for neutral-atom quantum devices (experimental).
|
59
59
|
|
60
60
|
Qadence also supports a `JAX` engine which is currently supporting the [Horqrux](https://github.com/pasqal-io/horqrux) backend. `horqrux` is currently only available via the [low-level API](examples/backends/low_level/horqrux_backend.py).
|
61
61
|
|
@@ -63,7 +63,7 @@ Qadence also supports a `JAX` engine which is currently supporting the [Horqrux]
|
|
63
63
|
To install individual extras, use the following syntax (**IMPORTANT** Make sure to use quotes):
|
64
64
|
|
65
65
|
```bash
|
66
|
-
pip install "qadence[
|
66
|
+
pip install "qadence[pulser,visualization]"
|
67
67
|
```
|
68
68
|
|
69
69
|
To install all available extras, simply do:
|
@@ -89,10 +89,10 @@ conda install python-graphviz
|
|
89
89
|
|
90
90
|
## Contributing
|
91
91
|
|
92
|
-
Before making a contribution, please review our [code of conduct](docs/CODE_OF_CONDUCT.md).
|
92
|
+
Before making a contribution, please review our [code of conduct](docs/getting_started/CODE_OF_CONDUCT.md).
|
93
93
|
|
94
94
|
- **Submitting Issues:** To submit bug reports or feature requests, please use our [issue tracker](https://github.com/pasqal-io/qadence/issues).
|
95
|
-
- **Developing in qadence:** To learn more about how to develop within `qadence`, please refer to [contributing guidelines](docs/CONTRIBUTING.md).
|
95
|
+
- **Developing in qadence:** To learn more about how to develop within `qadence`, please refer to [contributing guidelines](docs/getting_started/CONTRIBUTING.md).
|
96
96
|
|
97
97
|
### Setting up qadence in development mode
|
98
98
|
|
qadence-1.6.0/mkdocs.yml
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
site_name: Qadence
|
2
|
+
repo_url: "https://github.com/pasqal-io/qadence/"
|
3
|
+
site_url: "https://pasqal-io.github.io/qadence/"
|
4
|
+
repo_name: "qadence"
|
5
|
+
|
6
|
+
nav:
|
7
|
+
- Home: index.md
|
8
|
+
|
9
|
+
- Getting started:
|
10
|
+
- Installation: getting_started/installation.md
|
11
|
+
- Development & Info:
|
12
|
+
- Contributing: getting_started/CONTRIBUTING.md
|
13
|
+
- Code of conduct: getting_started/CODE_OF_CONDUCT.md
|
14
|
+
- License: getting_started/LICENSE.md
|
15
|
+
|
16
|
+
- Contents:
|
17
|
+
- Block system: content/block_system.md
|
18
|
+
- Parametric programs: content/parameters.md
|
19
|
+
- Quantum models: content/quantummodels.md
|
20
|
+
- Quantum registers: content/register.md
|
21
|
+
- State initialization: content/state_init.md
|
22
|
+
- Arbitrary Hamiltonians: content/hamiltonians.md
|
23
|
+
- QML Constructors: content/qml_constructors.md
|
24
|
+
- Wavefunction overlaps: content/overlap.md
|
25
|
+
- Backends: content/backends.md
|
26
|
+
- Useful info:
|
27
|
+
- State conventions: content/state_conventions.md
|
28
|
+
- Serialization: content/serializ_and_prep.md
|
29
|
+
|
30
|
+
- Tutorials:
|
31
|
+
- tutorials/index.md
|
32
|
+
- Digital-analog quantum computing:
|
33
|
+
- tutorials/digital_analog_qc/index.md
|
34
|
+
- Basic operations on neutral-atoms: tutorials/digital_analog_qc/analog-basics.md
|
35
|
+
- Fitting a simple function: tutorials/digital_analog_qc/analog-qcl.md
|
36
|
+
- Restricted local addressability: tutorials/digital_analog_qc/semi-local-addressing.md
|
37
|
+
- Pulse-level programming with Pulser: tutorials/digital_analog_qc/pulser-basic.md
|
38
|
+
- Solve a QUBO problem: tutorials/digital_analog_qc/analog-qubo.md
|
39
|
+
- CNOT with interacting qubits: tutorials/digital_analog_qc/daqc-cnot.md
|
40
|
+
|
41
|
+
- Variational quantum algorithms:
|
42
|
+
- tutorials/qml/index.md
|
43
|
+
- Training tools: tutorials/qml/ml_tools.md
|
44
|
+
- Quantum circuit learning: tutorials/qml/qcl.md
|
45
|
+
- Solving MaxCut with QAOA: tutorials/qml/qaoa.md
|
46
|
+
- Solving a 1D ODE: tutorials/qml/dqc_1d.md
|
47
|
+
|
48
|
+
- Advanced Tutorials:
|
49
|
+
- tutorials/advanced_tutorials/index.md
|
50
|
+
- Quantum circuits differentiation: tutorials/advanced_tutorials/differentiability.md
|
51
|
+
- Custom quantum models: tutorials/advanced_tutorials/custom-models.md
|
52
|
+
- Projector blocks: tutorials/advanced_tutorials/projectors.md
|
53
|
+
- Profiling and debugging on CUDA devices: tutorials/advanced_tutorials/profiling-and-debugging.md
|
54
|
+
|
55
|
+
- Realistic simulations:
|
56
|
+
- tutorials/realistic_sims/index.md
|
57
|
+
- Measurement protocols: tutorials/realistic_sims/measurements.md
|
58
|
+
- Simulated errors: tutorials/realistic_sims/noise.md
|
59
|
+
- Error mitigation: tutorials/realistic_sims/mitigation.md
|
60
|
+
|
61
|
+
- Development:
|
62
|
+
- Architecture and sharp bits: tutorials/development/architecture.md
|
63
|
+
- Drawing: tutorials/development/draw.md
|
64
|
+
|
65
|
+
- API:
|
66
|
+
- Block system: api/blocks.md
|
67
|
+
- Operations: api/operations.md
|
68
|
+
- Register: api/register.md
|
69
|
+
- QuantumCircuit: api/quantumcircuit.md
|
70
|
+
- Parameters: api/parameters.md
|
71
|
+
- State preparation: api/states.md
|
72
|
+
- Constructors: api/constructors.md
|
73
|
+
- Transpilation: api/transpile.md
|
74
|
+
- Execution: api/execution.md
|
75
|
+
- Quantum models: api/models.md
|
76
|
+
- QML tools: api/ml_tools.md
|
77
|
+
- Serialization: api/serialization.md
|
78
|
+
- Types: api/types.md
|
79
|
+
- Drawing: api/draw.md
|
80
|
+
|
81
|
+
- Backends:
|
82
|
+
- Abstract backend: api/backends/backend.md
|
83
|
+
- PyQTorch: api/backends/pyqtorch.md
|
84
|
+
- Pulser: api/backends/pulser.md
|
85
|
+
- DifferentiableBackend: api/backends/differentiable.md
|
86
|
+
|
87
|
+
edit_uri: edit/main/docs/
|
88
|
+
|
89
|
+
theme:
|
90
|
+
name: material
|
91
|
+
custom_dir: docs/extras/overrides/
|
92
|
+
logo: extras/assets/logo/qadence_logo_small_white.svg
|
93
|
+
features:
|
94
|
+
- content.code.annotate
|
95
|
+
- navigation.tabs
|
96
|
+
- navigation.indexes
|
97
|
+
- navigation.sections
|
98
|
+
- content.code.copy
|
99
|
+
- content.code.annotate
|
100
|
+
|
101
|
+
palette:
|
102
|
+
- media: "(prefers-color-scheme: light)"
|
103
|
+
scheme: default
|
104
|
+
primary: custom
|
105
|
+
accent: custom
|
106
|
+
toggle:
|
107
|
+
icon: material/weather-sunny
|
108
|
+
name: Switch to dark mode
|
109
|
+
- media: "(prefers-color-scheme: dark)"
|
110
|
+
scheme: slate
|
111
|
+
primary: black
|
112
|
+
accent: custom
|
113
|
+
toggle:
|
114
|
+
icon: material/weather-night
|
115
|
+
name: Switch to light mode
|
116
|
+
|
117
|
+
markdown_extensions:
|
118
|
+
- admonition # for notes
|
119
|
+
- footnotes
|
120
|
+
- pymdownx.arithmatex: # for mathjax
|
121
|
+
generic: true
|
122
|
+
- pymdownx.highlight:
|
123
|
+
anchor_linenums: true
|
124
|
+
- pymdownx.inlinehilite
|
125
|
+
- pymdownx.snippets
|
126
|
+
- pymdownx.details
|
127
|
+
- pymdownx.superfences:
|
128
|
+
custom_fences:
|
129
|
+
- name: python
|
130
|
+
class: python
|
131
|
+
validator: "!!python/name:markdown_exec.validator"
|
132
|
+
format: "!!python/name:markdown_exec.formatter"
|
133
|
+
|
134
|
+
plugins:
|
135
|
+
- search
|
136
|
+
- section-index
|
137
|
+
- mkdocstrings:
|
138
|
+
default_handler: python
|
139
|
+
handlers:
|
140
|
+
python:
|
141
|
+
selection:
|
142
|
+
filters:
|
143
|
+
- "!^_" # exlude all members starting with _
|
144
|
+
- "^__init__$" # but always include __init__ modules and methods
|
145
|
+
- "^__new__$" # but always include __init__ modules and methods
|
146
|
+
options:
|
147
|
+
show_root_toc_entry: false
|
148
|
+
heading_level: 3
|
149
|
+
merge_init_into_class: true
|
150
|
+
docstring_section_style: spacy
|
151
|
+
|
152
|
+
- markdown-exec
|
153
|
+
|
154
|
+
extra:
|
155
|
+
version:
|
156
|
+
provider: mike
|
157
|
+
|
158
|
+
# To get nice tabs
|
159
|
+
extra_css:
|
160
|
+
- extras/css/mkdocstrings.css
|
161
|
+
- extras/css/colors.css
|
162
|
+
- extras/css/home.css
|
163
|
+
|
164
|
+
# For mathjax
|
165
|
+
extra_javascript:
|
166
|
+
- extras/javascripts/mathjax.js
|
167
|
+
- https://polyfill.io/v3/polyfill.min.js?features=es6
|
168
|
+
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
|
169
|
+
|
170
|
+
watch:
|
171
|
+
- qadence
|
@@ -17,10 +17,11 @@ authors = [
|
|
17
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
|
+
{ name = "Eduardo Maschio", email = "eduardo.maschio@pasqal.com" },
|
20
21
|
]
|
21
|
-
requires-python = ">=3.9
|
22
|
+
requires-python = ">=3.9"
|
22
23
|
license = {text = "Apache 2.0"}
|
23
|
-
version = "1.
|
24
|
+
version = "1.6.0"
|
24
25
|
classifiers=[
|
25
26
|
"License :: OSI Approved :: Apache Software License",
|
26
27
|
"Programming Language :: Python",
|
@@ -28,6 +29,7 @@ classifiers=[
|
|
28
29
|
"Programming Language :: Python :: 3.9",
|
29
30
|
"Programming Language :: Python :: 3.10",
|
30
31
|
"Programming Language :: Python :: 3.11",
|
32
|
+
"Programming Language :: Python :: 3.12",
|
31
33
|
"Programming Language :: Python :: Implementation :: CPython",
|
32
34
|
"Programming Language :: Python :: Implementation :: PyPy",
|
33
35
|
]
|
@@ -42,8 +44,10 @@ dependencies = [
|
|
42
44
|
"jsonschema",
|
43
45
|
"nevergrad",
|
44
46
|
"scipy",
|
45
|
-
"pyqtorch==1.1.
|
47
|
+
"pyqtorch==1.1.2",
|
48
|
+
"pyyaml",
|
46
49
|
"matplotlib",
|
50
|
+
"Arpeggio==2.0.2",
|
47
51
|
]
|
48
52
|
|
49
53
|
[tool.hatch.metadata]
|
@@ -51,8 +55,8 @@ allow-direct-references = true
|
|
51
55
|
allow-ambiguous-features = true
|
52
56
|
|
53
57
|
[project.optional-dependencies]
|
54
|
-
pulser = ["pulser
|
55
|
-
braket = ["amazon-braket-sdk
|
58
|
+
pulser = ["pulser-core==0.18.0", "pulser-simulation==0.18.0","pasqal-cloud==0.8.1"]
|
59
|
+
braket = ["amazon-braket-sdk<1.71.2"]
|
56
60
|
visualization = [
|
57
61
|
"graphviz",
|
58
62
|
# FIXME: will be needed once we support latex labels
|
@@ -69,9 +73,12 @@ horqrux = [
|
|
69
73
|
"sympy2jax"]
|
70
74
|
protocols = ["qadence-protocols"]
|
71
75
|
libs = ["qadence-libs"]
|
76
|
+
dlprof = ["nvidia-pyindex", "nvidia-dlprof[pytorch]"]
|
72
77
|
all = [
|
73
|
-
"pulser
|
74
|
-
"
|
78
|
+
"pulser-core==0.18.0",
|
79
|
+
"pulser-simulation==0.18.0",
|
80
|
+
"pasqal-cloud==0.8.1",
|
81
|
+
"amazon-braket-sdk<1.71.2",
|
75
82
|
"graphviz",
|
76
83
|
"protocols",
|
77
84
|
"libs",
|
@@ -88,6 +95,7 @@ dependencies = [
|
|
88
95
|
"pytest-cov",
|
89
96
|
"pytest-mypy",
|
90
97
|
"pytest-xdist",
|
98
|
+
"types-PyYAML",
|
91
99
|
"ipykernel",
|
92
100
|
"pre-commit",
|
93
101
|
"black",
|
@@ -179,9 +187,10 @@ line-length = 100
|
|
179
187
|
required-imports = ["from __future__ import annotations"]
|
180
188
|
|
181
189
|
[tool.ruff.per-file-ignores]
|
182
|
-
"__init__.py" = ["F401"]
|
190
|
+
"__init__.py" = ["F401", "E402"]
|
183
191
|
"qadence/operations/primitive.py" = ["E742"] # Avoid ambiguous class name warning for identity.
|
184
192
|
"qadence/backends/horqrux/convert_ops.py" = ["E741"] # Avoid ambiguous class name warning for 0.
|
193
|
+
"examples/*" = ["E402"] # Allow torch seed to be set before qadence imports
|
185
194
|
|
186
195
|
[tool.ruff.mccabe]
|
187
196
|
max-complexity = 15
|
@@ -1,10 +1,43 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
+
import logging
|
4
|
+
import logging.config
|
5
|
+
import os
|
3
6
|
from importlib import import_module
|
7
|
+
from pathlib import Path
|
4
8
|
|
9
|
+
import yaml
|
5
10
|
from torch import cdouble, set_default_dtype
|
6
11
|
from torch import float64 as torchfloat64
|
7
12
|
|
13
|
+
DEFAULT_FLOAT_DTYPE = torchfloat64
|
14
|
+
DEFAULT_COMPLEX_DTYPE = cdouble
|
15
|
+
set_default_dtype(DEFAULT_FLOAT_DTYPE)
|
16
|
+
|
17
|
+
logging_levels = {
|
18
|
+
"DEBUG": logging.DEBUG,
|
19
|
+
"INFO": logging.INFO,
|
20
|
+
"WARNING": logging.WARNING,
|
21
|
+
"ERROR": logging.ERROR,
|
22
|
+
"CRITICAL": logging.CRITICAL,
|
23
|
+
}
|
24
|
+
LOG_CONFIG_PATH = os.environ.get("QADENCE_LOG_CONFIG", f"{Path(__file__).parent}/log_config.yaml")
|
25
|
+
LOG_BASE_LEVEL = os.environ.get("QADENCE_LOG_LEVEL", "").upper()
|
26
|
+
|
27
|
+
with open(LOG_CONFIG_PATH, "r") as stream:
|
28
|
+
log_config = yaml.load(stream, Loader=yaml.FullLoader)
|
29
|
+
logging.config.dictConfig(log_config)
|
30
|
+
|
31
|
+
logger: logging.Logger = logging.getLogger(__name__)
|
32
|
+
LOG_LEVEL = logging_levels.get(LOG_BASE_LEVEL, logging.INFO) # type: ignore[arg-type]
|
33
|
+
logger.setLevel(LOG_LEVEL)
|
34
|
+
[
|
35
|
+
h.setLevel(LOG_LEVEL) # type: ignore[func-returns-value]
|
36
|
+
for h in logger.handlers
|
37
|
+
if h.get_name() == "console"
|
38
|
+
]
|
39
|
+
logger.debug(f"Qadence logger successfully setup with log level {LOG_LEVEL}")
|
40
|
+
|
8
41
|
from .analog import *
|
9
42
|
from .backend import *
|
10
43
|
from .backends import *
|
@@ -28,11 +61,6 @@ from .transpile import *
|
|
28
61
|
from .types import *
|
29
62
|
from .utils import *
|
30
63
|
|
31
|
-
DEFAULT_FLOAT_DTYPE = torchfloat64
|
32
|
-
DEFAULT_COMPLEX_DTYPE = cdouble
|
33
|
-
set_default_dtype(DEFAULT_FLOAT_DTYPE)
|
34
|
-
|
35
|
-
|
36
64
|
"""Fetch the functions defined in the __all__ of each sub-module.
|
37
65
|
|
38
66
|
Import to the qadence name space. Make sure each added submodule has the respective definition:
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
3
3
|
from abc import ABC, abstractmethod
|
4
4
|
from collections import Counter
|
5
5
|
from dataclasses import dataclass, fields
|
6
|
+
from logging import getLogger
|
6
7
|
from typing import Any, Callable, Iterator, Tuple
|
7
8
|
|
8
9
|
from openfermion import QubitOperator
|
@@ -20,14 +21,13 @@ from qadence.blocks import (
|
|
20
21
|
)
|
21
22
|
from qadence.blocks.analog import ConstantAnalogRotation, InteractionBlock
|
22
23
|
from qadence.circuit import QuantumCircuit
|
23
|
-
from qadence.logger import get_logger
|
24
24
|
from qadence.measurements import Measurements
|
25
25
|
from qadence.mitigations import Mitigations
|
26
26
|
from qadence.noise import Noise
|
27
27
|
from qadence.parameters import stringify
|
28
28
|
from qadence.types import ArrayLike, BackendName, DiffMode, Endianness, Engine, ParamDictType
|
29
29
|
|
30
|
-
logger =
|
30
|
+
logger = getLogger(__name__)
|
31
31
|
|
32
32
|
|
33
33
|
@dataclass
|
@@ -7,7 +7,7 @@ from pyqtorch.circuit import QuantumCircuit as PyQCircuit
|
|
7
7
|
from pyqtorch.parametric import Parametric as PyQParametric
|
8
8
|
from pyqtorch.primitive import Primitive as PyQPrimitive
|
9
9
|
from pyqtorch.utils import inner_prod, param_dict
|
10
|
-
from torch import Tensor, no_grad,
|
10
|
+
from torch import Tensor, no_grad, zeros
|
11
11
|
from torch.autograd import Function
|
12
12
|
from torch.nn import Module
|
13
13
|
|
@@ -125,7 +125,7 @@ class AdjointExpectation(Function):
|
|
125
125
|
ctx.projected_state, op.dagger(values), op.qubit_support
|
126
126
|
)
|
127
127
|
elif isinstance(op, PyQCircuit):
|
128
|
-
grads = [g for sub_op in op.
|
128
|
+
grads = [g for sub_op in op.operations[::-1] for g in _apply_adjoint(ctx, sub_op)]
|
129
129
|
elif isinstance(op, PyQPrimitive):
|
130
130
|
ctx.out_state = apply_operator(ctx.out_state, op.dagger(values), op.qubit_support)
|
131
131
|
if isinstance(op, PyQParametric) and values[op.param_name].requires_grad:
|
@@ -147,13 +147,17 @@ class AdjointExpectation(Function):
|
|
147
147
|
|
148
148
|
grads = list(
|
149
149
|
reversed(
|
150
|
-
[
|
150
|
+
[
|
151
|
+
grad_out * g
|
152
|
+
for op in ctx.circuit.operations[::-1]
|
153
|
+
for g in _apply_adjoint(ctx, op)
|
154
|
+
]
|
151
155
|
)
|
152
156
|
)
|
153
157
|
num_grads = len(grads)
|
154
158
|
num_params = len(ctx.saved_tensors)
|
155
159
|
diff = num_params - num_grads
|
156
|
-
grads = grads + [
|
160
|
+
grads = grads + [zeros(1, device=ctx.circuit.device) for _ in range(diff)]
|
157
161
|
# Set observable grads to 0
|
158
162
|
ctx.save_for_backward(*grads)
|
159
163
|
return (None, None, None, None, *grads)
|