qadence 1.11.1__tar.gz → 1.11.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. {qadence-1.11.1 → qadence-1.11.3}/.github/workflows/test_fast.yml +1 -1
  2. {qadence-1.11.1 → qadence-1.11.3}/.pre-commit-config.yaml +1 -1
  3. qadence-1.11.3/LICENSE +13 -0
  4. {qadence-1.11.1 → qadence-1.11.3}/PKG-INFO +22 -11
  5. {qadence-1.11.1 → qadence-1.11.3}/README.md +2 -2
  6. {qadence-1.11.1 → qadence-1.11.3}/mkdocs.yml +2 -0
  7. {qadence-1.11.1 → qadence-1.11.3}/pyproject.toml +18 -9
  8. {qadence-1.11.1 → qadence-1.11.3}/qadence/backend.py +33 -10
  9. qadence-1.11.3/qadence/backends/agpsr_utils.py +96 -0
  10. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/api.py +8 -1
  11. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/horqrux/backend.py +24 -10
  12. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/horqrux/config.py +17 -1
  13. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/horqrux/convert_ops.py +20 -97
  14. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/jax_utils.py +5 -2
  15. qadence-1.11.1/qadence/backends/gpsr.py → qadence-1.11.3/qadence/backends/parameter_shift_rules.py +48 -30
  16. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/pulser/backend.py +16 -9
  17. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/pulser/config.py +18 -0
  18. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/pyqtorch/backend.py +25 -11
  19. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/pyqtorch/config.py +18 -0
  20. {qadence-1.11.1 → qadence-1.11.3}/qadence/blocks/embedding.py +10 -1
  21. {qadence-1.11.1 → qadence-1.11.3}/qadence/blocks/primitive.py +2 -3
  22. {qadence-1.11.1 → qadence-1.11.3}/qadence/blocks/utils.py +33 -24
  23. {qadence-1.11.1 → qadence-1.11.3}/qadence/engines/differentiable_backend.py +7 -1
  24. {qadence-1.11.1 → qadence-1.11.3}/qadence/engines/jax/differentiable_backend.py +7 -1
  25. {qadence-1.11.1 → qadence-1.11.3}/qadence/engines/torch/differentiable_backend.py +12 -9
  26. {qadence-1.11.1 → qadence-1.11.3}/qadence/engines/torch/differentiable_expectation.py +12 -11
  27. {qadence-1.11.1 → qadence-1.11.3}/qadence/extensions.py +0 -10
  28. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/__init__.py +2 -0
  29. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/callbacks/callbackmanager.py +4 -2
  30. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/constructors.py +264 -4
  31. qadence-1.11.3/qadence/ml_tools/qcnn_model.py +158 -0
  32. {qadence-1.11.1 → qadence-1.11.3}/qadence/model.py +113 -8
  33. {qadence-1.11.1 → qadence-1.11.3}/qadence/parameters.py +2 -0
  34. {qadence-1.11.1 → qadence-1.11.3}/qadence/serialization.py +1 -1
  35. {qadence-1.11.1 → qadence-1.11.3}/qadence/transpile/__init__.py +3 -2
  36. {qadence-1.11.1 → qadence-1.11.3}/qadence/transpile/block.py +58 -5
  37. {qadence-1.11.1 → qadence-1.11.3}/qadence/types.py +2 -4
  38. {qadence-1.11.1 → qadence-1.11.3}/qadence/utils.py +39 -8
  39. qadence-1.11.1/LICENSE +0 -202
  40. {qadence-1.11.1 → qadence-1.11.3}/.coveragerc +0 -0
  41. {qadence-1.11.1 → qadence-1.11.3}/.github/ISSUE_TEMPLATE/bug-report.yml +0 -0
  42. {qadence-1.11.1 → qadence-1.11.3}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  43. {qadence-1.11.1 → qadence-1.11.3}/.github/ISSUE_TEMPLATE/new-feature.yml +0 -0
  44. {qadence-1.11.1 → qadence-1.11.3}/.github/workflows/build_docs.yml +0 -0
  45. {qadence-1.11.1 → qadence-1.11.3}/.github/workflows/lint.yml +0 -0
  46. {qadence-1.11.1 → qadence-1.11.3}/.github/workflows/test_all.yml +0 -0
  47. {qadence-1.11.1 → qadence-1.11.3}/.github/workflows/test_examples.yml +0 -0
  48. {qadence-1.11.1 → qadence-1.11.3}/.gitignore +0 -0
  49. {qadence-1.11.1 → qadence-1.11.3}/MANIFEST.in +0 -0
  50. {qadence-1.11.1 → qadence-1.11.3}/qadence/__init__.py +0 -0
  51. {qadence-1.11.1 → qadence-1.11.3}/qadence/analog/__init__.py +0 -0
  52. {qadence-1.11.1 → qadence-1.11.3}/qadence/analog/addressing.py +0 -0
  53. {qadence-1.11.1 → qadence-1.11.3}/qadence/analog/constants.py +0 -0
  54. {qadence-1.11.1 → qadence-1.11.3}/qadence/analog/device.py +0 -0
  55. {qadence-1.11.1 → qadence-1.11.3}/qadence/analog/hamiltonian_terms.py +0 -0
  56. {qadence-1.11.1 → qadence-1.11.3}/qadence/analog/parse_analog.py +0 -0
  57. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/__init__.py +0 -0
  58. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/horqrux/__init__.py +0 -0
  59. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/pulser/__init__.py +0 -0
  60. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/pulser/channels.py +0 -0
  61. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/pulser/cloud.py +0 -0
  62. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/pulser/convert_ops.py +0 -0
  63. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/pulser/devices.py +0 -0
  64. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/pulser/pulses.py +0 -0
  65. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/pulser/waveforms.py +0 -0
  66. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/pyqtorch/__init__.py +0 -0
  67. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/pyqtorch/convert_ops.py +0 -0
  68. {qadence-1.11.1 → qadence-1.11.3}/qadence/backends/utils.py +0 -0
  69. {qadence-1.11.1 → qadence-1.11.3}/qadence/blocks/__init__.py +0 -0
  70. {qadence-1.11.1 → qadence-1.11.3}/qadence/blocks/abstract.py +0 -0
  71. {qadence-1.11.1 → qadence-1.11.3}/qadence/blocks/analog.py +0 -0
  72. {qadence-1.11.1 → qadence-1.11.3}/qadence/blocks/block_to_tensor.py +0 -0
  73. {qadence-1.11.1 → qadence-1.11.3}/qadence/blocks/composite.py +0 -0
  74. {qadence-1.11.1 → qadence-1.11.3}/qadence/blocks/manipulate.py +0 -0
  75. {qadence-1.11.1 → qadence-1.11.3}/qadence/blocks/matrix.py +0 -0
  76. {qadence-1.11.1 → qadence-1.11.3}/qadence/circuit.py +0 -0
  77. {qadence-1.11.1 → qadence-1.11.3}/qadence/constructors/__init__.py +0 -0
  78. {qadence-1.11.1 → qadence-1.11.3}/qadence/constructors/ala.py +0 -0
  79. {qadence-1.11.1 → qadence-1.11.3}/qadence/constructors/daqc/__init__.py +0 -0
  80. {qadence-1.11.1 → qadence-1.11.3}/qadence/constructors/daqc/daqc.py +0 -0
  81. {qadence-1.11.1 → qadence-1.11.3}/qadence/constructors/daqc/gen_parser.py +0 -0
  82. {qadence-1.11.1 → qadence-1.11.3}/qadence/constructors/daqc/utils.py +0 -0
  83. {qadence-1.11.1 → qadence-1.11.3}/qadence/constructors/feature_maps.py +0 -0
  84. {qadence-1.11.1 → qadence-1.11.3}/qadence/constructors/hamiltonians.py +0 -0
  85. {qadence-1.11.1 → qadence-1.11.3}/qadence/constructors/hea.py +0 -0
  86. {qadence-1.11.1 → qadence-1.11.3}/qadence/constructors/iia.py +0 -0
  87. {qadence-1.11.1 → qadence-1.11.3}/qadence/constructors/qft.py +0 -0
  88. {qadence-1.11.1 → qadence-1.11.3}/qadence/constructors/rydberg_feature_maps.py +0 -0
  89. {qadence-1.11.1 → qadence-1.11.3}/qadence/constructors/rydberg_hea.py +0 -0
  90. {qadence-1.11.1 → qadence-1.11.3}/qadence/constructors/utils.py +0 -0
  91. {qadence-1.11.1 → qadence-1.11.3}/qadence/decompose.py +0 -0
  92. {qadence-1.11.1 → qadence-1.11.3}/qadence/divergences.py +0 -0
  93. {qadence-1.11.1 → qadence-1.11.3}/qadence/draw/__init__.py +0 -0
  94. {qadence-1.11.1 → qadence-1.11.3}/qadence/draw/assets/dark/measurement.png +0 -0
  95. {qadence-1.11.1 → qadence-1.11.3}/qadence/draw/assets/dark/measurement.svg +0 -0
  96. {qadence-1.11.1 → qadence-1.11.3}/qadence/draw/assets/light/measurement.png +0 -0
  97. {qadence-1.11.1 → qadence-1.11.3}/qadence/draw/assets/light/measurement.svg +0 -0
  98. {qadence-1.11.1 → qadence-1.11.3}/qadence/draw/themes.py +0 -0
  99. {qadence-1.11.1 → qadence-1.11.3}/qadence/draw/utils.py +0 -0
  100. {qadence-1.11.1 → qadence-1.11.3}/qadence/draw/vizbackend.py +0 -0
  101. {qadence-1.11.1 → qadence-1.11.3}/qadence/engines/__init__.py +0 -0
  102. {qadence-1.11.1 → qadence-1.11.3}/qadence/engines/jax/__init__.py +0 -0
  103. {qadence-1.11.1 → qadence-1.11.3}/qadence/engines/jax/differentiable_expectation.py +0 -0
  104. {qadence-1.11.1 → qadence-1.11.3}/qadence/engines/torch/__init__.py +0 -0
  105. {qadence-1.11.1 → qadence-1.11.3}/qadence/exceptions/__init__.py +0 -0
  106. {qadence-1.11.1 → qadence-1.11.3}/qadence/exceptions/exceptions.py +0 -0
  107. {qadence-1.11.1 → qadence-1.11.3}/qadence/execution.py +0 -0
  108. {qadence-1.11.1 → qadence-1.11.3}/qadence/libs.py +0 -0
  109. {qadence-1.11.1 → qadence-1.11.3}/qadence/log_config.yaml +0 -0
  110. {qadence-1.11.1 → qadence-1.11.3}/qadence/logger.py +0 -0
  111. {qadence-1.11.1 → qadence-1.11.3}/qadence/measurements/__init__.py +0 -0
  112. {qadence-1.11.1 → qadence-1.11.3}/qadence/measurements/protocols.py +0 -0
  113. {qadence-1.11.1 → qadence-1.11.3}/qadence/measurements/samples.py +0 -0
  114. {qadence-1.11.1 → qadence-1.11.3}/qadence/measurements/shadow.py +0 -0
  115. {qadence-1.11.1 → qadence-1.11.3}/qadence/measurements/tomography.py +0 -0
  116. {qadence-1.11.1 → qadence-1.11.3}/qadence/measurements/utils.py +0 -0
  117. {qadence-1.11.1 → qadence-1.11.3}/qadence/mitigations/__init__.py +0 -0
  118. {qadence-1.11.1 → qadence-1.11.3}/qadence/mitigations/analog_zne.py +0 -0
  119. {qadence-1.11.1 → qadence-1.11.3}/qadence/mitigations/protocols.py +0 -0
  120. {qadence-1.11.1 → qadence-1.11.3}/qadence/mitigations/readout.py +0 -0
  121. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/callbacks/__init__.py +0 -0
  122. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/callbacks/callback.py +0 -0
  123. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/callbacks/saveload.py +0 -0
  124. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/callbacks/writer_registry.py +0 -0
  125. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/config.py +0 -0
  126. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/data.py +0 -0
  127. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/information/__init__.py +0 -0
  128. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/information/information_content.py +0 -0
  129. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/loss/__init__.py +0 -0
  130. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/loss/loss.py +0 -0
  131. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/models.py +0 -0
  132. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/optimize_step.py +0 -0
  133. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/parameters.py +0 -0
  134. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/stages.py +0 -0
  135. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/tensors.py +0 -0
  136. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/train_utils/__init__.py +0 -0
  137. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/train_utils/accelerator.py +0 -0
  138. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/train_utils/base_trainer.py +0 -0
  139. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/train_utils/config_manager.py +0 -0
  140. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/train_utils/distribution.py +0 -0
  141. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/train_utils/execution.py +0 -0
  142. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/trainer.py +0 -0
  143. {qadence-1.11.1 → qadence-1.11.3}/qadence/ml_tools/utils.py +0 -0
  144. {qadence-1.11.1 → qadence-1.11.3}/qadence/noise/__init__.py +0 -0
  145. {qadence-1.11.1 → qadence-1.11.3}/qadence/noise/protocols.py +0 -0
  146. {qadence-1.11.1 → qadence-1.11.3}/qadence/operations/__init__.py +0 -0
  147. {qadence-1.11.1 → qadence-1.11.3}/qadence/operations/analog.py +0 -0
  148. {qadence-1.11.1 → qadence-1.11.3}/qadence/operations/control_ops.py +0 -0
  149. {qadence-1.11.1 → qadence-1.11.3}/qadence/operations/ham_evo.py +0 -0
  150. {qadence-1.11.1 → qadence-1.11.3}/qadence/operations/parametric.py +0 -0
  151. {qadence-1.11.1 → qadence-1.11.3}/qadence/operations/primitive.py +0 -0
  152. {qadence-1.11.1 → qadence-1.11.3}/qadence/overlap.py +0 -0
  153. {qadence-1.11.1 → qadence-1.11.3}/qadence/pasqal_cloud_connection.py +0 -0
  154. {qadence-1.11.1 → qadence-1.11.3}/qadence/protocols.py +0 -0
  155. {qadence-1.11.1 → qadence-1.11.3}/qadence/py.typed +0 -0
  156. {qadence-1.11.1 → qadence-1.11.3}/qadence/qubit_support.py +0 -0
  157. {qadence-1.11.1 → qadence-1.11.3}/qadence/register.py +0 -0
  158. {qadence-1.11.1 → qadence-1.11.3}/qadence/serial_expr_grammar.peg +0 -0
  159. {qadence-1.11.1 → qadence-1.11.3}/qadence/states.py +0 -0
  160. {qadence-1.11.1 → qadence-1.11.3}/qadence/transpile/apply_fn.py +0 -0
  161. {qadence-1.11.1 → qadence-1.11.3}/qadence/transpile/circuit.py +0 -0
  162. {qadence-1.11.1 → qadence-1.11.3}/qadence/transpile/digitalize.py +0 -0
  163. {qadence-1.11.1 → qadence-1.11.3}/qadence/transpile/flatten.py +0 -0
  164. {qadence-1.11.1 → qadence-1.11.3}/qadence/transpile/invert.py +0 -0
  165. {qadence-1.11.1 → qadence-1.11.3}/qadence/transpile/noise.py +0 -0
  166. {qadence-1.11.1 → qadence-1.11.3}/qadence/transpile/transpile.py +0 -0
  167. {qadence-1.11.1 → qadence-1.11.3}/renovate.json +0 -0
  168. {qadence-1.11.1 → qadence-1.11.3}/setup.py +0 -0
