qml-essentials 0.2.1__tar.gz → 0.2.2__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.2}/.github/workflows/test-on-pr.yml +1 -1
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/CITATION.cff +2 -2
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/PKG-INFO +1 -1
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/benchmarks.py +2 -2
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/coefficients.md +86 -4
- qml_essentials-0.2.2/docs/jaqsi.md +259 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/references.md +3 -3
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/pyproject.toml +1 -1
- qml_essentials-0.2.2/qml_essentials/coefficients.py +1788 -0
- qml_essentials-0.2.1/qml_essentials/jaqsi.py → qml_essentials-0.2.2/qml_essentials/evolution.py +20 -128
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/gates.py +0 -1
- qml_essentials-0.2.2/qml_essentials/jaqsi.py +167 -0
- qml_essentials-0.2.2/qml_essentials/memory.py +345 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/model.py +61 -4
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/operations.py +675 -119
- qml_essentials-0.2.2/qml_essentials/pauli.py +341 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/pulses.py +161 -18
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/qoc.py +5 -5
- qml_essentials-0.2.2/qml_essentials/script.py +627 -0
- qml_essentials-0.2.2/qml_essentials/simulation.py +377 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/unitary.py +111 -30
- qml_essentials-0.2.2/qml_essentials/utils.py +13 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/tests/test_coefficients.py +393 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/tests/test_jaqsi.py +83 -85
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/tests/test_model.py +85 -7
- qml_essentials-0.2.2/tests/test_pauli.py +212 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/tests/test_pulse_state.py +3 -3
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/tests/test_qoc.py +8 -4
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/uv.lock +1 -1
- 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/script.py +0 -1157
- qml_essentials-0.2.1/qml_essentials/utils.py +0 -420
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/.github/CODEOWNERS +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/.github/ISSUE_TEMPLATE/code-health.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/.github/dependabot.yml +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/.github/workflows/dependabot-approve.yml +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/.github/workflows/docs-publish.yml +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/.github/workflows/docs.yml +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/.github/workflows/publish.yml +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/.github/workflows/quality-publish.yml +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/.github/workflows/quality.yml +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/.github/workflows/test-on-publish.yml +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/.gitignore +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/.pre-commit-config.yaml +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/CONTRIBUTING.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/LICENSE +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/README.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/ansaetze.ipynb +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/ansaetze.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/coefficients.ipynb +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/diagrams.drawio +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/entanglement.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/expressibility.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/bloch-sphere.svg +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuit_tikz_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuit_tikz_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_10_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_10_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_13_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_13_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_14_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_14_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_15_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_15_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_16_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_16_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_17_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_17_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_18_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_18_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_19_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_19_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_1_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_1_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_20_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_20_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_2_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_2_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_3_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_3_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_4_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_4_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_5_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_5_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_6_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_6_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_7_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_7_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_8_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_8_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_9_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Circuit_9_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/GHZ_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/GHZ_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Hardware_Efficient_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Hardware_Efficient_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/No_Ansatz_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/No_Ansatz_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/No_Entangling_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/No_Entangling_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Strongly_Entangling_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_4q/Strongly_Entangling_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_10_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_10_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_13_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_13_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_14_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_14_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_15_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_15_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_16_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_16_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_17_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_17_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_18_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_18_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_19_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_19_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_1_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_1_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_20_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_20_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_2_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_2_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_3_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_3_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_4_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_4_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_5_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_5_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_6_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_6_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_7_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_7_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_8_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_8_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_9_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Circuit_9_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/GHZ_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/GHZ_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Hardware_Efficient_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Hardware_Efficient_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/No_Ansatz_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/No_Ansatz_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/No_Entangling_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/No_Entangling_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Strongly_Entangling_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_5q/Strongly_Entangling_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_10_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_10_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_13_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_13_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_14_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_14_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_15_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_15_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_16_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_16_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_17_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_17_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_18_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_18_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_19_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_19_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_1_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_1_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_20_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_20_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_2_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_2_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_3_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_3_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_4_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_4_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_5_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_5_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_6_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_6_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_7_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_7_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_8_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_8_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_9_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Circuit_9_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/GHZ_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/GHZ_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Hardware_Efficient_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Hardware_Efficient_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/No_Ansatz_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/No_Ansatz_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/No_Entangling_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/No_Entangling_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Strongly_Entangling_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/circuits_6q/Strongly_Entangling_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/code.svg +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/fourier_fingerprint_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/fourier_fingerprint_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/fourier_series_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/fourier_series_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/fourier_series_tf_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/fourier_series_tf_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/gates_fidelities_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/gates_fidelities_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/histogram.svg +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/invert_images.sh +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/jaqsi_overview_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/jaqsi_overview_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/jaqsi_pulse_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/jaqsi_pulse_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/model_2d_psd_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/model_2d_psd_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/model_fct_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/model_fct_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/model_fct_spectr_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/model_fct_spectr_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/model_fct_spectr_os_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/model_fct_spectr_os_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/model_fct_spectr_ours_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/model_fct_spectr_ours_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/model_psd_an_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/model_psd_an_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/model_psd_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/model_psd_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/pulse_gates_dependencies_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/pulse_gates_dependencies_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/pulse_schedule_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/pulse_schedule_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/pulses_structure_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/pulses_structure_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/rel-entropy.svg +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/trained_series_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/trained_series_dataset_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/trained_series_dataset_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/trained_series_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/trained_series_tf_dark.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/figures/trained_series_tf_light.png +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/generate_circuits.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/index.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/jaqsi.ipynb +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/javascripts/mathjax.js +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/logo.svg +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/metrics.ipynb +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/noise.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/pulses.ipynb +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/pulses.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/slurm_benchmark.sh +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/style.css +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/training.ipynb +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/training.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/usage.ipynb +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/docs/usage.md +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/mkdocs.yml +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/__init__.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/ansaetze.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/drawing.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/entanglement.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/expressibility.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/math.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/qoc_results_drag.csv +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/qoc_results_gaussian.csv +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/qoc_results_square.csv +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/tape.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/qml_essentials/topologies.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/tests/__init__.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/tests/conftest.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/tests/test_ansaetze.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/tests/test_entanglement.py +0 -0
- {qml_essentials-0.2.1 → qml_essentials-0.2.2}/tests/test_expressiblity.py +0 -0
|
@@ -22,6 +22,6 @@ jobs:
|
|
|
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"
|
|
@@ -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-06-
|
|
24
|
+
version: 0.2.2
|
|
25
|
+
date-released: 2026-06-11
|
|
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
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: qml-essentials
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
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
|
|
@@ -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
|
|
@@ -143,7 +143,7 @@ fourier_tree = FourierTree(model)
|
|
|
143
143
|
an_coeffs, an_freqs = fourier_tree.get_spectrum(force_mean=True)
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
Unlike the FFT, this gives us the precise coefficients, solely depending on the parameters.
|
|
147
147
|
We can verify this by comparing it to the previous results:
|
|
148
148
|
|
|
149
149
|

