pauli-propagator 3.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.
Files changed (88) hide show
  1. pauli_propagator-3.3.0/.gitattributes +1 -0
  2. pauli_propagator-3.3.0/.github/workflows/native-tests.yml +23 -0
  3. pauli_propagator-3.3.0/.github/workflows/wheels.yml +100 -0
  4. pauli_propagator-3.3.0/.gitignore +132 -0
  5. pauli_propagator-3.3.0/.readthedocs.yaml +18 -0
  6. pauli_propagator-3.3.0/CITATION.cff +13 -0
  7. pauli_propagator-3.3.0/LICENSE +21 -0
  8. pauli_propagator-3.3.0/PKG-INFO +165 -0
  9. pauli_propagator-3.3.0/README.md +136 -0
  10. pauli_propagator-3.3.0/benchmarks/bench_evaluator.py +170 -0
  11. pauli_propagator-3.3.0/benchmarks/bench_pipeline.py +206 -0
  12. pauli_propagator-3.3.0/docs/Makefile +20 -0
  13. pauli_propagator-3.3.0/docs/make.bat +35 -0
  14. pauli_propagator-3.3.0/docs/requirements.txt +3 -0
  15. pauli_propagator-3.3.0/docs/source/_static/custom.css +18 -0
  16. pauli_propagator-3.3.0/docs/source/_static/logo_dark.svg +421 -0
  17. pauli_propagator-3.3.0/docs/source/_static/logo_light.svg +676 -0
  18. pauli_propagator-3.3.0/docs/source/_static/ppdoc1.svg +382 -0
  19. pauli_propagator-3.3.0/docs/source/conf.py +87 -0
  20. pauli_propagator-3.3.0/docs/source/getting_started/citation.rst +37 -0
  21. pauli_propagator-3.3.0/docs/source/getting_started/installation.rst +32 -0
  22. pauli_propagator-3.3.0/docs/source/getting_started/overview.rst +10 -0
  23. pauli_propagator-3.3.0/docs/source/getting_started/usage.rst +136 -0
  24. pauli_propagator-3.3.0/docs/source/index.rst +28 -0
  25. pauli_propagator-3.3.0/docs/source/modules.rst +7 -0
  26. pauli_propagator-3.3.0/docs/source/native_pprop_rs.rst +15 -0
  27. pauli_propagator-3.3.0/docs/source/pprop.gates.base.rst +7 -0
  28. pauli_propagator-3.3.0/docs/source/pprop.gates.controlled.rst +7 -0
  29. pauli_propagator-3.3.0/docs/source/pprop.gates.controlledrotation.rst +7 -0
  30. pauli_propagator-3.3.0/docs/source/pprop.gates.rotation.rst +7 -0
  31. pauli_propagator-3.3.0/docs/source/pprop.gates.rst +23 -0
  32. pauli_propagator-3.3.0/docs/source/pprop.gates.simpleclifford.rst +7 -0
  33. pauli_propagator-3.3.0/docs/source/pprop.gates.simplenonclifford.rst +7 -0
  34. pauli_propagator-3.3.0/docs/source/pprop.optimization.rst +10 -0
  35. pauli_propagator-3.3.0/docs/source/pprop.pauli.op.rst +7 -0
  36. pauli_propagator-3.3.0/docs/source/pprop.pauli.rst +19 -0
  37. pauli_propagator-3.3.0/docs/source/pprop.pauli.sentence.rst +7 -0
  38. pauli_propagator-3.3.0/docs/source/pprop.propagator.binding.rst +7 -0
  39. pauli_propagator-3.3.0/docs/source/pprop.propagator.rst +19 -0
  40. pauli_propagator-3.3.0/docs/source/pprop.propagator.utils.rst +7 -0
  41. pauli_propagator-3.3.0/docs/source/pprop.rst +21 -0
  42. pauli_propagator-3.3.0/native/pprop_rs/.gitignore +1 -0
  43. pauli_propagator-3.3.0/native/pprop_rs/Cargo.lock +228 -0
  44. pauli_propagator-3.3.0/native/pprop_rs/Cargo.toml +18 -0
  45. pauli_propagator-3.3.0/native/pprop_rs/pyproject.toml +12 -0
  46. pauli_propagator-3.3.0/native/pprop_rs/python/pprop_rs/__init__.py +3 -0
  47. pauli_propagator-3.3.0/native/pprop_rs/src/lib.rs +2009 -0
  48. pauli_propagator-3.3.0/notebooks/assets/brick6_cone.svg +813 -0
  49. pauli_propagator-3.3.0/notebooks/assets/ising2d.svg +243 -0
  50. pauli_propagator-3.3.0/notebooks/assets/logo_light.svg +677 -0
  51. pauli_propagator-3.3.0/notebooks/assets/pictures.svg +223 -0
  52. pauli_propagator-3.3.0/notebooks/assets/pruning.svg +295 -0
  53. pauli_propagator-3.3.0/notebooks/extra/dynamic_circuit.ipynb +255 -0
  54. pauli_propagator-3.3.0/notebooks/extra/new_stuff.ipynb +450 -0
  55. pauli_propagator-3.3.0/notebooks/extra/vqe.ipynb +359 -0
  56. pauli_propagator-3.3.0/notebooks/showcase.ipynb +472 -0
  57. pauli_propagator-3.3.0/notebooks/theory.ipynb +258 -0
  58. pauli_propagator-3.3.0/notebooks/tutorial.ipynb +284 -0
  59. pauli_propagator-3.3.0/postBuild +12 -0
  60. pauli_propagator-3.3.0/pyproject.toml +35 -0
  61. pauli_propagator-3.3.0/runtime.txt +1 -0
  62. pauli_propagator-3.3.0/src/pprop/__init__.py +1 -0
  63. pauli_propagator-3.3.0/src/pprop/gates/__init__.py +43 -0
  64. pauli_propagator-3.3.0/src/pprop/gates/base.py +118 -0
  65. pauli_propagator-3.3.0/src/pprop/gates/controlled.py +184 -0
  66. pauli_propagator-3.3.0/src/pprop/gates/controlledrotation.py +356 -0
  67. pauli_propagator-3.3.0/src/pprop/gates/rotation.py +173 -0
  68. pauli_propagator-3.3.0/src/pprop/gates/simpleclifford.py +172 -0
  69. pauli_propagator-3.3.0/src/pprop/gates/simplenonclifford.py +95 -0
  70. pauli_propagator-3.3.0/src/pprop/optimization/__init__.py +450 -0
  71. pauli_propagator-3.3.0/src/pprop/pauli/__init__.py +0 -0
  72. pauli_propagator-3.3.0/src/pprop/pauli/op.py +132 -0
  73. pauli_propagator-3.3.0/src/pprop/pauli/sentence.py +115 -0
  74. pauli_propagator-3.3.0/src/pprop/propagator/__init__.py +579 -0
  75. pauli_propagator-3.3.0/src/pprop/propagator/binding.py +157 -0
  76. pauli_propagator-3.3.0/src/pprop/propagator/evaluator.py +299 -0
  77. pauli_propagator-3.3.0/src/pprop/propagator/utils.py +87 -0
  78. pauli_propagator-3.3.0/tests/conftest.py +17 -0
  79. pauli_propagator-3.3.0/tests/legacy_sparse_arrays.py +150 -0
  80. pauli_propagator-3.3.0/tests/test_backends.py +612 -0
  81. pauli_propagator-3.3.0/tests/test_evaluator_gradient.py +82 -0
  82. pauli_propagator-3.3.0/tests/test_layered_propagation.py +243 -0
  83. pauli_propagator-3.3.0/tests/test_optimization.py +188 -0
  84. pauli_propagator-3.3.0/tests/test_propagation.py +75 -0
  85. pauli_propagator-3.3.0/tests/test_pruning.py +47 -0
  86. pauli_propagator-3.3.0/tests/test_ragged_layout.py +35 -0
  87. pauli_propagator-3.3.0/tests/test_rule_tables.py +193 -0
  88. pauli_propagator-3.3.0/tests/test_rust_evaluator.py +95 -0
