Kernel Polynomial Method
Module: sci_form::kpm (core since 2026-11-07; F91 validated; sci_form::beta::kpm is an alias) Feature flag: none — promoted to core on 2026-11-07. beta-kpm and experimental-kpm are retained as compatibility aliases, and sci_form::beta::kpm re-exports sci_form::kpm.
Validation and limits
| Question | Answer |
|---|---|
| Compared with | NumPy eigh on GOE and gapped spectra |
| Measured separation | moments 3.5e-15; DOS L2 1.7e-14; Mulliken 3.8e-5 gapped, 2.6e-2 finite-T |
| Confidence region | gapped spectra, order 100–500, sparse matrices up to 5000 sites |
| Main limitation | T=0 gapless spectra show Gibbs ringing; stochastic trace noise |
The raw rows and the exact tolerances are in the full validation matrix.
Overview
Computes the density of states (DOS), density matrix, and Mulliken populations via Chebyshev polynomial expansion of the Hamiltonian, avoiding diagonalization entirely. Achieves
Theory
Chebyshev Expansion
Any function of a Hermitian matrix can be expanded in Chebyshev polynomials:
where
Recursion
The Chebyshev polynomials are computed iteratively:
Each step costs
Jackson Kernel
Gibbs oscillations are suppressed by the Jackson damping kernel:
Stochastic Trace
The trace is estimated stochastically:
using
API
use sci_form::kpm::*;
// Spectral bounds
let (e_min, e_max) = estimate_spectral_bounds(&hamiltonian);
// Rescale matrix to [-1, 1]
let h_scaled = rescale_matrix(&hamiltonian, e_min, e_max);
// Chebyshev expansion (exact trace for small systems)
let expansion = ChebyshevExpansion::from_matrix_exact(&h_scaled, 100);
// Jackson kernel damping
let kernel = jackson_kernel(100);
// DOS at a specific energy
let dos = expansion.dos_at_energy(0.0, &kernel);
// Full KPM DOS computation
let config = KpmConfig { order: 100, n_random: 20, ..Default::default() };
let dos_result = compute_kpm_dos(&hamiltonian, &config);
// dos_result.energies, dos_result.dos, dos_result.homo_lumo_gap
// KPM Mulliken charges
let mulliken = compute_kpm_mulliken(&hamiltonian, &overlap, n_electrons, &config);
// mulliken.charges, mulliken.total_electronsConfiguration
| Parameter | Default | Description |
|---|---|---|
order | 100 | Number of Chebyshev moments |
n_random | 20 | Random vectors for stochastic trace |
temperature | 300.0 | Electronic temperature (K) for Fermi smearing |
Scaling
| System Size | Exact Diag. | KPM |
|---|---|---|
| Infeasible |
Validation (F91, 2026-10-14)
External gate tests/beta_kpm_validation.rs vs scripts/validation/oracle_kpm.py (numpy eigh, GOE + gapped spectra): exact moments 3.5e-15, Jackson DOS L2 1.7e-14 (σ=πa/M with Gershgorin a; Gaussian shape 0.054 irreducible), Mulliken gapped 3.8e-5 / finite-T 2.6e-2. Fixes: spurious 2× on k≥1 FD terms, missing spin-2 in Mulliken. Gap: T=0 on gapless spectra (Gibbs); pybinding uninstallable.
Tests
cargo test --test experimental_gates -- test_kpm9 integration tests (tests/experimental/test_kpm.rs) covering: spectral bounds estimation, Chebyshev recursion stability, Jackson kernel positivity, DOS peak detection, band gap identification, and Mulliken charge conservation.
These tests live in the experimental_gates target — see Overview for the full command matrix.