@@ -22,7 +22,7 @@ jobs:
22
22
  runs-on: ubuntu-latest
23
23
  strategy:
24
24
  matrix:
25
- python-version: ["3.9", "3.10", "3.11"]
25
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
26
26
  steps:
27
27
  - name: Checkout Qadence
28
28
  uses: actions/checkout@v4
@@ -23,7 +23,7 @@ repos:
23
23
  rev: v1.14.1
24
24
  hooks:
25
25
  - id: mypy
26
- args: [--install-types, --non-interactive]
26
+ args: [--install-types, --non-interactive, --explicit-package-bases]
27
27
  exclude: examples|docs
28
28
 
29
29
  - repo: https://github.com/DanielNoord/pydocstringformatter
qadence-1.11.3/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ PASQAL OPEN-SOURCE SOFTWARE LICENSE AGREEMENT (MIT-derived)
2
+
3
+ The author of the License is:
4
+ Pasqal, a Société par Actions Simplifiée (Simplified Joint Stock Company) registered under number 849 441 522 at the Registre du commerce et des sociétés (Trade and Companies Register) of Evry – France, headquartered at 24 rue Émile Baudot – 91120 – Palaiseau – France, duly represented by its Président, M. Georges-Olivier REYMOND, Hereafter referred to as « the Licensor »
5
+
6
+ - Permission is hereby granted, free of charge, to any person obtaining a copy of this software (the “Licensee”) and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Software is “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non-infringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise arising from, out of or in connection with the Software or the use or other dealings in the Software.
8
+
9
+ - If use of the Software leads to the necessary use of any patent of the Licensor and/or any of its Affiliates (defined as a company owned or controlled by the Licensor), the Licensee is granted a royalty-free license, in any country where such patent is in force, to use the object of such patent; or use the process covered by such patent,
10
+
11
+ - Such a patent license is granted for internal research or academic use of the Licensee's, which includes use by employees and students of the Licensee, acting on behalf of the Licensee, for research purposes only.
12
+
13
+ - The License is governed by the laws of France. Any dispute relating to the License, notably its execution, performance and/or termination shall be brought to, heard and tried by the Tribunal Judiciaire de Paris, regardless of the rules of jurisdiction in the matter.
@@ -1,17 +1,18 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qadence
3
- Version: 1.11.1
3
+ Version: 1.11.3
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>, Smit Chaudhary <smit.chaudhary@pasqal.com>, Ignacio Fernández Graña <ignacio.fernandez-grana@pasqal.com>, Charles Moussa <charles.moussa@pasqal.com>, Giorgio Tosti Balducci <giorgio.tosti-balducci@pasqal.com>, Daniele Cucurachi <daniele.cucurachi@pasqal.com>, Pim Venderbosch <pim.venderbosch@pasqal.com>, Manu Lahariya <manu.lahariya@pasqal.com>
6
- License: Apache 2.0
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>, Ignacio Fernández Graña <ignacio.fernandez-grana@pasqal.com>, Charles Moussa <charles.moussa@pasqal.com>, Giorgio Tosti Balducci <giorgio.tosti-balducci@pasqal.com>, Daniele Cucurachi <daniele.cucurachi@pasqal.com>, Pim Venderbosch <pim.venderbosch@pasqal.com>, Manu Lahariya <manu.lahariya@pasqal.com>, Sungwoo Ahn <sungwoo.ahn@pasqal.com>
6
+ License: PASQAL OPEN-SOURCE SOFTWARE LICENSE (MIT-derived)
7
7
  License-File: LICENSE
