Skip to content

Commit 1a1e5fc

Browse files
committed
v0.2.11 New features and maintainance
* feature: New lecture: Wigner-Dyson Nearest neigbour spacing distribution. . * feature: Spectral unfolding functionaliy implemented and tested. * feature: Spectra with Uncertainty Quantification (UQ) for distributions. * Update lectures with UQ. * Removed eigenvalue pooling. * feature: for random module * feature: supporting arbitrary distance locations. * maintainance: renamed to and into module. * maintainance: README installation notes. * maintainance: Updates on lecture, and mentioning MMES algorithm.
1 parent 18495e3 commit 1a1e5fc

18 files changed

+603
-119
lines changed

NEWS

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
v0.2.11
2+
3+
* feature: New lecture: Wigner-Dyson Nearest neigbour spacing distribution. `wigner_spacing.ipynb`.
4+
* feature: Spectral unfolding functionaliy implemented and tested.
5+
* feature: Spectra with Uncertainty Quantification (UQ) for distributions.
6+
* Update lectures with UQ.
7+
* Removed eigenvalue pooling.
8+
* feature: `choice` for random module
9+
* feature: `pdf` supporting arbitrary distance locations.
10+
* maintainance: `get_density` renamed to `pdf` and into `stats` module.
11+
* maintainance: README installation notes.
12+
* maintainance: Updates on `wigner_cat.ipynb` lecture, `setup.py` and `README.md` mentioning MMES algorithm.
13+
14+
15+
v0.1.55
16+
17+
* Updates on text: README and package description.
18+
* Fix image showing Leymosun on README.
19+
* Lecture wigner_semicircle.ipynb exercise 2, providing hint on scale.
20+
21+
122
v0.1.54
223

324
* New functions for HE-RNG module: random, normal and unit tests for them.

README.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,18 @@
1111
A package for randomness based research.
1212

