resona — matrix-free operator spectroscopy
Matrix-free operator spectroscopy, free resolvent calculus, and defect geometry.
resona.of(A)needs only the actionv ↦ Avand returns the spectral measure μ_A from O(k) matvecs per probe — no matrix is formed,eigis never called. Why a Fourier analogy holds, precisely: the Fourier transform turns convolution of independent variables into addition of cumulants; for free operators (Voiculescu) the R- and S-transforms do the same —R_{A⊞B} = R_A + R_B,S_{A⊠B} = S_A·S_B, solved via Biane–Pastur subordination — so A+B and A·B are read without forming them (freeness is the hypothesis, andfree.freeness_defectmeasures it).
In plain words: you have a thing that transforms vectors — a matrix too
big to write down, a graph, a physics simulation, a neural network's Hessian, a
quantum Hamiltonian. resona listens to it, tells you everything about its
spectrum, lets you add and multiply such things without ever building them,
apply functions of them to vectors, measure how hard your problem truly is —
and even design new operators to order.
pip install resona # numpy + scipy only
60 seconds
import numpy as np, resona
A = np.random.default_rng(0).standard_normal((3000, 3000)); A = A @ A.T / 3000
matvec = lambda v: A @ v # ← all resona ever needs: v ↦ Av
s = resona.of(matvec, 3000) # PROBE — "ring" the operator, hear its spectrum
s.extreme() # smallest & largest eigenvalue
s.trace(np.log) # log-determinant — no Cholesky, no eig
s.density(np.linspace(0, 4, 200)) # the spectrum's shape
s.effective_rank() # the cost dial: is this problem cheap or hard?
t = resona.of(lambda v: A @ (A @ v), 3000)
(s + t).extreme() # spectrum of A + A², A + A² never formed
b = np.random.standard_normal(3000)
mv1 = lambda v: A @ v + v # A + I (well-conditioned)
x = resona.apply(mv1, lambda lam: 1/lam, b) # solve (A+I)x = b, matrix-free
Every line above is matrix-free: the cost is the matvec, not O(N³).
Choose your door
🚶 New to operators / numerics? Take the tour — ten stops from "what is a matvec" to designing your own operators, every stop in plain words first, the math second.
🎓 Mathematician? The library is a dictionary of theorems made executable —
each entry verified in tests/ and examples/ against dense ground truth:
| you call | which is | verified |
|---|---|---|
resona.of(mv, N) |
stochastic Lanczos quadrature = Gauss quadrature of the spectral measure | moments vs dense, 35-operator suite |
s + t, s @ t |
exact closure (A+B)x = Ax+Bx; at the measure level: free convolution ⊞/⊠ (Voiculescu) |
extreme eig of A+B to 1e-9 |
s.boxplus(t) |
κₙ(A⊞B) = κₙ(A)+κₙ(B) (Speicher, non-crossing partitions); as_spectral=True → Golub–Welsch |
semicircle ⊞ semicircle exact |
s.r(w) / s.s(w) |
R-transform (linearizes ⊞ — "its Cole–Hopf", our framing, see NOVELTY) / S-transform (⊠) | additivity to 0.5% |
s.flow(t, xs) |
free heat flow = inviscid complex Burgers; shock_time = band merger |
t_c ≈ 1 for atoms ±1 |
subordination.pastur_grid |
the Pastur subordination fixed point g = G_A(z−σ²g) |
m₂ vs Monte-Carlo |
s.extreme() |
BBP transition & Tracy–Widom fluctuations live here | λ=θ+1/θ above θ_c; measured exp −0.65 (theory −⅔) |
defect.pseudospectrum_radius |
the ε^{1/q} bloom of an order-q Jordan defect; GMRES follows Λ_ε | exact on J_q, q=2…5 |
solve.catastrophe_solve |
Arnold A_{q−1} stratum ⇒ float64 keeps 16/q digits; budget dps = q·target | 4.9 → 17.0 digits |
cost.level_spacing_ratio |
⟨r⟩: Poisson 0.386 (integrable) vs GOE 0.531 (chaotic) | 0.392 / 0.532 on XXZ±NNN |
lift.conserved_charge |
commutator-Gram eigenproblem: near-kernel = integrals of motion | finds H, ΣZ, bilinears blind |
lift.carleman_* |
Carleman linearization; over GF(p), x^p≡x makes ANY logic exactly linear | 0 errors on all pⁿ inputs |
from_measure / from_eigenbasis |
the inverse spectral problem (Stieltjes / Jacobi); synthesis of operators to order | eig = order to 5.6e-15 |
s.effective_rank() |
Φ₁ participation ratio; the Extraction-Law cost dial | dequantization boundary (Tang) |
free.rie_clean |
free DEconvolution: Ledoit–Péché / Bun–Bouchaud–Potters RIE | 95% of the oracle at q=1/2 |
s.trace(f, with_err=True) |
the stochastic estimate with its own standard error (probe scatter) | bars bracket truth, free |
quadform(..., certified=True) |
Gauss–Radau brackets (Golub–Meurant): the answer PROVABLY inside | GP variance certified, width 4e-4 at k=24 |
s.zoom(a, b) |
Chebyshev spectrum slicing: interior eigenvalues at full k-resolution | interior to 4e-16 of span |
of(deflate=K) |
Hutch++ at the measure level: exact top-K atoms + complement probes | variance −63× (Tr A²), −724× (Tr eᴬ) |
of(engine="kpm") |
Chebyshev/Jackson harvest, no reorthogonalization | 2.7× at k=256, same object out |
cloud(mv, N) |
non-Hermitian Arnoldi cloud; abscissa = NUMERICAL abscissa (transient growth) | Markov gap to 1e-3; ω−α gap measured |
lift.koopman(X) |
data → the DMD/Koopman propagator's action (one thin SVD) | rotation eigenvalues to 1e-6 |
thermal.correlator |
typicality: ⟨O(t)O⟩_β — one Lanczos basis per vector for the whole t-grid (4.0, if the a-posteriori Krylov error < 1e-12; else stepping) | vs dense to 0.014 (200 probes); L=8, t≤5: 10.9 → 0.16 s |
defect.generator_read |
the solver's defect IS the Koopman generator (BE: (t²/4n)·A²e^{−tA}u₀) | O(n⁻²) exact, incl. defective Grcar κ=∞ |
defect.defect_barycentres |
per-band barycentre of the defect power (BDS) — blind-zone-free | 35/35 PDEs; stable at 5% noise where the ratio dies at 1e-5 |
wkernel.track |
the spectral-flow line integral, crossing-safe by eigenvector continuation | 8.9e-15 vs 3.3 (sorted) at a crossing |
wkernel.kappa_w(modes=k) / track(modes=k) |
matrix-free SELECTED-mode flow (eigsh bottom/top-k) — closes the last O(N³) |
820× / 690× vs dense at N=4000; gapped rel.err 1.8e-5 |
subordination.contraction |
|T′| of the Pastur fixed point — the edge-of-chaos read | →0.9998 at the band edge, iters 90→12k |
defect.normality |
global departure-from-normality ‖[A,A*]‖²_F (Rademacher–Hutchinson) | 0 for normal; 1.25e8 triangular, 0.3% off dense |
defect.hard_points |
matrix-free avoided-crossing / EP locator (Φ_η peak = gap min), no eig | argmax Φ_η = argmin gap, Hutchinson+CG |
cost.rmt_class |
the Dyson universality class from R4 rigidity (companion to ⟨r⟩) | Poisson +0.21 > GOE +0.03 > GUE −0.06, ordered |
beta.beta_from(robust=True) |
the whole band from two trace numbers (μ₁, μ₂ + edges) | < 2% of span; N=10⁷ in ~90 s |
brown.brown_measure |
the BROWN MEASURE: stable eigenvalue density in the plane via hermitization | circular law 0.322 vs 1/π=0.318, mass 1.01 |
brown.brown_boxplus |
the Brown measure of a *-free sum A+B (non-Hermitian ⊞) in the plane | Belinschi–Bercovici subordination, no matrix |
cloud_flow.cloud_wkernel / exceptional_point |
non-Hermitian (biorthogonal) ∂λ=(uBv)/(uv) + EP locator | EP to 2e-6; blow-up matches 1/(2√k) to <1e-4 |
4.0 Cloud.certify(tol) |
free Arnoldi residual ‖(A−θ)u‖ = |h_{m+1,m}|·|e_mᵀy| — proves ε-pseudospectral membership | identity to 2e-15; Grcar+5: 96→44 nodes, all 5 modes |
4.0 flow.shock_time(caustic=True) |
Biane's gap-closing time t_c = 1/Σwᵢ/(u*−λᵢ)², u*: Σwᵢ/(u−λᵢ)³=0 | unequal weights: exact closed form to the last digit |
4.0 lift.shadow_rom |
Fourier modulus–phase lift: translation becomes linear (beats the Kolmogorov n-width) | soliton rank 2: 5e-15 vs POD 87% |
4.0 lift.koopman(affine=True) |
DMD on increments: the offset w* cancels; predict(∞) = fixed point | GD fixed point 1e-5; plain DMD's spurious |λ|>1 gone |
4.0 cost.weyl_exponent |
4-point quantile cross-ratio → 2+2cosh(α ln k), PGL(2)-invariant | α through a shifted resolvent to 1e-15 |
4.0 cost.mp_rank |
sketch rank + participation ratio from U-statistics (no Marchenko–Pastur bias) | 1.5% at p=128 vs naive 56% |
4.0 free.order_matrix |
K_ab — the Magnus/BCH commutator coefficient of a word; Mann–Whitney null | Thue–Morse K≡0: Trotter error 3000× below ABAB |
4.0 free.rie_clean(loo=True) |
leave-one-out, scale-covariant RIE: spikes are not self-shrunk | top spike 4.5% vs 69% off |
4.0 defect.defect_phase |
λ = √((4n/t²)·D̂ₙ/P̂₂ₙ): damping AND signed dispersion from solver error | advection–diffusion modes to 4e-6 (Richardson) |
4.0 wkernel.hessian |
Rayleigh–Schrödinger ∂²λ/∂k∂k from the eigenbasis, zero extra eigensolves | ±1/Δ at an avoided crossing (W=0) |
4.0 from_measure(ref_measure=) |
Weyl-shifted tail completion of a truncated Jacobi measure | inverse Sturm–Liouville from 12/40 modes: 17× vs naive |
4.0 local_density(V, typical=True) |
block LDOS; geometric mean = Anderson's typical DOS | ρ_typ/ρ_mean 0.88 → 0.02 across W_c |
🔧 Have a task right now? The cookbook: find your task in the "I want to…" table, copy the recipe.
What it solves (matrix-free, one primitive)
Verified against dense ground truth in examples/ — 65 gallery
scripts, every metric printed by the script itself:
| task | what | metric |
|---|---|---|
| GP log-determinant | log|K| for hyperparameter learning at scale |
0.84% rel.err, no Cholesky |
| Loss-Hessian spectrum | sharpness & curvature from HVPs, no Hessian formed | λ_max 0.00%, Tr 0.30% |
| Loss-landscape curvature | effective curvature dimension + flat/sharp split from HVPs | eff-rank 15.8 vs 15.1, λ_max exact, 587/12 flat/sharp |
| Effective degrees of freedom | model complexity Tr K(K+λI)⁻¹ matrix-free, sweep λ |
DoF rel.err 0.9–1.6%, N=50k kernel |
| Eigenvalues in the plane | Brown measure of a non-normal A (the stable 2-D law) | circular law density ≈ 1/π, mass 1.01 |
| Exceptional points | where two eigenvalues coalesce, biorthogonal ∂λ→∞ | EP located to 2e-6, blow-up = 1/(2√k) |
| Spectrum of A+B | composed, matrix-free (Horn's problem in practice) | extreme eig to 1e-9 |
| Deep-net trainability | cond(W_L…W_1) predicted from init, no fwd/bwd |
Gaussian explodes, orthogonal ≈1 |
| Effective rank Φ₁ | the cost dial: structured/cheap vs full/frontier | 14 vs 466 |
| Nonlinear PDE (Burgers) | lift to linear (Cole–Hopf) → exp(tK)·v |
residual 5e-9, matrix-free |
| 35 operators → spectra | matrix-free Ritz seed → Rayleigh polish | seed 1e-4 → 1e-16, 100% machine-zero |
| Operator synthesis | order a spectrum → get a working local matvec | eig = order to 5.6e-15 |
| GMRES stall prediction | same spectrum, opposite fates — the pseudospectrum knows | 14 iters vs stall, read from σ_min |
| Is it integrable? | ⟨r⟩ + blind conserved-charge search | 0.392/0.532; 4 charges vs 1 |
| Signal in noise (BBP) | does a spike detach from the bulk? | λ=θ+1/θ above θ_c=1 |
| Anderson localization | metal→insulator from disorder, matrix-free | Λ: 0.97→0.15 in 3.4s |
| Tracy–Widom edge | the universal fluctuation law of extreme() |
std·N^⅔→1.27, measured exp −0.65 (theory −⅔) |
| JWST image analysis | structure map, source detection, denoising — straight from PyPI | corr 0.97 vs dense; front found |
| Covariance cleaning (RIE) | free deconvolution of Marchenko–Pastur noise | 1.84× closer to truth, 96% of oracle |
| The zeta-zero operator | Hilbert–Pólya computationally: built, verified, interrogated | eig = zeros to 2.8e-13; β-rigidity > GUE |
More broadly: density of states, Tr f(A) (log-det, Tr A⁻¹, partition
functions, Schatten norms), extreme eigenvalues & gaps, disorder-averaged
spectra, phase transitions, spectral clustering, operator design — anything that
is a spectral functional of an operator you can only matvec.
The shape of the library
Three verbs on one object, everything else reads off the same hub:
PROBE READ COMPOSE
s = resona.of(matvec, N) → s.trace(f) s.density(xs) s + t s @ t
s.extreme() s.moment(p) s.boxplus(t)
│
the lifted coordinates: │ the dials:
s.cauchy(z) s.r(w) s.s(w) │ s.effective_rank() (Φ₁)
s.cumulants() │ s.condition()
│
the flow: s.flow(t, xs) s.shock_time() the closure: s.levels(N)
flow.shock_time(s, caustic=True) exact band-merger time (4.0)
APPLY resona.apply(matvec, f, v) → f(A)·v (solve / evolve / filter)
INVERSE resona.from_measure / from_eigenbasis (measure → operator: SYNTHESIS)
PRECISION resona.solve.rayleigh_polish / catastrophe_solve (digits, only where needed)
LINEARIZE lift.koopman(X, affine=True) → predict(np.inf) lift.shadow_rom(U, rank) (4.0)
MOVE wkernel.hessian(λ, V, Bs) ∂²λ from the eigenbasis you have (4.0)
TRUST defect.hard_points(..., E=None | "auto") the transition, energy not given (4.0)
NON-HERMITIAN corner (same five verbs, the plane instead of the line):
brown.brown_measure / brown_boxplus eigenvalue DENSITY in C, *-free sum
cloud_flow ∂λ=(u*Bv)/(u*v) / exceptional_point biorthogonal MOVE + EP
defect.normality ‖[A,A*]‖²_F is the spectrum the whole story?
cloud(...).certify(tol) drop Ritz ghosts, zero matvecs (proves Λ_ε, 4.0)
When the matvec also maps blocks (A @ X), probing rides one BLAS-3
block-Lanczos automatically (N ≥ 120) — 1.4–2.9× faster at N = 120…1000,
3–8× at N = 2000, agreeing to ~1e-14 (verified, then enabled; never assumed).
The deeper machinery is in plain modules — wkernel (spectral Jacobian
∂λ/∂k + design + matrix-free modes=k selected flow), lift (R/S transforms,
Carleman, conserved charges), free (cumulants, freeness), subordination
(Pastur), flow (Burgers), beta (max-entropy closure, beta_from), defect
(Richardson + pseudospectra + normality + hard_points), cost (Extraction
Law, ⟨r⟩, rmt_class), solve (precision on the defect) — each documented in
its docstring, each verified in tests/.
Both corners are closed. All five verbs — read / move / trust / compose /
synthesize — now run matrix-free for non-Hermitian operators too: brown
(the Brown measure — eigenvalue density in the plane, brown_boxplus for the
*-free sum) and cloud_flow (the biorthogonal ∂λ and the exceptional-point
locator) complete the self-adjoint line into the non-normal plane. With
wkernel.kappa_w(modes=k) the last O(N³) on the Hermitian side is gone:
selected-mode spectral flow is eigsh-cheap (820× over dense at N=4000).
Honesty
The underlying algorithms (SLQ, Lanczos, free probability, Carleman,
Golub–Welsch) are classical and credited in NOVELTY.md.
resona's contribution is the single primitive + matrix-free composition
algebra + the built-in cost law as one object — organized around the free
R/S-transforms the way Fourier analysis organizes signal processing. The unifying claims (the Extraction Law, Φ₁-as-boundary) are
research hypotheses, labelled as such; the computations are verified. Every
estimate states its honest limit in its docstring: condition() is a lower
bound, boxplus needs freeness, from_measure is ill-conditioned for atomic
measures, catastrophe_solve cannot recover information float64 already
destroyed. Stochastic reads give ~2–4 digits; machine precision is bought,
where it matters, with rayleigh_polish — paying only on the defect's support.
Theory
The unified picture — the response measure as a conjugate pair, free
probability (closure, the freeness boundary, the semicircle attractor), the
defect = shock = edge identity, and the Extraction Law — is in
THEORY.md, with reproducible scripts in theory/.
The claims are calibrated in NOVELTY.md; open conjectures and
the research log including the failures are in FRONTIER.md.
The cost of every method is in COMPLEXITY.md.
License
MIT © 2026 Dmitry Sierikov. Attribution requested for the research
contributions in NOVELTY.md.
Metadata
Release files for resona 4.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| resona-4.0.1.tar.gz | 157.6 kB | Without provenance | Details for resona-4.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| resona-4.0.1-py3-none-any.whl | Python 3 | none | any | Details for resona-4.0.1-py3-none-any.whl |
Total release size: 267.6 kB
Release files / resona-4.0.1.tar.gz
| Download URL | resona-4.0.1.tar.gz |
|---|---|
| Size | 157.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da3fb59473257f2dcb134ac46db4b2f81c3e0940b640f429cdcfe9b246901a36
|
|
BLAKE2b-256 checksum How to use checksums |
3193b9bdcff06f8b6a6f3fadadb256c5d7db72d7f3753052122c463cf5f1f6e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Release files / resona-4.0.1-py3-none-any.whl
| Download URL | resona-4.0.1-py3-none-any.whl |
|---|---|
| Size | 110.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b35c6877e2791545e1ae513d7ee2c652f5839efd97e4ddcd680d554a9c051e8
|
|
BLAKE2b-256 checksum How to use checksums |
dd3446f80c0277edbde891b5130de565b56bb14152443040560dc6840148b560
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Security for resona 4.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.