qml-essentials 0.2.1__tar.gz → 0.2.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.
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/.github/workflows/docs-publish.yml +4 -4
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/.github/workflows/docs.yml +4 -4
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/.github/workflows/publish.yml +2 -2
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/.github/workflows/quality-publish.yml +2 -2
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/.github/workflows/quality.yml +2 -2
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/.github/workflows/test-on-pr.yml +3 -3
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/.github/workflows/test-on-publish.yml +2 -2
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/.gitignore +1 -2
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/CITATION.cff +2 -2
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/PKG-INFO +4 -2
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/ansaetze.md +26 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/benchmarks.py +2 -2
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/coefficients.ipynb +4 -23
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/coefficients.md +109 -7
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/entanglement.md +11 -1
- qml_essentials-0.2.3/docs/expressibility.md +48 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/generate_circuits.py +14 -10
- qml_essentials-0.2.3/docs/jaqsi.md +356 -0
- qml_essentials-0.2.3/docs/math_utils.md +108 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/noise.md +20 -1
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/pulses.ipynb +2 -2
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/pulses.md +64 -6
- qml_essentials-0.2.3/docs/random_sampling.md +117 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/references.md +52 -4
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/training.md +36 -6
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/usage.md +64 -12
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/mkdocs.yml +2 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/pyproject.toml +3 -1
- qml_essentials-0.2.3/qml_essentials/algebra.py +338 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/qml_essentials/ansaetze.py +231 -90
- qml_essentials-0.2.3/qml_essentials/coefficients.py +2246 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/qml_essentials/drawing.py +12 -4
- qml_essentials-0.2.1/qml_essentials/jaqsi.py → qml_essentials-0.2.3/qml_essentials/evolution.py +20 -128
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/qml_essentials/expressibility.py +2 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/qml_essentials/gates.py +20 -1
- qml_essentials-0.2.3/qml_essentials/jaqsi.py +167 -0
- qml_essentials-0.2.3/qml_essentials/math.py +431 -0
- qml_essentials-0.2.3/qml_essentials/memory.py +345 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/qml_essentials/model.py +1144 -256
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/qml_essentials/operations.py +812 -160
- qml_essentials-0.2.3/qml_essentials/pauli.py +341 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/qml_essentials/pulses.py +171 -21
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/qml_essentials/qoc.py +5 -5
- qml_essentials-0.2.3/qml_essentials/random_sampling.py +312 -0
- qml_essentials-0.2.3/qml_essentials/script.py +720 -0
- qml_essentials-0.2.3/qml_essentials/simulation.py +400 -0
- qml_essentials-0.2.3/qml_essentials/states.py +134 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/qml_essentials/topologies.py +6 -0
- qml_essentials-0.2.3/qml_essentials/trainability.py +128 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/qml_essentials/unitary.py +125 -33
- qml_essentials-0.2.3/qml_essentials/utils.py +13 -0
- qml_essentials-0.2.3/tests/test_algebra.py +312 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/tests/test_ansaetze.py +220 -10
- qml_essentials-0.2.3/tests/test_coefficients.py +1682 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/tests/test_jaqsi.py +368 -354
- qml_essentials-0.2.3/tests/test_matchgate_migration.py +147 -0
- qml_essentials-0.2.3/tests/test_math.py +468 -0
- qml_essentials-0.2.3/tests/test_model.py +2295 -0
- qml_essentials-0.2.3/tests/test_pauli.py +258 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/tests/test_pulse_state.py +3 -3
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/tests/test_qoc.py +8 -4
- qml_essentials-0.2.3/tests/test_random_sampling.py +162 -0
- qml_essentials-0.2.3/tests/test_states.py +117 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/uv.lock +48 -50
- qml_essentials-0.2.1/docs/expressibility.md +0 -38
- qml_essentials-0.2.1/docs/jaqsi.md +0 -247
- qml_essentials-0.2.1/qml_essentials/coefficients.py +0 -1790
- qml_essentials-0.2.1/qml_essentials/math.py +0 -206
- qml_essentials-0.2.1/qml_essentials/script.py +0 -1157
- qml_essentials-0.2.1/qml_essentials/utils.py +0 -420
- qml_essentials-0.2.1/tests/test_coefficients.py +0 -929
- qml_essentials-0.2.1/tests/test_model.py +0 -1308
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/.github/CODEOWNERS +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/.github/ISSUE_TEMPLATE/code-health.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/.github/dependabot.yml +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/.github/workflows/dependabot-approve.yml +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/.pre-commit-config.yaml +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/CONTRIBUTING.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/LICENSE +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/README.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/ansaetze.ipynb +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/diagrams.drawio +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/bloch-sphere.svg +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuit_tikz_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuit_tikz_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_10_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_10_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_13_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_13_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_14_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_14_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_15_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_15_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_16_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_16_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_17_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_17_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_18_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_18_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_19_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_19_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_1_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_1_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_20_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_20_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_2_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_2_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_3_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_3_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_4_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_4_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_5_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_5_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_6_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_6_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_7_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_7_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_8_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_8_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_9_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Circuit_9_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/GHZ_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/GHZ_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Hardware_Efficient_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Hardware_Efficient_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/No_Ansatz_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/No_Ansatz_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/No_Entangling_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/No_Entangling_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Strongly_Entangling_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_4q/Strongly_Entangling_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_10_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_10_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_13_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_13_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_14_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_14_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_15_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_15_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_16_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_16_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_17_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_17_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_18_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_18_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_19_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_19_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_1_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_1_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_20_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_20_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_2_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_2_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_3_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_3_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_4_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_4_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_5_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_5_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_6_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_6_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_7_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_7_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_8_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_8_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_9_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Circuit_9_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/GHZ_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/GHZ_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Hardware_Efficient_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Hardware_Efficient_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/No_Ansatz_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/No_Ansatz_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/No_Entangling_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/No_Entangling_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Strongly_Entangling_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_5q/Strongly_Entangling_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_10_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_10_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_13_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_13_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_14_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_14_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_15_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_15_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_16_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_16_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_17_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_17_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_18_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_18_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_19_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_19_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_1_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_1_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_20_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_20_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_2_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_2_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_3_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_3_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_4_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_4_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_5_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_5_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_6_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_6_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_7_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_7_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_8_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_8_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_9_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Circuit_9_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/GHZ_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/GHZ_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Hardware_Efficient_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Hardware_Efficient_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/No_Ansatz_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/No_Ansatz_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/No_Entangling_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/No_Entangling_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Strongly_Entangling_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/circuits_6q/Strongly_Entangling_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/code.svg +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/fourier_fingerprint_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/fourier_fingerprint_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/fourier_series_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/fourier_series_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/fourier_series_tf_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/fourier_series_tf_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/gates_fidelities_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/gates_fidelities_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/histogram.svg +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/invert_images.sh +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/jaqsi_overview_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/jaqsi_overview_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/jaqsi_pulse_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/jaqsi_pulse_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/model_2d_psd_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/model_2d_psd_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/model_fct_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/model_fct_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/model_fct_spectr_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/model_fct_spectr_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/model_fct_spectr_os_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/model_fct_spectr_os_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/model_fct_spectr_ours_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/model_fct_spectr_ours_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/model_psd_an_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/model_psd_an_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/model_psd_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/model_psd_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/pulse_gates_dependencies_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/pulse_gates_dependencies_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/pulse_schedule_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/pulse_schedule_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/pulses_structure_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/pulses_structure_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/rel-entropy.svg +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/trained_series_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/trained_series_dataset_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/trained_series_dataset_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/trained_series_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/trained_series_tf_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/figures/trained_series_tf_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/index.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/jaqsi.ipynb +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/javascripts/mathjax.js +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/logo.svg +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/metrics.ipynb +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/slurm_benchmark.sh +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/style.css +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/training.ipynb +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/docs/usage.ipynb +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/qml_essentials/__init__.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/qml_essentials/entanglement.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/qml_essentials/qoc_results_drag.csv +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/qml_essentials/qoc_results_gaussian.csv +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/qml_essentials/qoc_results_square.csv +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/qml_essentials/tape.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/tests/__init__.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/tests/conftest.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/tests/test_entanglement.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.3}/tests/test_expressiblity.py +0 -0
|
@@ -14,11 +14,11 @@ jobs:
|
|
|
14
14
|
runs-on: self-hosted
|
|
15
15
|
if: ${{ github.ref != 'refs/heads/main' }}
|
|
16
16
|
steps:
|
|
17
|
-
- uses: actions/checkout@
|
|
17
|
+
- uses: actions/checkout@v7
|
|
18
18
|
- name: Install system dependencies
|
|
19
19
|
run: sudo apt-get update && sudo apt-get install -y gcc graphviz libgraphviz-dev pkg-config
|
|
20
20
|
- name: Set up Python 3.13
|
|
21
|
-
uses: actions/setup-python@
|
|
21
|
+
uses: actions/setup-python@v7
|
|
22
22
|
with:
|
|
23
23
|
python-version: "3.13"
|
|
24
24
|
# cache: "uv"
|
|
@@ -42,13 +42,13 @@ jobs:
|
|
|
42
42
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
43
43
|
steps:
|
|
44
44
|
- uses: actions/configure-pages@v6
|
|
45
|
-
- uses: actions/checkout@
|
|
45
|
+
- uses: actions/checkout@v7
|
|
46
46
|
- name: Configure Git Credentials
|
|
47
47
|
run: |
|
|
48
48
|
git config user.name github-actions[bot]
|
|
49
49
|
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
|
50
50
|
- name: Set up Python 3.13
|
|
51
|
-
uses: actions/setup-python@
|
|
51
|
+
uses: actions/setup-python@v7
|
|
52
52
|
with:
|
|
53
53
|
python-version: "3.13"
|
|
54
54
|
# cache: "uv"
|
|
@@ -14,11 +14,11 @@ jobs:
|
|
|
14
14
|
runs-on: self-hosted
|
|
15
15
|
if: ${{ github.ref != 'refs/heads/main' }}
|
|
16
16
|
steps:
|
|
17
|
-
- uses: actions/checkout@
|
|
17
|
+
- uses: actions/checkout@v7
|
|
18
18
|
- name: Install system dependencies
|
|
19
19
|
run: sudo apt-get update && sudo apt-get install -y gcc graphviz libgraphviz-dev pkg-config
|
|
20
20
|
- name: Set up Python 3.13
|
|
21
|
-
uses: actions/setup-python@
|
|
21
|
+
uses: actions/setup-python@v7
|
|
22
22
|
with:
|
|
23
23
|
python-version: "3.13"
|
|
24
24
|
# cache: "uv"
|
|
@@ -38,13 +38,13 @@ jobs:
|
|
|
38
38
|
runs-on: self-hosted
|
|
39
39
|
if: ${{ github.ref == 'refs/heads/main' }}
|
|
40
40
|
steps:
|
|
41
|
-
- uses: actions/checkout@
|
|
41
|
+
- uses: actions/checkout@v7
|
|
42
42
|
- name: Configure Git Credentials
|
|
43
43
|
run: |
|
|
44
44
|
git config user.name github-actions[bot]
|
|
45
45
|
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
|
46
46
|
- name: Set up Python 3.13
|
|
47
|
-
uses: actions/setup-python@
|
|
47
|
+
uses: actions/setup-python@v7
|
|
48
48
|
with:
|
|
49
49
|
python-version: "3.13"
|
|
50
50
|
# cache: "uv"
|
|
@@ -25,12 +25,12 @@ jobs:
|
|
|
25
25
|
if: ${{ github.ref == 'refs/heads/main' }}
|
|
26
26
|
runs-on: ubuntu-latest
|
|
27
27
|
steps:
|
|
28
|
-
- uses: actions/checkout@
|
|
28
|
+
- uses: actions/checkout@v7
|
|
29
29
|
with:
|
|
30
30
|
fetch-tags: true
|
|
31
31
|
ssh-key: ${{ secrets.DEPLOY_KEY }}
|
|
32
32
|
- name: Set up Python 3.13
|
|
33
|
-
uses: actions/setup-python@
|
|
33
|
+
uses: actions/setup-python@v7
|
|
34
34
|
with:
|
|
35
35
|
python-version: "3.13"
|
|
36
36
|
# cache: "uv"
|
|
@@ -8,9 +8,9 @@ jobs:
|
|
|
8
8
|
runs-on: self-hosted
|
|
9
9
|
if: ${{ (github.actor != 'dependabot[bot]') }}
|
|
10
10
|
steps:
|
|
11
|
-
- uses: actions/checkout@
|
|
11
|
+
- uses: actions/checkout@v7
|
|
12
12
|
- name: Set up Python 3.13
|
|
13
|
-
uses: actions/setup-python@
|
|
13
|
+
uses: actions/setup-python@v7
|
|
14
14
|
with:
|
|
15
15
|
python-version: "3.13"
|
|
16
16
|
# cache: "uv"
|
|
@@ -9,9 +9,9 @@ jobs:
|
|
|
9
9
|
runs-on: self-hosted
|
|
10
10
|
if: ${{ (github.actor != 'dependabot[bot]') }}
|
|
11
11
|
steps:
|
|
12
|
-
- uses: actions/checkout@
|
|
12
|
+
- uses: actions/checkout@v7
|
|
13
13
|
- name: Set up Python 3.13
|
|
14
|
-
uses: actions/setup-python@
|
|
14
|
+
uses: actions/setup-python@v7
|
|
15
15
|
with:
|
|
16
16
|
python-version: "3.13"
|
|
17
17
|
# cache: "uv"
|
|
@@ -13,15 +13,15 @@ jobs:
|
|
|
13
13
|
test-all:
|
|
14
14
|
runs-on: self-hosted
|
|
15
15
|
steps:
|
|
16
|
-
- uses: actions/checkout@
|
|
16
|
+
- uses: actions/checkout@v7
|
|
17
17
|
- name: Set up Python 3.13
|
|
18
|
-
uses: actions/setup-python@
|
|
18
|
+
uses: actions/setup-python@v7
|
|
19
19
|
with:
|
|
20
20
|
python-version: "3.13"
|
|
21
21
|
# cache: "uv"
|
|
22
22
|
- name: Install dependencies
|
|
23
23
|
run: pipx run uv sync --group dev
|
|
24
24
|
- name: Test with pytest (no benchmark)
|
|
25
|
-
run: pipx run uv run pytest --cov=qml_essentials --dist load -n 2 -m "not benchmark"
|
|
25
|
+
run: pipx run uv run pytest --cov=qml_essentials --dist load -n 2 -m "not benchmark" -v
|
|
26
26
|
- name: Test with pytest (benchmark)
|
|
27
27
|
run: pipx run uv run pytest --cov=qml_essentials -m "benchmark"
|
|
@@ -8,9 +8,9 @@ jobs:
|
|
|
8
8
|
runs-on: self-hosted
|
|
9
9
|
if: ${{ (github.actor != 'github-actions[bot]') }}
|
|
10
10
|
steps:
|
|
11
|
-
- uses: actions/checkout@
|
|
11
|
+
- uses: actions/checkout@v7
|
|
12
12
|
- name: Set up Python 3.13
|
|
13
|
-
uses: actions/setup-python@
|
|
13
|
+
uses: actions/setup-python@v7
|
|
14
14
|
with:
|
|
15
15
|
python-version: "3.13"
|
|
16
16
|
# cache: "uv"
|
|
@@ -21,8 +21,8 @@ authors:
|
|
|
21
21
|
- family-names: "Wahl"
|
|
22
22
|
given-names: "Johannes"
|
|
23
23
|
title: "QML Essentials"
|
|
24
|
-
version: 0.2.
|
|
25
|
-
date-released: 2026-
|
|
24
|
+
version: 0.2.3
|
|
25
|
+
date-released: 2026-08-28
|
|
26
26
|
repository-code: "https://github.com/cirKITers/qml-essentials"
|
|
27
27
|
url: "https://cirkiters.github.io/qml-essentials"
|
|
28
28
|
license: MIT
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: qml-essentials
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: A toolbox to make working with QML models easier.
|
|
5
5
|
Project-URL: Homepage, https://cirkiters.github.io/qml-essentials/
|
|
6
6
|
Project-URL: Repository, https://github.com/cirKITers/qml-essentials
|
|
@@ -22,10 +22,12 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
22
22
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
23
23
|
Requires-Python: <3.13,>=3.11
|
|
24
24
|
Requires-Dist: diffrax>=0.7.2
|
|
25
|
+
Requires-Dist: equinox>=0.13.4
|
|
25
26
|
Requires-Dist: jax>=0.9.0.1
|
|
26
27
|
Requires-Dist: jaxlib>=0.9.0.1
|
|
27
28
|
Requires-Dist: optax>=0.2.7
|
|
28
29
|
Requires-Dist: psutil>=7.2.2
|
|
30
|
+
Requires-Dist: scipy>=1.17.0
|
|
29
31
|
Description-Content-Type: text/markdown
|
|
30
32
|
|
|
31
33
|
# QML Essentials
|
|
@@ -20,6 +20,8 @@ To get an overview of all the available Ansaetze, checkout the [references](http
|
|
|
20
20
|
## Custom Ansatz
|
|
21
21
|
|
|
22
22
|
For building the different Ansatzes, we use topology patterns defined in `qml_essentials.topologies`.
|
|
23
|
+
Four patterns are available: `Topology.stairs` (a configurable chain of entangling gates), `Topology.bricks` (a brick-wall pattern), `Topology.all_to_all` (every ordered qubit pair) and `Topology.all_pairs` (every unordered qubit pair).
|
|
24
|
+
Several built-in circuits rely on them, e.g. Circuit_5 uses `all_to_all` and Circuit_7 uses `bricks`.
|
|
23
25
|
You can find a list of all the available topologies in the [references](https://cirkiters.github.io/qml-essentials/references/) as well.
|
|
24
26
|
|
|
25
27
|
To start implementing your own ansatz, you can inheriting from the `Circuit` class:
|
|
@@ -105,6 +107,18 @@ class MyHardwareEfficient(Circuit):
|
|
|
105
107
|
The `**kwargs` allow both [noise simulation](noise.md) and [pulse simulation](pulses.md).
|
|
106
108
|
A custom `Circuit` should define `n_pulse_params_per_layer` if it will use pulse simulation at some point, but may be omitted otherwise.
|
|
107
109
|
|
|
110
|
+
If instead all gates of a block should share a single parameter, pass `shared=True` to the `Block`. The built-in `Permutation_Equivariant` ansatz uses this: it is an $S_n$-equivariant layer with a shared-angle RX and RY on every qubit and a shared-angle RZZ on every qubit pair, so it has three tied parameters per layer regardless of the qubit count.
|
|
111
|
+
```python
|
|
112
|
+
class Permutation_Equivariant(DeclarativeCircuit):
|
|
113
|
+
@classmethod
|
|
114
|
+
def structure(cls):
|
|
115
|
+
return (
|
|
116
|
+
Block(gate=Gates.RX, shared=True),
|
|
117
|
+
Block(gate=Gates.RY, shared=True),
|
|
118
|
+
Block(gate=Gates.RZZ, topology=Topology.all_pairs, shared=True),
|
|
119
|
+
)
|
|
120
|
+
```
|
|
121
|
+
|
|
108
122
|
Check out page [*Usage*](usage.md) on how to proceed from here.
|
|
109
123
|
|
|
110
124
|
## Custom Encoding
|
|
@@ -220,6 +234,10 @@ Oh and in case you need a refresh on the rotational axes and their corresponding
|
|
|
220
234
|

|
|
221
235
|

|
|
222
236
|
|
|
237
|
+
#### Circuit 20
|
|
238
|
+

|
|
239
|
+

|
|
240
|
+
|
|
223
241
|
#### No Entangling
|
|
224
242
|

|
|
225
243
|

|
|
@@ -310,6 +328,10 @@ Oh and in case you need a refresh on the rotational axes and their corresponding
|
|
|
310
328
|

|
|
311
329
|

|
|
312
330
|
|
|
331
|
+
#### Circuit 20
|
|
332
|
+

|
|
333
|
+

|
|
334
|
+
|
|
313
335
|
#### No Entangling
|
|
314
336
|

|
|
315
337
|

|
|
@@ -400,6 +422,10 @@ Oh and in case you need a refresh on the rotational axes and their corresponding
|
|
|
400
422
|

|
|
401
423
|

|
|
402
424
|
|
|
425
|
+
#### Circuit 20
|
|
426
|
+

|
|
427
|
+

|
|
428
|
+
|
|
403
429
|
#### No Entangling
|
|
404
430
|

|
|
405
431
|

|
|
@@ -66,13 +66,13 @@ def var_ghz_benchmark(mode, q) -> None:
|
|
|
66
66
|
logger.info("Running Jaqsi benchmark")
|
|
67
67
|
|
|
68
68
|
# --- Jaqsi ---
|
|
69
|
-
def
|
|
69
|
+
def jaqsi_circuit(phi):
|
|
70
70
|
for i in range(n_qubits):
|
|
71
71
|
H(wires=i)
|
|
72
72
|
for i in range(n_qubits):
|
|
73
73
|
CRX(phi, wires=[i, (i + 1) % n_qubits])
|
|
74
74
|
|
|
75
|
-
script = Script(f=
|
|
75
|
+
script = Script(f=jaqsi_circuit)
|
|
76
76
|
|
|
77
77
|
# do some warmup (allows pre-compilation)
|
|
78
78
|
# Note that we use a phi, which will not be part of the benchmarking later
|
|
@@ -472,28 +472,9 @@
|
|
|
472
472
|
"cell_type": "code",
|
|
473
473
|
"execution_count": null,
|
|
474
474
|
"metadata": {},
|
|
475
|
-
"outputs": [
|
|
476
|
-
{
|
|
477
|
-
"name": "stderr",
|
|
478
|
-
"output_type": "stream",
|
|
479
|
-
"text": [
|
|
480
|
-
"/home/maja/code/qml-essentials/.venv/lib/python3.12/site-packages/jax/_src/numpy/lax_numpy.py:2608: ComplexWarning: Casting complex values to real discards the imaginary part\n",
|
|
481
|
-
" out_array: Array = lax_internal._convert_element_type(\n"
|
|
482
|
-
]
|
|
483
|
-
},
|
|
484
|
-
{
|
|
485
|
-
"data": {
|
|
486
|
-
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAasAAAHHCAYAAAABJ3dMAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjMsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvZiW1igAAAAlwSFlzAAAPYQAAD2EBqD+naQAAMgRJREFUeJzt3Xl4VOWhx/HfJJBJyEZAggmEJICyhyUgBRqCIJssYlUE8Yr7QhAQue2lKuBSobZVqKYIaEERRCsCirIjQqsoS6MgSGURIoRFlmxAxMx7//AylzFBkiHJeSHfz/Oc52HeeefM7wTIL2fJGZcxxggAAIsFOB0AAIALoawAANajrAAA1qOsAADWo6wAANajrAAA1qOsAADWo6wAANajrAAA1qOsYIU1a9bI5XJpzZo1TkepUEuXLlWrVq0UHBwsl8ulEydOSJJmz56txo0bq2rVqqpevbokqUuXLurSpUup38PlcmnChAlllhlwAmVVic2aNUsul0sbN24s9vkuXbqoefPmFZzq0peQkCCXy1Xs0qtXL++8o0ePauDAgQoJCVF6erpmz56t0NBQff3117rzzjvVoEEDzZgxQ9OnT3dwa0pm7ty5mjx5cqlfV1hYqNjYWLlcLi1ZsqTsg/npwIEDmjBhgjIyMpyOgv9TxekAwOWoVatWevTRR4uMx8bGev+8YcMG5ebm6umnn9Z1113nHV+zZo08Ho+mTJmihg0beseXL1/uV5ZTp06pSpXy/a8+d+5cbd26VaNGjSrV61avXq2srCwlJCRozpw56t27d/kELKUDBw7oySefVEJCglq1auV0HIiyQgUxxuj06dMKCQlxOsp5eTwe/fDDDwoODr7oddWpU0e33377L845fPiwJHkP811oPCgoyK8sZbE95eWNN95QmzZtNHToUP3+979Xfn6+QkNDnY4FC3EYEKUyc+ZMde3aVdHR0XK73WratKmmTp1aZF5CQoL69u2rZcuWqW3btgoJCdG0adMkSd99950GDBig0NBQRUdH65FHHlFBQYHP6//6178qMDDQew5Hkv7yl7/I5XJp9OjR3rHCwkKFh4frd7/7nXfsz3/+szp27KiaNWsqJCREycnJeuedd4pkdLlcGj58uObMmaNmzZrJ7XZr6dKlkqT9+/fr7rvvVu3ateV2u9WsWTP9/e9/v6iv3bm6dOmioUOHSpLatWsnl8ulO++8UwkJCRo/frwkqVatWj7nm4o7Z3X69GlNmDBBV199tYKDgxUTE6Pf/OY32rVrl892/vycVUm27+x5xLffflt/+MMfVLduXQUHB6tbt27auXOnz7Z88MEH2rt3r/dwZ0JCwgW/BqdOndKCBQs0aNAgDRw4UKdOndKiRYuKzLvzzjsVFham/fv3a8CAAQoLC1OtWrU0ZswYFRYW+sydN2+ekpOTFR4eroiICLVo0UJTpkzxPn/s2DGNGTNGLVq0UFhYmCIiItS7d2998cUXPtvdrl07SdJdd93l3aZZs2Z5D50Xt/hzPhElx54VlJ2dre+//77I+JkzZ4qMTZ06Vc2aNVP//v1VpUoVvf/++xo2bJg8Ho/S0tJ85u7YsUODBw/WAw88oPvuu0+NGjXSqVOn1K1bN+3bt08jRoxQbGysZs+erdWrV/u8NiUlRR6PR//85z/Vt29fSdK6desUEBCgdevWeef9+9//Vl5enjp37uwdmzJlivr3768hQ4bohx9+0Lx583TLLbdo8eLF6tOnj8/7rF69Wm+//baGDx+uK664QgkJCTp06JB+9atfecusVq1aWrJkie655x7l5OSU6FDXmTNniv2ahoaGKiQkRI899pgaNWqk6dOn66mnnlJiYqIaNGigAQMG6PXXX9eCBQs0depUhYWFKSkpqdj3KCwsVN++fbVq1SoNGjRII0eOVG5urlasWKGtW7eqQYMGxb6utNs3adIkBQQEaMyYMcrOztZzzz2nIUOG6LPPPpMkPfbYY8rOztZ3332nF154QZIUFhZ2wa/Re++9p7y8PA0aNEhXXnmlunTpojlz5ui2224rdlt79uyp9u3b689//rNWrlypv/zlL2rQoIEeeughSdKKFSs0ePBgdevWTX/84x8lSdu3b9e//vUvjRw5UpK0e/duLVy4ULfccosSExN16NAhTZs2Tampqdq2bZtiY2PVpEkTPfXUUxo3bpzuv/9+paSkSJI6duwo6aeLX861d+9ePf7444qOjr7gNuMiGFRaM2fONJJ+cWnWrJnPa06ePFlkPT179jT169f3GYuPjzeSzNKlS33GJ0+ebCSZt99+2zuWn59vGjZsaCSZjz76yBhjTGFhoYmIiDC//e1vjTHGeDweU7NmTXPLLbeYwMBAk5uba4wx5vnnnzcBAQHm+PHj5834ww8/mObNm5uuXbv6jEsyAQEB5quvvvIZv+eee0xMTIz5/vvvfcYHDRpkIiMji/0aFLftxS0TJ070zjv79d+wYYPP68ePH28kmSNHjviMp6ammtTUVO/jv//970aSef7554tk8Hg8Pts5fvz4Um/fRx99ZCSZJk2amIKCAu+8KVOmGElmy5Yt3rE+ffqY+Pj4X/y6/Fzfvn1Np06dvI+nT59uqlSpYg4fPuwzb+jQoUaSeeqpp3zGW7dubZKTk72PR44caSIiIsyPP/543vc8ffq0KSws9Bnbs2ePcbvdPuvfsGGDkWRmzpz5i9tw6tQpk5ycbGJjY01WVtYvzsXF4TAglJ6erhUrVhRZivuJ/txzTmf3yFJTU7V7925lZ2f7zE1MTFTPnj19xj788EPFxMTo5ptv9o5Vq1ZN999/v8+8gIAAdezYUWvXrpX000/IR48e1f/8z//IGKNPP/1U0k97W82bN/c5v3NuxuPHjys7O1spKSnavHlzke1JTU1V06ZNvY+NMZo/f7769esnY4y+//5779KzZ09lZ2cXu56fa9++fbFf08GDB1/wtSU1f/58XXHFFXr44YeLPOdyuYp9jT/bd9ddd/mcLzu7p7F7926/sx89elTLli3z+XrcdNNN3sOOxXnwwQd9HqekpPhkqF69uvLz87VixYrzvq/b7VZAwE/f9goLC3X06FGFhYWpUaNGJfp7/blhw4Zpy5Ytmj9/vq688spSvx4lx2FA6JprrlHbtm2LjEdFRRU5lPWvf/1L48eP16effqqTJ0/6PJedna3IyEjv48TExCLr3Lt3rxo2bFjkm2mjRo2KzE1JSdGECRN06tQprVu3TjExMWrTpo1atmypdevWqXv37vrnP/+pgQMH+rxu8eLFeuaZZ5SRkeFzLqy4b+A/z3jkyBGdOHFC06dPP+8l42cvgPglV1xxhc8VfuVh165datSoUamu9PNn++rVq+fzOCoqStJPPwj466233tKZM2fUunVrn/Nf7du315w5c4ocUg4ODlatWrWK5Dg3w7Bhw/T222+rd+/eqlOnjnr06KGBAwf6/LrA2ass//a3v2nPnj0+57xq1qxZqm2YNm2aZs6cqWnTpulXv/pVqV6L0qOsUGK7du1St27d1LhxYz3//POKi4tTUFCQPvzwQ73wwgvyeDw+8y/2yr9f//rXOnPmjD799FOtW7fO+xN9SkqK1q1bp6+//lpHjhzxjks/7Wn1799fnTt31t/+9jfFxMSoatWqmjlzpubOnVvkPX6e8ew23H777d4LIH7ufOeQLgX+bF9gYGCx84wxfueYM2eOJKlTp07FPr97927Vr1//ghnOFR0drYyMDC1btkxLlizRkiVLNHPmTN1xxx167bXXJEnPPvusnnjiCd199916+umnVaNGDQUEBGjUqFFF/v3+ks8//1wjR47UvffeW+SoAMoHZYUSe//991VQUKD33nvP56ftjz76qMTriI+P19atW2WM8dnT2bFjR5G511xzjYKCgrRu3TqtW7dO//3f/y1J6ty5s2bMmKFVq1Z5H581f/58BQcHa9myZXK73d7xmTNnlihfrVq1FB4ersLCwnLfM7pYDRo00GeffaYzZ86oatWqJXpNeW3f+Q47FmfPnj365JNPNHz4cKWmpvo85/F49F//9V+aO3euHn/88VLnCAoKUr9+/dSvXz95PB4NGzZM06ZN0xNPPKGGDRvqnXfe0bXXXqtXX33V53UnTpzQFVdcUaLtOXLkiG6++Wa1atVK6enppc4I/3DOCiV29qfbc3+izs7OLnERSNL111+vAwcO+FxKfvLkyWIPSQUHB6tdu3Z68803tW/fPp89q1OnTumvf/2rGjRooJiYGJ+MLpfL5/DOt99+q4ULF5Z4G2+66SbNnz9fW7duLfL8kSNHSrqp5e6mm27S999/r5deeqnIc+fb6ymv7QsNDS1yzvJ8zu5V/fa3v9XNN9/sswwcOFCpqaneOaVx9OhRn8cBAQHevcSzh4MDAwOLfG3+8Y9/aP/+/UW2R5LPr05IP53nGjRokH744QfNnz/f7999Q+mxZ4US69Gjh/cn1wceeEB5eXmaMWOGoqOjlZWVVaJ13HfffXrppZd0xx13aNOmTYqJidHs2bNVrVq1YuenpKRo0qRJioyMVIsWLST9dLinUaNG2rFjh+68806f+X369NHzzz+vXr166bbbbtPhw4eVnp6uhg0b6ssvvyxRxkmTJumjjz5S+/btdd9996lp06Y6duyYNm/erJUrV+rYsWMXXMf+/fv1xhtvFBkPCwvTgAEDSpTjQu644w69/vrrGj16tD7//HOlpKQoPz9fK1eu1LBhw3TDDTcU+7qy2L6fS05O1ltvvaXRo0erXbt2CgsLU79+/YqdO2fOHLVq1UpxcXHFPt+/f389/PDD2rx5s9q0aVPiDPfee6+OHTumrl27qm7dutq7d69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c6ZatGih1NRUzZo1q1R7Vh07dtSDDz6oW2+9VbVq1dJzzz2n6tWr691331XXrl3VpEkTvfzyy3rzzTfVrFmzi9o+oCT4WHsAgPXYswIAWI+yAgBYj7ICAFiPsgIAWI+yAgBYj7ICAFiPsgIAWI+yAgBYj7ICAFiPsgIAWI+yAgBYj7ICAFjvfwGRWU3riwsaMAAAAABJRU5ErkJggg==",
|
|
487
|
-
"text/plain": [
|
|
488
|
-
"<Figure size 640x480 with 1 Axes>"
|
|
489
|
-
]
|
|
490
|
-
},
|
|
491
|
-
"metadata": {},
|
|
492
|
-
"output_type": "display_data"
|
|
493
|
-
}
|
|
494
|
-
],
|
|
475
|
+
"outputs": [],
|
|
495
476
|
"source": [
|
|
496
|
-
"fp, _ = FCC.get_fourier_fingerprint(\n",
|
|
477
|
+
"fp, _, _ = FCC.get_fourier_fingerprint(\n",
|
|
497
478
|
" model=model,\n",
|
|
498
479
|
" n_samples=500,\n",
|
|
499
480
|
" random_key=jax.random.key(1000),\n",
|
|
@@ -536,7 +517,7 @@
|
|
|
536
517
|
],
|
|
537
518
|
"metadata": {
|
|
538
519
|
"kernelspec": {
|
|
539
|
-
"display_name": "
|
|
520
|
+
"display_name": "qml-essentials",
|
|
540
521
|
"language": "python",
|
|
541
522
|
"name": "python3"
|
|
542
523
|
},
|
|
@@ -550,7 +531,7 @@
|
|
|
550
531
|
"name": "python",
|
|
551
532
|
"nbconvert_exporter": "python",
|
|
552
533
|
"pygments_lexer": "ipython3",
|
|
553
|
-
"version": "3.
|
|
534
|
+
"version": "3.11.6"
|
|
554
535
|
}
|
|
555
536
|
},
|
|
556
537
|
"nbformat": 4,
|
|
@@ -130,6 +130,18 @@ psd = Coefficients.get_psd(coeffs)
|
|
|
130
130
|

|
|
131
131
|

|
|
132
132
|
|
|
133
|
+
## Evaluating a Fourier Series
|
|
134
|
+
|
|
135
|
+
Given a set of coefficients and frequencies (e.g. those returned by `get_spectrum`), the corresponding Fourier series can be evaluated at arbitrary input points with `evaluate_Fourier_series`:
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
coeffs, freqs = Coefficients.get_spectrum(model)
|
|
139
|
+
|
|
140
|
+
y = Coefficients.evaluate_Fourier_series(coeffs, freqs, inputs=0.5)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
This accepts both single- and multi-dimensional frequency arrays, mirroring the shapes produced by `get_spectrum`.
|
|
144
|
+
|
|
133
145
|
## Analytic Coefficients
|
|
134
146
|
|
|
135
147
|
All of the calculations above were performed by applying a Fast Fourier Transform to the output of our Model.
|
|
@@ -143,7 +155,7 @@ fourier_tree = FourierTree(model)
|
|
|
143
155
|
an_coeffs, an_freqs = fourier_tree.get_spectrum(force_mean=True)
|
|
144
156
|
```
|
|
145
157
|
|
|
146
|
-
|
|
158
|
+
Unlike the FFT, this gives us the precise coefficients, solely depending on the parameters.
|
|
147
159
|
We can verify this by comparing it to the previous results:
|
|
148
160
|
|
|
149
161
|

|
|
@@ -154,11 +166,96 @@ We can verify this by comparing it to the previous results:
|
|
|
154
166
|
We use an approach developed by [Nemkov et al.](https://arxiv.org/pdf/2304.03787), which was later extended by [Wiedmann et al.](https://arxiv.org/pdf/2411.03450).
|
|
155
167
|
The implementation is also inspired by the corresponding [code](https://github.com/idnm/FourierVQA) for Nemkov et al.'s paper.
|
|
156
168
|
|
|
157
|
-
In Nemkov et al.'s algorithm the first step is to separate Clifford and non-Clifford gates, such that all Clifford gates can be regarded as part of the observable, and the actual circuit only consists of Pauli rotations (cf. qml_essentials.
|
|
169
|
+
In Nemkov et al.'s algorithm the first step is to separate Clifford and non-Clifford gates, such that all Clifford gates can be regarded as part of the observable, and the actual circuit only consists of Pauli rotations (cf. `qml_essentials.pauli.PauliCircuit`).
|
|
158
170
|
The main idea is then to split each Pauli rotation into sine and cosine product terms to obtain the coefficients, which are only dependent on the parameters of the circuit.
|
|
159
171
|
|
|
160
|
-
|
|
172
|
+
The Clifford commutation and Pauli bookkeeping are implemented symbolically on a stabilizer-tableau Pauli representation (`qml_essentials.operations.PauliWord`), and the parameter-dependent coefficients are evaluated with vectorized operations.
|
|
173
|
+
This makes the tree fast to build and evaluate, and it supports multiple input features: in that case `get_spectrum` returns, per observable, the multi-dimensional frequency vectors (shape `(n_freqs, n_features)`) and their coefficients.
|
|
174
|
+
|
|
175
|
+
The symbolic core is gate-set agnostic and lives in `qml_essentials.operations`:
|
|
176
|
+
|
|
177
|
+
- `PauliWord` — an n-qubit Pauli in the symplectic $i^{\text{phase}}\,X^x Z^z$ representation, with `compose`, `commutes_with`, `conjugate_by_clifford` (Clifford tableau evolution), and a `to_matrix`/`from_matrix` bridge to dense operators.
|
|
178
|
+
- `Operation.is_clifford` — a class flag marking the standard Clifford gates ($I, X, Y, Z, H, S, \text{CX}, \text{CY}, \text{CZ}, \text{SWAP}$); `conjugate_by_clifford` uses fast symbolic rules for the common ones and an exact matrix fallback for the rest.
|
|
179
|
+
- `Operation.decompose()` — expresses composite gates (`Rot`, `CRX`/`CRY`/`CRZ`, `CZ`) in terms of Clifford + Pauli-rotation primitives. Diagonal-Hamiltonian encodings (`DiagonalQubitUnitary`, e.g. the Golomb strategy) are expanded into commuting Pauli-$Z$ rotations via the Walsh-Hadamard transform of their real generator.
|
|
180
|
+
|
|
181
|
+
### Custom Circuits and Input Scaling
|
|
182
|
+
|
|
183
|
+
The `FourierTree` operates on whatever circuit the model's `script` records, so a custom variational circuit can be analysed by replacing `model.script`:
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
import qml_essentials.jaqsi as js
|
|
187
|
+
from qml_essentials.gates import Gates as g
|
|
188
|
+
|
|
189
|
+
def variational(params, inputs, *args, **kwargs):
|
|
190
|
+
params = params.squeeze()
|
|
191
|
+
g.PauliRot(1 * inputs, "Y", wires=[0])
|
|
192
|
+
g.PauliRot(params[0], "XZX", wires=[0, 1, 2])
|
|
193
|
+
g.PauliRot(3 * inputs, "XZ", wires=[0, 1])
|
|
194
|
+
g.PauliRot(params[1], "YY", wires=[0, 1])
|
|
195
|
+
g.PauliRot(9 * inputs, "XY", wires=[0, 1])
|
|
196
|
+
|
|
197
|
+
model = Model(n_qubits=3, n_layers=1, observables=0)
|
|
198
|
+
model._params_shape = (2, 1)
|
|
199
|
+
model.initialize_params() # reallocate params for the custom shape
|
|
200
|
+
model.script = js.Script(f=variational, n_qubits=3)
|
|
201
|
+
|
|
202
|
+
coeffs, freqs = FourierTree(model).get_spectrum()
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
The tree distinguishes encoding from variational rotations **automatically**.
|
|
206
|
+
Because every canonical rotation angle is an affine function of the inputs (encodings apply $\omega_k\,x_f$; Clifford commutation only flips a generator's sign), the tree perturbs each input feature in turn and reads off, from the change in the recorded angles, which rotations depend on which feature and with what signed integer scaling $\omega_k$.
|
|
207
|
+
|
|
208
|
+
The only requirement is that each encoding rotation be **linear in a single feature**, $\omega_k\,x_f$. Heterogeneous scalings such as $(1, 3, 9)$ are then resolved to the correctly scaled frequencies (here $\{-13, -11, -7, -5, 5, 7, 11, 13\}$) instead of unit counts.
|
|
209
|
+
Scalings may be rational rather than integer for some encodings: a diagonal-Hamiltonian encoding $\exp(-i x\,\mathrm{diag}(h))$ (such as the Golomb strategy) decomposes into commuting Pauli-$Z$ rotations whose scalings are dyadic rationals, while the resulting model frequencies stay integer (the pairwise differences of the Hamiltonian eigenvalues).
|
|
210
|
+
A rotation depending on more than one feature raises `NotImplementedError`; and the `method="dp"` exact-support path does not support non-unit scaling (it raises for Golomb encodings — use `method="tree"`).
|
|
211
|
+
|
|
212
|
+
For the numerical FFT (`Coefficients.get_spectrum`) a custom circuit additionally requires `model.degree` to be set high enough to resolve the largest frequency.
|
|
213
|
+
The sampling grid is built from `model.degree` (the number of frequencies, i.e. $2\,\omega_\text{max} + 1$), not `model.frequencies`.
|
|
214
|
+
Because `model.degree` reflects the nominal integer comb and not any scaling applied through `enc_params` or `enc_pulse_params`, a model whose effective frequencies exceed the nominal degree by a factor $s > 1$ needs `mfs` at least $\lceil s \rceil$ to avoid aliasing the scaled components.
|
|
161
215
|
|
|
216
|
+
## Estimating the Exact Spectrum
|
|
217
|
+
|
|
218
|
+
The number of frequencies a model can represent is, by default, estimated naively from the encoding (see `model.frequencies` / `model.degree`).
|
|
219
|
+
This estimate is an *upper bound*: as shown by Wiedmann et al., some coefficients are constrained to zero for all parameter values, so the true spectrum can be smaller.
|
|
220
|
+
|
|
221
|
+
The `FourierTree` lets us obtain the *exact* spectrum of a model via the opt-in `Model.exact_spectrum` method:
|
|
222
|
+
```python
|
|
223
|
+
model = Model(
|
|
224
|
+
n_qubits=3,
|
|
225
|
+
n_layers=1,
|
|
226
|
+
circuit_type="Circuit_19",
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
exact = model.exact_spectrum() # tuple of frequency arrays, one per input feature
|
|
230
|
+
```
|
|
231
|
+
The result is always a subset of `model.frequencies`.
|
|
232
|
+
For example, for the model above the naive estimate is `{-3, ..., 3}` while the exact spectrum is `{-2, -1, 0, 1, 2}`.
|
|
233
|
+
|
|
234
|
+
The support is derived *purely symbolically* — no parameter sampling is involved.
|
|
235
|
+
This exploits a structural property of the tree: every parameter contributes at most one sine **or** cosine factor per path, so the variational leaf factors are square-free monomials over $\{1, \cos\theta_i, i\sin\theta_i\}$, which are linearly independent.
|
|
236
|
+
A frequency is therefore absent if and only if all of its signature-grouped path weights sum to zero — an exact test, since all weights are dyadic rationals.
|
|
237
|
+
This correctly removes frequencies whose contributions cancel identically across paths, e.g. two consecutive encodings combining into a single rotation ($\langle Z \rangle = \cos(2x)$ has spectrum $\{-2, 2\}$, not $\{-2, \dots, 2\}$).
|
|
238
|
+
|
|
239
|
+
Two methods are available:
|
|
240
|
+
|
|
241
|
+
- `method="tree"` (default): fully exact, but enumerates the explicit tree, whose size can grow exponentially with circuit depth.
|
|
242
|
+
- `method="dp"`: merges tree nodes with identical (rotation index, observable) state, at most $n_\text{params} \cdot 4^{n_\text{qubits}}$ states, and tracks the achievable per-feature sine/cosine counts per state as a mixed-radix bitmask.
|
|
243
|
+
While it scales better for deep circuits and is exact per path, it cannot detect coefficients that cancel identically *across* paths with identical variational dependence (such as the repeated-encoding example above), where it returns a tight superset.
|
|
244
|
+
It supports any number of input features, returning the same per-feature frequency layout as `method="tree"`, but requires unit-magnitude input scaling: per-gate non-unit scalings such as Golomb encodings are rejected (use `method="tree"`).
|
|
245
|
+
|
|
246
|
+
```python
|
|
247
|
+
exact = model.exact_spectrum(method="dp") # for deep circuits
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Both `method="dp"` limitations mentioned above follow from its merged-state design, which keeps only the achievable sine/cosine counts per node and discards the per-path variational signature:
|
|
251
|
+
|
|
252
|
+
1. Cross-path cancellations are invisible.
|
|
253
|
+
The tree method groups leaves by their variational signature and tests whether each group's weights sum to zero; the DP never stores those signatures, so it can confirm that a frequency is structurally reachable but not whether contributions from distinct paths cancel.
|
|
254
|
+
It therefore returns a tight superset (e.g. it keeps $\omega = 0$ for the repeated-encoding $\langle Z \rangle = \cos(2x)$ that the tree removes).
|
|
255
|
+
2. Only unit-magnitude input scaling is allowed.
|
|
256
|
+
Within a feature the DP aggregates the total sine/cosine counts $(s_f, c_f)$ over all of that feature's rotations, which is exact only when those rotations share a single angle $x_f$.
|
|
257
|
+
A sign flip ($\omega = -1$, arising from Clifford commutation) is harmless because $\cos$ is even and $\sin$ odd, changing only the coefficient sign.
|
|
258
|
+
A genuine per-gate scaling (as for the `method="tree"` case) changes the angle and would require expanding and convolving each rotation individually.
|
|
162
259
|
|
|
163
260
|
## Multi-Dimensional Coefficients
|
|
164
261
|
|
|
@@ -203,7 +300,7 @@ model = Model(
|
|
|
203
300
|
n_qubits=6,
|
|
204
301
|
n_layers=1,
|
|
205
302
|
circuit_type="Hardware_Efficient",
|
|
206
|
-
|
|
303
|
+
observables=None,
|
|
207
304
|
encoding=["RY"],
|
|
208
305
|
)
|
|
209
306
|
|
|
@@ -215,16 +312,17 @@ fcc = FCC.get_fcc(
|
|
|
215
312
|
```
|
|
216
313
|
Returns `0.1442` as already in Fig. 3a of aforementioned paper.
|
|
217
314
|
|
|
218
|
-
Optionally, you can choose a different correlation `method` (currently "pearson", "complex_pearson", and "
|
|
315
|
+
Optionally, you can choose a different correlation `method` (currently "pearson", "complex_pearson", "spearman", and "covariance" are supported).
|
|
219
316
|
The default "pearson" method preserves the existing behavior for complex coefficients by correlating stacked real and imaginary parts.
|
|
220
317
|
The "complex_pearson" method computes a complex-valued Pearson coefficient via Hermitian normalized covariance, so the magnitude describes correlation strength and the angle describes the relative phase between coefficient vectors.
|
|
318
|
+
The "covariance" method returns the (Hermitian, for complex coefficients) sample covariance instead of a normalized correlation; unlike the correlation methods its entries are not bounded to $[0, 1]$.
|
|
221
319
|
When calculating the scalar FCC, `calculate_fcc` uses the magnitude of the fingerprint entries.
|
|
222
320
|
Similar, other methods which require specifying `n_samples` (c.f. calculation of [expressibility](expressibility.md) and [entangling capability](entanglement.md)), methods in the `FCC` class take an optional parameter `scale` (defaults to `False`), which scales the number of samples depending on the number of qubits and the number of input features as $n_\text{samples} \cdot n_\text{params} \cdot 2^{n_\text{qubits}} \cdot n_\text{features}$.
|
|
223
321
|
|
|
224
322
|
As described in our paper, the FCC is calculated as the mean of the Fourier fingerprint, which in turn can be obtained separately as follows:
|
|
225
323
|
|
|
226
324
|
```python
|
|
227
|
-
fingerprint = FCC.get_fourier_fingerprint(
|
|
325
|
+
fingerprint, freqs, coeffs = FCC.get_fourier_fingerprint(
|
|
228
326
|
model=model,
|
|
229
327
|
n_samples=500,
|
|
230
328
|
random_key=jax.random.key(1000),
|
|
@@ -240,5 +338,9 @@ This is implicitly done in `FCC.get_fourier_fingerprint` (and controlled using t
|
|
|
240
338
|
- removing symmetries inside the correlation matrix (the Fourier fingerprint), e.g. $c_{0,1} = c_{1,0}$
|
|
241
339
|
Note that `get_fcc` also (by default) trims down the fingerprint before calculating the actual FCC.
|
|
242
340
|
|
|
341
|
+
When `trim_redundant` is enabled, the frequencies returned alongside the fingerprint are a `(row_freqs, col_freqs)` tuple that labels the two (trimmed) matrix axes one-to-one, so they always match the shape of the returned correlation matrix. The coefficients are returned as a matching `(row_coeffs, col_coeffs)` tuple whose rows align with those frequencies.
|
|
342
|
+
The optional `numerical_cap` argument (passed through to `get_spectrum`) prunes negligible Fourier modes: coefficients below the cap are zeroed and, for a single input feature, the corresponding frequencies are dropped from the spectrum.
|
|
343
|
+
The `get_fourier_fingerprint` method additionally accepts `nan_to_one` (default `False`), which replaces undefined correlation entries (`NaN`s, e.g. arising from constant coefficient vectors with zero variance) with one.
|
|
344
|
+
|
|
243
345
|
Both `get_fcc` and `get_fourier_fingerprint` support a `weight` parameter, which can be used to weight the correlation matrix, such that high-frequency components receive a lower weight.
|
|
244
|
-
Intuitively this adresses the issue, that low frequency components have a higher impact on the mean-squared error (c.f. App. D in our paper).
|
|
346
|
+
Intuitively this adresses the issue, that low frequency components have a higher impact on the mean-squared error (c.f. App. D in our paper).
|
|
@@ -94,4 +94,14 @@ This measure, introduced in [Computable and operationally meaningful multipartit
|
|
|
94
94
|
ent_cap = Entanglement.concentratable_entanglement(
|
|
95
95
|
model, n_samples=1000, random_key=jax.random.key(1000)
|
|
96
96
|
)
|
|
97
|
-
```
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The same quantity can also be obtained from a Bell-basis measurement instead of the ancilla-based SWAP test, via `concentratable_entanglement_estimation`:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
ent_cap = Entanglement.concentratable_entanglement_estimation(
|
|
103
|
+
model, n_samples=1000, random_key=jax.random.key(1000)
|
|
104
|
+
)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Here the concentratable entanglement is read off from the expectation value of a Bell-basis observable rather than from the overlap measured on an ancilla register.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Expressibility
|
|
2
|
+
|
|
3
|
+
Our package allows you estimate the expressiblity of a given model.
|
|
4
|
+
```python
|
|
5
|
+
model = Model(
|
|
6
|
+
n_qubits=2,
|
|
7
|
+
n_layers=1,
|
|
8
|
+
circuit_type="Hardware_Efficient",
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
bins, dist_circuit = Expressibility.state_fidelities(
|
|
12
|
+
n_samples=200,
|
|
13
|
+
n_bins=10,
|
|
14
|
+
model=model,
|
|
15
|
+
random_key=jax.random.key(1000),
|
|
16
|
+
)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Here, `n_bins` is the number of bins used in the histogram and `n_samples` is the number of parameter pairs to generate (using the default initialization strategy of the model).
|
|
20
|
+
For each pair, the state fidelity is computed and histogrammed, so `state_fidelities` returns the bin edges and the corresponding fidelity distribution.
|
|
21
|
+
`random_key` is an optional JAX random key for parameter initialization; if omitted, the model's internal random key is used.
|
|
22
|
+
|
|
23
|
+
Note that `state_fidelities` accepts keyword arguments that are being passed to the model call.
|
|
24
|
+
This allows you to utilize e.g. caching.
|
|
25
|
+
|
|
26
|
+
Next, you can calculate the Haar integral (as reference), by
|
|
27
|
+
```python
|
|
28
|
+
input_domain, dist_haar = Expressibility.haar_integral(
|
|
29
|
+
n_qubits=2,
|
|
30
|
+
n_bins=10,
|
|
31
|
+
cache=True,
|
|
32
|
+
)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Finally, the Kullback-Leibler divergence allows you to see how well the particular circuit performs compared to the Haar integral:
|
|
36
|
+
```python
|
|
37
|
+
kl_dist = Expressibility.kullback_leibler_divergence(dist_circuit, dist_haar).mean()
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Alternatively, the `kl_divergence_to_haar` shortcut combines all three steps (sampling the fidelities, computing the Haar reference and the divergence) in a single call:
|
|
41
|
+
```python
|
|
42
|
+
kl_dist = Expressibility.kl_divergence_to_haar(
|
|
43
|
+
model=model,
|
|
44
|
+
n_samples=200,
|
|
45
|
+
n_bins=10,
|
|
46
|
+
random_key=jax.random.key(1000),
|
|
47
|
+
).mean()
|
|
48
|
+
```
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import os
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import jax.numpy as jnp
|
|
4
|
+
|
|
4
5
|
from qml_essentials.ansaetze import Ansaetze
|
|
6
|
+
from qml_essentials.drawing import draw_mpl
|
|
7
|
+
from qml_essentials.operations import Barrier
|
|
8
|
+
from qml_essentials.tape import recording
|
|
5
9
|
|
|
6
10
|
edit_ansaetze_file = False
|
|
7
11
|
ansaetze = Ansaetze.get_available()
|
|
@@ -9,16 +13,16 @@ cwd = os.path.dirname(__file__)
|
|
|
9
13
|
|
|
10
14
|
|
|
11
15
|
def plot_circuit(q, ansatz):
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
data_reupload=False,
|
|
19
|
-
)
|
|
16
|
+
# record the ansatz directly with jaqsi to exclude any encoding gates
|
|
17
|
+
pqc = ansatz()
|
|
18
|
+
params = jnp.zeros(pqc.n_params_per_layer(q))
|
|
19
|
+
|
|
20
|
+
with recording() as tape:
|
|
21
|
+
pqc(params, q)
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
# barriers and gate angles only add clutter to the ansatz overview
|
|
24
|
+
ops = [op for op in tape if not isinstance(op, Barrier)]
|
|
25
|
+
fig, _ = draw_mpl(ops, q, gate_values=False)
|
|
22
26
|
|
|
23
27
|
fig.savefig(
|
|
24
28
|
f"{cwd}/figures/circuits_{q}q/{ansatz.__name__}_light.png",
|