qml-essentials 0.2.3__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/.gitignore +1 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/CITATION.cff +2 -2
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/CONTRIBUTING.md +2 -2
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/PKG-INFO +15 -16
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/README.md +11 -9
- qml_essentials-0.3.0/docs/algebra.md +84 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/ansaetze.ipynb +2 -2
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/ansaetze.md +3 -3
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/coefficients.ipynb +2 -2
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/coefficients.md +4 -4
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/generate_circuits.py +3 -3
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/index.md +2 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/noise.md +2 -2
- qml_essentials-0.3.0/docs/pulses.md +69 -0
- qml_essentials-0.3.0/docs/references.md +140 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/usage.md +15 -12
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/mkdocs.yml +1 -2
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/pyproject.toml +4 -7
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/qml_essentials/algebra.py +1 -1
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/qml_essentials/ansaetze.py +138 -10
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/qml_essentials/coefficients.py +2 -2
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/qml_essentials/entanglement.py +19 -18
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/qml_essentials/model.py +46 -45
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/qml_essentials/pauli.py +12 -8
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/qml_essentials/random_sampling.py +5 -5
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/qml_essentials/states.py +1 -1
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/qml_essentials/trainability.py +4 -4
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/tests/conftest.py +1 -1
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/tests/test_algebra.py +1 -1
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/tests/test_ansaetze.py +20 -51
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/tests/test_coefficients.py +5 -5
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/tests/test_matchgate_migration.py +5 -5
- qml_essentials-0.3.0/tests/test_math_model.py +56 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/tests/test_model.py +8 -8
- qml_essentials-0.3.0/tests/test_pauli_circuit.py +70 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/tests/test_states.py +2 -2
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/uv.lock +36 -261
- qml_essentials-0.2.3/docs/benchmarks.py +0 -322
- qml_essentials-0.2.3/docs/figures/gates_fidelities_dark.png +0 -0
- qml_essentials-0.2.3/docs/figures/gates_fidelities_light.png +0 -0
- qml_essentials-0.2.3/docs/figures/jaqsi_overview_dark.png +0 -0
- qml_essentials-0.2.3/docs/figures/jaqsi_overview_light.png +0 -0
- qml_essentials-0.2.3/docs/figures/jaqsi_pulse_dark.png +0 -0
- qml_essentials-0.2.3/docs/figures/jaqsi_pulse_light.png +0 -0
- qml_essentials-0.2.3/docs/figures/pulse_gates_dependencies_dark.png +0 -0
- qml_essentials-0.2.3/docs/figures/pulse_gates_dependencies_light.png +0 -0
- qml_essentials-0.2.3/docs/figures/pulse_schedule_dark.png +0 -0
- qml_essentials-0.2.3/docs/figures/pulse_schedule_light.png +0 -0
- qml_essentials-0.2.3/docs/figures/pulses_structure_dark.png +0 -0
- qml_essentials-0.2.3/docs/figures/pulses_structure_light.png +0 -0
- qml_essentials-0.2.3/docs/jaqsi.ipynb +0 -549
- qml_essentials-0.2.3/docs/jaqsi.md +0 -356
- qml_essentials-0.2.3/docs/math_utils.md +0 -108
- qml_essentials-0.2.3/docs/pulses.ipynb +0 -615
- qml_essentials-0.2.3/docs/pulses.md +0 -185
- qml_essentials-0.2.3/docs/references.md +0 -372
- qml_essentials-0.2.3/docs/slurm_benchmark.sh +0 -31
- qml_essentials-0.2.3/qml_essentials/drawing.py +0 -970
- qml_essentials-0.2.3/qml_essentials/evolution.py +0 -570
- qml_essentials-0.2.3/qml_essentials/gates.py +0 -245
- qml_essentials-0.2.3/qml_essentials/jaqsi.py +0 -167
- qml_essentials-0.2.3/qml_essentials/math.py +0 -431
- qml_essentials-0.2.3/qml_essentials/memory.py +0 -345
- qml_essentials-0.2.3/qml_essentials/operations.py +0 -2617
- qml_essentials-0.2.3/qml_essentials/pulses.py +0 -1689
- qml_essentials-0.2.3/qml_essentials/qoc.py +0 -3085
- qml_essentials-0.2.3/qml_essentials/qoc_results_drag.csv +0 -4
- qml_essentials-0.2.3/qml_essentials/qoc_results_gaussian.csv +0 -4
- qml_essentials-0.2.3/qml_essentials/qoc_results_square.csv +0 -4
- qml_essentials-0.2.3/qml_essentials/script.py +0 -720
- qml_essentials-0.2.3/qml_essentials/simulation.py +0 -400
- qml_essentials-0.2.3/qml_essentials/tape.py +0 -138
- qml_essentials-0.2.3/qml_essentials/unitary.py +0 -712
- qml_essentials-0.2.3/qml_essentials/utils.py +0 -13
- qml_essentials-0.2.3/tests/test_jaqsi.py +0 -3074
- qml_essentials-0.2.3/tests/test_math.py +0 -468
- qml_essentials-0.2.3/tests/test_pauli.py +0 -258
- qml_essentials-0.2.3/tests/test_pulse_state.py +0 -113
- qml_essentials-0.2.3/tests/test_qoc.py +0 -388
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/.github/CODEOWNERS +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/.github/ISSUE_TEMPLATE/code-health.md +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/.github/dependabot.yml +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/.github/workflows/dependabot-approve.yml +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/.github/workflows/docs-publish.yml +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/.github/workflows/docs.yml +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/.github/workflows/publish.yml +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/.github/workflows/quality-publish.yml +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/.github/workflows/quality.yml +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/.github/workflows/test-on-pr.yml +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/.github/workflows/test-on-publish.yml +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/.pre-commit-config.yaml +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/LICENSE +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/diagrams.drawio +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/entanglement.md +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/expressibility.md +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/bloch-sphere.svg +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuit_tikz_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuit_tikz_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_10_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_10_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_13_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_13_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_14_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_14_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_15_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_15_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_16_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_16_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_17_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_17_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_18_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_18_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_19_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_19_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_1_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_1_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_20_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_20_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_2_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_2_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_3_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_3_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_4_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_4_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_5_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_5_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_6_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_6_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_7_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_7_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_8_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_8_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_9_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Circuit_9_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/GHZ_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/GHZ_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Hardware_Efficient_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Hardware_Efficient_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/No_Ansatz_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/No_Ansatz_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/No_Entangling_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/No_Entangling_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Strongly_Entangling_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_4q/Strongly_Entangling_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_10_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_10_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_13_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_13_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_14_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_14_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_15_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_15_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_16_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_16_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_17_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_17_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_18_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_18_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_19_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_19_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_1_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_1_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_20_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_20_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_2_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_2_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_3_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_3_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_4_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_4_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_5_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_5_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_6_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_6_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_7_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_7_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_8_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_8_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_9_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Circuit_9_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/GHZ_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/GHZ_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Hardware_Efficient_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Hardware_Efficient_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/No_Ansatz_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/No_Ansatz_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/No_Entangling_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/No_Entangling_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Strongly_Entangling_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_5q/Strongly_Entangling_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_10_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_10_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_13_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_13_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_14_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_14_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_15_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_15_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_16_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_16_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_17_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_17_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_18_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_18_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_19_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_19_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_1_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_1_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_20_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_20_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_2_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_2_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_3_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_3_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_4_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_4_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_5_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_5_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_6_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_6_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_7_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_7_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_8_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_8_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_9_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Circuit_9_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/GHZ_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/GHZ_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Hardware_Efficient_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Hardware_Efficient_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/No_Ansatz_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/No_Ansatz_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/No_Entangling_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/No_Entangling_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Strongly_Entangling_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/circuits_6q/Strongly_Entangling_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/code.svg +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/fourier_fingerprint_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/fourier_fingerprint_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/fourier_series_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/fourier_series_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/fourier_series_tf_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/fourier_series_tf_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/histogram.svg +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/invert_images.sh +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/model_2d_psd_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/model_2d_psd_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/model_fct_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/model_fct_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/model_fct_spectr_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/model_fct_spectr_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/model_fct_spectr_os_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/model_fct_spectr_os_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/model_fct_spectr_ours_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/model_fct_spectr_ours_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/model_psd_an_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/model_psd_an_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/model_psd_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/model_psd_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/rel-entropy.svg +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/trained_series_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/trained_series_dataset_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/trained_series_dataset_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/trained_series_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/trained_series_tf_dark.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/figures/trained_series_tf_light.png +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/javascripts/mathjax.js +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/logo.svg +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/metrics.ipynb +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/random_sampling.md +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/style.css +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/training.ipynb +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/training.md +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/docs/usage.ipynb +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/qml_essentials/__init__.py +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/qml_essentials/expressibility.py +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/qml_essentials/topologies.py +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/tests/__init__.py +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/tests/test_entanglement.py +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/tests/test_expressiblity.py +0 -0
- {qml_essentials-0.2.3 → qml_essentials-0.3.0}/tests/test_random_sampling.py +0 -0
|
@@ -21,8 +21,8 @@ authors:
|
|
|
21
21
|
- family-names: "Wahl"
|
|
22
22
|
given-names: "Johannes"
|
|
23
23
|
title: "QML Essentials"
|
|
24
|
-
version: 0.
|
|
25
|
-
date-released: 2026-
|
|
24
|
+
version: 0.3.0
|
|
25
|
+
date-released: 2026-09-02
|
|
26
26
|
repository-code: "https://github.com/cirKITers/qml-essentials"
|
|
27
27
|
url: "https://cirkiters.github.io/qml-essentials"
|
|
28
28
|
license: MIT
|
|
@@ -34,9 +34,9 @@ However, it's a good idea to run tests and linting (Ruff and Ty) locally before
|
|
|
34
34
|
```
|
|
35
35
|
uv run ruff format qml_essentials tests
|
|
36
36
|
uv run ruff check --fix qml_essentials tests
|
|
37
|
-
uv run pytest --dist load -m "not
|
|
37
|
+
uv run pytest --dist load -m "not benchmark" -n auto
|
|
38
38
|
```
|
|
39
|
-
Which will run all tests that are not marked as
|
|
39
|
+
Which will run all tests that are not marked as benchmarks.
|
|
40
40
|
See [Pytest](https://pytest.org/) for more details on how to run specific tests only.
|
|
41
41
|
|
|
42
42
|
## Packaging
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: qml-essentials
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
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
|
|
@@ -16,17 +16,14 @@ Classifier: Natural Language :: English
|
|
|
16
16
|
Classifier: Programming Language :: Python
|
|
17
17
|
Classifier: Programming Language :: Python :: 3
|
|
18
18
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
22
21
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
23
|
-
Requires-Python: <3.13,>=3.
|
|
24
|
-
Requires-Dist:
|
|
25
|
-
Requires-Dist: equinox>=0.13.4
|
|
22
|
+
Requires-Python: <3.13,>=3.12
|
|
23
|
+
Requires-Dist: jaqsi>=0.1.0
|
|
26
24
|
Requires-Dist: jax>=0.9.0.1
|
|
27
25
|
Requires-Dist: jaxlib>=0.9.0.1
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist: psutil>=7.2.2
|
|
26
|
+
Requires-Dist: numpy>=2.0.0
|
|
30
27
|
Requires-Dist: scipy>=1.17.0
|
|
31
28
|
Description-Content-Type: text/markdown
|
|
32
29
|
|
|
@@ -49,10 +46,6 @@ Checkout our [Arxiv Paper](https://arxiv.org/abs/2506.06695) to learn more.
|
|
|
49
46
|
```
|
|
50
47
|
pip install qml-essentials
|
|
51
48
|
```
|
|
52
|
-
or with the [uv package manager](https://github.com/astral-sh/uv):
|
|
53
|
-
```
|
|
54
|
-
uv add qml-essentials
|
|
55
|
-
```
|
|
56
49
|
|
|
57
50
|
to install our package from [PyPI](https://pypi.org/project/qml-essentials/).
|
|
58
51
|
|
|
@@ -69,21 +62,22 @@ You can find details on how to use it and further documentation on the correspon
|
|
|
69
62
|
|
|
70
63
|
The following diagram provides an overview on how the different components within this package depend on each other.
|
|
71
64
|
|
|
65
|
+
Circuit simulation is provided by [jaqsi](https://github.com/cirKITers/jaqsi), our gate- and pulse-level simulator, which this package builds upon.
|
|
66
|
+
|
|
72
67
|
```mermaid
|
|
73
68
|
flowchart LR
|
|
74
69
|
qmless([QML Essentials])
|
|
75
70
|
qmless --> qmless.ansaetze([Ansaetze])
|
|
76
71
|
qmless.ansaetze --> qmless.blocks([Blocks])
|
|
77
|
-
qmless.blocks --> qmless.gates([Gates])
|
|
78
72
|
qmless.blocks --> qmless.topo([Topologies])
|
|
79
|
-
qmless.
|
|
80
|
-
qmless.gates --> qmless.pulse([PulseGates])
|
|
73
|
+
qmless.blocks --> jaqsi.gates([Gates])
|
|
81
74
|
qmless --> qmless.coefficients([Coefficients])
|
|
82
75
|
qmless.coefficients --> qmless.analytical([Analytical])
|
|
83
76
|
qmless.coefficients --> qmless.numerical([Numerical])
|
|
84
77
|
qmless.numerical --> qmless.fcc([Fourier Coefficient Correlation])
|
|
85
78
|
qmless.numerical --> qmless.fingerprint([Fourier Fingerprints])
|
|
86
79
|
qmless --> qmless.models([Models])
|
|
80
|
+
qmless.models --> jaqsi.script([Script])
|
|
87
81
|
qmless --> qmless.expr([Expressibility])
|
|
88
82
|
qmless --> qmless.ent([Entanglement])
|
|
89
83
|
qmless.ent --> qmless.mw([Meyer Wallach])
|
|
@@ -92,6 +86,11 @@ flowchart LR
|
|
|
92
86
|
qmless.ent --> qmless.ef([Entanglement of Formation])
|
|
93
87
|
qmless.ent --> qmless.ce([Concentratable Entanglement])
|
|
94
88
|
|
|
89
|
+
subgraph jaqsi [jaqsi]
|
|
90
|
+
jaqsi.gates
|
|
91
|
+
jaqsi.script
|
|
92
|
+
end
|
|
93
|
+
|
|
95
94
|
classDef l1 fill:#1f8f5a,stroke:#1f8f5a,color:#d4f7e8
|
|
96
95
|
classDef l2 fill:#2fb170,stroke:#2fb170,color:#d4f7e8
|
|
97
96
|
classDef l3 fill:#58e3a6,stroke:#58e3a6,color:#272a35
|
|
@@ -101,8 +100,8 @@ flowchart LR
|
|
|
101
100
|
|
|
102
101
|
class qmless l1
|
|
103
102
|
class qmless.ansaetze,qmless.coefficients,qmless.models,qmless.expr,qmless.ent l2
|
|
104
|
-
class qmless.blocks,qmless.
|
|
105
|
-
class qmless.
|
|
103
|
+
class qmless.blocks,qmless.numerical,qmless.analytical,qmless.mw,qmless.bell,qmless.ef,qmless.re,qmless.ce l3
|
|
104
|
+
class qmless.topo,qmless.fcc,qmless.fingerprint,jaqsi.gates,jaqsi.script l4
|
|
106
105
|
```
|
|
107
106
|
|
|
108
107
|
## 🚧 Contributing
|
|
@@ -17,10 +17,6 @@ Checkout our [Arxiv Paper](https://arxiv.org/abs/2506.06695) to learn more.
|
|
|
17
17
|
```
|
|
18
18
|
pip install qml-essentials
|
|
19
19
|
```
|
|
20
|
-
or with the [uv package manager](https://github.com/astral-sh/uv):
|
|
21
|
-
```
|
|
22
|
-
uv add qml-essentials
|
|
23
|
-
```
|
|
24
20
|
|
|
25
21
|
to install our package from [PyPI](https://pypi.org/project/qml-essentials/).
|
|
26
22
|
|
|
@@ -37,21 +33,22 @@ You can find details on how to use it and further documentation on the correspon
|
|
|
37
33
|
|
|
38
34
|
The following diagram provides an overview on how the different components within this package depend on each other.
|
|
39
35
|
|
|
36
|
+
Circuit simulation is provided by [jaqsi](https://github.com/cirKITers/jaqsi), our gate- and pulse-level simulator, which this package builds upon.
|
|
37
|
+
|
|
40
38
|
```mermaid
|
|
41
39
|
flowchart LR
|
|
42
40
|
qmless([QML Essentials])
|
|
43
41
|
qmless --> qmless.ansaetze([Ansaetze])
|
|
44
42
|
qmless.ansaetze --> qmless.blocks([Blocks])
|
|
45
|
-
qmless.blocks --> qmless.gates([Gates])
|
|
46
43
|
qmless.blocks --> qmless.topo([Topologies])
|
|
47
|
-
qmless.
|
|
48
|
-
qmless.gates --> qmless.pulse([PulseGates])
|
|
44
|
+
qmless.blocks --> jaqsi.gates([Gates])
|
|
49
45
|
qmless --> qmless.coefficients([Coefficients])
|
|
50
46
|
qmless.coefficients --> qmless.analytical([Analytical])
|
|
51
47
|
qmless.coefficients --> qmless.numerical([Numerical])
|
|
52
48
|
qmless.numerical --> qmless.fcc([Fourier Coefficient Correlation])
|
|
53
49
|
qmless.numerical --> qmless.fingerprint([Fourier Fingerprints])
|
|
54
50
|
qmless --> qmless.models([Models])
|
|
51
|
+
qmless.models --> jaqsi.script([Script])
|
|
55
52
|
qmless --> qmless.expr([Expressibility])
|
|
56
53
|
qmless --> qmless.ent([Entanglement])
|
|
57
54
|
qmless.ent --> qmless.mw([Meyer Wallach])
|
|
@@ -60,6 +57,11 @@ flowchart LR
|
|
|
60
57
|
qmless.ent --> qmless.ef([Entanglement of Formation])
|
|
61
58
|
qmless.ent --> qmless.ce([Concentratable Entanglement])
|
|
62
59
|
|
|
60
|
+
subgraph jaqsi [jaqsi]
|
|
61
|
+
jaqsi.gates
|
|
62
|
+
jaqsi.script
|
|
63
|
+
end
|
|
64
|
+
|
|
63
65
|
classDef l1 fill:#1f8f5a,stroke:#1f8f5a,color:#d4f7e8
|
|
64
66
|
classDef l2 fill:#2fb170,stroke:#2fb170,color:#d4f7e8
|
|
65
67
|
classDef l3 fill:#58e3a6,stroke:#58e3a6,color:#272a35
|
|
@@ -69,8 +71,8 @@ flowchart LR
|
|
|
69
71
|
|
|
70
72
|
class qmless l1
|
|
71
73
|
class qmless.ansaetze,qmless.coefficients,qmless.models,qmless.expr,qmless.ent l2
|
|
72
|
-
class qmless.blocks,qmless.
|
|
73
|
-
class qmless.
|
|
74
|
+
class qmless.blocks,qmless.numerical,qmless.analytical,qmless.mw,qmless.bell,qmless.ef,qmless.re,qmless.ce l3
|
|
75
|
+
class qmless.topo,qmless.fcc,qmless.fingerprint,jaqsi.gates,jaqsi.script l4
|
|
74
76
|
```
|
|
75
77
|
|
|
76
78
|
## 🚧 Contributing
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Algebra and States
|
|
2
|
+
|
|
3
|
+
Beyond the metrics computed from a `Model`, the `algebra` and `states` modules provide
|
|
4
|
+
dynamical Lie algebra (DLA) tooling and state-preparation utilities used for
|
|
5
|
+
trainability and barren-plateau analysis.
|
|
6
|
+
|
|
7
|
+
## DLA and g-purity
|
|
8
|
+
|
|
9
|
+
Beyond circuit execution, the `algebra` module provides dynamical Lie algebra (DLA) helpers used for trainability and barren-plateau analysis.
|
|
10
|
+
The matchgate algebra $\mathfrak{so}(2n)$ is available both as a generating set and as an explicit Pauli-string basis, and the latter must match the Lie closure of the former:
|
|
11
|
+
|
|
12
|
+
```python
|
|
13
|
+
from qml_essentials.algebra import (
|
|
14
|
+
matchgate_generators,
|
|
15
|
+
matchgate_basis,
|
|
16
|
+
dim_so2n,
|
|
17
|
+
lie_closure_paulis,
|
|
18
|
+
g_purity_from_basis,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
n = 3
|
|
22
|
+
gens = matchgate_generators(n) # {Z_k} u {X_k X_{k+1}}
|
|
23
|
+
basis = matchgate_basis(n) # the n(2n-1) Pauli strings of so(2n)
|
|
24
|
+
assert len(basis) == dim_so2n(n)
|
|
25
|
+
assert {pw.to_pauli_string() for pw in lie_closure_paulis(gens)} == set(basis)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
An ansatz that saturates $\mathfrak{su}(2^n)$ has a closure of $4^n - 1$ words, which quickly becomes intractable to enumerate.
|
|
29
|
+
Pass `max_dim` to stop the growth early; a result of that length means $\dim \mathfrak{g} \geq$ `max_dim` and the basis is partial, so it is only meaningful as a dimension bound:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
capped = lie_closure_paulis(gens, max_dim=dim_so2n(n))
|
|
33
|
+
assert len(capped) == dim_so2n(n) # so(2n) is reached exactly
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The g-purity $P_g = \sum_B \langle\psi\lvert B\rvert\psi\rangle^2$ of a statevector with respect to a DLA basis measures how much of the state lies in the algebra:
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
import numpy as np
|
|
40
|
+
|
|
41
|
+
psi = np.zeros(2**n, dtype=complex)
|
|
42
|
+
psi[0] = 1.0 # |0...0>
|
|
43
|
+
print(g_purity_from_basis(psi, basis)) # 3.0 (only the on-site Z_k contribute)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`g_purity_from_basis` takes a Pauli-word basis (strings or `PauliWord` objects).
|
|
47
|
+
For a Hilbert-Schmidt-orthonormal Hermitian matrix basis, for example the output of `lie_closure_matrices`, use `g_purity_matrix` instead.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## Permutation-symmetric operators and input states
|
|
51
|
+
|
|
52
|
+
The `symmetric_pauli_sum` constructor sums a Pauli over all subsets of a given size, e.g. $\sum_k X_k$ (`locality=1`) or $\sum_{j<k} X_j X_k$ (`locality=2`).
|
|
53
|
+
The $S_n$-equivariant generators $\{\sum_k X_k, \sum_k Y_k, \sum_{j<k} Z_j Z_k\}$ and observable $O = \tfrac{2}{n(n-1)} \sum_{j<k} X_j X_k$ build on it, and the generators feed the matrix DLA:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import numpy as np
|
|
57
|
+
from qml_essentials.algebra import (
|
|
58
|
+
sn_equivariant_generators,
|
|
59
|
+
lie_closure_matrices,
|
|
60
|
+
g_purity_matrix,
|
|
61
|
+
)
|
|
62
|
+
from qml_essentials.states import dicke_state, haar_state, graph_state_vector, path_edges
|
|
63
|
+
|
|
64
|
+
n = 4
|
|
65
|
+
basis = lie_closure_matrices(sn_equivariant_generators(n)) # HS-orthonormal DLA basis
|
|
66
|
+
|
|
67
|
+
for psi in (dicke_state(n, 2), haar_state(n, seed=0), graph_state_vector(n, path_edges(n))):
|
|
68
|
+
print(g_purity_matrix(psi, basis))
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The same statevectors can be evolved through a circuit by passing them as the initial state:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from jaqsi import Script
|
|
75
|
+
from qml_essentials.ansaetze import Ansaetze
|
|
76
|
+
import jaqsi
|
|
77
|
+
|
|
78
|
+
def circ():
|
|
79
|
+
Ansaetze.Permutation_Equivariant.build(np.array([0.7, 1.1, 0.5]), n)
|
|
80
|
+
|
|
81
|
+
script = Script(circ, n_qubits=n)
|
|
82
|
+
zs = script.execute(type="expval", obs=[jaqsi.PauliZ(q) for q in range(n)], initial_state=dicke_state(n, 2))
|
|
83
|
+
```
|
|
84
|
+
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"outputs": [],
|
|
57
57
|
"source": [
|
|
58
58
|
"from qml_essentials.ansaetze import Circuit\n",
|
|
59
|
-
"from
|
|
59
|
+
"from jaqsi.gates import Gates\n",
|
|
60
60
|
"from qml_essentials.topologies import Topology, Block\n",
|
|
61
61
|
"\n",
|
|
62
62
|
"\n",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"outputs": [],
|
|
100
100
|
"source": [
|
|
101
101
|
"import pennylane.numpy as np\n",
|
|
102
|
-
"from
|
|
102
|
+
"from jaqsi.gates import PulseInformation as pinfo\n",
|
|
103
103
|
"from typing import Optional\n",
|
|
104
104
|
"\n",
|
|
105
105
|
"\n",
|
|
@@ -27,7 +27,7 @@ You can find a list of all the available topologies in the [references](https://
|
|
|
27
27
|
To start implementing your own ansatz, you can inheriting from the `Circuit` class:
|
|
28
28
|
```python
|
|
29
29
|
from qml_essentials.ansaetze import Circuit
|
|
30
|
-
from
|
|
30
|
+
from jaqsi import Gates
|
|
31
31
|
from qml_essentials.topologies import Topology, Block
|
|
32
32
|
|
|
33
33
|
class MyHardwareEfficient(Circuit):
|
|
@@ -67,7 +67,7 @@ model = Model(
|
|
|
67
67
|
If you don't want to use the provided blocks and topologies, you can build your own Ansatz from scratch but have to implement all the required methods shown in the example below:
|
|
68
68
|
```python
|
|
69
69
|
import pennylane.numpy as np
|
|
70
|
-
from
|
|
70
|
+
from jaqsi.gates import PulseInformation as pinfo
|
|
71
71
|
from typing import Optional
|
|
72
72
|
|
|
73
73
|
class MyHardwareEfficient(Circuit):
|
|
@@ -133,7 +133,7 @@ A callable must take an input, the wire where it's acting on and an optional noi
|
|
|
133
133
|
Let's look at an example, where we want to encode a two-dimensional input:
|
|
134
134
|
```python
|
|
135
135
|
from qml_essentials.model import Model
|
|
136
|
-
from
|
|
136
|
+
from jaqsi import Gates
|
|
137
137
|
|
|
138
138
|
def MyCustomEncoding(w, wires, **kwars):
|
|
139
139
|
Gates.RX(w[0], wires, **kwargs)
|
|
@@ -327,7 +327,7 @@
|
|
|
327
327
|
],
|
|
328
328
|
"source": [
|
|
329
329
|
"from matplotlib.colors import LogNorm\n",
|
|
330
|
-
"from
|
|
330
|
+
"from jaqsi.gates import Gates\n",
|
|
331
331
|
"import pennylane as qml\n",
|
|
332
332
|
"import numpy as np\n",
|
|
333
333
|
"\n",
|
|
@@ -396,7 +396,7 @@
|
|
|
396
396
|
}
|
|
397
397
|
],
|
|
398
398
|
"source": [
|
|
399
|
-
"from
|
|
399
|
+
"from jaqsi.gates import Gates\n",
|
|
400
400
|
"\n",
|
|
401
401
|
"\n",
|
|
402
402
|
"def none_encoding(*args, **kwargs):\n",
|
|
@@ -169,10 +169,10 @@ The implementation is also inspired by the corresponding [code](https://github.c
|
|
|
169
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`).
|
|
170
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.
|
|
171
171
|
|
|
172
|
-
The Clifford commutation and Pauli bookkeeping are implemented symbolically on a stabilizer-tableau Pauli representation (`
|
|
172
|
+
The Clifford commutation and Pauli bookkeeping are implemented symbolically on a stabilizer-tableau Pauli representation (`jaqsi.paulis.PauliWord`), and the parameter-dependent coefficients are evaluated with vectorized operations.
|
|
173
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
174
|
|
|
175
|
-
The symbolic core is gate-set agnostic and lives in `
|
|
175
|
+
The symbolic core is gate-set agnostic and lives in `jaqsi.paulis`:
|
|
176
176
|
|
|
177
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
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.
|
|
@@ -183,8 +183,8 @@ The symbolic core is gate-set agnostic and lives in `qml_essentials.operations`:
|
|
|
183
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
184
|
|
|
185
185
|
```python
|
|
186
|
-
import
|
|
187
|
-
from
|
|
186
|
+
import jaqsi as js
|
|
187
|
+
from jaqsi import Gates as g
|
|
188
188
|
|
|
189
189
|
def variational(params, inputs, *args, **kwargs):
|
|
190
190
|
params = params.squeeze()
|
|
@@ -3,9 +3,9 @@ import os
|
|
|
3
3
|
import jax.numpy as jnp
|
|
4
4
|
|
|
5
5
|
from qml_essentials.ansaetze import Ansaetze
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
6
|
+
from jaqsi.drawing import draw_mpl
|
|
7
|
+
from jaqsi.operations import Barrier
|
|
8
|
+
from jaqsi.tape import recording
|
|
9
9
|
|
|
10
10
|
edit_ansaetze_file = False
|
|
11
11
|
ansaetze = Ansaetze.get_available()
|
|
@@ -23,6 +23,8 @@ or with the [uv package manager](https://github.com/astral-sh/uv):
|
|
|
23
23
|
uv add qml-essentials
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
Circuit simulation is provided by [jaqsi](https://cirkiters.github.io/jaqsi/), our gate- and pulse-level simulator, which is installed alongside this package.
|
|
27
|
+
|
|
26
28
|
Once you have set things up, go ahead and checkout [how to use qml-essentials](usage.md).
|
|
27
29
|
|
|
28
30
|
<p align="center">
|
|
@@ -34,12 +34,12 @@ model(
|
|
|
34
34
|
|
|
35
35
|
In addition to these decoherent errors, we can also apply a `GateError` which affects each parameterized gate as $w = w + \mathcal{N}(0, \epsilon)$, where $\sqrt{\epsilon}$ is the standard deviation of the noise, specified by the `GateError` key in the `noise_params` argument.
|
|
36
36
|
Each gate draws its own error, independently of the other gates in the circuit.
|
|
37
|
-
It's important to note that, depending on the flag set in `
|
|
37
|
+
It's important to note that, depending on the flag set in `UnitaryGates.batch_gate_error`, the error of a given gate will be applied to the entire batch of parameters (all batch elements are affected in the same way) or drawn for each batch element individually (default).
|
|
38
38
|
This can be particularly usefull in a scenario where one would like to apply noise e.g. only on the encoding gates but wants to change them all uniformly.
|
|
39
39
|
An example of this is provided in the following code:
|
|
40
40
|
|
|
41
41
|
```python
|
|
42
|
-
from
|
|
42
|
+
from jaqsi.gates import UnitaryGates
|
|
43
43
|
|
|
44
44
|
UnitaryGates.batch_gate_error = False
|
|
45
45
|
model(
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Pulses
|
|
2
|
+
|
|
3
|
+
Models can be run at the **pulse level**, where each gate is implemented as a time-dependent control pulse rather than an abstract unitary.
|
|
4
|
+
This provides a more fine grained access to the simulation of the underlying physical process.
|
|
5
|
+
While we provide a developer-oriented overview in this section, we would like to highlight [Tilmann's Bachelor's Thesis](https://doi.org/10.5445/IR/1000184129) if you want to have a more detailled read into pulse-level simulation and quantum Fourier models.
|
|
6
|
+
|
|
7
|
+
The pulse gates themselves, their envelopes, the ODE solver and the quantum optimal control tooling live in the [jaqsi simulator](https://cirkiters.github.io/jaqsi/pulses/).
|
|
8
|
+
This page covers how to drive them from a `Model`.
|
|
9
|
+
|
|
10
|
+
## Building Ansatzes in Pulse Mode
|
|
11
|
+
|
|
12
|
+
When building an ansatz in pulse mode (via a `Model`), the framework internally passes an array of ones as element-wise scalers for the optimized parameters.
|
|
13
|
+
If `pulse_params` are provided for a model or gate, these are treated similarly as element-wise scalers to modify the default pulses. We again take advantage of the **kwargs and call:
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
model(pulse_params=model.pulse_params * 1.5)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Here, input and params are inferred from the `Model` instance, and we scale all pulse parameters by a factor of 1.5.
|
|
20
|
+
Currently there is no way to change the raw values of pulse parameter through the model api directly.
|
|
21
|
+
|
|
22
|
+
Note that a `Model` selects the pulse level differently than an individual gate does.
|
|
23
|
+
An individual gate takes `pulse=True` on the [`Gates`](https://cirkiters.github.io/jaqsi/usage/#gate-level) entry point, whereas a model infers the level per gate group from the pulse parameters you pass: `pulse_params` lowers the ansatz and state-preparation gates, `enc_pulse_params` lowers the input-encoding gates.
|
|
24
|
+
Passing neither keeps the whole circuit unitary.
|
|
25
|
+
The `gate_mode` argument of a model call is deprecated and only kept for backwards compatibility.
|
|
26
|
+
|
|
27
|
+
Similar to the input and standard parameters, we also support batching for the `pulse_params` argument, meaning that you can also pass a batched array of pulse parameters of e.g. size 2 to as follows:
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
model(pulse_params=np.repeat(model.pulse_params, 2, axis=0))
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Pulse-Level Encoding
|
|
34
|
+
|
|
35
|
+
Passing `pulse_params` runs the ansatz and state-preparation gates at pulse level while the input-encoding gates are still applied as ideal unitaries.
|
|
36
|
+
The encoding gates are covered by `enc_pulse_params`: passing only those runs the encoding at pulse level and keeps the ansatz unitary, passing both runs everything at pulse level.
|
|
37
|
+
Pass only `enc_pulse_params` if you want to study the encoding in isolation, without the ansatz pulses contributing to the result.
|
|
38
|
+
The scalers behave identically to the pulse parameters of trainable unitaries.
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
model = Model(n_qubits=2, n_layers=1, circuit_type="Hardware_Efficient")
|
|
42
|
+
|
|
43
|
+
# only the encoding gates run as pulses, the ansatz stays unitary
|
|
44
|
+
model(inputs=inputs, enc_pulse_params=model.enc_pulse_params)
|
|
45
|
+
|
|
46
|
+
# encoding and ansatz gates run as pulses
|
|
47
|
+
model(inputs=inputs, pulse_params=model.pulse_params, enc_pulse_params=model.enc_pulse_params)
|
|
48
|
+
|
|
49
|
+
# scale the encoding pulses explicitly
|
|
50
|
+
model(inputs=inputs, enc_pulse_params=model.enc_pulse_params * 1.5)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`enc_pulse_params` is batchable along its leading axis, analogous to `pulse_params`:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
model(inputs=inputs, enc_pulse_params=np.repeat(model.enc_pulse_params, 2, axis=0))
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Each parameter set only lowers the gates it belongs to, so the group whose parameters you omit stays unitary.
|
|
60
|
+
|
|
61
|
+
Note that Golomb encoding and custom encoding callables have no pulse level representation, so passing `enc_pulse_params` raises a `ValueError` for them.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
## Pulse Envelopes
|
|
65
|
+
|
|
66
|
+
Each pulse is shaped by an envelope; the available ones are `gaussian`, `square`, `cosine`, `drag`, `sech` and `general` (see `PulseEnvelope.available()`).
|
|
67
|
+
The envelope is selected globally via the `pulse_shape` argument of the `Model`, e.g. `Model(..., pulse_shape="drag")`.
|
|
68
|
+
|
|
69
|
+
For the underlying pulse parametrization, the ODE solver settings and how to tune pulse parameters with quantum optimal control, see the [jaqsi pulses documentation](https://cirkiters.github.io/jaqsi/pulses/).
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
## Ansaetze
|
|
2
|
+
|
|
3
|
+
```python
|
|
4
|
+
from qml_essentials.ansaetze import Ansaetze
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
::: qml_essentials.ansaetze.Ansaetze
|
|
8
|
+
options:
|
|
9
|
+
heading_level: 3
|
|
10
|
+
|
|
11
|
+
### Circuit
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from qml_essentials.ansaetze import Circuit
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
::: qml_essentials.ansaetze.Circuit
|
|
18
|
+
options:
|
|
19
|
+
heading_level: 4
|
|
20
|
+
|
|
21
|
+
### Declarative Circuit
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from qml_essentials.ansaetze import DeclarativeCircuit
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
::: qml_essentials.ansaetze.DeclarativeCircuit
|
|
28
|
+
options:
|
|
29
|
+
heading_level: 4
|
|
30
|
+
|
|
31
|
+
### Block
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from qml_essentials.ansaetze import Block
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
::: qml_essentials.ansaetze.Block
|
|
38
|
+
options:
|
|
39
|
+
heading_level: 4
|
|
40
|
+
|
|
41
|
+
### Encoding
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from qml_essentials.ansaetze import Encoding
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
::: qml_essentials.ansaetze.Encoding
|
|
48
|
+
options:
|
|
49
|
+
heading_level: 4
|
|
50
|
+
|
|
51
|
+
## Model
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from qml_essentials.model import Model
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
::: qml_essentials.model.Model
|
|
58
|
+
options:
|
|
59
|
+
heading_level: 3
|
|
60
|
+
|
|
61
|
+
## Entanglement
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from qml_essentials.entanglement import Entanglement
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
::: qml_essentials.entanglement.Entanglement
|
|
68
|
+
options:
|
|
69
|
+
heading_level: 3
|
|
70
|
+
|
|
71
|
+
## Expressibility
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from qml_essentials.expressibility import Expressibility
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
::: qml_essentials.expressibility.Expressibility
|
|
78
|
+
options:
|
|
79
|
+
heading_level: 3
|
|
80
|
+
|
|
81
|
+
## Coefficients
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from qml_essentials.coefficients import Coefficients
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
::: qml_essentials.coefficients.Coefficients
|
|
88
|
+
options:
|
|
89
|
+
heading_level: 3
|
|
90
|
+
|
|
91
|
+
### Fourier Tree
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from qml_essentials.coefficients import FourierTree
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
::: qml_essentials.coefficients.FourierTree
|
|
98
|
+
options:
|
|
99
|
+
heading_level: 4
|
|
100
|
+
|
|
101
|
+
### Fourier Coefficient Correlation
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from qml_essentials.coefficients import FCC
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
::: qml_essentials.coefficients.FCC
|
|
108
|
+
options:
|
|
109
|
+
heading_level: 4
|
|
110
|
+
|
|
111
|
+
### Datasets
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
from qml_essentials.coefficients import Datasets
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
::: qml_essentials.coefficients.Datasets
|
|
118
|
+
options:
|
|
119
|
+
heading_level: 4
|
|
120
|
+
|
|
121
|
+
## Topologies
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
from qml_essentials.topologies import Topology
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
::: qml_essentials.topologies.Topology
|
|
128
|
+
options:
|
|
129
|
+
heading_level: 3
|
|
130
|
+
|
|
131
|
+
## Pauli Circuit
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from qml_essentials.pauli import PauliCircuit
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
::: qml_essentials.pauli.PauliCircuit
|
|
138
|
+
options:
|
|
139
|
+
heading_level: 3
|
|
140
|
+
|
|
@@ -251,14 +251,14 @@ See [*Pulses*](pulses.md#pulse_level_encoding) for the parameters belonging to e
|
|
|
251
251
|
Pulse-level gates can also be instantiated directly:
|
|
252
252
|
|
|
253
253
|
```python
|
|
254
|
-
from
|
|
254
|
+
from jaqsi import Gates
|
|
255
255
|
|
|
256
256
|
# RX gate represented by its microwave pulse
|
|
257
|
-
Gates.RX(w, wires=0,
|
|
257
|
+
Gates.RX(w, wires=0, pulse=True)
|
|
258
258
|
|
|
259
259
|
# With custom pulse parameters [A, sigma, t]
|
|
260
260
|
pulse_params = [0.5, 0.2, 1.0]
|
|
261
|
-
Gates.RX(w, wires=0, pulse_params=pulse_params,
|
|
261
|
+
Gates.RX(w, wires=0, pulse_params=pulse_params, pulse=True)
|
|
262
262
|
```
|
|
263
263
|
and then used in [custom Ansaetze](ansaetze.md#custom_ansatz) or directly as [encoding gates](ansaetze.md#custom_encoding).
|
|
264
264
|
See our documentation on [Quantum Optimal Control (QOC)](pulses.md#quantum_optimal_control_qoc) for more details on how to choose pulse parameters.
|
|
@@ -272,21 +272,21 @@ For more details:
|
|
|
272
272
|
## Batching and Multithreading (using JAX)
|
|
273
273
|
|
|
274
274
|
In our framework, JAX automatically handles the number and distribution of the workers depending on the batch sizes and available CPUs.
|
|
275
|
-
Batching works for inputs, parameters and pulse parameters.
|
|
276
|
-
If all
|
|
277
|
-
Internally, these combinations will be flattened during processing and then reshaped to the original shape afterwards, such that the output shape is `[B_I, B_P, B_R, O]`.
|
|
278
|
-
Here, `O` is the general output shape depending on the execution type.
|
|
279
|
-
|
|
275
|
+
Batching works for inputs, parameters, pulse parameters and encoding pulse parameters.
|
|
276
|
+
If all four are provided, with sizes `B_I`, `B_P`, `B_R` and `B_E`, respectively, the effective batch dimension will multiply, i.e. resulting in `B_I * B_P * B_R * B_E` combinations.
|
|
277
|
+
Internally, these combinations will be flattened during processing and then reshaped to the original shape afterwards, such that the output shape is `[B_I, B_P, B_R, B_E, O]`.
|
|
278
|
+
Here, `O` is the general output shape depending on the execution type, and may span more than one axis (e.g. for `density` and `probs`).
|
|
279
|
+
The batch part of that shape is also available as a property of the model: `model.batch_shape`.
|
|
280
280
|
Note, that the output shape is squeezed by default, i.e. every axis of dimension 1 is suppressed.
|
|
281
281
|
This includes the output axis `O`, so a single observable or a batch of one changes the rank of the result.
|
|
282
|
-
Pass `keepdims=True` to get the full `[B_I, B_P, B_R, O]` shape instead:
|
|
282
|
+
Pass `keepdims=True` to get the full `[B_I, B_P, B_R, B_E, O]` shape instead:
|
|
283
283
|
|
|
284
284
|
```python
|
|
285
285
|
model(params, inputs, keepdims=True)
|
|
286
286
|
```
|
|
287
287
|
|
|
288
288
|
In addition to letting the model handle repeating the batch axes, it is also possible to disable this functionality by setting `repeat_batch_axis` upon model initialization.
|
|
289
|
-
This parameter is an array of boolean values determining
|
|
289
|
+
This parameter is an array of four boolean values determining if the corresponding axis in the `batch_shape` (#Inputs, #Params, #PulseParams, #EncPulseParams) should be repeated.
|
|
290
290
|
Of course, when providing the batch manually, the dimensions have to match.
|
|
291
291
|
|
|
292
292
|
```python
|
|
@@ -353,10 +353,13 @@ To create a document that can be compiled, simply pass `full_document=True` when
|
|
|
353
353
|
In some cases you may not want to utilize the structure enforced by the `Model` class.
|
|
354
354
|
Therefore, this section provides an example on how to use a custom circuit.
|
|
355
355
|
|
|
356
|
+
Gates are applied through jaqsi's [`Gates`](https://cirkiters.github.io/jaqsi/usage/#gate-level) entry point, exactly as inside a `Model`.
|
|
357
|
+
It records the gate, attaches any noise you request, and runs it as an ideal unitary or, with `pulse=True`, at pulse level.
|
|
358
|
+
|
|
356
359
|
```python
|
|
357
|
-
from
|
|
360
|
+
from jaqsi import Gates as g
|
|
358
361
|
from qml_essentials.model import Model
|
|
359
|
-
import
|
|
362
|
+
import jaqsi as js
|
|
360
363
|
import jax.numpy as jnp
|
|
361
364
|
|
|
362
365
|
def my_circuit(params, inputs, *args, **kwargs) -> None:
|