shrinkers 0.1.1__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 (117) hide show
  1. shrinkers-0.1.1/.cargo/config.toml +10 -0
  2. shrinkers-0.1.1/.github/workflows/ci.yml +77 -0
  3. shrinkers-0.1.1/.github/workflows/release.yml +74 -0
  4. shrinkers-0.1.1/.github/workflows/testpypi.yml +33 -0
  5. shrinkers-0.1.1/.gitignore +33 -0
  6. shrinkers-0.1.1/CHANGELOG.md +520 -0
  7. shrinkers-0.1.1/Cargo.lock +920 -0
  8. shrinkers-0.1.1/Cargo.toml +59 -0
  9. shrinkers-0.1.1/LICENSE +21 -0
  10. shrinkers-0.1.1/PKG-INFO +281 -0
  11. shrinkers-0.1.1/README.md +264 -0
  12. shrinkers-0.1.1/benches/kernel_tiled_blocksize.rs +48 -0
  13. shrinkers-0.1.1/benches/pipeline_cache_scaling.rs +62 -0
  14. shrinkers-0.1.1/benches/pipeline_config_sweep.rs +88 -0
  15. shrinkers-0.1.1/benches/pipeline_methods_overview.rs +49 -0
  16. shrinkers-0.1.1/benches/support/mod.rs +25 -0
  17. shrinkers-0.1.1/docs/OPTIMIZE_DECONVOLUTION.md +164 -0
  18. shrinkers-0.1.1/docs/chebcode_algorithms.md +204 -0
  19. shrinkers-0.1.1/docs/eta_choice.md +108 -0
  20. shrinkers-0.1.1/docs/img/chebcode_equivalent_densities.png +0 -0
  21. shrinkers-0.1.1/docs/img/chebcode_presets.png +0 -0
  22. shrinkers-0.1.1/docs/img/chebcode_traversal.png +0 -0
  23. shrinkers-0.1.1/docs/img/chebcode_tree.png +0 -0
  24. shrinkers-0.1.1/docs/img/cleaning_quality.png +0 -0
  25. shrinkers-0.1.1/docs/img/performance.png +0 -0
  26. shrinkers-0.1.1/docs/img/readme_figures.json +148 -0
  27. shrinkers-0.1.1/docs/internals.md +442 -0
  28. shrinkers-0.1.1/docs/pareto/bench_after.json +1018 -0
  29. shrinkers-0.1.1/docs/pareto/bench_before.json +98 -0
  30. shrinkers-0.1.1/docs/pareto/crossover_small_p.png +0 -0
  31. shrinkers-0.1.1/docs/pareto/eta_sweep.json +72 -0
  32. shrinkers-0.1.1/docs/pareto/order_sweep.jsonl +144 -0
  33. shrinkers-0.1.1/docs/pareto/pareto_rayon.png +0 -0
  34. shrinkers-0.1.1/docs/pareto/pareto_seq.png +0 -0
  35. shrinkers-0.1.1/docs/pareto/runtime_vs_p_grid.png +0 -0
  36. shrinkers-0.1.1/docs/pareto/runtime_vs_p_rayon.png +0 -0
  37. shrinkers-0.1.1/docs/pareto/runtime_vs_p_seq.png +0 -0
  38. shrinkers-0.1.1/docs/pareto/small_p.json +154 -0
  39. shrinkers-0.1.1/docs/python_api.md +300 -0
  40. shrinkers-0.1.1/examples/README.md +34 -0
  41. shrinkers-0.1.1/examples/ab_quick_timing.rs +195 -0
  42. shrinkers-0.1.1/examples/basic_usage.rs +98 -0
  43. shrinkers-0.1.1/examples/measure_batch_gamma_sweep.rs +66 -0
  44. shrinkers-0.1.1/examples/measure_build_share.rs +39 -0
  45. shrinkers-0.1.1/examples/measure_cheb_sweep.rs +113 -0
  46. shrinkers-0.1.1/examples/measure_eta_sweep.rs +289 -0
  47. shrinkers-0.1.1/examples/measure_fft5_duel.rs +87 -0
  48. shrinkers-0.1.1/examples/measure_fft_order_sweep.rs +210 -0
  49. shrinkers-0.1.1/examples/measure_pareto_frontier.rs +214 -0
  50. shrinkers-0.1.1/examples/measure_pipeline_phases.rs +61 -0
  51. shrinkers-0.1.1/examples/measure_small_p_crossover.rs +194 -0
  52. shrinkers-0.1.1/examples/measure_windowed_ratio.rs +53 -0
  53. shrinkers-0.1.1/examples/measure_xtreme_duel.rs +74 -0
  54. shrinkers-0.1.1/examples/profile_hot_loop.rs +51 -0
  55. shrinkers-0.1.1/figures/population_reconstruction.png +0 -0
  56. shrinkers-0.1.1/figures/reconstruction_error.png +0 -0
  57. shrinkers-0.1.1/figures/stieltjes_all.png +0 -0
  58. shrinkers-0.1.1/figures/stieltjes_best.png +0 -0
  59. shrinkers-0.1.1/figures/stieltjes_data.csv +411 -0
  60. shrinkers-0.1.1/figures/stieltjes_error.png +0 -0
  61. shrinkers-0.1.1/figures/stieltjes_parallel.png +0 -0
  62. shrinkers-0.1.1/pixi.lock +1456 -0
  63. shrinkers-0.1.1/pixi.toml +45 -0
  64. shrinkers-0.1.1/pyproject.toml +56 -0
  65. shrinkers-0.1.1/scripts/analyze_order_sweep.py +141 -0
  66. shrinkers-0.1.1/scripts/bench_deconvolve_spiked.py +151 -0
  67. shrinkers-0.1.1/scripts/bench_population.py +106 -0
  68. shrinkers-0.1.1/scripts/bench_stieltjes.py +79 -0
  69. shrinkers-0.1.1/scripts/bench_stieltjes_all.py +368 -0
  70. shrinkers-0.1.1/scripts/build_pareto_table.py +165 -0
  71. shrinkers-0.1.1/scripts/demo_cleaning.py +93 -0
  72. shrinkers-0.1.1/scripts/demo_spiked.py +102 -0
  73. shrinkers-0.1.1/scripts/example_population.py +264 -0
  74. shrinkers-0.1.1/scripts/make_chebcode_figures.py +239 -0
  75. shrinkers-0.1.1/scripts/make_readme_figures.py +272 -0
  76. shrinkers-0.1.1/scripts/measure_current.py +41 -0
  77. shrinkers-0.1.1/scripts/pca_regression_factor_model.py +258 -0
  78. shrinkers-0.1.1/scripts/plot_crossover.py +82 -0
  79. shrinkers-0.1.1/scripts/plot_pareto.py +116 -0
  80. shrinkers-0.1.1/scripts/plot_runtime_vs_p.py +125 -0
  81. shrinkers-0.1.1/scripts/rie_numpy.py +144 -0
  82. shrinkers-0.1.1/scripts/toy_regression_clean_vs_sample.py +346 -0
  83. shrinkers-0.1.1/shrinkers.pyi +195 -0
  84. shrinkers-0.1.1/src/config/pareto_autogen.rs +79 -0
  85. shrinkers-0.1.1/src/config.rs +598 -0
  86. shrinkers-0.1.1/src/deconvolution/adaptive.rs +164 -0
  87. shrinkers-0.1.1/src/deconvolution/hybrid.rs +253 -0
  88. shrinkers-0.1.1/src/deconvolution/mod.rs +852 -0
  89. shrinkers-0.1.1/src/deconvolution/population.rs +169 -0
  90. shrinkers-0.1.1/src/deconvolution/precision.rs +208 -0
  91. shrinkers-0.1.1/src/deconvolution/shrinkage.rs +190 -0
  92. shrinkers-0.1.1/src/eigenvector_overlaps/mod.rs +46 -0
  93. shrinkers-0.1.1/src/eigenvector_overlaps/overlaps.rs +46 -0
  94. shrinkers-0.1.1/src/lib.rs +41 -0
  95. shrinkers-0.1.1/src/pipeline/mod.rs +482 -0
  96. shrinkers-0.1.1/src/python.rs +839 -0
  97. shrinkers-0.1.1/src/rmt.rs +36 -0
  98. shrinkers-0.1.1/src/spiked/detection.rs +361 -0
  99. shrinkers-0.1.1/src/spiked/eigenvector.rs +92 -0
  100. shrinkers-0.1.1/src/spiked/estimation.rs +155 -0
  101. shrinkers-0.1.1/src/spiked/mod.rs +323 -0
  102. shrinkers-0.1.1/src/stieltjes/adaptive.rs +185 -0
  103. shrinkers-0.1.1/src/stieltjes/autovec.rs +146 -0
  104. shrinkers-0.1.1/src/stieltjes/blocked_autovec.rs +276 -0
  105. shrinkers-0.1.1/src/stieltjes/cacheblock.rs +2007 -0
  106. shrinkers-0.1.1/src/stieltjes/chebcode.rs +977 -0
  107. shrinkers-0.1.1/src/stieltjes/ewald.rs +295 -0
  108. shrinkers-0.1.1/src/stieltjes/fft5.rs +871 -0
  109. shrinkers-0.1.1/src/stieltjes/fftplan.rs +76 -0
  110. shrinkers-0.1.1/src/stieltjes/hodlr.rs +1235 -0
  111. shrinkers-0.1.1/src/stieltjes/mod.rs +891 -0
  112. shrinkers-0.1.1/src/stieltjes/naive.rs +49 -0
  113. shrinkers-0.1.1/src/stieltjes/simd.rs +269 -0
  114. shrinkers-0.1.1/src/stieltjes/term.rs +75 -0
  115. shrinkers-0.1.1/src/stieltjes/testutil.rs +44 -0
  116. shrinkers-0.1.1/src/stieltjes/treecode.rs +398 -0
  117. shrinkers-0.1.1/tests/test_python_api.py +380 -0