|
|
@@ -154,10 +154,88 @@ We can verify this by comparing it to the previous results:
|
|
|
154
154
|
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
155
|
The implementation is also inspired by the corresponding [code](https://github.com/idnm/FourierVQA) for Nemkov et al.'s paper.
|
|
156
156
|
|
|
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.
|
|
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.pauli.PauliCircuit`).
|
|
158
158
|
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
159
|
|
|
160
|
-
|
|
160
|
+
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.
|
|
161
|
+
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.
|
|
162
|
+
|
|
163
|
+
The symbolic core is gate-set agnostic and lives in `qml_essentials.operations`:
|
|
164
|
+
|
|
165
|
+
- `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.
|
|
166
|
+
- `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.
|
|
167
|
+
- `Operation.decompose()` — expresses composite gates (`Rot`, `CRX`/`CRY`/`CRZ`, `CZ`) in terms of Clifford + Pauli-rotation primitives.
|
|
168
|
+
|
|
169
|
+
### Custom Circuits and Input Scaling
|
|
170
|
+
|
|
171
|
+
The `FourierTree` operates on whatever circuit the model's `script` records, so a custom variational circuit can be analysed by replacing `model.script`:
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
import qml_essentials.jaqsi as js
|
|
175
|
+
from qml_essentials.gates import Gates as g
|
|
176
|
+
|
|
177
|
+
def variational(params, inputs, *args, **kwargs):
|
|
178
|
+
params = params.squeeze()
|
|
179
|
+
g.PauliRot(1 * inputs, "Y", wires=[0])
|
|
180
|
+
g.PauliRot(params[0], "XZX", wires=[0, 1, 2])
|
|
181
|
+
g.PauliRot(3 * inputs, "XZ", wires=[0, 1])
|
|
182
|
+
g.PauliRot(params[1], "YY", wires=[0, 1])
|
|
183
|
+
g.PauliRot(9 * inputs, "XY", wires=[0, 1])
|
|
184
|
+
|
|
185
|
+
model = Model(n_qubits=3, n_layers=1, output_qubit=0)
|
|
186
|
+
model._params_shape = (2, 1)
|
|
187
|
+
model.initialize_params() # reallocate params for the custom shape
|
|
188
|
+
model.script = js.Script(f=variational, n_qubits=3)
|
|
189
|
+
|
|
190
|
+
coeffs, freqs = FourierTree(model).get_spectrum()
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The tree distinguishes encoding from variational rotations **automatically**.
|
|
194
|
+
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$.
|
|
195
|
+
|
|
196
|
+
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.
|
|
197
|
+
Non-integer scalings are rounded with a warning; a rotation depending on more than one feature raises `NotImplementedError`; and the `method="dp"` exact-support path does not support non-unit scaling.
|
|
198
|
+
|
|
199
|
+
For the numerical FFT (`Coefficients.get_spectrum`) a custom circuit additionally requires `model.degree` to be set high enough to resolve the largest frequency.
|
|
200
|
+
The sampling grid is built from `model.degree` (the number of frequencies, i.e. $2\,\omega_\text{max} + 1$), not `model.frequencies`.
|
|
201
|
+
|
|
202
|
+
## Estimating the Exact Spectrum
|
|
203
|
+
|
|
204
|
+
The number of frequencies a model can represent is, by default, estimated naively from the encoding (see `model.frequencies` / `model.degree`).
|
|
205
|
+
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.
|
|
206
|
+
|
|
207
|
+
The `FourierTree` lets us obtain the *exact* spectrum of a model via the opt-in `Model.exact_spectrum` method:
|
|
208
|
+
```python
|
|
209
|
+
model = Model(
|
|
210
|
+
n_qubits=3,
|
|
211
|
+
n_layers=1,
|
|
212
|
+
circuit_type="Circuit_19",
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
exact = model.exact_spectrum() # tuple of frequency arrays, one per input feature
|
|
216
|
+
```
|
|
217
|
+
The result is always a subset of `model.frequencies`.
|
|
218
|
+
For example, for the model above the naive estimate is `{-3, ..., 3}` while the exact spectrum is `{-2, -1, 0, 1, 2}`.
|
|
219
|
+
|
|
220
|
+
The support is derived *purely symbolically* — no parameter sampling is involved.
|
|
221
|
+
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.
|
|
222
|
+
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.
|
|
223
|
+
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\}$).
|
|
224
|
+
|
|
225
|
+
Two methods are available:
|
|
226
|
+
|
|
227
|
+
- `method="tree"` (default): fully exact, but enumerates the explicit tree, whose size can grow exponentially with circuit depth.
|
|
228
|
+
- `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 input sine/cosine counts per state.
|
|
229
|
+
This scales to deep circuits where the explicit tree is infeasible (e.g. a 10-layer `Strongly_Entangling` ansatz on 5 qubits takes seconds instead of being intractable).
|
|
230
|
+
It is exact per path, but 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.
|
|
231
|
+
Currently it supports a single input feature.
|
|
232
|
+
|
|
233
|
+
```python
|
|
234
|
+
exact = model.exact_spectrum(method="dp") # for deep circuits
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Note that `exact_spectrum` requires a Clifford + Pauli-rotation ansatz (the same restriction as the `FourierTree`).
|
|
238
|
+
Also keep in mind that a *structurally present* frequency can still have an exponentially small coefficient (the leaf weights scale with $0.5^{s+c}$), so numerically thresholding an FFT spectrum may show fewer frequencies than the exact symbolic support.
|
|
161
239
|
|
|
162
240
|
|
|
163
241
|
## Multi-Dimensional Coefficients
|
|
@@ -215,9 +293,10 @@ fcc = FCC.get_fcc(
|
|
|
215
293
|
```
|
|
216
294
|
Returns `0.1442` as already in Fig. 3a of aforementioned paper.
|
|
217
295
|
|
|
218
|
-
Optionally, you can choose a different correlation `method` (currently "pearson", "complex_pearson", and "
|
|
296
|
+
Optionally, you can choose a different correlation `method` (currently "pearson", "complex_pearson", "spearman", and "covariance" are supported).
|
|
219
297
|
The default "pearson" method preserves the existing behavior for complex coefficients by correlating stacked real and imaginary parts.
|
|
220
298
|
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.
|
|
299
|
+
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
300
|
When calculating the scalar FCC, `calculate_fcc` uses the magnitude of the fingerprint entries.
|
|
222
301
|
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
302
|
|
|
@@ -240,5 +319,8 @@ This is implicitly done in `FCC.get_fourier_fingerprint` (and controlled using t
|
|
|
240
319
|
- removing symmetries inside the correlation matrix (the Fourier fingerprint), e.g. $c_{0,1} = c_{1,0}$
|
|
241
320
|
Note that `get_fcc` also (by default) trims down the fingerprint before calculating the actual FCC.
|
|
242
321
|
|
|
322
|
+
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.
|
|
323
|
+
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.
|
|
324
|
+
|
|
243
325
|
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
326
|
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).
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# JAQSI
|
|
2
|
+
|
|
3
|
+
This page aims to provide a brief overview of the JAQSI (just another quantum simulator) embedded in our package.
|
|
4
|
+
|
|
5
|
+
The simulator aims to be fully abstracted by the `Model` class, so for most usecases, it should not be required to interact with the simulator directly.
|
|
6
|
+
However, some scenarios require building a custom circuits or require more granular control.
|
|
7
|
+
|
|
8
|
+
In the figure below, you can see how JAQSI provides the Foundation for the more standard interfaces `Model`, `Ansaetze` and `Gates`.
|
|
9
|
+
With the latter two being responsible of constructing quantum circuits and therefore interface direction with the `Operations` module of JAQSI, `Model` interfaces with the `Script` class, the main interface for circuit execution.
|
|
10
|
+
|
|
11
|
+
Generally, all operations are registered on a `Tape` when being created in the context of a `Script` (see examples below).
|
|
12
|
+
All matrix definitions (including Kraus channels for noisy simulation) are registered in the `Operations` module.
|
|
13
|
+
|
|
14
|
+

|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
While the standard gate execution is quite straight-forward, the pulse simulation requires a bit more care.
|
|
18
|
+
Here we split up `PulseGates` (abstracted by the `Gates` class) into `PulseParams` and `PulseEnvelope` to get more fine grained control over the underlying implementation.
|
|
19
|
+
As a single source of truth for both, there is the `PulseInformation` class, providing valid combination of these two characteristics.
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+

|
|
23
|
+
|
|
24
|
+
## Architecture
|
|
25
|
+
|
|
26
|
+
Internally, the simulator is split into a handful of modules, each with a single responsibility.
|
|
27
|
+
Together they form a pipeline that turns a circuit function into a measurement result.
|
|
28
|
+
|
|
29
|
+
- `operations.py` : the foundation. Defines every quantum operation: gates (`H`, `RX`, `CX`, `Rot`, ...), observables (`PauliZ`, `Hermitian`), Kraus noise channels (`DepolarizingChannel`, `AmplitudeDamping`, ...) and the (parametrized) Hamiltonians used for pulse evolution. Each `Operation` carries its matrix definition and knows how to apply itself to a statevector or density matrix via cached `einsum` contractions.
|
|
30
|
+
- `tape.py` : the recording layer. Holds the thread-local `Tape` onto which operations register themselves as they are created. A `recording()` context manager collects the operations built inside a circuit function into an ordered list : nothing is executed yet.
|
|
31
|
+
- `script.py` : the orchestrator. The `Script` class is the main entry point (and what `Model` builds upon). It records the circuit, infers the number of qubits, decides between pure and density-matrix simulation, dispatches measurements, and takes care of JIT caching, automatic batching (`vmap` with memory-aware chunking) and circuit drawing.
|
|
32
|
+
- `simulation.py` : the compute engine. A set of pure, stateless functions that run a recorded tape: `simulate_pure` (statevector), `simulate_mixed` (density matrix) and the measurement kernels (`measure_state`, `measure_density`, `sample_shots`). Being pure JAX functions, they are fully differentiable and `jit`/`vmap`-compatible.
|
|
33
|
+
- `memory.py` : memory accounting. Pure helpers that estimate the peak memory of a batched run and, when it would not fit in available RAM, split the batch into chunks that do (`estimate_peak_bytes`, `compute_chunk_size`, `execute_chunked`). `Script` calls these to drive its memory-aware `vmap` chunking.
|
|
34
|
+
- `evolution.py` : Hamiltonian time-evolution. The `Evolution` class builds gates that evolve a (parametrized) Hamiltonian in time, either analytically (`exp(-i t H)` for a static `H`) or by solving the Schrödinger equation with an adaptive `diffrax` solver or a fixed-step Magnus integrator. This module backs the pulse-level simulation.
|
|
35
|
+
- `jaqsi.py` : the entry-point module. Exposes `Script` for circuit building, the `Hamiltonian` factory for time-evolution sources, and a few pulse/gate-independent quantum-info helpers (`partial_trace`, `marginalize_probs`, `build_parity_observable`). Time evolution is invoked as a method on the Hamiltonian object (`hamiltonian.evolve(...)`); the `Evolution` engine is re-exported here for solver configuration (`Evolution.set_solver_defaults`).
|
|
36
|
+
|
|
37
|
+
A call to `Script.execute(...)` then runs four stages:
|
|
38
|
+
|
|
39
|
+
1. Record : the circuit function is executed once so that each operation registers itself on a fresh `Tape`.
|
|
40
|
+
2. Prepare : the qubit count is inferred and the presence of noise channels decides between statevector and density-matrix simulation.
|
|
41
|
+
3. Simulate : the operations are applied in order, each gate contracted into the state via `einsum`.
|
|
42
|
+
4. Measure : the resulting state is turned into the requested output (`state`, `probs`, `expval` or `density`) and optionally sampled into shots.
|
|
43
|
+
|
|
44
|
+
As the whole pipeline is built on JAX, any execution can be differentiated, JIT-compiled and vectorized.
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
The API of our simulator is very similar to what one might be used to know from pennylane.
|
|
49
|
+
|
|
50
|
+
### Gate Level
|
|
51
|
+
|
|
52
|
+
For a basic circuit execution, we have to do two imports:
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import qml_essentials.jaqsi as js
|
|
56
|
+
import qml_essentials.operations as op
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Next, we can create a circuit and specify the observable:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
def circuit():
|
|
63
|
+
op.H(wires=0)
|
|
64
|
+
op.CX(wires=[0, 1])
|
|
65
|
+
|
|
66
|
+
obs = [op.PauliZ(wires=0), op.PauliZ(wires=1)]
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Finally, creating a `Script` and excute it will give us the probabilities for this standard Bell-Circuit:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
jss = js.Script(circuit)
|
|
73
|
+
jss.execute(type="probs", obs=obs)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Parameterization of circuits is straightforward; you just have to pass the args to the `execute` function:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
import jax.numpy as jnp
|
|
80
|
+
|
|
81
|
+
n_qubits = 1
|
|
82
|
+
|
|
83
|
+
def circuit(phi, theta, omega):
|
|
84
|
+
op.Rot(phi, theta, omega, wires=0)
|
|
85
|
+
op.Rot(jnp.pi, 1/2*jnp.pi, 1/4*jnp.pi, wires=0)
|
|
86
|
+
|
|
87
|
+
obs = [op.PauliZ(wires=i) for i in range(n_qubits)]
|
|
88
|
+
jss = js.Script(circuit)
|
|
89
|
+
jss.execute(type="expval", obs=obs, args=(jnp.pi, 1/2*jnp.pi, 1/4*jnp.pi))
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Training those circuits is a breeze as we entirely build upon JAX and can just use OPTAX for this purpose:
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
import optax as otx
|
|
96
|
+
|
|
97
|
+
def cost_fct(params):
|
|
98
|
+
phi, theta, omega = params
|
|
99
|
+
return jss.execute(type="expval", obs=[op.PauliZ(0)], args=(phi, theta, omega))[0]
|
|
100
|
+
|
|
101
|
+
params = jax.numpy.array([0.1, 0.2, 0.3])
|
|
102
|
+
opt = otx.adam(0.01)
|
|
103
|
+
opt_state = opt.init(params)
|
|
104
|
+
|
|
105
|
+
for epoch in range(1, 101):
|
|
106
|
+
grads = jax.grad(cost_fct)(params)
|
|
107
|
+
updates, opt_state = opt.update(grads, opt_state, params)
|
|
108
|
+
params = otx.apply_updates(params, updates)
|
|
109
|
+
|
|
110
|
+
if epoch % 10 == 0:
|
|
111
|
+
print(f"Epoch: {epoch}, Cost: {cost_fct(params):.4f}")
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Beyond this, you can conveniently call `.dagger()` or `.power()` on operations, ...
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
def circuit():
|
|
118
|
+
op.RX(0.5, wires=0)
|
|
119
|
+
op.RX(0.5, wires=0).dagger()
|
|
120
|
+
op.PauliX(wires=0).power(2)
|
|
121
|
+
|
|
122
|
+
obs = [op.PauliZ(0)]
|
|
123
|
+
jss = js.Script(circuit)
|
|
124
|
+
res = jss.execute(type="expval", obs=obs)
|
|
125
|
+
|
|
126
|
+
print(res) # we expect to end up in |0⟩ again
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
or combine them with different noise channels:
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
def circuit():
|
|
133
|
+
op.H(wires=0)
|
|
134
|
+
op.CX(wires=[0, 1])
|
|
135
|
+
op.DepolarizingChannel(0.1, wires=0)
|
|
136
|
+
op.DepolarizingChannel(0.1, wires=1)
|
|
137
|
+
|
|
138
|
+
jss = js.Script(circuit)
|
|
139
|
+
rho = jss.execute(type="density")
|
|
140
|
+
purity = jnp.real(jnp.trace(rho @ rho))
|
|
141
|
+
print(purity) # Purity should be < 1
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
### Pulse Level
|
|
146
|
+
|
|
147
|
+
This section is focussing on the Pulse-level related interface of the simulator.
|
|
148
|
+
If you want to work with the higher-level `Model` interface instead, head over to the [pulses](pulses.md) documentation.
|
|
149
|
+
|
|
150
|
+
As [Pulse Gates](pulses.md) are built entirely upon JAQSI operations, you can also use those in the circuit to perform pulse level simulation:
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
from qml_essentials.gates import PulseGates
|
|
154
|
+
|
|
155
|
+
def circuit(w):
|
|
156
|
+
PulseGates.RX(w, wires=0)
|
|
157
|
+
|
|
158
|
+
obs = [op.PauliZ(0)]
|
|
159
|
+
jss = js.Script(circuit)
|
|
160
|
+
res = jss.execute(type="expval", obs=obs, args=(jnp.pi*0.5,))
|
|
161
|
+
print(res) # expect sth. around 0 (but not too close)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Mixing pulse level simulation with noisy simulations is possible as well:
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
def circuit(w):
|
|
168
|
+
PulseGates.RX(w, wires=0)
|
|
169
|
+
PulseGates.RY(w, wires=0)
|
|
170
|
+
PulseGates.CX(wires=[0, 1])
|
|
171
|
+
op.DepolarizingChannel(0.1, wires=0)
|
|
172
|
+
op.DepolarizingChannel(0.1, wires=1)
|
|
173
|
+
|
|
174
|
+
jss = js.Script(circuit)
|
|
175
|
+
res = jss.execute(type="density", args=(jnp.pi*0.5,))
|
|
176
|
+
purity = jnp.real(jnp.trace(rho @ rho))
|
|
177
|
+
print(purity) # Purity should be < 1
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
You can visualize the pulses schedules, i.e. the sequence in which the pulses are applied on each qubit in the circuit, using the `draw` method.
|
|
181
|
+
Here, shaded areas represent the pulse shape/envelope (e.g. "Gaussian") of the pulse and the vertical line represents the time at which the pulse is applied.
|
|
182
|
+
Note that all gates are automatically decomposed into basis gates (e.g. `H` is decomposed into `RZ` and `RY`).
|
|
183
|
+
|
|
184
|
+
```python
|
|
185
|
+
def circuit(w):
|
|
186
|
+
PulseGates.RX(w, wires=0)
|
|
187
|
+
PulseGates.CZ(wires=0)
|
|
188
|
+
PulseGates.H(wires=1)
|
|
189
|
+
PulseGates.H(wires=1)
|
|
190
|
+
|
|
191
|
+
jss = js.Script(circuit)
|
|
192
|
+
|
|
193
|
+
fig, axes = jss.draw(figure="pulse", args=(jnp.pi*0.5,))
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+

|
|
197
|
+

|
|
198
|
+
|
|
199
|
+
Now let's get a level deeper into the pulse interface.
|
|
200
|
+
Under the hood what happens when you run a pulse gate, is that you evolve a Hermitian matrix in time.
|
|
201
|
+
To demonstrate this, we build a very simple circuit:
|
|
202
|
+
|
|
203
|
+
```python
|
|
204
|
+
def evol_circuit(t):
|
|
205
|
+
time_evol = op.Hermitian(matrix=op.PauliZ._matrix, wires=0).evolve()
|
|
206
|
+
time_evol(t=t, wires=0)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
We can use this circuit directly in JAQSI by passing it to the `Script` class we've seen above:
|
|
210
|
+
|
|
211
|
+
```python
|
|
212
|
+
jss = js.Script(f=evol_circuit)
|
|
213
|
+
res = jss.execute(type="expval", obs=[PauliX(0)], args=(0.3,))
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Here, we let the circuit evolve for `t=0.3` and measure the qubit in the `X` basis.
|
|
217
|
+
Obviously this isn't particluarly usefull, because it doesn't change the state of the qubit.
|
|
218
|
+
However, we can extend this circuit a little bit to start in the `|+⟩` state instead:
|
|
219
|
+
|
|
220
|
+
```python
|
|
221
|
+
def evol_circuit(t):
|
|
222
|
+
H(wires=0) # prepare |+⟩
|
|
223
|
+
time_evol = op.Hermitian(matrix=op.PauliZ._matrix, wires=0).evolve()
|
|
224
|
+
time_evol(t=t, wires=0)
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Note, how we combine a "standard" gate here and combine it with a Hermitian evolution.
|
|
228
|
+
We can then measure:
|
|
229
|
+
|
|
230
|
+
```python
|
|
231
|
+
t = 0.3
|
|
232
|
+
jss = js.Script(f=evol_circuit)
|
|
233
|
+
res = jss.execute(type="expval", obs=[PauliX(0)], args=(t,))
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
which gives us exactly `jnp.cos(2 * t)`.
|
|
237
|
+
|
|
238
|
+
We've just seen an example for a static Hermitian evolution.
|
|
239
|
+
Naturally we can extend this to a parameterized Hermitian as well:
|
|
240
|
+
|
|
241
|
+
```python
|
|
242
|
+
def coeff(p, t):
|
|
243
|
+
return p
|
|
244
|
+
|
|
245
|
+
def circuit(p,t):
|
|
246
|
+
H(wires=0) # prepare |+⟩
|
|
247
|
+
ph = coeff * Hermitian(matrix=Z, wires=0, record=False)
|
|
248
|
+
ph.evolve()([p], t)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Note here, that `coeff` is a callable.
|
|
252
|
+
While it seems a little bit strange to first use a callable and the parameterize it directly afterwards, this mechanism allows us to pre-compile the operation.
|
|
253
|
+
|
|
254
|
+
```python
|
|
255
|
+
jss = js.Script(f=circuit)
|
|
256
|
+
res = jss.execute(type="expval", obs=[PauliX(0)], args=(p,))
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Naturally, we can now use this parameter in a training-scenario and leverage the performance advantage we got through the pre-compilation.
|
|
@@ -271,13 +271,13 @@ from qml_essentials.qoc import CostFnRegistry
|
|
|
271
271
|
options:
|
|
272
272
|
heading_level: 4
|
|
273
273
|
|
|
274
|
-
###
|
|
274
|
+
### Evolution Engine
|
|
275
275
|
|
|
276
276
|
```python
|
|
277
|
-
from qml_essentials.jaqsi import
|
|
277
|
+
from qml_essentials.jaqsi import Evolution
|
|
278
278
|
```
|
|
279
279
|
|
|
280
|
-
::: qml_essentials.
|
|
280
|
+
::: qml_essentials.evolution.Evolution
|
|
281
281
|
options:
|
|
282
282
|
heading_level: 4
|
|
283
283
|
|