Skip to main content

Module random_matrix

Module random_matrix 

Source
Expand description

Random matrix theory: GOE, GUE, Wishart matrices, eigenvalue computation, and spectral distribution analysis (Wigner semicircle, Marchenko-Pastur).

Structs§

EigenvalueRenderer
Render eigenvalue distribution as a glyph histogram.
RandomMatrix
A dense matrix stored in row-major order.

Functions§

eigenvalues
Compute eigenvalues of a real symmetric matrix using the QR algorithm with Wilkinson shifts.
eigenvalues_jacobi
Compute eigenvalues using a simpler Jacobi rotation method for small symmetric matrices. More robust than QR for our purposes.
goe
Gaussian Orthogonal Ensemble: symmetric matrix with N(0,1) off-diagonal and N(0,2) diagonal entries, divided by sqrt(2n).
gue
Gaussian Unitary Ensemble (real approximation): symmetric matrix similar to GOE but with different normalization. For a real approximation, we use the same structure as GOE with scale 1/sqrt(n).
level_spacing_ratios
Level spacing ratio: r_i = min(s_i, s_{i+1}) / max(s_i, s_{i+1}) where s_i = lambda_{i+1} - lambda_i.
marchenko_pastur
Marchenko-Pastur distribution: eigenvalues of large Wishart matrices. For ratio gamma = p/n, support is [(1-sqrt(gamma))^2, (1+sqrt(gamma))^2].
marchenko_pastur_density
Marchenko-Pastur theoretical density.
random_correlation
Generate a random correlation matrix of size n.
semicircle_density
Wigner semicircle theoretical density at x with radius R.
wigner_semicircle
Wigner semicircle law: eigenvalues of GOE(n) should follow rho(x) = (2/(pi*R^2)) * sqrt(R^2 - x^2) for |x| <= R, where R = 2.
wishart
Wishart matrix: W = X^T * X / n where X is a p x n matrix with iid N(0,1).