@@ -0,0 +1,10 @@
1
+ # Enable native CPU instructions (AVX2, FMA, NEON, etc.)
2
+ # Without this, Rust only uses baseline features for the target arch.
3
+ # On Apple M-series this enables the full NEON ISA + FMA.
4
+ # Also enables auto-vectorization and use of advanced SIMD instructions.
5
+ #
6
+ # Note: We do NOT set FTZ/DAZ globally via build script because it has
7
+ # weird interactions with some libraries. Instead, we handle it at runtime
8
+ # in the entry points (Python bindings and public API).
9
+ [target.'cfg(all())']
10
+ rustflags = ["-C", "target-cpu=native"]
@@ -0,0 +1,77 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ env:
10
+ CARGO_TERM_COLOR: always
11
+
12
+ jobs:
13
+ rust:
14
+ name: Rust — fmt / clippy / test
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Install Rust toolchain
20
+ uses: dtolnay/rust-toolchain@stable
21
+ with:
22
+ components: rustfmt, clippy
23
+
24
+ - name: Cache cargo build
25
+ uses: Swatinem/rust-cache@v2
26
+
27
+ - name: Format check
28
+ run: cargo fmt --check
29
+
30
+ - name: Clippy (all targets, deny warnings)
31
+ run: cargo clippy --all-targets -- -D warnings
32
+
33
+ - name: Tests
34
+ run: cargo test
35
+
36
+ python:
37
+ name: Python ${{ matrix.python-version }} — wheel + pytest
38
+ runs-on: ubuntu-latest
39
+ strategy:
40
+ fail-fast: false
41
+ matrix:
42
+ python-version: ["3.10", "3.13"]
43
+ steps:
44
+ - uses: actions/checkout@v4
45
+
46
+ - name: Set up Python ${{ matrix.python-version }}
47
+ uses: actions/setup-python@v5
48
+ with:
49
+ python-version: ${{ matrix.python-version }}
50
+
51
+ - name: Cache cargo build
52
+ uses: Swatinem/rust-cache@v2
53
+
54
+ - name: Build wheel (maturin)
55
+ uses: PyO3/maturin-action@v1
56
+ with:
57
+ command: build
58
+ args: --release --out dist --find-interpreter
59
+ manylinux: auto
60
+
61
+ - name: Install wheel + test deps
62
+ run: |
63
+ pip install --force-reinstall --find-links dist shrinkers
64
+ pip install numpy pytest
65
+
66
+ - name: Import smoke test
67
+ run: |
68
+ python -c "import shrinkers; print('shrinkers', shrinkers.__version__)"
69
+ python -c "
70
+ import numpy as np, shrinkers
71
+ res = shrinkers.deconvolve_spiked(np.arange(1, 11, dtype=np.float64), c=0.25)
72
+ assert 'spikes' in res and 'bulk' in res
73
+ print('deconvolve_spiked OK:', res['k'], 'spikes detected')
74
+ "
75
+
76
+ - name: Python API tests
77
+ run: pytest tests -q
@@ -0,0 +1,74 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ build-wheels:
12
+ name: Wheel — ${{ matrix.os }} ${{ matrix.target }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ include:
17
+ - { os: ubuntu-latest, target: x86_64 }
18
+ - { os: ubuntu-latest, target: aarch64 }
19
+ # GitHub retired the Intel macos-13 runner label; build the
20
+ # x86_64 wheel by cross-compiling on the arm64 runner instead
21
+ # (maturin-action installs the rustup target automatically).
22
+ - { os: macos-14, target: aarch64 }
23
+ - { os: macos-14, target: x86_64 }
24
+ - { os: windows-latest, target: x86_64 }
25
+ runs-on: ${{ matrix.os }}
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+
29
+ - name: Build wheel (maturin)
30
+ uses: PyO3/maturin-action@v1
31
+ with:
32
+ target: ${{ matrix.target }}
33
+ command: build
34
+ args: --release --out dist
35
+ manylinux: auto
36
+
37
+ - uses: actions/upload-artifact@v4
38
+ with:
39
+ name: wheel-${{ matrix.os }}-${{ matrix.target }}
40
+ path: dist
41
+
42
+ sdist:
43
+ runs-on: ubuntu-latest
44
+ steps:
45
+ - uses: actions/checkout@v4
46
+
47
+ - name: Build sdist (maturin)
48
+ uses: PyO3/maturin-action@v1
49
+ with:
50
+ command: sdist
51
+ args: --out dist
52
+
53
+ - uses: actions/upload-artifact@v4
54
+ with:
55
+ name: sdist
56
+ path: dist
57
+
58
+ publish-pypi:
59
+ needs: [build-wheels, sdist]
60
+ runs-on: ubuntu-latest
61
+ environment: pypi
62
+ permissions:
63
+ # OIDC token for PyPI trusted publishing — no API secret needed
64
+ id-token: write
65
+ steps:
66
+ - uses: actions/download-artifact@v4
67
+ with:
68
+ path: dist
69
+ merge-multiple: true
70
+
71
+ - name: List artifacts to publish
72
+ run: ls -la dist/
73
+
74
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,33 @@
1
+ name: TestPyPI dry run
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ permissions:
7
+ contents: read
8
+
9
+ jobs:
10
+ publish-testpypi:
11
+ runs-on: ubuntu-latest
12
+ environment: testpypi
13
+ permissions:
14
+ id-token: write
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Build abi3 wheel + sdist (maturin)
19
+ uses: PyO3/maturin-action@v1
20
+ with:
21
+ command: build
22
+ args: --release --out dist
23
+ manylinux: auto
24
+
25
+ - name: Build sdist
26
+ uses: PyO3/maturin-action@v1
27
+ with:
28
+ command: sdist
29
+ args: --out dist
30
+
31
+ - uses: pypa/gh-action-pypi-publish@release/v1
32
+ with:
33
+ repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,33 @@
1
+ # Rust build artifacts
2
+ /target
3
+
4
+ # Python build artifacts
5
+ *.so
6
+ *.dylib
7
+ *.dll
8
+ *.pyd
9
+ __pycache__/
10
+ *.py[cod]
11
+ *.egg-info/
12
+ dist/
13
+ build/
14
+ *.whl
15
+
16
+ # pixi environment (managed by pixi, not committed)
17
+ .pixi/
18
+
19
+ # Virtual environments
20
+ .venv/
21
+ venv/
22
+
23
+ # Editor / OS
24
+ .DS_Store
25
+ *.swp
26
+ .vscode/
27
+
28
+ # Python tooling caches
29
+ .ruff_cache/
30
+ .mypy_cache/
31
+ .pytest_cache/
32
+ .cache/
33
+