finitefree 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 (88) hide show
  1. finitefree-0.1.0/.github/workflows/ci.yml +92 -0
  2. finitefree-0.1.0/.github/workflows/deploy-docs.yml +66 -0
  3. finitefree-0.1.0/.github/workflows/publish.yml +85 -0
  4. finitefree-0.1.0/.gitignore +90 -0
  5. finitefree-0.1.0/LICENSE +21 -0
  6. finitefree-0.1.0/PKG-INFO +17 -0
  7. finitefree-0.1.0/README.md +501 -0
  8. finitefree-0.1.0/conda/recipe/meta.yaml +47 -0
  9. finitefree-0.1.0/docs/api.md +32 -0
  10. finitefree-0.1.0/docs/index.md +459 -0
  11. finitefree-0.1.0/docs/javascripts/mathjax.js +19 -0
  12. finitefree-0.1.0/docs/visuals/assets/asymptotic_kernel_bulk.gif +0 -0
  13. finitefree-0.1.0/docs/visuals/assets/asymptotic_kernel_edge.gif +0 -0
  14. finitefree-0.1.0/docs/visuals/assets/cauchy_domain_coloring.gif +0 -0
  15. finitefree-0.1.0/docs/visuals/assets/cumulant_decay.gif +0 -0
  16. finitefree-0.1.0/docs/visuals/assets/free_jacobi_arcsine_convergence.gif +0 -0
  17. finitefree-0.1.0/docs/visuals/assets/free_lognormal_convergence.gif +0 -0
  18. finitefree-0.1.0/docs/visuals/assets/hyperbolic_cones.png +0 -0
  19. finitefree-0.1.0/docs/visuals/assets/level_repulsion.png +0 -0
  20. finitefree-0.1.0/docs/visuals/assets/marchenko_pastur_convergence.gif +0 -0
  21. finitefree-0.1.0/docs/visuals/assets/root_interlacing_additive.png +0 -0
  22. finitefree-0.1.0/docs/visuals/assets/root_interlacing_multiplicative.png +0 -0
  23. finitefree-0.1.0/docs/visuals/assets/root_interlacing_original.png +0 -0
  24. finitefree-0.1.0/docs/visuals/assets/s_transform_convergence.gif +0 -0
  25. finitefree-0.1.0/docs/visuals/assets/t_transform_convergence.gif +0 -0
  26. finitefree-0.1.0/docs/visuals/assets/temp_tw_frames/frame_000.png +0 -0
  27. finitefree-0.1.0/docs/visuals/assets/temp_tw_frames/frame_001.png +0 -0
  28. finitefree-0.1.0/docs/visuals/assets/temp_tw_frames/frame_002.png +0 -0
  29. finitefree-0.1.0/docs/visuals/assets/tracy_widom_convergence.png +0 -0
  30. finitefree-0.1.0/docs/visuals/assets/unitary_trajectories.gif +0 -0
  31. finitefree-0.1.0/docs/visuals/assets/wigner_semicircle_convergence.gif +0 -0
  32. finitefree-0.1.0/examples/showcase.py +213 -0
  33. finitefree-0.1.0/finitefree/__init__.py +81 -0
  34. finitefree-0.1.0/finitefree/convolutions.py +116 -0
  35. finitefree-0.1.0/finitefree/core.py +1036 -0
  36. finitefree-0.1.0/finitefree/dpp.py +293 -0
  37. finitefree-0.1.0/finitefree/ensembles.py +257 -0
  38. finitefree-0.1.0/finitefree/hyperbolic/__init__.py +8 -0
  39. finitefree-0.1.0/finitefree/hyperbolic/pencils.py +384 -0
  40. finitefree-0.1.0/finitefree/hyperbolic/slp.py +235 -0
  41. finitefree-0.1.0/finitefree/multivariate.py +571 -0
  42. finitefree-0.1.0/finitefree/orthogonal.py +500 -0
  43. finitefree-0.1.0/finitefree/transforms.py +248 -0
  44. finitefree-0.1.0/finitefree/utils/__init__.py +1 -0
  45. finitefree-0.1.0/finitefree/utils/conversion.py +47 -0
  46. finitefree-0.1.0/finitefree/utils/modular.py +116 -0
  47. finitefree-0.1.0/finitefree/utils/modular_fast.pyx +290 -0
  48. finitefree-0.1.0/finitefree/utils/parallel.py +158 -0
  49. finitefree-0.1.0/finitefree/utils/precision.py +21 -0
  50. finitefree-0.1.0/finitefree/utils/prs.py +110 -0
  51. finitefree-0.1.0/mkdocs.yml +30 -0
  52. finitefree-0.1.0/pyproject.toml +93 -0
  53. finitefree-0.1.0/scripts/sync_docs.py +116 -0
  54. finitefree-0.1.0/tests/test_convolutions.py +181 -0
  55. finitefree-0.1.0/tests/test_core.py +201 -0
  56. finitefree-0.1.0/tests/test_empirical.py +119 -0
  57. finitefree-0.1.0/tests/test_ensembles.py +287 -0
  58. finitefree-0.1.0/tests/test_hyperbolic.py +404 -0
  59. finitefree-0.1.0/tests/test_orthogonal.py +173 -0
  60. finitefree-0.1.0/tests/test_performance_and_scipy.py +141 -0
  61. finitefree-0.1.0/tests/test_transformations.py +110 -0
  62. finitefree-0.1.0/tests/test_transforms.py +311 -0
  63. finitefree-0.1.0/visuals/assets/asymptotic_kernel_bulk.gif +0 -0
  64. finitefree-0.1.0/visuals/assets/asymptotic_kernel_edge.gif +0 -0
  65. finitefree-0.1.0/visuals/assets/cauchy_domain_coloring.gif +0 -0
  66. finitefree-0.1.0/visuals/assets/cumulant_decay.gif +0 -0
  67. finitefree-0.1.0/visuals/assets/free_jacobi_arcsine_convergence.gif +0 -0
  68. finitefree-0.1.0/visuals/assets/free_lognormal_convergence.gif +0 -0
  69. finitefree-0.1.0/visuals/assets/hyperbolic_cones.png +0 -0
  70. finitefree-0.1.0/visuals/assets/level_repulsion.png +0 -0
  71. finitefree-0.1.0/visuals/assets/marchenko_pastur_convergence.gif +0 -0
  72. finitefree-0.1.0/visuals/assets/root_interlacing_additive.png +0 -0
  73. finitefree-0.1.0/visuals/assets/root_interlacing_multiplicative.png +0 -0
  74. finitefree-0.1.0/visuals/assets/root_interlacing_original.png +0 -0
  75. finitefree-0.1.0/visuals/assets/s_transform_convergence.gif +0 -0
  76. finitefree-0.1.0/visuals/assets/t_transform_convergence.gif +0 -0
  77. finitefree-0.1.0/visuals/assets/temp_tw_frames/frame_000.png +0 -0
  78. finitefree-0.1.0/visuals/assets/temp_tw_frames/frame_001.png +0 -0
  79. finitefree-0.1.0/visuals/assets/temp_tw_frames/frame_002.png +0 -0
  80. finitefree-0.1.0/visuals/assets/tracy_widom_convergence.png +0 -0
  81. finitefree-0.1.0/visuals/assets/unitary_trajectories.gif +0 -0
  82. finitefree-0.1.0/visuals/assets/wigner_semicircle_convergence.gif +0 -0
  83. finitefree-0.1.0/visuals/visualize_dpp.py +403 -0
  84. finitefree-0.1.0/visuals/visualize_free_limits.py +335 -0
  85. finitefree-0.1.0/visuals/visualize_hyperbolic.py +61 -0
  86. finitefree-0.1.0/visuals/visualize_interlacing.py +207 -0
  87. finitefree-0.1.0/visuals/visualize_transforms.py +631 -0
  88. finitefree-0.1.0/visuals/visualize_unitary.py +144 -0
