freealg 0.3.2__py3-none-any.whl → 0.3.3__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "0.3.2"
1
+ __version__ = "0.3.3"
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
- """Compute f(A_n) over subsamples A_n of A. If the output of
22
- f is an array (e.g. eigvals), specify output_array to be True."""
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.2
3
+ Version: 0.3.3
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.com/ameli/freealg/blob/main/README.rst
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,14 @@ Dynamic: requires-dist
53
53
  Dynamic: requires-python
54
54
  Dynamic: summary
55
55
 
56
- .. image:: https://raw.githubusercontent.com/ameli/freealg/refs/heads/main/docs/source/_static/images/icons/logo-freealg-light.png
56
+ .. .. image:: https://raw.githubusercontent.com/ameli/freealg/refs/heads/main/docs/source/_static/images/icons/logo-freealg-light.png
57
+ .. :align: left
58
+ .. :width: 240
59
+ .. :class: custom-dark
60
+
61
+ .. figure:: https://raw.githubusercontent.com/ameli/freealg/refs/heads/main/docs/source/_static/images/icons/logo-freealg-light.png
57
62
  :align: left
58
63
  :width: 240
59
- :class: custom-dark
60
64
 
61
65
  `Paper <https://arxiv.org/abs/2506.11994>`__ |
62
66
  `Slides <https://www.dropbox.com/scl/fi/03gjuyz17k9yhsqy0isoz/free_decomporession_slides.pdf?rlkey=8f82mhciyl2ju02l7hv1md5li&st=26xmhjga&dl=0>`__ |
@@ -65,10 +69,11 @@ Dynamic: summary
65
69
 
66
70
  .. `Slides <https://ameli.github.io/freealg/_static/data/slides.pdf>`__ |
67
71
 
68
- *freealg* is a Python package that employs **free** probability to evaluate the spectral
69
- densities of large matrix **form**\ s. The fundamental algorithm employed by *freealg* is
70
- **free decompression**, which extrapolates from the empirical spectral densities of small
71
- submatrices to infer the eigenspectrum of extremely large matrices.
72
+ *freealg* is a Python package that employs **free** probability to evaluate the
73
+ spectral densities of large matrix **form**\ s. The fundamental algorithm
74
+ employed by *freealg* is **free decompression**, which extrapolates from the
75
+ empirical spectral densities of small submatrices to infer the eigenspectrum
76
+ of extremely large matrices.
72
77
 
73
78
  Install
74
79
  =======
@@ -94,8 +99,8 @@ Documentation is available at `ameli.github.io/freealg <https://ameli.github.io/
94
99
  Quick Usage
95
100
  ===========
96
101
 
97
- The following code estimates the eigenvalues of a very large Wishart matrix using a much
98
- smaller Wishart matrix.
102
+ The following code estimates the eigenvalues of a very large Wishart matrix
103
+ using a much smaller Wishart matrix.
99
104
 
100
105
  .. code-block:: python
101
106
 
@@ -104,7 +109,8 @@ smaller Wishart matrix.
104
109
  >>> A = mp.matrix(1000) # Sample a 1000 x 1000 Wishart matrix
105
110
  >>> eigs = fa.eigfree(A, 100_000) # Estimate the eigenvalues of 100000 x 100000
106
111
 
107
- For more details on how to interface with *freealg* check out the `Quick Start Guide <https://github.com/ameli/freealg/blob/main/notebooks/quick_start.ipynb>`__.
112
+ For more details on how to interface with *freealg* check out the
113
+ `Quick Start Guide <https://github.com/ameli/freealg/blob/main/notebooks/quick_start.ipynb>`__.
108
114
 
109
115
 
110
116
  Test
@@ -128,9 +134,9 @@ How to Contribute
128
134
  =================
129
135
 
130
136
  We welcome contributions via GitHub's pull request. Developers should review
131
- our [Contributing Guidelines](CONTRIBUTING.rst) before submitting their code.
132
- If you do not feel comfortable modifying the code, we also welcome feature
133
- requests and bug reports.
137
+ our [Contributing Guidelines](https://github.com/ameli/freealg/blob/main/CONTRIBUTING.rst)
138
+ before submitting their code. If you do not feel comfortable modifying the
139
+ code, we also welcome feature requests and bug reports.
134
140
 
135
141
  How to Cite
136
142
  ===========
@@ -1,5 +1,5 @@
1
1
  freealg/__init__.py,sha256=AM0G2tX7sBgzCTcOVbWynA9NFkQZKyphL9IR1tKOoK4,614
2
- freealg/__version__.py,sha256=vNiWJ14r_cw5t_7UDqDQIVZvladKFGyHH2avsLpN7Vg,22
2
+ freealg/__version__.py,sha256=8KcCYTXH99C2-gCLuPILJvtT9YftRWJsartIx6TQ2ZY,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=5SFixxpXiVBsf5R9S0neg1lqWgmPoqGwVx4jwunh0xg,10856
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.2.dist-info/licenses/AUTHORS.txt,sha256=0b67Nz4_JgIzUupHJTAZxu5QdSUM_HRM_X_w4xCb17o,30
21
- freealg-0.3.2.dist-info/licenses/LICENSE.txt,sha256=J-EEYEtxb3VVf_Bn1TYfWnpY5lMFIM15iLDDcnaDTPA,1443
22
- freealg-0.3.2.dist-info/METADATA,sha256=uRwMJGay5-IuqPSOWqpoMeaSqbNC1dq47moA2MxkGlo,4978
23
- freealg-0.3.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
- freealg-0.3.2.dist-info/top_level.txt,sha256=eR2wrgYwDdnnJ9Zf5PruPqe4kQav0GMvRsqct6y00Q8,8
25
- freealg-0.3.2.dist-info/RECORD,,
20
+ freealg-0.3.3.dist-info/licenses/AUTHORS.txt,sha256=0b67Nz4_JgIzUupHJTAZxu5QdSUM_HRM_X_w4xCb17o,30
21
+ freealg-0.3.3.dist-info/licenses/LICENSE.txt,sha256=J-EEYEtxb3VVf_Bn1TYfWnpY5lMFIM15iLDDcnaDTPA,1443
22
+ freealg-0.3.3.dist-info/METADATA,sha256=DADdzlak4svhV-GaZCt5NohqxbJCk1KXN9hk33Vs9_c,5178
23
+ freealg-0.3.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
+ freealg-0.3.3.dist-info/top_level.txt,sha256=eR2wrgYwDdnnJ9Zf5PruPqe4kQav0GMvRsqct6y00Q8,8
25
+ freealg-0.3.3.dist-info/RECORD,,