8
- Classifier: License :: OSI Approved :: Apache Software License
8
+ Classifier: License :: Other/Proprietary License
9
9
  Classifier: Programming Language :: Python
10
10
  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
14
  Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
15
16
  Classifier: Programming Language :: Python :: Implementation :: CPython
16
17
  Classifier: Programming Language :: Python :: Implementation :: PyPy
17
18
  Requires-Python: >=3.9
@@ -23,11 +24,11 @@ Requires-Dist: nevergrad
23
24
  Requires-Dist: numpy
24
25
  Requires-Dist: openfermion
25
26
  Requires-Dist: pasqal-cloud
26
- Requires-Dist: pyqtorch==1.7.2
27
+ Requires-Dist: pyqtorch==1.7.6
27
28
  Requires-Dist: pyyaml
28
29
  Requires-Dist: rich
29
30
  Requires-Dist: scipy
30
- Requires-Dist: sympy<1.13
31
+ Requires-Dist: sympy<1.13.4
31
32
  Requires-Dist: sympytorch>=0.1.2
32
33
  Requires-Dist: tensorboard>=2.12.0
33
34
  Requires-Dist: torch
@@ -43,21 +44,31 @@ Requires-Dist: nvidia-pyindex; extra == 'dlprof'
43
44
  Provides-Extra: horqrux