@@ -0,0 +1 @@
1
+ *.ipynb -linguist-detectable
@@ -0,0 +1,23 @@
1
+ name: Native extension tests
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ native-tests:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ matrix:
12
+ python-version: ['3.12', '3.13']
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: ${{ matrix.python-version }}
18
+ - uses: dtolnay/rust-toolchain@stable
19
+ - run: python -m pip install . pytest ./native/pprop_rs
20
+ - name: Require the native implementation and run the full suite
21
+ run: python -m pytest tests/ -q
22
+ env:
23
+ PPROP_REQUIRE_NATIVE: '1'
@@ -0,0 +1,100 @@
1
+ name: Wheels
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ native:
11
+ strategy:
12
+ matrix:
13
+ include:
14
+ - { os: ubuntu-latest, target: x86_64, manylinux: "2_28" }
15
+ - { os: ubuntu-latest, target: aarch64, manylinux: "2_28" }
16
+ - { os: macos-14, target: aarch64 }
17
+ - { os: windows-latest, target: x64 }
18
+ runs-on: ${{ matrix.os }}
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: PyO3/maturin-action@v1
22
+ with:
23
+ working-directory: native/pprop_rs
24
+ target: ${{ matrix.target }}
25
+ manylinux: ${{ matrix.manylinux || 'auto' }}
26
+ args: --release --out dist
27
+ - uses: actions/upload-artifact@v4
28
+ with:
29
+ name: wheels-${{ matrix.os }}-${{ matrix.target }}
30
+ path: native/pprop_rs/dist
31
+
32
+ sdists:
33
+ runs-on: ubuntu-latest
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+ - uses: PyO3/maturin-action@v1
37
+ with:
38
+ command: sdist
39
+ working-directory: native/pprop_rs
40
+ args: --out dist
41
+ - uses: astral-sh/setup-uv@v5
42
+ # Pure-Python wheel + sdist of pauli-propagator.
43
+ - run: uv build --out-dir native/pprop_rs/dist
44
+ - uses: actions/upload-artifact@v4
45
+ with:
46
+ name: sdists
47
+ path: native/pprop_rs/dist
48
+
49
+ # Install the built wheels (no Rust toolchain) and run the suite against them.
50
+ test:
51
+ needs: [native, sdists]
52
+ runs-on: ubuntu-latest
53
+ strategy:
54
+ matrix:
55
+ python-version: ['3.12', '3.13']
56
+ steps:
57
+ - uses: actions/checkout@v4
58
+ - uses: actions/setup-python@v5
59
+ with:
60
+ python-version: ${{ matrix.python-version }}
61
+ - uses: actions/download-artifact@v4
62
+ with:
63
+ path: dist
64
+ merge-multiple: true
65
+ - run: python -m pip install --find-links dist --only-binary pprop-rs pauli-propagator pytest
66
+ - run: python -m pytest tests/ -q
67
+ env:
68
+ PPROP_REQUIRE_NATIVE: '1'
69
+
70
+ # Each package has its own PyPI trusted publisher, and so its own environment.
71
+ # pprop-rs goes first so pauli-propagator is never live without its dependency.
72
+ publish-pprop-rs:
73
+ if: startsWith(github.ref, 'refs/tags/v')
74
+ needs: [native, sdists, test]
75
+ runs-on: ubuntu-latest
76
+ environment: pypi-rs
77
+ permissions:
78
+ id-token: write
79
+ steps:
80
+ - uses: actions/download-artifact@v4
81
+ with:
82
+ path: dist
83
+ merge-multiple: true
84
+ - run: find dist -type f ! -name 'pprop_rs-*' -delete
85
+ - uses: pypa/gh-action-pypi-publish@release/v1
86
+
87
+ publish-pauli-propagator:
88
+ if: startsWith(github.ref, 'refs/tags/v')
89
+ needs: [publish-pprop-rs]
90
+ runs-on: ubuntu-latest
91
+ environment: pypi
92
+ permissions:
93
+ id-token: write
94
+ steps:
95
+ - uses: actions/download-artifact@v4
96
+ with:
97
+ path: dist
98
+ merge-multiple: true
99
+ - run: find dist -type f ! -name 'pauli_propagator-*' -delete
100
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,132 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ *.sage.py
7
+ cython_debug/
8
+
9
+ # Build & packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ *egg-info
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+ *.manifest
30
+ *.spec
31
+ pip-log.txt
32
+ pip-delete-this-directory.txt
33
+ wandb/
34
+
35
+ # Virtual environments
36
+ .env
37
+ .venv
38
+ env/
39
+ venv/
40
+ ENV/
41
+ env.bak/
42
+ venv.bak/
43
+ __pypackages__/
44
+ .python-version
45
+
46
+ # Testing & coverage
47
+ htmlcov/
48
+ .tox/
49
+ .nox/
50
+ .coverage
51
+ .coverage.*
52
+ .cache
53
+ nosetests.xml
54
+ coverage.xml
55
+ *.cover
56
+ *.py,cover
57
+ .hypothesis/
58
+ .pytest_cache/
59
+ cover/
60
+
61
+ # Type checkers & linters
62
+ .mypy_cache/
63
+ .dmypy.json
64
+ dmypy.json
65
+ .pyre/
66
+ .pytype/
67
+
68
+ # Dependency managers
69
+ .pdm.toml
70
+ # Pipfile.lock
71
+ # poetry.lock
72
+ # pdm.lock
73
+
74
+ # Jupyter & IPython
75
+ .ipynb_checkpoints
76
+ profile_default/
77
+ ipython_config.py
78
+
79
+ # IDEs & editors
80
+ .spyderproject
81
+ .spyproject
82
+ .ropeproject
83
+ # .idea/
84
+ *.code-workspace
85
+
86
+ # Documentation
87
+ docs/_build/
88
+ /site
89
+
90
+ # Translations
91
+ *.mo
92
+ *.pot
93
+
94
+ # Python frameworks & misc tools
95
+ *.log
96
+ local_settings.py
97
+ db.sqlite3
98
+ db.sqlite3-journal
99
+ instance/
100
+ .webassets-cache
101
+ .scrapy
102
+ .pybuilder/
103
+ target/
104
+ celerybeat-schedule
105
+ celerybeat.pid
106
+
107
+ # LaTeX
108
+ *.aux
109
+ *.bit
110
+ *.blg
111
+ *.bbl
112
+ *.lof
113
+ *.lot
114
+ *.glo
115
+ *.glx
116
+ *.gxg
117
+ *.gxs
118
+ *.idx
119
+ *.ilg
120
+ *.ind
121
+ *.out
122
+ *.url
123
+ *.svn
124
+ *.toc
125
+ svg-inkscape/
126
+
127
+ # Project-specific
128
+ test/
129
+ scripts/
130
+ personal/
131
+ future/
132
+ .vscode/
@@ -0,0 +1,18 @@
1
+ # Read the Docs configuration file
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+
4
+ version: 2
5
+
6
+ build:
7
+ os: ubuntu-24.04
8
+ tools:
9
+ python: "3.13"
10
+
11
+ sphinx:
12
+ configuration: docs/source/conf.py
13
+
14
+ python:
15
+ install:
16
+ - method: pip
17
+ path: .
18
+ - requirements: docs/requirements.txt
@@ -0,0 +1,13 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it as below."
3
+ authors:
4
+ - family-names: "Monaco"
5
+ given-names: "Saverio"
6
+ orcid: "https://orcid.org/0000-0001-8784-5011"
7
+ - family-names: "Lipponen"
8
+ given-names: "Aapo"
9
+ title: "Pauli-Propagator"
10
+ version: 3.1.0
11
+ doi: 10.5281/zenodo.21650428
12
+ date-released: 2026-09-28
13
+ url: "https://github.com/SaverioMonaco/Pauli-Propagator"
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Saverio Monaco
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,165 @@
1
+ Metadata-Version: 2.5
2
+ Name: pauli-propagator
3
+ Version: 3.3.0
4
+ Summary: A Pennylane-based toolkit for approximate symbolic Pauli propagation and evaluation of quantum circuit observables.
5
+ Author-email: Saverio Monaco <saverio.monaco@desy.de>, Aapo Lipponen <aapo.lipponen@gmail.com>
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.12
8
+ Requires-Dist: jax==0.5.0
9
+ Requires-Dist: jaxlib==0.5.0
10
+ Requires-Dist: matplotlib==3.11.1
11
+ Requires-Dist: optax==0.2.4
12
+ Requires-Dist: pennylane==0.42.3
13
+ Requires-Dist: pprop-rs==0.1.0
14
+ Requires-Dist: scipy>=1.11
15
+ Requires-Dist: sympy>=1.14.0
16
+ Provides-Extra: dev
17
+ Requires-Dist: furo; extra == 'dev'
18
+ Requires-Dist: myst-parser; extra == 'dev'
19
+ Requires-Dist: sphinx>=7; extra == 'dev'
20
+ Provides-Extra: notebooks
21
+ Requires-Dist: ipykernel>=6.29.5; extra == 'notebooks'
22
+ Requires-Dist: matplotlib>=3.10.3; extra == 'notebooks'
23
+ Provides-Extra: scripts
24
+ Requires-Dist: pillow; extra == 'scripts'
25
+ Requires-Dist: qiskit; extra == 'scripts'
26
+ Requires-Dist: qiskit-ibm-runtime; extra == 'scripts'
27
+ Requires-Dist: wandb>=0.19; extra == 'scripts'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # Pauli Propagation of Parametrized Circuits
31
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23020043.svg)](https://doi.org/10.5281/zenodo.23020043)
32
+
33
+ Try it without installation via Binder: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/SaverioMonaco/Pauli-Propagator/HEAD?urlpath=%2Fdoc%2Ftree%2Fnotebooks%2Fshowcase.ipynb)
34
+
35
+ ## Overview
36
+
37
+ Convert the expectation values of a circuit’s observables into explicit functions of the circuit’s parameters.
38
+
39
+ ## Usage
40
+
41
+ * First import all the necessary libraries:
42
+
43
+ ```python
44
+ import pennylane as qml # To define the circuit
45
+ from pprop.propagator import Propagator # For Pauli Propagation
46
+ ```
47
+
48
+ * Define the circuit as a function of the parameters
49
+
50
+ ```python
51
+ # Function of parameters
52
+ def ansatz(params : list[float]):
53
+ qml.RX(params[0], wires=0)
54
+ qml.RX(params[1], wires=1)
55
+
56
+ qml.RY(params[2], wires=0)
57
+ qml.RY(params[3], wires=1)
58
+
59
+ qml.Hadamard(wires = 2)
60
+
61
+ qml.Barrier()
62
+
63
+ qml.CNOT(wires = [0, 1])
64
+ qml.CNOT(wires = [1, 2])
65
+
66
+ qml.Barrier()
67
+
68
+ qml.RY(params[4], wires=0)
69
+ qml.RY(params[5], wires=1)
70
+ qml.RY(params[6], wires=2)
71
+
72
+ return [qml.expval(qml.PauliZ(qubit)) for qubit in range(1)] + [qml.expval(qml.PauliX(0)@qml.PauliX(1)@qml.PauliX(2))] + [qml.expval(qml.PauliY(2))] + [qml.expval(-qml.PauliX(0)@qml.PauliX(1)@qml.PauliX(2) + 13*qml.PauliZ(2))]
73
+ ```
74
+
75
+ * Define the propagator
76
+ ```python
77
+ prop = Propagator(
78
+ ansatz,
79
+ k1 = None, # Cutoff on the Pauli Weight
80
+ k2 = None, # Cutoff on the frequencies
81
+ )
82
+ ```
83
+ ```
84
+ >>> prop
85
+ Propagator
86
+ Number of qubits : 3
87
+ Trainable parameters : 7
88
+ ```
89
+ ```
90
+ >>> prop.show()
91
+ 0: ──RX(0.00)──RY(2.00)──||─╭●─────||──RY(4.00)─┤ <Z> ╭<X@X@X> ╭<𝓗(-1.00,13.00)>
92
+ 1: ──RX(1.00)──RY(3.00)──||─╰X─╭●──||──RY(5.00)─┤ ├<X@X@X> ├<𝓗(-1.00,13.00)>
93
+ 2: ──H───────────────────||────╰X──||──RY(6.00)─┤ ╰<X@X@X> <Y> ╰<𝓗(-1.00,13.00)>
94
+ ```
95
+
96
+ * Propagate the observables (this runs in the Rust extension `pprop_rs`):
97
+ ```python
98
+ prop.propagate()
99
+ ```
100
+
101
+ * Get the output expectation values by calling the class and feeding the circuit's parameters
102
+ ```python
103
+ random_params = qml.numpy.arange(prop.num_params)
104
+ prop_output = prop(random_params)
105
+ [ 0.32448205 -0.52806187 0. 4.1604633 ]
106
+ ```
107
+
108
+ * You can inspect the explicit functions using `.expression()`
109
+ ```
110
+ >>> prop.expression(0)
111
+ -1.0*sin(θ2)*sin(θ3)*sin(θ4)*cos(θ0)*cos(θ1) + 1.0*cos(θ0)*cos(θ2)*cos(θ4)
112
+ ```
113
+
114
+ ## Installation
115
+
116
+ ```bash
117
+ pip install pauli-propagator
118
+ ```
119
+
120
+ This pulls in the Rust extension `pprop_rs` as a prebuilt wheel (Linux x86_64/aarch64,
121
+ macOS arm64, Windows x64; Python 3.12+). On other platforms pip builds it from
122
+ source, which needs a Rust toolchain ([rustup](https://rustup.rs/)).
123
+
124
+ ### Development install
125
+
126
+ ```bash
127
+ pip install maturin
128
+ cd native/pprop_rs
129
+ maturin develop --release
130
+ cd ../..
131
+ pip install -e .
132
+ ```
133
+
134
+ `maturin develop` builds `pprop_rs` and installs it straight into the active
135
+ virtual environment. Re-run it after pulling changes to `native/pprop_rs`.
136
+
137
+ ## Examples
138
+
139
+ For detailed examples, please refer to the `notebooks` directory, which
140
+ contains Jupyter notebooks that demonstrate various use cases and tests of
141
+ the propagator.
142
+
143
+ ## Citation
144
+ If you use this software in your research or publications, **please cite** the following:
145
+
146
+ ```
147
+ @software{monaco_2026_23020043,
148
+ author = {Monaco, Saverio and
149
+ Lipponen, Aapo},
150
+ doi = {10.5281/zenodo.23021244},
151
+ month = sep,
152
+ publisher = {Zenodo},
153
+ swhid = {swh:1:dir:ce152d847302ce6b14f1197f106986050d09c0f4
154
+ ;origin=https://doi.org/10.5281/zenodo.16028009;vi
155
+ sit=swh:1:snp:a9b8558798b8b9e8375e83e7aca935976731
156
+ 18b2;anchor=swh:1:rel:6f6cac02e75daff2e374b752bb49
157
+ f157960d3915;path=SaverioMonaco-Pauli-
158
+ Propagator-4bb7e0d
159
+ },
160
+ title = {Pauli-Propagator},
161
+ url = {https://doi.org/10.5281/zenodo.23021244},
162
+ version = {v3.1.0},
163
+ year = 2026
164
+ }
165
+ ```
@@ -0,0 +1,136 @@
1
+ # Pauli Propagation of Parametrized Circuits
2
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23020043.svg)](https://doi.org/10.5281/zenodo.23020043)
3
+
4
+ Try it without installation via Binder: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/SaverioMonaco/Pauli-Propagator/HEAD?urlpath=%2Fdoc%2Ftree%2Fnotebooks%2Fshowcase.ipynb)
5
+
6
+ ## Overview
7
+
8
+ Convert the expectation values of a circuit’s observables into explicit functions of the circuit’s parameters.
9
+
10
+ ## Usage
11
+
12
+ * First import all the necessary libraries:
13
+
14
+ ```python
15
+ import pennylane as qml # To define the circuit
16
+ from pprop.propagator import Propagator # For Pauli Propagation
17
+ ```
18
+
19
+ * Define the circuit as a function of the parameters
20
+
21
+ ```python
22
+ # Function of parameters
23
+ def ansatz(params : list[float]):
24
+ qml.RX(params[0], wires=0)
25
+ qml.RX(params[1], wires=1)
26
+
27
+ qml.RY(params[2], wires=0)
28
+ qml.RY(params[3], wires=1)
29
+
30
+ qml.Hadamard(wires = 2)
31
+
32
+ qml.Barrier()
33
+
34
+ qml.CNOT(wires = [0, 1])
35
+ qml.CNOT(wires = [1, 2])
36
+
37
+ qml.Barrier()
38
+
39
+ qml.RY(params[4], wires=0)
40
+ qml.RY(params[5], wires=1)
41
+ qml.RY(params[6], wires=2)
42
+
43
+ return [qml.expval(qml.PauliZ(qubit)) for qubit in range(1)] + [qml.expval(qml.PauliX(0)@qml.PauliX(1)@qml.PauliX(2))] + [qml.expval(qml.PauliY(2))] + [qml.expval(-qml.PauliX(0)@qml.PauliX(1)@qml.PauliX(2) + 13*qml.PauliZ(2))]
44
+ ```
45
+
46
+ * Define the propagator
47
+ ```python
48
+ prop = Propagator(
49
+ ansatz,
50
+ k1 = None, # Cutoff on the Pauli Weight
51
+ k2 = None, # Cutoff on the frequencies
52
+ )
53
+ ```
54
+ ```
55
+ >>> prop
56
+ Propagator
57
+ Number of qubits : 3
58
+ Trainable parameters : 7
59
+ ```
60
+ ```
61
+ >>> prop.show()
62
+ 0: ──RX(0.00)──RY(2.00)──||─╭●─────||──RY(4.00)─┤ <Z> ╭<X@X@X> ╭<𝓗(-1.00,13.00)>
63
+ 1: ──RX(1.00)──RY(3.00)──||─╰X─╭●──||──RY(5.00)─┤ ├<X@X@X> ├<𝓗(-1.00,13.00)>
64
+ 2: ──H───────────────────||────╰X──||──RY(6.00)─┤ ╰<X@X@X> <Y> ╰<𝓗(-1.00,13.00)>
65
+ ```
66
+
67
+ * Propagate the observables (this runs in the Rust extension `pprop_rs`):
68
+ ```python
69
+ prop.propagate()
70
+ ```
71
+
72
+ * Get the output expectation values by calling the class and feeding the circuit's parameters
73
+ ```python
74
+ random_params = qml.numpy.arange(prop.num_params)
75
+ prop_output = prop(random_params)
76
+ [ 0.32448205 -0.52806187 0. 4.1604633 ]
77
+ ```
78
+
79
+ * You can inspect the explicit functions using `.expression()`
80
+ ```
81
+ >>> prop.expression(0)
82
+ -1.0*sin(θ2)*sin(θ3)*sin(θ4)*cos(θ0)*cos(θ1) + 1.0*cos(θ0)*cos(θ2)*cos(θ4)
83
+ ```
84
+
85
+ ## Installation
86
+
87
+ ```bash
88
+ pip install pauli-propagator
89
+ ```
90
+
91
+ This pulls in the Rust extension `pprop_rs` as a prebuilt wheel (Linux x86_64/aarch64,
92
+ macOS arm64, Windows x64; Python 3.12+). On other platforms pip builds it from
93
+ source, which needs a Rust toolchain ([rustup](https://rustup.rs/)).
94
+
95
+ ### Development install
96
+
97
+ ```bash
98
+ pip install maturin
99
+ cd native/pprop_rs
100
+ maturin develop --release
101
+ cd ../..
102
+ pip install -e .
103
+ ```
104
+
105
+ `maturin develop` builds `pprop_rs` and installs it straight into the active
106
+ virtual environment. Re-run it after pulling changes to `native/pprop_rs`.
107
+
108
+ ## Examples
109
+
110
+ For detailed examples, please refer to the `notebooks` directory, which
111
+ contains Jupyter notebooks that demonstrate various use cases and tests of
112
+ the propagator.
113
+
114
+ ## Citation
115
+ If you use this software in your research or publications, **please cite** the following:
116
+
117
+ ```
118
+ @software{monaco_2026_23020043,
119
+ author = {Monaco, Saverio and
120
+ Lipponen, Aapo},
121
+ doi = {10.5281/zenodo.23021244},
122
+ month = sep,
123
+ publisher = {Zenodo},
124
+ swhid = {swh:1:dir:ce152d847302ce6b14f1197f106986050d09c0f4
125
+ ;origin=https://doi.org/10.5281/zenodo.16028009;vi
126
+ sit=swh:1:snp:a9b8558798b8b9e8375e83e7aca935976731
127
+ 18b2;anchor=swh:1:rel:6f6cac02e75daff2e374b752bb49
128
+ f157960d3915;path=SaverioMonaco-Pauli-
129
+ Propagator-4bb7e0d
130
+ },
131
+ title = {Pauli-Propagator},
132
+ url = {https://doi.org/10.5281/zenodo.23021244},
133
+ version = {v3.1.0},
134
+ year = 2026
135
+ }
136
+ ```