freealg 0.3.2__py3-none-any.whl → 0.3.4__py3-none-any.whl
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.
- freealg/__version__.py +1 -1
- freealg/eigh.py +13 -2
- {freealg-0.3.2.dist-info → freealg-0.3.4.dist-info}/METADATA +15 -14
- {freealg-0.3.2.dist-info → freealg-0.3.4.dist-info}/RECORD +8 -8
- {freealg-0.3.2.dist-info → freealg-0.3.4.dist-info}/WHEEL +0 -0
- {freealg-0.3.2.dist-info → freealg-0.3.4.dist-info}/licenses/AUTHORS.txt +0 -0
- {freealg-0.3.2.dist-info → freealg-0.3.4.dist-info}/licenses/LICENSE.txt +0 -0
- {freealg-0.3.2.dist-info → freealg-0.3.4.dist-info}/top_level.txt +0 -0
freealg/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.3.
|
|
1
|
+
__version__ = "0.3.4"
|
freealg/eigh.py
CHANGED
|
@@ -17,12 +17,19 @@ from .freeform import FreeForm
|
|
|
17
17
|
__all__ = ['eigh', 'cond', 'norm', 'trace', 'slogdet']
|
|
18
18
|
|
|
19
19
|
|
|
20
|
+
# ===============
|
|
21
|
+
# subsample apply
|
|
22
|
+
# ===============
|
|
23
|
+
|
|
20
24
|
def _subsample_apply(f, A, output_array=False):
|
|
21
|
-
"""
|
|
22
|
-
f
|
|
25
|
+
"""
|
|
26
|
+
Compute f(A_n) over subsamples A_n of A. If the output of
|
|
27
|
+
f is an array (e.g. eigvals), specify output_array to be True.
|
|
28
|
+
"""
|
|
23
29
|
|
|
24
30
|
if A.ndim != 2 or A.shape[0] != A.shape[1]:
|
|
25
31
|
raise RuntimeError("Only square matrices are permitted.")
|
|
32
|
+
|
|
26
33
|
n = A.shape[0]
|
|
27
34
|
|
|
28
35
|
# Size of sample matrix
|
|
@@ -30,6 +37,7 @@ def _subsample_apply(f, A, output_array=False):
|
|
|
30
37
|
# If matrix is not large enough, return eigenvalues
|
|
31
38
|
if n < n_s:
|
|
32
39
|
return f(A), n, n
|
|
40
|
+
|
|
33
41
|
# Number of samples
|
|
34
42
|
num_samples = int(10 * (n / n_s)**0.5)
|
|
35
43
|
|
|
@@ -38,6 +46,7 @@ def _subsample_apply(f, A, output_array=False):
|
|
|
38
46
|
for _ in range(num_samples):
|
|
39
47
|
indices = numpy.random.choice(n, n_s, replace=False)
|
|
40
48
|
samples.append(f(A[numpy.ix_(indices, indices)]))
|
|
49
|
+
|
|
41
50
|
if output_array:
|
|
42
51
|
return numpy.concatenate(samples).ravel(), n, n_s
|
|
43
52
|
|
|
@@ -113,6 +122,7 @@ def eigh(A, N=None, psd=None, plots=False):
|
|
|
113
122
|
>>> A = mp.matrix(3000)
|
|
114
123
|
>>> eigs = eigh(A)
|
|
115
124
|
"""
|
|
125
|
+
|
|
116
126
|
samples, n, n_s = _subsample_apply(compute_eig, A, output_array=True)
|
|
117
127
|
|
|
118
128
|
if N is None:
|
|
@@ -367,6 +377,7 @@ def trace(A, N=None, p=1.0):
|
|
|
367
377
|
>>> A = mp.matrix(3000)
|
|
368
378
|
>>> trace(A, 100_000)
|
|
369
379
|
"""
|
|
380
|
+
|
|
370
381
|
if numpy.isclose(p, 1.0):
|
|
371
382
|
samples, n, n_s = _subsample_apply(numpy.trace, A, output_array=False)
|
|
372
383
|
if N is None:
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: freealg
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Free probability for large matrices
|
|
5
5
|
Home-page: https://github.com/ameli/freealg
|
|
6
6
|
Download-URL: https://github.com/ameli/freealg/archive/main.zip
|
|
7
|
-
Project-URL: Documentation, https://github.
|
|
7
|
+
Project-URL: Documentation, https://ameli.github.io/freealg
|
|
8
8
|
Project-URL: Source, https://github.com/ameli/freealg
|
|
9
9
|
Project-URL: Tracker, https://github.com/ameli/freealg/issues
|
|
10
10
|
Keywords: linalg,free-probability
|
|
@@ -53,10 +53,9 @@ Dynamic: requires-dist
|
|
|
53
53
|
Dynamic: requires-python
|
|
54
54
|
Dynamic: summary
|
|
55
55
|
|
|
56
|
-
..
|
|
56
|
+
.. figure:: https://raw.githubusercontent.com/ameli/freealg/refs/heads/main/docs/source/_static/images/icons/logo-freealg-light.png
|
|
57
57
|
:align: left
|
|
58
58
|
:width: 240
|
|
59
|
-
:class: custom-dark
|
|
60
59
|
|
|
61
60
|
`Paper <https://arxiv.org/abs/2506.11994>`__ |
|
|
62
61
|
`Slides <https://www.dropbox.com/scl/fi/03gjuyz17k9yhsqy0isoz/free_decomporession_slides.pdf?rlkey=8f82mhciyl2ju02l7hv1md5li&st=26xmhjga&dl=0>`__ |
|
|
@@ -65,10 +64,11 @@ Dynamic: summary
|
|
|
65
64
|
|
|
66
65
|
.. `Slides <https://ameli.github.io/freealg/_static/data/slides.pdf>`__ |
|
|
67
66
|
|
|
68
|
-
*freealg* is a Python package that employs **free** probability to evaluate the
|
|
69
|
-
densities of large matrix **form**\ s. The fundamental algorithm
|
|
70
|
-
**free decompression**, which extrapolates from the
|
|
71
|
-
submatrices to infer the eigenspectrum
|
|
67
|
+
*freealg* is a Python package that employs **free** probability to evaluate the
|
|
68
|
+
spectral densities of large matrix **form**\ s. The fundamental algorithm
|
|
69
|
+
employed by *freealg* is **free decompression**, which extrapolates from the
|
|
70
|
+
empirical spectral densities of small submatrices to infer the eigenspectrum
|
|
71
|
+
of extremely large matrices.
|
|
72
72
|
|
|
73
73
|
Install
|
|
74
74
|
=======
|
|
@@ -94,8 +94,8 @@ Documentation is available at `ameli.github.io/freealg <https://ameli.github.io/
|
|
|
94
94
|
Quick Usage
|
|
95
95
|
===========
|
|
96
96
|
|
|
97
|
-
The following code estimates the eigenvalues of a very large Wishart matrix
|
|
98
|
-
smaller Wishart matrix.
|
|
97
|
+
The following code estimates the eigenvalues of a very large Wishart matrix
|
|
98
|
+
using a much smaller Wishart matrix.
|
|
99
99
|
|
|
100
100
|
.. code-block:: python
|
|
101
101
|
|
|
@@ -104,7 +104,8 @@ smaller Wishart matrix.
|
|
|
104
104
|
>>> A = mp.matrix(1000) # Sample a 1000 x 1000 Wishart matrix
|
|
105
105
|
>>> eigs = fa.eigfree(A, 100_000) # Estimate the eigenvalues of 100000 x 100000
|
|
106
106
|
|
|
107
|
-
For more details on how to interface with *freealg* check out the
|
|
107
|
+
For more details on how to interface with *freealg* check out the
|
|
108
|
+
`Quick Start Guide <https://github.com/ameli/freealg/blob/main/notebooks/quick_start.ipynb>`__.
|
|
108
109
|
|
|
109
110
|
|
|
110
111
|
Test
|
|
@@ -128,9 +129,9 @@ How to Contribute
|
|
|
128
129
|
=================
|
|
129
130
|
|
|
130
131
|
We welcome contributions via GitHub's pull request. Developers should review
|
|
131
|
-
our [Contributing Guidelines](CONTRIBUTING.rst)
|
|
132
|
-
If you do not feel comfortable modifying the
|
|
133
|
-
requests and bug reports.
|
|
132
|
+
our [Contributing Guidelines](https://github.com/ameli/freealg/blob/main/CONTRIBUTING.rst)
|
|
133
|
+
before submitting their code. If you do not feel comfortable modifying the
|
|
134
|
+
code, we also welcome feature requests and bug reports.
|
|
134
135
|
|
|
135
136
|
How to Cite
|
|
136
137
|
===========
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
freealg/__init__.py,sha256=AM0G2tX7sBgzCTcOVbWynA9NFkQZKyphL9IR1tKOoK4,614
|
|
2
|
-
freealg/__version__.py,sha256=
|
|
2
|
+
freealg/__version__.py,sha256=oYLGMpySamd16KLiaBTfRyrAS7_oyp-TOEHmzmeumwg,22
|
|
3
3
|
freealg/_chebyshev.py,sha256=dsAj3YEpmkzB65smluZ0Fi5IZSdpnQXBSIuKMg19grA,5523
|
|
4
4
|
freealg/_damp.py,sha256=k2vtBtWOxQBf4qXaWu_En81lQBXbEO4QbxxWpvuVhdE,1802
|
|
5
5
|
freealg/_decompress.py,sha256=0MYoO3lqwMgNYlVriaRNUqUwY3XYyZZsDAtNRBq6rhE,10470
|
|
@@ -9,7 +9,7 @@ freealg/_plot_util.py,sha256=U4alp7Pzg315_7jJdu1UB0tIUcxUovQgHDHsUYoa2Z0,19728
|
|
|
9
9
|
freealg/_sample.py,sha256=ckC75eqv-mRP1F5BnhvsjfLTaoAzHK8bebl9bCRZYDo,2561
|
|
10
10
|
freealg/_support.py,sha256=mYlrsdLbniqFgFofbHrZIiYSyJudPqtyMQQTPBD9Y6M,6439
|
|
11
11
|
freealg/_util.py,sha256=8Tvz-XODtKYoU76ODmF1TBaIYLlr6-AXiyoMDwDSxVg,3779
|
|
12
|
-
freealg/eigh.py,sha256=
|
|
12
|
+
freealg/eigh.py,sha256=ybUCE8Qi-H8r-QxDvbeSP9Ow-q8xTuq5o-LNhPvBvIE,10926
|
|
13
13
|
freealg/freeform.py,sha256=8emyCQ6AUjp_HB1gWQ-ecddlDgfxHGr3PqXSyoPxeMo,28593
|
|
14
14
|
freealg/distributions/__init__.py,sha256=t_yZyEkW_W_tSV9IvgYXtVASxD2BEdiNVXcV2ebMy8M,579
|
|
15
15
|
freealg/distributions/_kesten_mckay.py,sha256=210RF2OQEYLZBeLB6wmbdHnZPs_9ldDNHm_FMlg5tis,19881
|
|
@@ -17,9 +17,9 @@ freealg/distributions/_marchenko_pastur.py,sha256=kchFccRMuVF2Cus_99vdEwuRimkHzE
|
|
|
17
17
|
freealg/distributions/_meixner.py,sha256=ws7t_EUa7V0s97dgMQIJLv1b6qMLqf9fLLbTJQudf_8,17512
|
|
18
18
|
freealg/distributions/_wachter.py,sha256=Hna_MXqAPjuRkeilLPMf4Xg_3C6tTu5oZLEQnA-RuE4,16897
|
|
19
19
|
freealg/distributions/_wigner.py,sha256=SxgPLtvIVBi9m4De-oBD0x6-2Je_eBqpDrpDYcoLuis,15871
|
|
20
|
-
freealg-0.3.
|
|
21
|
-
freealg-0.3.
|
|
22
|
-
freealg-0.3.
|
|
23
|
-
freealg-0.3.
|
|
24
|
-
freealg-0.3.
|
|
25
|
-
freealg-0.3.
|
|
20
|
+
freealg-0.3.4.dist-info/licenses/AUTHORS.txt,sha256=0b67Nz4_JgIzUupHJTAZxu5QdSUM_HRM_X_w4xCb17o,30
|
|
21
|
+
freealg-0.3.4.dist-info/licenses/LICENSE.txt,sha256=J-EEYEtxb3VVf_Bn1TYfWnpY5lMFIM15iLDDcnaDTPA,1443
|
|
22
|
+
freealg-0.3.4.dist-info/METADATA,sha256=lIBEqbu7pp06QtpSXWg24y0rt7s6AokWnueOuutnwCY,4977
|
|
23
|
+
freealg-0.3.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
24
|
+
freealg-0.3.4.dist-info/top_level.txt,sha256=eR2wrgYwDdnnJ9Zf5PruPqe4kQav0GMvRsqct6y00Q8,8
|
|
25
|
+
freealg-0.3.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|