44
45
  Requires-Dist: einops; extra == 'horqrux'
45
46
  Requires-Dist: flax; extra == 'horqrux'
46
- Requires-Dist: horqrux==0.7.0; extra == 'horqrux'
47
+ Requires-Dist: horqrux==0.8.1; extra == 'horqrux'
47
48
  Requires-Dist: jax; extra == 'horqrux'
48
49
  Requires-Dist: jaxopt; extra == 'horqrux'
49
50
  Requires-Dist: optax; extra == 'horqrux'
50
51
  Requires-Dist: sympy2jax; extra == 'horqrux'
52
+ Provides-Extra: hub
53
+ Requires-Dist: qadence-measurement; extra == 'hub'
54
+ Requires-Dist: qadence-mitigation; extra == 'hub'
55
+ Requires-Dist: qadence-model; extra == 'hub'
51
56
  Provides-Extra: libs
52
57
  Requires-Dist: qadence-libs; extra == 'libs'
58
+ Provides-Extra: measurement
59
+ Requires-Dist: qadence-measurement; extra == 'measurement'
60
+ Provides-Extra: mitigation
61
+ Requires-Dist: qadence-mitigation; extra == 'mitigation'
53
62
  Provides-Extra: mlflow
54
63
  Requires-Dist: mlflow; extra == 'mlflow'