1313
> ![](https://raw.githubusercontent.com/msuzen/leymosun/refs/heads/main/assets/cat.png)
14-
> **Figure** Empirical spectral density for mixed ensemble at $\mu=0.8$, so called `Wigner's Cats`.
14+
> **Figure** Empirical spectral density for mixed ensemble at $\mu=0.8$, so called `Wigner's Cats` with error bars. (See the lecture.)
15+
16+
## Installation
17+
18+
It is recommended that latest stable package is released on the Python Package Index ([PyPI](https://pypi.org/project/leymosun/)). PyPI version should be installed via `pip`.
19+
20+
```bash
21+
pip install leymosun
22+
```
23+
24+
It is recommended that package shouldn't be installed via github version control, unless it is a
25+
specific release.
1526

1627
## Approach and features
1728

@@ -29,13 +40,19 @@ The core package is providing strong randomness improving the simulation quality
2940
* Uniform integer on the given range
3041
* Uniform float on the given range
3142
* Normal distribution (Gaussian)
43+
* Random sampling from a set, choice.
3244

3345
### Random Matrices
3446
* Generation of Gaussian ensembles (Orthogonal).
35-
* Generation of Mixed Gaussian ensembles (Orthogonal).
47+
* Generation of Mixed Gaussian ensembles (Orthogonal) via `Mixed Matrix Ensemble Sampling (MMES) algoritm`
3648
* Extract offdiagonal elements.
3749
* Spectra generation given ensemble.
38-
* Analytic distributions: Wigner semi-circle law.
50+
* Spectral unfolding.
51+
* Analytic distributions: Wigner semi-circle law, neares-neigbour spacing.
52+
53+
### Statistics
54+
* Centered PDF computation.
55+
* Bootstrapped uncertainty quantification given observation matrix.
3956

4057
### Data manager
4158
* Storage object utilities.
@@ -45,6 +62,7 @@ The core package is providing strong randomness improving the simulation quality
4562
Lectures notes that introduce randomization concepts with the usage of `Leymosun`.
4663

4764
* [wigner_semicircle.ipynb](https://github.com/msuzen/leymosun/blob/main/lectures/wigner_semicircle.ipynb): `Lecture on the Wigner's semicircle law`. The Wigner Semicircle law for the Gaussian Orthogonal Ensemble (GOE), comparison with the analytical case.
65+
* [wigner_dyson_spacing.ipynb](https://github.com/msuzen/leymosun/blob/main/lectures/wigner_dyson_spacing.ipynb): `Lecture on the Wigner-Dyson nearest-neighbour distribution`. The Wigner-Dyson spacing law for the Gaussian Orthogonal Ensemble (GOE), comparison with the analytical case.
4866
* [wigner_semicircle_mixed.ipynb](https://github.com/msuzen/leymosun/blob/main/lectures/wigner_semicircle_mixed.ipynb): `Lecture on the Wigner's cats`. Deviations from the Wigner Semicircle law for the mixed-Gaussian Orthogonal Ensemble (GOE). This would demonstrate, so-called "Wigner's Cats", i.e., the deviation makes the density looks like cat.
4967
* [he_rng_nist.ipynb](https://github.com/msuzen/leymosun/blob/main/lectures/he_rng_nist.ipynb): `Lecture on Understanding High-Entropy RNGs with NIST benchmark`. This lecture provides a way to test different RNGs or usage of RNGs via standard quality
5068
tests.
@@ -58,7 +76,7 @@ Papers, datasets and other material that used `leymosun`.
5876

5977
## Citation
6078

61-
We would be grateful for a citation of our paper(s) if you use `leymosun` or ideas from the package in your research. The following is the bibtex entry
79+
We would be grateful for a citation of our paper(s) if you use `leymosun` or ideas from the package in your research. Initial introduction of mixed matrix ensembles and MMES algorithm with M-shaped (Wigner's Cat) density [suzen21]. The following is the bibtex entry
6280

6381
```
6482
@article{suzen21,

assets/cat.png

-2.53 KB
Loading

assets/wigner-dyson-spacing.png

34.3 KB
Loading

assets/wigner-semi.png

33.5 KB
Loading

lectures/wigner_cats.ipynb

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"\n",
1313
"Prerequisite to this tutorial is finishing the `wigner_semicircle.ipynb` tutorial first for a background. \n",
1414
"\n",
15-
"In this lecture we will generate a mixed ensemble. A mixed ensemble implies different order matrices at a given `degree of mixture` (DoM). DoMs are a principled way to generate those different order matrices. "
15+
"In this lecture we will generate a mixed ensemble. A mixed ensemble implies different order matrices at a given `degree of mixture` (DoM). DoMs are a principled way to generate those different order matrices via `Mixed Matrix Ensemble Sampling (MMES) algoritm`. [suzen21]. "
1616
]
1717
},
1818
{
@@ -27,7 +27,7 @@
2727
"`goe` : Gaussian Orthogonal Matrix generator. \n",
2828
"`mixed_ensemble`: Ensemble generator, for mixed ensemble. \n",
2929
"`empirical_spectral_density`: Compute eigenvalues and their density $\\rho(\\lambda)$. \n",
30-
"`wigner`: Compute the Wigner density at a given $\\lambda$.\n",
30+
"`wigner`: Compute the Wigner density.\n",
3131
"\n",
3232
"See each method's documentation for more details. "
3333
]
@@ -41,9 +41,10 @@
4141
"source": [
4242
"import numpy as np\n",
4343
"import matplotlib.pyplot as plt\n",
44-
"from leymosun.gaussian import goe\n",
44+
"from leymosun.gaussian import goe, wigner\n",
4545
"from leymosun.matrix import mixed_ensemble \n",
46-
"from leymosun.spectral import empirical_spectral_density, wigner\n",
46+
"from leymosun.spectral import empirical_spectral_density\n",
47+
"from leymosun.stats import bootstrap_observed_matrix_ci\n",
4748
"import leymosun\n",
4849
"leymosun.__version__"
4950
]
@@ -57,7 +58,7 @@
5758
"\n",
5859
"A mixed matrix ensemble is formed by choosing different sized matrices. Recent work on this demonstrated [Suzen21] a principled way of generating a mixed ensemble. After setting a reference $N$ matrix order, generating mixed-sizes from a Binomial distribution with re-interpretation of the probability of success as the degree of mixture. This mixture defines which new matrix orders to generate and how many. \n",
5960
"\n",
60-
"The idea is to get a new matrix order $N_{i}$ at the reference matrix order $N_{ref}$ via binomimal distribution at the given probability-so called the Degree-of-Mixture (DoM) $\\mu$: $N_{i} \\sim Bin(N_{ref}, \\mu)$. Repeating this procedure with the ensemble size $M$ will generate the mixed ensembles matrix-orders we should generate. `mixed_ensemble` method from `leymosun` exactly do this. "
61+
"`Mixed Matrix Ensemble Sampling (MMES)`: The idea is to get a new matrix order $N_{i}$ at the reference matrix order $N_{ref}$ via binomimal distribution at the given probability-so called the Degree-of-Mixture (DoM) $\\mu$: $N_{i} \\sim Bin(N_{ref}, \\mu)$. Repeating this procedure with the ensemble size $M$ will generate the mixed ensembles matrix-orders we should generate. `mixed_ensemble` method from `leymosun` exactly do this. "
6162
]
6263
},
6364
{
@@ -103,11 +104,29 @@
103104
"metadata": {},
104105
"outputs": [],
105106
"source": [
106-
"_, empirical_density, elocations = empirical_spectral_density(\n",
107-
" ensemble_sample, mixed_order=matrix_order, scale=\"wigner\"\n",
107+
"eigenvalues, densities, locations = empirical_spectral_density(\n",
108+
" ensemble_sample, mmes_order=matrix_order, scale=\"wigner\"\n",
108109
")"
109110
]
110111
},
112+
{
113+
"cell_type": "markdown",
114+
"id": "57aeef26",
115+
"metadata": {},
116+
"source": [
117+
"We want to report 95% confidence intervals. "
118+
]
119+
},
120+
{
121+
"cell_type": "code",
122+
"execution_count": null,
123+
"id": "afd55df4",
124+
"metadata": {},
125+
"outputs": [],
126+
"source": [
127+
"observed_mean, observed_upper, observed_lower = bootstrap_observed_matrix_ci(densities)"
128+
]
129+
},
111130
{
112131
"cell_type": "markdown",
113132
"id": "09b7e3dd",
@@ -123,15 +142,15 @@
123142
"metadata": {},
124143
"outputs": [],
125144
"source": [
126-
"dwigner = wigner(elocations, domain_boundary=2.0)"
145+
"dwigner = wigner(locations, domain_boundary=2.0)"
127146
]
128147
},
129148
{
130149
"cell_type": "markdown",
131150
"id": "ce4b8bcf",
132151
"metadata": {},
133152
"source": [
134-
"Now plotting the densities, we observer the \"Cat\" at the degree of mixture $\\mu=0.8$."
153+
"Now plotting the densities, we observer the `Wigner's Cat` (`M-shaped`) desity at the degree of mixture $\\mu=0.8$."
135154
]
136155
},
137156
{
@@ -141,9 +160,10 @@
141160
"metadata": {},
142161
"outputs": [],
143162
"source": [
144-
"plt.bar(elocations, empirical_density, width=0.08, alpha=0.6, align='center')\n",
145-
"plt.plot(elocations, dwigner, color='red')\n",
146-
"plt.title(\"Wigner's Semicircle law with Leymosun \\n with Wigner's cat at $\\mu=0.8$ \")\n",
163+
"yerr = np.array([observed_mean-observed_lower, observed_upper-observed_mean])\n",
164+
"plt.bar(locations, observed_mean, width=0.02, alpha=0.3, align='center') \n",
165+
"plt.errorbar(locations, observed_mean, yerr=yerr, fmt=' ', capsize=5) \n",
166+
"plt.title(\"Wigner's Semicircle law with Leymosun \\n with Wigner's cat (M-shaped) density at $\\mu=0.8$ \")\n",
147167
"plt.xlabel(\"Eigenvalue Locations\")\n",
148168
"plt.ylabel(\"Density\")"
149169
]
@@ -168,7 +188,8 @@
168188
"## Reference\n",
169189
"\n",
170190
"[Suzen21] Empirical deviations of semicircle law in mixed-matrix ensembles, M. Suzen\n",
171-
"hal-03464130 (2021) [url](https://hal.science/hal-03464130)"
191+
"hal-03464130 (2021) [url](https://hal.science/hal-03464130) \n",
192+
"`Introduction of mixed matrix ensembles and MMES algorithm with M-shaped (Wigner's Cat) density.`"
172193
]
173194
}
174195
],

0 commit comments

Comments
 (0)