@@ -0,0 +1,92 @@
1
+ name: FiniteFree CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main", "master" ]
6
+ pull_request:
7
+ branches: [ "main", "master" ]
8
+
9
+ jobs:
10
+ test:
11
+ name: ${{ matrix.os }} / Python ${{ matrix.python-version }}
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ os: [ubuntu-latest, macos-latest, windows-latest]
17
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
18
+
19
+ defaults:
20
+ run:
21
+ shell: bash
22
+
23
+ steps:
24
+ - name: Checkout Repository
25
+ uses: actions/checkout@v4
26
+
27
+ - name: Set up Python ${{ matrix.python-version }}
28
+ uses: actions/setup-python@v5
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+
32
+ - name: Install System Dependencies (Linux)
33
+ if: matrix.os == 'ubuntu-latest'
34
+ run: |
35
+ sudo apt-get update
36
+ sudo apt-get install -y libflint-dev libgmp-dev libmpfr-dev
37
+
38
+ - name: Install System Dependencies (macOS)
39
+ if: matrix.os == 'macos-latest'
40
+ run: |
41
+ if command -v brew &> /dev/null; then
42
+ brew install flint gmp mpfr
43
+ echo "C_INCLUDE_PATH=/opt/homebrew/include" >> $GITHUB_ENV
44
+ echo "LIBRARY_PATH=/opt/homebrew/lib" >> $GITHUB_ENV
45
+ elif command -v apt-get &> /dev/null; then
46
+ sudo apt-get update
47
+ sudo apt-get install -y libflint-dev libgmp-dev libmpfr-dev
48
+ fi
49
+
50
+ - name: Install Dependencies
51
+ run: |
52
+ python -m pip install --upgrade pip setuptools wheel
53
+ # Force pre-compiled wheels for python-flint >= 0.6.0 on Windows, fallback on others
54
+ python -m pip install --only-binary=python-flint "python-flint>=0.6.0" || python -m pip install "python-flint>=0.6.0"
55
+ # Standard install (not editable) ensures Cython modules compile and link properly
56
+ pip install .[dev]
57
+
58
+ - name: Verify Code Formatting & Linting (Linux only)
59
+ if: matrix.os == 'ubuntu-latest'
60
+ run: |
61
+ python -m ruff format --check finitefree/ tests/
62
+ python -m ruff check finitefree/ tests/
63
+ python -m mypy finitefree/ tests/
64
+
65
+ - name: Test with pytest and coverage (Cython Enabled)
66
+ run: |
67
+ # Compile Cython module in-place so it is available locally in the source tree, including NumPy headers
68
+ python -m pip install Cython
69
+ python -c "from setuptools import setup, Extension; from Cython.Build import cythonize; import numpy as np; setup(ext_modules=cythonize(Extension('finitefree.utils.modular_fast', ['finitefree/utils/modular_fast.pyx'], include_dirs=[np.get_include()])), script_args=['build_ext', '--inplace'])"
70
+ export PYTHONPATH=.
71
+ python -m pytest --import-mode=importlib --cov=finitefree --cov-report=xml tests/
72
+
73
+ - name: Test with pytest (Cython Disabled Fallback)
74
+ env:
75
+ PYFFP_DISABLE_CYTHON: "1"
76
+ run: |
77
+ export PYTHONPATH=.
78
+ python -m pytest --import-mode=importlib tests/
79
+
80
+ - name: Mark workspace as safe directory (Linux only)
81
+ if: matrix.os == 'ubuntu-latest'
82
+ run: |
83
+ git config --global --add safe.directory "${{ github.workspace }}"
84
+
85
+ - name: Upload coverage to Codecov (Linux only)
86
+ if: matrix.os == 'ubuntu-latest'
87
+ uses: codecov/codecov-action@v4
88
+ with:
89
+ file: ./coverage.xml
90
+ fail_ci_if_error: false
91
+ token: ${{ secrets.CODECOV_TOKEN }}
92
+ disable_safe_directory: true
@@ -0,0 +1,66 @@
1
+ name: Deploy MkDocs Documentation
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+ pages: write
13
+ id-token: write
14
+
15
+ concurrency:
16
+ group: "pages"
17
+ cancel-in-progress: false
18
+
19
+ jobs:
20
+ build-and-deploy:
21
+ runs-on: ubuntu-latest
22
+ environment:
23
+ name: github-pages
24
+ url: ${{ steps.deployment.outputs.page_url }}
25
+
26
+ steps:
27
+ - name: Checkout repository
28
+ uses: actions/checkout@v4
29
+
30
+ - name: Provision C toolchains and arbitrary-precision libraries
31
+ run: |
32
+ sudo apt-get update
33
+ sudo apt-get install -y gcc libgmp-dev libmpfr-dev libflint-dev
34
+
35
+ - name: Initialize Python runtime
36
+ uses: actions/setup-python@v5
37
+ with:
38
+ python-version: '3.11'
39
+ cache: 'pip'
40
+
41
+ - name: Execute local package installation and compile Cython extensions
42
+ run: |
43
+ python -m pip install --upgrade pip setuptools wheel
44
+ # Force pre-compiled wheels for python-flint, fallback on source
45
+ python -m pip install --only-binary=python-flint "python-flint>=0.6.0" || python -m pip install "python-flint>=0.6.0"
46
+ pip install -e ".[dev]"
47
+ pip install mkdocs-material mkdocstrings[python]
48
+
49
+ - name: Construct static documentation assets
50
+ run: |
51
+ python scripts/sync_docs.py
52
+ mkdocs build
53
+
54
+ - name: Configure GitHub Pages environment
55
+ uses: actions/configure-pages@v4
56
+ with:
57
+ enablement: true
58
+
59
+ - name: Upload compiled artifact
60
+ uses: actions/upload-pages-artifact@v3
61
+ with:
62
+ path: './site'
63
+
64
+ - name: Execute deployment
65
+ id: deployment
66
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,85 @@
1
+ name: Build and Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*'
7
+ workflow_dispatch:
8
+ inputs:
9
+ publish_to_testpypi:
10
+ description: 'Publish to TestPyPI instead of PyPI'
11
+ required: true
12
+ type: boolean
13
+ default: true
14
+
15
+ jobs:
16
+ build_wheels:
17
+ name: Build wheels on ${{ matrix.os }}
18
+ runs-on: ${{ matrix.os }}
19
+ strategy:
20
+ matrix:
21
+ os: [ubuntu-latest, macos-latest, windows-latest]
22
+
23
+ steps:
24
+ - name: Checkout repository
25
+ uses: actions/checkout@v4
26
+
27
+ - name: Build wheels via cibuildwheel
28
+ uses: pypa/cibuildwheel@v2.21.3
29
+
30
+ - name: Upload compiled wheels
31
+ uses: actions/upload-artifact@v4
32
+ with:
33
+ name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
34
+ path: ./wheelhouse/*.whl
35
+
36
+ build_sdist:
37
+ name: Build source distribution
38
+ runs-on: ubuntu-latest
39
+ steps:
40
+ - name: Checkout repository
41
+ uses: actions/checkout@v4
42
+
43
+ - name: Install build tools
44
+ run: python -m pip install --upgrade pip build
45
+
46
+ - name: Build sdist
47
+ run: python -m build --sdist
48
+
49
+ - name: Upload sdist
50
+ uses: actions/upload-artifact@v4
51
+ with:
52
+ name: cibw-sdist
53
+ path: dist/*.tar.gz
54
+
55
+ publish:
56
+ name: Publish packages to PyPI
57
+ needs: [build_wheels, build_sdist]
58
+ runs-on: ubuntu-latest
59
+ environment: release
60
+ permissions:
61
+ id-token: write # Required for Trusted Publishing / OIDC
62
+
63
+ steps:
64
+ - name: Download all build artifacts
65
+ uses: actions/download-artifact@v4
66
+ with:
67
+ path: dist
68
+ merge-multiple: true
69
+
70
+ - name: Publish to TestPyPI
71
+ # Publish to TestPyPI if triggered by manual dispatch with TestPyPI input, or tags ending in rc/dev
72
+ if: |
73
+ (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_to_testpypi == 'true') ||
74
+ (github.event_name == 'push' && (contains(github.ref, 'rc') || contains(github.ref, 'dev')))
75
+ uses: pypa/gh-action-pypi-publish@release/v1
76
+ with:
77
+ repository-url: https://test.pypi.org/legacy/
78
+ skip-existing: true
79
+
80
+ - name: Publish to PyPI
81
+ # Publish to production PyPI only on clean semver releases (non-pre-release tags)
82
+ if: |
83
+ (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_to_testpypi == 'false') ||
84
+ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'rc') && !contains(github.ref, 'dev'))
85
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,90 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+ *.c
9
+ *.cpp
10
+
11
+ # Distribution / packaging
12
+ .Python
13
+ build/
14
+ develop-eggs/
15
+ dist/
16
+ downloads/
17
+ eggs/
18
+ .eggs/
19
+ lib/
20
+ lib64/
21
+ parts/
22
+ sdist/
23
+ var/
24
+ wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ *.manifest
32
+ *.spec
33
+
34
+ # Installer logs
35
+ pip-log.txt
36
+ pip-delete-this-directory.txt
37
+
38
+ # Unit test / coverage reports
39
+ htmlcov/
40
+ .tox/
41
+ .nox/
42
+ .coverage
43
+ .coverage.*
44
+ .cache
45
+ nosetests.xml
46
+ coverage.xml
47
+ *.cover
48
+ *.sveditor
49
+ .hypothesis/
50
+ .pytest_cache/
51
+
52
+ # Environments
53
+ .env
54
+ .venv
55
+ env/
56
+ venv/
57
+ ENV/
58
+ env.bak/
59
+ venv.bak/
60
+
61
+ # IDEs
62
+ .vscode/
63
+ .idea/
64
+ *.swp
65
+
66
+ # Python cache & tooling
67
+ .mypy_cache/
68
+ .ruff_cache/
69
+
70
+ # Local visual output directory (whitelist key showcase assets and scripts)
71
+ visuals/*
72
+ !visuals/*.py
73
+ !visuals/assets/
74
+ !visuals/assets/*
75
+
76
+ # Local TODO tracking
77
+ TODO.md
78
+
79
+ # Convergence Experiment Outputs
80
+ experiments/
81
+
82
+ # Local Scratch/Development scripts
83
+ scratch/
84
+
85
+ # MkDocs output
86
+ site/
87
+
88
+
89
+
90
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FiniteFree Authors
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,17 @@
1
+ Metadata-Version: 2.4
2
+ Name: finitefree
3
+ Version: 0.1.0
4
+ Summary: A Python library for exact finite free probability
5
+ Author: Author
6
+ License: MIT
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.9
9
+ Requires-Dist: numpy>=1.24
10
+ Requires-Dist: python-flint>=0.6.0
11
+ Requires-Dist: scipy>=1.10
12
+ Requires-Dist: sympy>=1.12
13
+ Provides-Extra: dev
14
+ Requires-Dist: mypy>=1.0; extra == 'dev'
15
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
16
+ Requires-Dist: pytest>=7.0; extra == 'dev'
17
+ Requires-Dist: ruff>=0.3.0; extra == 'dev'