Start with the mathematical operation. A dense Hermitian eigensolver, an exact polynomial calculation and a time integrator certify different things. For each entry below, the linked example includes data or a result against which to check your own installation.
Choose a solver
Section titled “Choose a solver”| Operation | Tool and check | Boundary of the test |
|---|---|---|
| Small Hermitian sector | NumPy eigh, check eigenpairs against the full input matrix | The routine uses one triangle and assumes Hermiticity |
| Fredholm gap probability | NumPy weighted quadrature matrix; SciPy special functions and independent ODE | Vary quadrature and tail cutoff independently |
| Singular Bethe vector | Exact leading polynomial coefficient, then a normalized finite-vector residual | Raw floating-point subtraction can lose the limiting vector |
| Finite open Toda with free end particles | Velocity Verlet, compared against QR evolution of open Toda | Preserved energy alone cannot verify phase accuracy |
Test the installation with a complex matrix
Section titled “Test the installation with a complex matrix”The following test uses the 1.23 interface, checked with NumPy 1.23.5. The columns returned by the routine are orthonormal eigenvectors. An overall complex phase is arbitrary. NumPy 1.23, Parameters, Returns and Notes
import numpy as npH = np.array([[1, 1j], [-1j, 1]])assert np.allclose(H, H.conj().T)E, V = np.linalg.eigh(H)assert np.allclose(E, [0, 2])assert np.linalg.norm(H @ V - V * E) < 1e-13assert np.linalg.norm(V.conj().T @ V - np.eye(2)) < 1e-13Change just the upper off-diagonal entry to . With default lower-triangle input the solver can still return the original two eigenvalues. The matrix is now non-Hermitian; a full-input residual and the first assertion expose the changed problem. Compare subspace projectors if an eigenvalue is repeated. Quadrature and ODE example (Python) · Open Toda experiment (ZIP) · Finite-chain acceptance criteria
The two triangle choices give a quantitative failure control. With lower-triangle input the effective Hermitian matrix has off-diagonal magnitude one and eigenvalues . Choosing the upper triangle makes that magnitude two and gives . For either returned unitary eigenbasis , the Frobenius norm of the residual against the actual nonsymmetric input is one: the input and its Hermitian completion differ in one entry of magnitude one. Set a tolerance on this full-matrix residual only after checking the data type and energy units.
On 22 November 2026 this example ran with Python 3.10.16 and NumPy 1.23.5. The original full-input Frobenius residual was zero and its eigenvectors’ orthogonality defect was . The pinned NumPy release lists Python 3.8–3.11 support and uses a BSD license. Its eigensolver calls a Hermitian or real-symmetric LAPACK driver. Record the Python and NumPy versions and the linked numerical libraries when comparing your run with the example. NumPy 1.23.5 release and distribution metadata · NumPy 1.23 solver notes
References
Section titled “References”- NumPy Developers (2022). numpy.linalg.eigh. NumPy 1.23 Manual, Linear algebra, Hermitian eigenproblems. Source
Connected readings
- Further reading