paulikit 0.1.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 (93) hide show
  1. paulikit-0.1.0/.github/workflows/paulikit-wheels.yml +160 -0
  2. paulikit-0.1.0/.gitignore +38 -0
  3. paulikit-0.1.0/AUTHORS +17 -0
  4. paulikit-0.1.0/CHANGELOG.md +118 -0
  5. paulikit-0.1.0/CITATION.cff +65 -0
  6. paulikit-0.1.0/CODE_OF_CONDUCT.md +136 -0
  7. paulikit-0.1.0/CONTRIBUTING.md +128 -0
  8. paulikit-0.1.0/LICENSE +232 -0
  9. paulikit-0.1.0/Makefile.in +212 -0
  10. paulikit-0.1.0/PKG-INFO +352 -0
  11. paulikit-0.1.0/README.md +305 -0
  12. paulikit-0.1.0/configure +3091 -0
  13. paulikit-0.1.0/docs/Makefile +23 -0
  14. paulikit-0.1.0/docs/api/_native.rst +26 -0
  15. paulikit-0.1.0/docs/api/algorithms.rst +20 -0
  16. paulikit-0.1.0/docs/api/cli.rst +7 -0
  17. paulikit-0.1.0/docs/api/hamiltonian.rst +7 -0
  18. paulikit-0.1.0/docs/api/index.md +12 -0
  19. paulikit-0.1.0/docs/api/pauli_utils.rst +7 -0
  20. paulikit-0.1.0/docs/api/testing.rst +12 -0
  21. paulikit-0.1.0/docs/background.md +118 -0
  22. paulikit-0.1.0/docs/conf.py +109 -0
  23. paulikit-0.1.0/docs/index.md +16 -0
  24. paulikit-0.1.0/docs/installation.md +144 -0
  25. paulikit-0.1.0/docs/non_hermitian.md +134 -0
  26. paulikit-0.1.0/docs/package_layout.md +55 -0
  27. paulikit-0.1.0/docs/theory.md +241 -0
  28. paulikit-0.1.0/docs/tutorial.md +411 -0
  29. paulikit-0.1.0/meson.build +24 -0
  30. paulikit-0.1.0/meson.options +39 -0
  31. paulikit-0.1.0/pyproject.toml +159 -0
  32. paulikit-0.1.0/src/paulikit/__init__.py +57 -0
  33. paulikit-0.1.0/src/paulikit/_native/__init__.py +37 -0
  34. paulikit-0.1.0/src/paulikit/_native/cache_probe.c +217 -0
  35. paulikit-0.1.0/src/paulikit/_native/cache_probe.h +110 -0
  36. paulikit-0.1.0/src/paulikit/_native/cache_probe.pyx +80 -0
  37. paulikit-0.1.0/src/paulikit/_native/coeffs.c +128 -0
  38. paulikit-0.1.0/src/paulikit/_native/coeffs.h +131 -0
  39. paulikit-0.1.0/src/paulikit/_native/coeffs_native.pyx +136 -0
  40. paulikit-0.1.0/src/paulikit/_native/gather.c +42 -0
  41. paulikit-0.1.0/src/paulikit/_native/gather.h +82 -0
  42. paulikit-0.1.0/src/paulikit/_native/gather_native.pyx +89 -0
  43. paulikit-0.1.0/src/paulikit/_native/hermitian_check.c +33 -0
  44. paulikit-0.1.0/src/paulikit/_native/hermitian_check.h +71 -0
  45. paulikit-0.1.0/src/paulikit/_native/hermitian_check_native.pyx +67 -0
  46. paulikit-0.1.0/src/paulikit/_native/meson.build +291 -0
  47. paulikit-0.1.0/src/paulikit/_native/pauli_label.c +38 -0
  48. paulikit-0.1.0/src/paulikit/_native/pauli_label.h +54 -0
  49. paulikit-0.1.0/src/paulikit/_native/pauli_label_native.pyx +119 -0
  50. paulikit-0.1.0/src/paulikit/_native/pauli_label_parallel.cpp +38 -0
  51. paulikit-0.1.0/src/paulikit/_native/pauli_label_parallel.h +37 -0
  52. paulikit-0.1.0/src/paulikit/_native/test_pauli_label.c +119 -0
  53. paulikit-0.1.0/src/paulikit/_native/test_pauli_label_parallel.cpp +101 -0
  54. paulikit-0.1.0/src/paulikit/_native/wht.c +197 -0
  55. paulikit-0.1.0/src/paulikit/_native/wht.h +140 -0
  56. paulikit-0.1.0/src/paulikit/_native/wht_native.pyx +92 -0
  57. paulikit-0.1.0/src/paulikit/algorithms/__init__.py +10 -0
  58. paulikit-0.1.0/src/paulikit/algorithms/autotune.py +475 -0
  59. paulikit-0.1.0/src/paulikit/algorithms/fwht.py +3433 -0
  60. paulikit-0.1.0/src/paulikit/algorithms/meson.build +6 -0
  61. paulikit-0.1.0/src/paulikit/cli.py +501 -0
  62. paulikit-0.1.0/src/paulikit/hamiltonian.py +202 -0
  63. paulikit-0.1.0/src/paulikit/meson.build +11 -0
  64. paulikit-0.1.0/src/paulikit/pauli_utils.py +71 -0
  65. paulikit-0.1.0/src/paulikit/testing/__init__.py +7 -0
  66. paulikit-0.1.0/src/paulikit/testing/fixtures.py +236 -0
  67. paulikit-0.1.0/src/paulikit/testing/meson.build +5 -0
  68. paulikit-0.1.0/tests/test_array_yielding.py +285 -0
  69. paulikit-0.1.0/tests/test_autotune.py +425 -0
  70. paulikit-0.1.0/tests/test_benchmark_reference.py +86 -0
  71. paulikit-0.1.0/tests/test_cache_probe.py +76 -0
  72. paulikit-0.1.0/tests/test_checkpoint_format.py +237 -0
  73. paulikit-0.1.0/tests/test_chunked_accumulator.py +140 -0
  74. paulikit-0.1.0/tests/test_cli_parallel.py +151 -0
  75. paulikit-0.1.0/tests/test_exhaustive_verification.py +163 -0
  76. paulikit-0.1.0/tests/test_fixtures.py +67 -0
  77. paulikit-0.1.0/tests/test_fwht.py +341 -0
  78. paulikit-0.1.0/tests/test_parallel_decompose.py +464 -0
  79. paulikit-0.1.0/tests/test_progress_marker.py +204 -0
  80. paulikit-0.1.0/tests/test_sparse_hamiltonian.py +166 -0
  81. paulikit-0.1.0/tests/test_streaming.py +240 -0
  82. paulikit-0.1.0/tests/test_threaded_drain.py +213 -0
  83. paulikit-0.1.0/tests/test_wht_kernel.py +192 -0
  84. paulikit-0.1.0/verification/FINDINGS.md +155 -0
  85. paulikit-0.1.0/verification/README.md +87 -0
  86. paulikit-0.1.0/verification/exhaustive_projection.py +288 -0
  87. paulikit-0.1.0/verification/results/N100_hermitian_20260828.json +32 -0
  88. paulikit-0.1.0/verification/results/N150_hermitian_20260828.json +33 -0
  89. paulikit-0.1.0/verification/results/N20_hermitian_20260828.json +40 -0
  90. paulikit-0.1.0/verification/results/N20_nonhermitian_20260828.json +40 -0
  91. paulikit-0.1.0/verification/results/N50_hermitian_20260828.json +33 -0
  92. paulikit-0.1.0/verification/results/N80_hermitian_20260828.json +32 -0
  93. paulikit-0.1.0/verification/run_verification.py +265 -0