64
+ Provides-Extra: model
65
+ Requires-Dist: qadence-model; extra == 'model'
55
66
  Provides-Extra: protocols
56
67
  Requires-Dist: qadence-protocols; extra == 'protocols'
57
68
  Provides-Extra: pulser
58
69
  Requires-Dist: pasqal-cloud==0.20.2; extra == 'pulser'
59
- Requires-Dist: pulser-core==1.3.0; extra == 'pulser'
60
- Requires-Dist: pulser-simulation==1.3.0; extra == 'pulser'
70
+ Requires-Dist: pulser-core==1.4.0; extra == 'pulser'
71
+ Requires-Dist: pulser-simulation==1.4.0; extra == 'pulser'
61
72
  Provides-Extra: visualization
62
73
  Requires-Dist: graphviz; extra == 'visualization'
63
74
  Description-Content-Type: text/markdown
@@ -84,7 +95,7 @@ programs** with tunable qubit interactions and arbitrary register topologies rea
84
95
  [![Tests](https://github.com/pasqal-io/qadence/actions/workflows/test_fast.yml/badge.svg)](https://github.com/pasqal-io/qadence/actions/workflows/test_fast.yml)
85
96
  [![Documentation](https://github.com/pasqal-io/qadence/actions/workflows/build_docs.yml/badge.svg)](https://pasqal-io.github.io/qadence/latest)
86
97
  [![Pypi](https://badge.fury.io/py/qadence.svg)](https://pypi.org/project/qadence/)
87
- [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
98
+ [![License](https://img.shields.io/badge/License-MIT--derived-yellow.svg)](https://opensource.org/licenses/MIT)
88
99
  ![Coverage](https://img.shields.io/codecov/c/github/pasqal-io/qadence?style=flat-square)
89
100
 
90
101
 
@@ -215,4 +226,4 @@ doi = {10.1109/MS.2025.3536607}
215
226
  ```
216
227
 
217
228
  ## License
218
- Qadence is a free and open source software package, released under the Apache License, Version 2.0.
229
+ Qadence is a free and open source software package, released under the PASQAL OPEN-SOURCE SOFTWARE LICENSE (MIT-derived).
@@ -20,7 +20,7 @@ programs** with tunable qubit interactions and arbitrary register topologies rea
20
20
  [![Tests](https://github.com/pasqal-io/qadence/actions/workflows/test_fast.yml/badge.svg)](https://github.com/pasqal-io/qadence/actions/workflows/test_fast.yml)
21
21
  [![Documentation](https://github.com/pasqal-io/qadence/actions/workflows/build_docs.yml/badge.svg)](https://pasqal-io.github.io/qadence/latest)
22
22
  [![Pypi](https://badge.fury.io/py/qadence.svg)](https://pypi.org/project/qadence/)
23
- [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
23
+ [![License](https://img.shields.io/badge/License-MIT--derived-yellow.svg)](https://opensource.org/licenses/MIT)
24
24
  ![Coverage](https://img.shields.io/codecov/c/github/pasqal-io/qadence?style=flat-square)
25
25
 
26
26
 
@@ -151,4 +151,4 @@ doi = {10.1109/MS.2025.3536607}
151
151
  ```
152
152
 
153
153
  ## License
154
- Qadence is a free and open source software package, released under the Apache License, Version 2.0.
154
+ Qadence is a free and open source software package, released under the PASQAL OPEN-SOURCE SOFTWARE LICENSE (MIT-derived).
@@ -45,8 +45,10 @@ nav:
45
45
  - tutorials/qml/index.md
46
46
  - Configuring a QNN: tutorials/qml/config_qnn.md
47
47
  - Quantum circuit learning: tutorials/qml/qcl.md
48
+ - Classification with QNN: tutorials/qml/classification.md
48
49
  - Solving MaxCut with QAOA: tutorials/qml/qaoa.md
49
50
  - Solving a 1D ODE: tutorials/qml/dqc_1d.md
51
+ - QCNN model: tutorials/qml/qcnn.md
50
52
 
51
53
  - ML Tools:
52
54
  - tutorials/qml/ml_tools/intro.md
@@ -25,18 +25,20 @@ authors = [
25
25
  { name = "Daniele Cucurachi", email = "daniele.cucurachi@pasqal.com" },
26
26
  { name = "Pim Venderbosch", email = "pim.venderbosch@pasqal.com" },
27
27
  { name = "Manu Lahariya", email = "manu.lahariya@pasqal.com" },
28
+ { name = "Sungwoo Ahn", email = "sungwoo.ahn@pasqal.com" },
28
29
  ]
29
30
  requires-python = ">=3.9"
30
- license = { text = "Apache 2.0" }
31
- version = "1.11.1"
31
+ license = { text = "PASQAL OPEN-SOURCE SOFTWARE LICENSE (MIT-derived)" }
32
+ version = "1.11.3"
32
33
  classifiers = [
33
- "License :: OSI Approved :: Apache Software License",
34
+ "License :: Other/Proprietary License",
34
35
  "Programming Language :: Python",
35
36
  "Programming Language :: Python :: 3",
36
37
  "Programming Language :: Python :: 3.9",
37
38
  "Programming Language :: Python :: 3.10",
38
39
  "Programming Language :: Python :: 3.11",
39
40
  "Programming Language :: Python :: 3.12",
41
+ "Programming Language :: Python :: 3.13",
40
42
  "Programming Language :: Python :: Implementation :: CPython",
41
43
  "Programming Language :: Python :: Implementation :: PyPy",
42
44
  ]
@@ -44,7 +46,7 @@ dependencies = [
44
46
  "numpy",
45
47
  "torch",
46
48
  "openfermion",
47
- "sympy<1.13",
49
+ "sympy<1.13.4",
48
50
  "sympytorch>=0.1.2",
49
51
  "rich",
50
52
  "tensorboard>=2.12.0",
@@ -52,7 +54,7 @@ dependencies = [
52
54
  "jsonschema",
53
55
  "nevergrad",
54
56
  "scipy",
55
- "pyqtorch==1.7.2",
57
+ "pyqtorch==1.7.6",
56
58
  "pyyaml",
57
59
  "matplotlib",
58
60
  "Arpeggio==2.0.2",
@@ -65,8 +67,8 @@ allow-ambiguous-features = true
65
67
 
66
68
  [project.optional-dependencies]
67
69
  pulser = [
68
- "pulser-core==1.3.0",
69
- "pulser-simulation==1.3.0",
70
+ "pulser-core==1.4.0",
71
+ "pulser-simulation==1.4.0",
70
72
  "pasqal-cloud==0.20.2",
71
73
  ]
72
74
  visualization = [
@@ -76,7 +78,7 @@ visualization = [
76
78
  # "scour",
77
79
  ]
78
80
  horqrux = [
79
- "horqrux==0.7.0",
81
+ "horqrux==0.8.1",
80
82
  "jax",
81
83
  "flax",
82
84
  "optax",
@@ -89,7 +91,14 @@ libs = ["qadence-libs"]
89
91
  dlprof = ["nvidia-pyindex", "nvidia-dlprof[pytorch]"]
90
92
  mlflow = ["mlflow"]
91
93
  all = ["pulser", "visualization", "protocols", "libs", "mlflow"]
92
-
94
+ hub = [
95
+ "qadence-mitigation",
96
+ "qadence-measurement",
97
+ "qadence-model",
98
+ ]
99
+ mitigation = ["qadence-mitigation"]
100
+ measurement = ["qadence-measurement"]
101
+ model = ["qadence-model"]
93
102
 
94
103
  [tool.hatch.envs.default]
95
104
  dependencies = [
@@ -25,7 +25,14 @@ from qadence.measurements import Measurements
25
25
  from qadence.mitigations import Mitigations
26
26
  from qadence.noise import NoiseHandler
27
27
  from qadence.parameters import stringify
28
- from qadence.types import ArrayLike, BackendName, DiffMode, Endianness, Engine, ParamDictType
28
+ from qadence.types import (
29
+ ArrayLike,
30
+ BackendName,
31
+ DiffMode,
32
+ Endianness,
33
+ Engine,
34
+ ParamDictType,
35
+ )
29
36
 
30
37
  logger = getLogger(__name__)
31
38
 
@@ -54,11 +61,18 @@ class BackendConfiguration:
54
61
  conf_msg = ""
55
62
  for _field in fields(self):
56
63
  if not _field.name.startswith("_"):
57
- conf_msg += (
58
- f"Name: {_field.name} - Type: {_field.type} - Default value: {_field.default}\n"
59
- )
64
+ conf_msg += f"Name: {_field.name} - Type: {_field.type} - Current value: {getattr(self, _field.name)} - Default value: {_field.default}\n"
60
65
  return conf_msg
61
66
 
67
+ def change_config(self, new_config: dict) -> None:
68
+ """Change configuration with the input."""
69
+
70
+ for key, value in new_config.items():
71
+ if hasattr(self, key):
72
+ setattr(self, key, value)
73
+ else:
74
+ raise ValueError(f"Warning: '{key}' is not a valid configuration attribute.")
75
+
62
76
  @classmethod
63
77
  def from_dict(cls, values: dict) -> BackendConfiguration:
64
78
  field_names = {field.name for field in fields(cls)}
@@ -208,7 +222,7 @@ class Backend(ABC):
208
222
  if observable is not None:
209
223
  observable = observable if isinstance(observable, list) else [observable]
210
224
  conv_obs = []
211
- obs_embedding_fn_list = []
225
+ obs_embedding_fns = []
212
226
 
213
227
  for obs in observable:
214
228
  obs = check_observable(obs)
@@ -217,13 +231,18 @@ class Backend(ABC):
217
231
  c_obs.abstract, self.config._use_gate_params, self.engine
218
232
  )
219
233
  params.update(obs_params)
220
- obs_embedding_fn_list.append(obs_embedding_fn)
234
+ obs_embedding_fns.append(obs_embedding_fn)
221
235
  conv_obs.append(c_obs)
222
236
 
223
237
  def embedding_fn_dict(a: dict, b: dict) -> dict:
224
- embedding_dict = circ_embedding_fn(a, b)
225
- for o in obs_embedding_fn_list:
226
- embedding_dict.update(o(a, b))
238
+ if "circuit" in b or "observables" in b:
239
+ embedding_dict = {"circuit": circ_embedding_fn(a, b), "observables": dict()}
240
+ for obs_embedding_fn in obs_embedding_fns:
241
+ embedding_dict["observables"].update(obs_embedding_fn(a, b))
242
+ else:
243
+ embedding_dict = circ_embedding_fn(a, b)
244
+ for obs_embedding_fn in obs_embedding_fns:
245
+ embedding_dict.update(obs_embedding_fn(a, b))
227
246
  return embedding_dict
228
247
 
229
248
  return Converted(conv_circ, conv_obs, embedding_fn_dict, params)
@@ -309,7 +328,11 @@ class Backend(ABC):
309
328
  raise NotImplementedError
310
329
 
311
330
  @abstractmethod
312
- def assign_parameters(self, circuit: ConvertedCircuit, param_values: dict[str, Tensor]) -> Any:
331
+ def assign_parameters(
332
+ self,
333
+ circuit: ConvertedCircuit,
334
+ param_values: dict[str, Tensor] | dict[str, dict[str, Tensor]],
335
+ ) -> Any:
313
336
  raise NotImplementedError
314
337
 
315
338
  @staticmethod
@@ -0,0 +1,96 @@
1
+ from __future__ import annotations
2
+
3
+ from functools import lru_cache
4
+ from typing import Callable
5
+
6
+ import numpy as np
7
+ import torch
8
+ from scipy.optimize import minimize
9
+ from torch import Tensor
10
+
11
+
12
+ def variance(shifts: Tensor, spectral_gaps: Tensor) -> Tensor:
13
+ """Calculate the exact variance of deirivative estimation using aGPSR.
14
+
15
+ Args:
16
+ shifts (Tensor): shifts to apply for each spectral gap
17
+ spectral_gaps (Tensor): tensor containing spectral gap values
18
+
19
+ Returns:
20
+ Tensor: variance tensor
21
+ """
22
+
23
+ # calculate inverse of M (see: https://arxiv.org/pdf/2108.01218.pdf on p. 4 for definitions)
24
+ M = 4 * torch.sin(torch.outer(torch.as_tensor(shifts), spectral_gaps) / 2)
25
+ try:
26
+ # calculate the variance of derivative estimation by solving a linear equation system
27
+ a = torch.linalg.solve(M, spectral_gaps.reshape(-1, 1))
28
+ var = 2 * torch.matmul(a.T, a)
29
+ except RuntimeError: # matrix M is singulkar
30
+ # fallback method of variance calculation using inverse matrix
31
+ M_inv = torch.linalg.pinv(M)
32
+ a = torch.matmul(spectral_gaps.reshape(1, -1), M_inv)
33
+ var = 2 * torch.matmul(a, a.T)
34
+
35
+ return var
36
+
37
+
38
+ @lru_cache
39
+ def calculate_optimal_shifts(
40
+ n_eqs: int,
41
+ spectral_gaps: Tensor,
42
+ lb: float,
43
+ ub: float,
44
+ ) -> Tensor:
45
+ """Calculates optimal shift values for GPSR algorithm.
46
+
47
+ Args:
48
+ n_eqs (int): number of equations in linear equation system for derivative estimation
49
+ spectral_gaps (Tensor): tensor containing spectral gap values
50
+ lb (float): lower bound of optimal shift value search interval
51
+ ub (float): upper bound of optimal shift value search interval
52
+
53
+ Returns:
54
+ Tensor: optimal shift values
55
+ """
56
+ if not (lb and ub):
57
+ raise ValueError("Both lower and upper bounds of optimization interval must be given.")
58
+
59
+ constraints = []
60
+
61
+ # specify solution bound constraints
62
+ for i in range(n_eqs):
63
+
64
+ def fn_lb(x, i=i): # type: ignore [no-untyped-def]
65
+ return x[i] - lb
66
+
67
+ def fn_ub(x, i=i): # type: ignore [no-untyped-def]
68
+ return ub - x[i]
69
+
70
+ constraints.append({"type": "ineq", "fun": fn_lb})
71
+ constraints.append({"type": "ineq", "fun": fn_ub})
72
+
73
+ # specify constraints for solutions to be unique
74
+ for i in range(n_eqs - 1, 0, -1):
75
+ for j in range(i):
76
+
77
+ def fn(x, i=i, j=j): # type: ignore [no-untyped-def]
78
+ return np.abs(x[i] - x[j]) - 0.02
79
+
80
+ constraints.append({"type": "ineq", "fun": fn})
81
+
82
+ init_guess = torch.linspace(lb, ub, n_eqs)
83
+
84
+ def minimize_variance(
85
+ var_fn: Callable[[Tensor, Tensor], Tensor],
86
+ ) -> Tensor:
87
+ res = minimize(
88
+ fun=var_fn,
89
+ x0=init_guess,
90
+ args=(spectral_gaps,),
91
+ method="COBYLA",
92
+ constraints=constraints,
93
+ )
94
+ return torch.as_tensor(res.x)
95
+
96
+ return minimize_variance(variance)
@@ -50,7 +50,14 @@ def backend_factory(
50
50
  # Wrap the quantum Backend in a DifferentiableBackend if a diff_mode is passed.
51
51
  if diff_mode is not None:
52
52
  diff_backend_cls = import_engine(backend_inst.engine)
53
- backend_inst = diff_backend_cls(backend=backend_inst, diff_mode=DiffMode(diff_mode)) # type: ignore[operator]
53
+ psr_args = {
54
+ "n_eqs": configuration.n_eqs, # type: ignore [attr-defined]
55
+ "shift_prefac": configuration.shift_prefac, # type: ignore [attr-defined]
56
+ "gap_step": configuration.gap_step, # type: ignore [attr-defined]
57
+ "lb": configuration.lb, # type: ignore [attr-defined]
58
+ "ub": configuration.ub, # type: ignore [attr-defined]
59
+ }
60
+ backend_inst = diff_backend_cls(backend=backend_inst, diff_mode=DiffMode(diff_mode), **psr_args) # type: ignore[operator]
54
61
  return backend_inst
55
62
  except (BackendNotFoundError, EngineNotFoundError, ConfigNotFoundError) as e:
56
63
  logger.error(e.msg)
@@ -7,7 +7,7 @@ from typing import Any
7
7
 
8
8
  import jax
9
9
  import jax.numpy as jnp
10
- from horqrux.utils import zero_state
10
+ from horqrux.utils.operator_utils import zero_state
11
11
  from jax.typing import ArrayLike
12
12
 
13
13
  from qadence.backend import Backend as BackendInterface
@@ -27,7 +27,8 @@ from qadence.types import BackendName, Endianness, Engine, ParamDictType
27
27
  from qadence.utils import int_to_basis
28
28
 
29
29
  from .config import Configuration, default_passes
30
- from .convert_ops import HorqruxCircuit, convert_block, convert_observable
30
+ from .convert_ops import convert_block, convert_observable
31
+ from horqrux.circuit import QuantumCircuit as HorqruxCircuit
31
32
 
32
33
  logger = getLogger(__name__)
33
34
 
@@ -58,7 +59,7 @@ class Backend(BackendInterface):
58
59
  circuit = transpile(*passes)(circuit)
59
60
  ops = convert_block(circuit.block, n_qubits=circuit.n_qubits, config=self.config)
60
61
  return ConvertedCircuit(
61
- native=HorqruxCircuit(ops), abstract=circuit, original=original_circ
62
+ native=HorqruxCircuit(circuit.n_qubits, ops), abstract=circuit, original=original_circ
62
63
  )
63
64
 
64
65
  def observable(self, observable: AbstractBlock, n_qubits: int) -> ConvertedObservable:
@@ -97,7 +98,7 @@ class Backend(BackendInterface):
97
98
  state = zero_state(n_qubits)
98
99
  else:
99
100
  state = horqify(state) if horqify_state else state
100
- state = circuit.native.forward(state, param_values)
101
+ state = circuit.native(state, param_values)
101
102
  if endianness != self.native_endianness:
102
103
  state = jnp.reshape(state, (1, 2**n_qubits)) # batch_size is always 1
103
104
  ls = list(range(2**n_qubits))
@@ -133,19 +134,32 @@ class Backend(BackendInterface):
133
134
  Returns:
134
135
  A jax.Array of shape (batch_size, n_observables)
135
136
  """
136
- observable = observable if isinstance(observable, list) else [observable]
137
- batch_size = max([arr.size for arr in param_values.values()])
137
+ observables = observable if isinstance(observable, list) else [observable]
138
+ if "observables" in param_values or "circuit" in param_values:
139
+ raise NotImplementedError("The Horqrux backend does not support separated parameters.")
140
+ else:
141
+ merged_params = param_values
142
+ batch_size = max([arr.size for arr in param_values.values()]) # type: ignore[union-attr]
138
143
  n_obs = len(observable)
139
144
 
140
145
  def _expectation(params: ParamDictType) -> ArrayLike:
146
+ param_circuits = params["circuit"] if "circuit" in params else params
147
+ param_observables = params["observables"] if "observables" in params else params
141
148
  out_state = self.run(
142
- circuit, params, state, endianness, horqify_state=True, unhorqify_state=False
149
+ circuit,
150
+ param_circuits,
151
+ state,
152
+ endianness,
153
+ horqify_state=True,
154
+ unhorqify_state=False,
155
+ )
156
+ return jnp.array(
157
+ [observable.native(out_state, param_observables) for observable in observables]
143
158
  )
144
- return jnp.array([o.native.forward(out_state, params) for o in observable])
145
159
 
146
160
  if batch_size > 1: # We vmap for batch_size > 1
147
- expvals = jax.vmap(_expectation, in_axes=({k: 0 for k in param_values.keys()},))(
148
- uniform_batchsize(param_values)
161
+ expvals = jax.vmap(_expectation, in_axes=({k: 0 for k in merged_params.keys()},))(
162
+ uniform_batchsize(merged_params)
149
163
  )
150
164
  else:
151
165
  expvals = _expectation(param_values)
@@ -32,4 +32,20 @@ def default_passes(config: Configuration) -> list[Callable]:
32
32
 
33
33
  @dataclass
34
34
  class Configuration(BackendConfiguration):
35
- pass
35
+ n_eqs: int | None = None
36
+ """Number of equations to use in aGPSR calculations."""
37
+
38
+ shift_prefac: float = 0.5
39
+ """Prefactor governing the magnitude of parameter shift values.
40
+
41
+ Select smaller value if spectral gaps are large.
42
+ """
43
+
44
+ gap_step: float = 1.0
45
+ """Step between generated pseudo-gaps when using aGPSR algorithm."""
46
+
47
+ lb: float | None = None
48
+ """Lower bound of optimal shift value search interval."""
49
+
50
+ ub: float | None = None
51
+ """Upper bound of optimal shift value search interval."""