@@ -0,0 +1,160 @@
1
+ # Build manylinux wheels for paulikit (sdist is a separate job in this
2
+ # workflow). Config lives in pyproject.toml under [tool.cibuildwheel]:
3
+ # Linux x86_64 + aarch64, CPython 3.10-3.13, musllinux/Windows/macOS
4
+ # skipped by design.
5
+ #
6
+ # Runs on the GitHub mirror (github.com/beavernets-inc/paulikit). Codeberg
7
+ # (codeberg.org/beavernets/paulikit) is the canonical repository;
8
+ # hosted Forgejo Actions runners are not used for this matrix (need
9
+ # Docker-capable manylinux builds). Manual or tag-triggered only —
10
+ # not on every push. Kernel import gates (wht_native / coeffs_native /
11
+ # gather_native) run inside cibuildwheel's test-command so a wheel
12
+ # without the transform path fails the job.
13
+ #
14
+ # Publish: prefer Trusted Publishing (OIDC). Optional fallback: set
15
+ # environment secret TEST_PYPI_API_TOKEN or PYPI_API_TOKEN (pypi.org
16
+ # "API token" with upload scope) on the matching GitHub Environment.
17
+ # Do not commit tokens.
18
+
19
+ name: paulikit wheels
20
+
21
+ on:
22
+ push:
23
+ tags:
24
+ - "v*"
25
+ workflow_dispatch:
26
+ inputs:
27
+ publish:
28
+ description: "Upload built artifacts"
29
+ type: choice
30
+ options:
31
+ - none
32
+ - testpypi
33
+ - pypi
34
+ default: none
35
+
36
+ jobs:
37
+ build_wheels:
38
+ name: Wheels on ${{ matrix.os }}
39
+ runs-on: ${{ matrix.os }}
40
+ strategy:
41
+ fail-fast: false
42
+ matrix:
43
+ os:
44
+ - ubuntu-latest
45
+ - ubuntu-24.04-arm
46
+
47
+ steps:
48
+ - uses: actions/checkout@v6
49
+ with:
50
+ persist-credentials: false
51
+
52
+ - name: Build wheels
53
+ uses: pypa/cibuildwheel@v4.2.1
54
+ with:
55
+ package-dir: .
56
+ output-dir: wheelhouse
57
+
58
+ - uses: actions/upload-artifact@v4
59
+ with:
60
+ name: paulikit-wheels-${{ matrix.os }}-${{ strategy.job-index }}
61
+ path: ./wheelhouse/*.whl
62
+
63
+ build_sdist:
64
+ name: Source distribution
65
+ runs-on: ubuntu-latest
66
+ steps:
67
+ - uses: actions/checkout@v6
68
+ with:
69
+ persist-credentials: false
70
+
71
+ - uses: actions/setup-python@v6
72
+ with:
73
+ python-version: "3.12"
74
+
75
+ - name: Build sdist
76
+ run: |
77
+ python -m pip install --upgrade build
78
+ python -m build --sdist --outdir dist
79
+
80
+ - name: Sanity-check sdist contents
81
+ run: |
82
+ python - <<'PY'
83
+ import tarfile
84
+ from pathlib import Path
85
+ sdists = list(Path("dist").glob("*.tar.gz"))
86
+ assert len(sdists) == 1, sdists
87
+ names = tarfile.open(sdists[0]).getnames()
88
+ banned = ("plans/", "profiling/", ".worktrees/", "PYPI_RELEASE")
89
+ hits = [n for n in names if any(b in n for b in banned)]
90
+ assert not hits, f"sdist carries private/research paths: {hits[:20]}"
91
+ print(f"ok: {sdists[0].name} ({len(names)} entries)")
92
+ PY
93
+
94
+ - uses: actions/upload-artifact@v4
95
+ with:
96
+ name: paulikit-sdist
97
+ path: dist/*.tar.gz
98
+
99
+ publish:
100
+ name: Publish package
101
+ needs: [build_wheels, build_sdist]
102
+ if: >
103
+ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
104
+ || (github.event_name == 'workflow_dispatch'
105
+ && inputs.publish != 'none')
106
+ runs-on: ubuntu-latest
107
+ environment:
108
+ name: ${{ (github.event_name == 'workflow_dispatch' && inputs.publish == 'testpypi') && 'testpypi' || 'pypi' }}
109
+ url: ${{ (github.event_name == 'workflow_dispatch' && inputs.publish == 'testpypi') && 'https://test.pypi.org/project/paulikit/' || 'https://pypi.org/project/paulikit/' }}
110
+ permissions:
111
+ id-token: write
112
+ env:
113
+ # Resolved when the job starts (safe to branch on in step if:).
114
+ TEST_PYPI_API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}
115
+ PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
116
+ steps:
117
+ - uses: actions/download-artifact@v4
118
+ with:
119
+ pattern: paulikit-*
120
+ merge-multiple: true
121
+ path: dist
122
+
123
+ - name: Show artifacts
124
+ run: ls -la dist
125
+
126
+ - name: Publish to TestPyPI (Trusted Publishing)
127
+ if: github.event_name == 'workflow_dispatch' && inputs.publish == 'testpypi' && env.TEST_PYPI_API_TOKEN == ''
128
+ uses: pypa/gh-action-pypi-publish@release/v1
129
+ with:
130
+ repository-url: https://test.pypi.org/legacy/
131
+ packages-dir: dist
132
+
133
+ - name: Publish to TestPyPI (API token)
134
+ if: github.event_name == 'workflow_dispatch' && inputs.publish == 'testpypi' && env.TEST_PYPI_API_TOKEN != ''
135
+ uses: pypa/gh-action-pypi-publish@release/v1
136
+ with:
137
+ repository-url: https://test.pypi.org/legacy/
138
+ packages-dir: dist
139
+ user: __token__
140
+ password: ${{ env.TEST_PYPI_API_TOKEN }}
141
+
142
+ - name: Publish to PyPI (Trusted Publishing)
143
+ if: >
144
+ ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
145
+ || (github.event_name == 'workflow_dispatch' && inputs.publish == 'pypi'))
146
+ && env.PYPI_API_TOKEN == ''
147
+ uses: pypa/gh-action-pypi-publish@release/v1
148
+ with:
149
+ packages-dir: dist
150
+
151
+ - name: Publish to PyPI (API token)
152
+ if: >
153
+ ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
154
+ || (github.event_name == 'workflow_dispatch' && inputs.publish == 'pypi'))
155
+ && env.PYPI_API_TOKEN != ''
156
+ uses: pypa/gh-action-pypi-publish@release/v1
157
+ with:
158
+ packages-dir: dist
159
+ user: __token__
160
+ password: ${{ env.PYPI_API_TOKEN }}
@@ -0,0 +1,38 @@
1
+ # Python bytecode and caches
2
+ __pycache__/
3
+ *.py[cod]
4
+
5
+ # Virtual environments
6
+ .venv/
7
+ venv/
8
+
9
+ # Build and packaging artefacts
10
+ build/
11
+ dist/
12
+ *.egg-info/
13
+ .mesonpy-*/
14
+ *.so
15
+
16
+ # Generated by ./configure; Makefile.in is the source template.
17
+ # Anchored to the root: docs/Makefile is a checked-in source file that
18
+ # Sphinx needs, and `make clean` tests for its presence.
19
+ /Makefile
20
+ config.log
21
+ config.status
22
+
23
+ # Test and tooling caches
24
+ .pytest_cache/
25
+ .ruff_cache/
26
+
27
+ # Sphinx output
28
+ docs/_build/
29
+
30
+ # Local agent plans/specs and git worktrees — never ship these.
31
+ plans/
32
+ .worktrees/
33
+
34
+ # Lockfiles are deliberately not tracked: this is a library, not an
35
+ # application, so pinning a resolved dependency set here would
36
+ # constrain downstreams without benefiting them.
37
+ uv.lock
38
+ poetry.lock
paulikit-0.1.0/AUTHORS ADDED
@@ -0,0 +1,17 @@
1
+ paulikit was written by:
2
+
3
+ Mohammadreza Khellat
4
+ Mohammad Masoumi
5
+ Saman Nasouri
6
+ Soroush Nasouri
7
+
8
+ all at Beavernets Technologies.
9
+
10
+ The citation order, and the metadata to use when citing this software
11
+ in published work, are in CITATION.cff. That file is the authoritative
12
+ record; this one exists because the GNU Coding Standards expect an
13
+ AUTHORS file, and because a reader looking for "who wrote this" should
14
+ not have to know what CITATION.cff is.
15
+
16
+ Contributors are credited in the git history. Substantial ongoing
17
+ contributors will be added here on request.
@@ -0,0 +1,118 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here.
4
+
5
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+ While the version is 0.x, the public API may change between minor
8
+ versions; see the README's Status section.
9
+
10
+ ## [Unreleased]
11
+
12
+ ## [0.1.0] - 2026-09-26
13
+
14
+ First public release (PyPI target). Package contents were prepared
15
+ 2026-09-10; this dated entry is the freeze for the first tagged /
16
+ uploaded artifacts.
17
+
18
+ ### Added
19
+
20
+ - **Pauli decomposition by fast Walsh-Hadamard transform.**
21
+ `paulikit.algorithms.fwht` decomposes any $2^n \times 2^n$ complex matrix
22
+ into its Pauli-basis coefficients in $O(n \cdot 4^n)$. Hermitian and
23
+ non-Hermitian input take the same transform; `assume_hermitian=True`
24
+ (the default) returns real coefficients and verifies the input
25
+ really is Hermitian rather than assuming it.
26
+
27
+ - **Bounded memory.** The active-x set is chunked and each chunk is
28
+ thresholded and emitted before the next is computed, so peak
29
+ resident memory is set by `chunk_size` rather than by the size of
30
+ the result. Sparse input is kept sparse throughout.
31
+
32
+ - **Streaming entry points.** `fwht_pauli_terms_iter` and
33
+ `parallel_decompose_arrays` yield per chunk, so a caller can consume
34
+ and discard results that would not fit in memory if accumulated.
35
+
36
+ - **Multi-core execution.** `parallel_decompose` and
37
+ `parallel_decompose_arrays` distribute independent chunks across a
38
+ process pool or a thread pool. Worker count is taken from the CPUs
39
+ actually available to the process rather than from `os.cpu_count()`,
40
+ so a cgroup- or cpuset-restricted machine is not oversubscribed.
41
+ Threaded drain (`executor="thread"` / `"auto"`) uses physical-core
42
+ pinning, capacity-weighted slices, work-stealing, and optional eager
43
+ thread spin-up.
44
+
45
+ - **Checkpoint and restart.** A binary chunk-framed checkpoint format
46
+ cheap enough to leave permanently enabled. Frames carry their own
47
+ chunk index, so completed work replays on resume regardless of the
48
+ order a pool returns it in, and a torn tail means exactly "that
49
+ chunk was not recorded".
50
+
51
+ - **Optional compiled kernels.** Under three meson options:
52
+ `wht_kernel` (Walsh–Hadamard butterfly, fused coefficients, dense
53
+ gather, Hermiticity check, with optional x86-64-v3 twins), `native`
54
+ (Pauli label kernel with a oneTBB-parallel variant), and
55
+ `cache_probe` (empirical cache-latency probe). All are optional: the
56
+ package is correct and installable with no C toolchain, and reports
57
+ once when a fallback path is taken. Manylinux wheels ship
58
+ `wht_kernel` (+ `cache_probe`) with `-Dnative=disabled` (no oneTBB
59
+ in the wheel image); label generation falls back to pure Python.
60
+
61
+ - **Cache-aware auto-tuning.** `paulikit.algorithms.autotune` sizes
62
+ chunks against measured cache boundaries, interpolating between
63
+ measured anchor points rather than applying a closed-form fit.
64
+
65
+ - **Command-line interface.** `paulikit decompose`, `paulikit
66
+ benchmark` and `paulikit regenerate-fixtures`.
67
+
68
+ - **Exhaustive verification.** Every term of a decomposition checked
69
+ individually against an independently derived projection oracle -
70
+ not sampled - up to 91,652,096 terms at 14 qubits, Hermitian and
71
+ non-Hermitian. Artifacts and method under `verification/`.
72
+
73
+ - **Test suite.** 323 default tests (8 further slow benchmark
74
+ comparisons excluded by default).
75
+
76
+ - **Documentation.** Installation, tutorial, theory, background,
77
+ non-Hermitian operators, annotated source tree, and an API
78
+ reference built from the docstrings.
79
+
80
+ - GitHub Actions workflow (`.github/workflows/paulikit-wheels.yml` on
81
+ the GitHub mirror,
82
+ [github.com/beavernets-inc/paulikit](https://github.com/beavernets-inc/paulikit))
83
+ that builds manylinux wheels (x86_64 / aarch64, CPython 3.10–3.13)
84
+ and an sdist on tag / manual dispatch, with an optional Trusted
85
+ Publishing upload job. Codeberg remains the canonical repository;
86
+ hosted Forgejo runners are not used for the manylinux matrix.
87
+
88
+ ### Changed
89
+
90
+ - README Usage leads with the measured sparse/dense fastest paths;
91
+ Sphinx tutorial, installation, and native docs match the multi-kernel
92
+ surface; `--chunk-size` help no longer claims auto-tuning is absent
93
+ from the library APIs.
94
+ - GitHub mirror moved to
95
+ [beavernets-inc/paulikit](https://github.com/beavernets-inc/paulikit);
96
+ install docs lead with `pip install paulikit` for the first PyPI
97
+ upload.
98
+
99
+ ### Fixed
100
+
101
+ - `make check` no longer dumps expected autotune/fork warnings from
102
+ intentional no-probe and process-pool tests.
103
+
104
+ ### Removed
105
+
106
+ - Stale Status/CHANGELOG claim of an unexplained 14-to-15 qubit
107
+ parallel-efficiency step under the process-pool drain.
108
+
109
+ ### Known limitations
110
+
111
+ - Linux manylinux wheels ship `wht_kernel` (+ `cache_probe`) but omit
112
+ `pauli_label_native` (oneTBB). macOS / Windows / musllinux use the
113
+ sdist. Install with `pip install paulikit`.
114
+ - CPU pinning and topology detection are Linux-only, with a documented
115
+ fallback elsewhere; the non-Linux paths are not exercised in CI.
116
+
117
+ [Unreleased]: https://codeberg.org/beavernets/paulikit/compare/v0.1.0...HEAD
118
+ [0.1.0]: https://codeberg.org/beavernets/paulikit/releases/tag/v0.1.0
@@ -0,0 +1,65 @@
1
+ cff-version: 1.2.0
2
+ title: >-
3
+ paulikit: memory-bounded, checkpointable Pauli decomposition of
4
+ complex matrices
5
+ message: >-
6
+ If you use this software, please cite it using the metadata in this
7
+ file.
8
+ type: software
9
+ # Order is the intended citation order, with the corresponding author
10
+ # first. These are the people credited when the SOFTWARE is cited,
11
+ # which need not be identical to the author list of any paper about
12
+ # it - keep the two in step deliberately rather than by accident.
13
+ authors:
14
+ - given-names: Mohammadreza
15
+ family-names: Khellat
16
+ affiliation: Beavernets Technologies
17
+ - given-names: Mohammad
18
+ family-names: Masoumi
19
+ affiliation: Beavernets Technologies
20
+ - given-names: Saman
21
+ family-names: Nasouri
22
+ affiliation: Beavernets Technologies
23
+ - given-names: Soroush
24
+ family-names: Nasouri
25
+ affiliation: Beavernets Technologies
26
+ repository-code: "https://codeberg.org/beavernets/paulikit"
27
+ # Wheel CI / GitHub mirror (not the citation canonical URL):
28
+ # https://github.com/beavernets-inc/paulikit
29
+ # Project contact rather than any individual's address: it survives
30
+ # people changing roles, and a CITATION.cff is archived permanently
31
+ # alongside the DOI.
32
+ contact:
33
+ - name: paulikit developers
34
+ email: dev@beavernets.com
35
+ abstract: >-
36
+ paulikit computes the exact Pauli decomposition of an arbitrary
37
+ complex matrix via the fast Walsh-Hadamard transform. Hermitian and
38
+ non-Hermitian input are equally supported and take the same
39
+ transform; declaring input Hermitian additionally yields real
40
+ coefficients and checks that assumption rather than trusting it.
41
+ Both are verified against an independent projection oracle, and at
42
+ small sizes against PennyLane.
43
+ The transform itself is established practice; the contribution here
44
+ is making it usable at scale - a streaming formulation whose peak
45
+ resident memory is bounded independently of the term count,
46
+ multi-core execution over independent chunks, a chunk-framed binary
47
+ checkpoint format cheap enough to leave permanently enabled,
48
+ cache-aware automatic chunk sizing, and exhaustive per-term
49
+ verification against an independent projection oracle at up to
50
+ 91,652,096 terms.
51
+ keywords:
52
+ - Pauli decomposition
53
+ - fast Walsh-Hadamard transform
54
+ - quantum Hamiltonian simulation
55
+ - linear combination of unitaries
56
+ - memory-bounded algorithms
57
+ - parallel computing
58
+ - scientific Python
59
+ - checkpoint and restart
60
+ license: GPL-3.0-or-later
61
+ version: 0.1.0
62
+ # NOTE: no DOI yet. This is added on the first archived release
63
+ # (Zenodo), and the version above must be bumped to match the tag that
64
+ # is archived. A CITATION.cff claiming a version that was never
65
+ # released is worse than none.
@@ -0,0 +1,136 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation
6
+ in our community a harassment-free experience for everyone, regardless
7
+ of age, body size, visible or invisible disability, ethnicity, sex
8
+ characteristics, gender identity and expression, level of experience,
9
+ education, socio-economic status, nationality, personal appearance,
10
+ race, caste, color, religion, or sexual identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open,
13
+ welcoming, diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for
18
+ our community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our
24
+ mistakes, and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or
33
+ political attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email
36
+ address, without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in
38
+ a professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our
43
+ standards of acceptable behavior and will take appropriate and fair
44
+ corrective action in response to any behavior that they deem
45
+ inappropriate, threatening, offensive, or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit,
48
+ or reject comments, commits, code, wiki edits, issues, and other
49
+ contributions that are not aligned to this Code of Conduct, and will
50
+ communicate reasons for moderation decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also
55
+ applies when an individual is officially representing the community in
56
+ public spaces. Examples of representing our community include using an
57
+ official email address, posting via an official social media account,
58
+ or acting as an appointed representative at an online or offline
59
+ event.
60
+
61
+ ## Enforcement
62
+
63
+ Instances of abusive, harassing, or otherwise unacceptable behavior
64
+ may be reported to the community leaders responsible for enforcement
65
+ at dev@beavernets.com.
66
+
67
+ All complaints will be reviewed and investigated promptly and fairly.
68
+
69
+ All community leaders are obligated to respect the privacy and
70
+ security of the reporter of any incident.
71
+
72
+ ## Enforcement Guidelines
73
+
74
+ Community leaders will follow these Community Impact Guidelines in
75
+ determining the consequences for any action they deem in violation of
76
+ this Code of Conduct:
77
+
78
+ ### 1. Correction
79
+
80
+ **Community Impact**: Use of inappropriate language or other behavior
81
+ deemed unprofessional or unwelcome in the community.
82
+
83
+ **Consequence**: A private, written warning from community leaders,
84
+ providing clarity around the nature of the violation and an
85
+ explanation of why the behavior was inappropriate. A public apology
86
+ may be requested.
87
+
88
+ ### 2. Warning
89
+
90
+ **Community Impact**: A violation through a single incident or series
91
+ of actions.
92
+
93
+ **Consequence**: A warning with consequences for continued behavior.
94
+ No interaction with the people involved, including unsolicited
95
+ interaction with those enforcing the Code of Conduct, for a specified
96
+ period of time. This includes avoiding interactions in community
97
+ spaces as well as external channels like social media. Violating these
98
+ terms may lead to a temporary or permanent ban.
99
+
100
+ ### 3. Temporary Ban
101
+
102
+ **Community Impact**: A serious violation of community standards,
103
+ including sustained inappropriate behavior.
104
+
105
+ **Consequence**: A temporary ban from any sort of interaction or
106
+ public communication with the community for a specified period of
107
+ time. No public or private interaction with the people involved,
108
+ including unsolicited interaction with those enforcing the Code of
109
+ Conduct, is allowed during this period. Violating these terms may lead
110
+ to a permanent ban.
111
+
112
+ ### 4. Permanent Ban
113
+
114
+ **Community Impact**: Demonstrating a pattern of violation of
115
+ community standards, including sustained inappropriate behavior,
116
+ harassment of an individual, or aggression toward or disparagement of
117
+ classes of individuals.
118
+
119
+ **Consequence**: A permanent ban from any sort of public interaction
120
+ within the community.
121
+
122
+ ## Attribution
123
+
124
+ This Code of Conduct is adapted from the [Contributor Covenant][
125
+ homepage], version 2.1, available at
126
+ https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
127
+
128
+ Community Impact Guidelines were inspired by
129
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
130
+
131
+ For answers to common questions about this code of conduct, see the
132
+ FAQ at https://www.contributor-covenant.org/faq. Translations are
133
+ available at https://www.contributor-covenant.org/translations.
134
+
135
+ [homepage]: https://www.contributor-covenant.org
136
+ [Mozilla CoC]: https://github.com/mozilla/diversity
@@ -0,0 +1,128 @@
1
+ # Contributing to paulikit
2
+
3
+ Thank you for your interest. This document covers how to build the
4
+ package, how to run its tests, and what a change is expected to carry
5
+ with it.
6
+
7
+ ## Where the project lives
8
+
9
+ **Canonical repository:**
10
+ [codeberg.org/beavernets/paulikit](https://codeberg.org/beavernets/paulikit)
11
+ (`origin`).
12
+
13
+ **Mirror:**
14
+ [github.com/beavernets-inc/paulikit](https://github.com/beavernets-inc/paulikit)
15
+ (`github`).
16
+
17
+ Issues and pull requests are welcome at either. Prefer Codeberg when
18
+ you have a choice; the GitHub remote exists so Linux wheel CI can use
19
+ GitHub-hosted runners with Docker (manylinux), which Codeberg's
20
+ hosted Forgejo Actions runners are not sized for.
21
+
22
+ ## Building
23
+
24
+ The package uses [meson-python](https://mesonbuild.com/meson-python/),
25
+ the same build backend as NumPy and SciPy. A `configure` script wraps
26
+ the setup:
27
+
28
+ ```bash
29
+ ./configure # creates a venv, reports what the toolchain offers
30
+ make # editable install with the correct sequencing
31
+ make check # run the test suite
32
+ make docs # Sphinx HTML under docs/_build/html
33
+ ```
34
+
35
+ `./configure` prints an itemised capability report - compiler, Cython,
36
+ oneTBB, cache hierarchy, NumPy's BLAS backend - and then generates a
37
+ Makefile with the standard GNU targets. Run `./configure --help` for
38
+ the options.
39
+
40
+ If you would rather not use it, `docs/installation.md` gives the
41
+ manual sequence. The one thing that matters is `--no-build-isolation`
42
+ on editable installs; without it NumPy's include path is baked in from
43
+ a throwaway environment and goes stale on the next rebuild.
44
+
45
+ ## Running the tests
46
+
47
+ ```bash
48
+ make check # or: pytest
49
+ make test-native # the standalone C and C++ kernel self-tests
50
+ ```
51
+
52
+ `pyproject.toml` sets `addopts = "-m 'not slow'"`, so the eight
53
+ benchmark comparisons are skipped by default. To run them, override
54
+ that rather than adding to it:
55
+
56
+ ```bash
57
+ pytest -o addopts="" -m slow
58
+ ```
59
+
60
+ The suite passes with no compiled extensions and no development
61
+ dependencies installed - a few tests skip in that configuration, which
62
+ is deliberate. That is the same environment the pure-Python fallback
63
+ exists to serve, so it needs to stay green there.
64
+
65
+ ## Wheels and releases
66
+
67
+ ```bash
68
+ pip install paulikit
69
+ ```
70
+
71
+ Manylinux wheels (x86_64 and aarch64, CPython 3.10–3.13) and the sdist
72
+ are built by `.github/workflows/paulikit-wheels.yml` on the GitHub
73
+ mirror
74
+ ([github.com/beavernets-inc/paulikit](https://github.com/beavernets-inc/paulikit)):
75
+ push a `v*` tag, or run the workflow manually. The job fails
76
+ if `wht_native` / `coeffs_native` / `gather_native` are missing from
77
+ the wheel. musllinux, macOS, and Windows are intentionally not wheel
78
+ targets; those platforms use the sdist and documented fallbacks.
79
+ Wheels omit `pauli_label_native` (oneTBB).
80
+
81
+ Codeberg remains the source of truth for the tree. Do not expect the
82
+ same cibuildwheel matrix to run on Codeberg's hosted Actions without
83
+ a self-hosted runner that can drive Docker.
84
+
85
+ ## What a change should carry
86
+
87
+ - **A test.** A bug fix should come with a test that fails without it.
88
+ A new code path should come with tests that cover it.
89
+ - **The reason, not just the change.** Comments and docstrings here
90
+ record why something is the way it is, including approaches that
91
+ were measured and rejected. That is the most expensive information
92
+ in the codebase and the easiest to lose.
93
+ - **A measurement, if the claim is about performance.** Wall-clock
94
+ time on a laptop is not evidence: CPU frequency scaling alone moves
95
+ it by a factor of two. Prefer instruction and cycle counts
96
+ (`perf stat -e instructions:u,cycles:u`), report the problem size,
97
+ and replicate before quoting a ratio.
98
+ - **Documentation, if behaviour changed.** Including the docstring, so
99
+ the API reference stays correct. User-visible behaviour also updates
100
+ the README and/or CHANGELOG `[Unreleased]` section.
101
+ - **Atomic commits.** One reviewable design step per commit (see the
102
+ repository history). Prefer a few closely related files over a
103
+ mega-commit that mixes engine, UI, and docs.
104
+
105
+ ## Style
106
+
107
+ `ruff` is configured in `pyproject.toml` (line length 92) and is part
108
+ of the `dev` extra. Most of the codebase is wrapped tighter than that,
109
+ at 79, and new code should follow the file it lives in.
110
+
111
+ Commit messages follow the GNU convention: a short imperative subject
112
+ line, a blank line, then a body explaining *why* the change is being
113
+ made, wrapped at 72 characters. The existing history is the reference.
114
+
115
+ ## Reporting a bug
116
+
117
+ Please include the paulikit version, the Python version, the operating
118
+ system, whether the compiled extensions were built (`./configure`
119
+ reports this), and the smallest input that reproduces the problem.
120
+
121
+ For a decomposition that produces a wrong result, the most useful
122
+ report includes the operator - or the code that builds it - and the
123
+ term that disagrees.
124
+
125
+ ## Licence
126
+
127
+ paulikit is GPL-3.0-or-later. By contributing you agree that your
128
+ contribution is licensed under the same terms.