/** * Iterative symmetric eigensolver — Lanczos tridiagonalization + Rayleigh-Ritz. * * For large symmetric problems where the dense `eigs` (full O(n^3) * eigendecomposition of the whole matrix) is prohibitive, `eigsh` extracts * just the `k` largest or smallest eigenpairs. It builds an orthonormal * Krylov basis `V` via the Lanczos iteration (with full reorthogonalization * against every prior Lanczos vector, for numerical stability at the small * sizes this is exercised at), forming the small tridiagonal projection * `T = Vᵀ A V`. `T`'s eigenproblem is solved directly (cyclic Jacobi * rotations — `T` is dense-symmetric-small by construction) and lifted back * through `V` (Rayleigh-Ritz) to approximate `A`'s eigenpairs. Accepts either * a dense matrix or a matvec callback (a linear operator, matching the * `krylov.ts` convention) — the matvec form never forms `A` and requires * `opts.n` since the dimension can't otherwise be inferred. * * @packageDocumentation */ /** A symmetric linear operator: either a dense matrix or a matvec callback `x -> A x`. */ export type EigshOperatorInput = number[][] | ((x: number[]) => number[]); /** Options accepted by {@link eigsh}. */ export interface EigshOptions { /** Which end of the spectrum to return: `'LM'` (largest, default) or `'SM'` (smallest). */ which?: 'LM' | 'SM'; /** Dimension of `A` — required when `A` is a matvec callback. */ n?: number; /** Convergence tolerance for diagonalizing the small tridiagonal projection (default 1e-10). */ tol?: number; /** Maximum Lanczos steps (default `min(max(2k + 20, 20), n)`). */ maxIter?: number; } /** * Result of {@link eigsh}. * * `eigenvectors` is an `n x k` matrix with eigenvectors stored as **columns**: * `eigenvectors[i][j]` is the `i`-th component of the `j`-th eigenvector, * which corresponds to `eigenvalues[j]`. */ export interface EigshResult { /** The `k` selected eigenvalues, ordered by `which` (largest-first for `'LM'`, smallest-first for `'SM'`). */ eigenvalues: number[]; /** The `k` corresponding eigenvectors, as columns of an `n x k` matrix. */ eigenvectors: number[][]; } /** * `eigsh` — the `k` largest or smallest eigenpairs of a **symmetric** matrix * via the Lanczos iteration, for problems too large for the dense `eigs`. * * `A` may be a dense `number[][]` or a matvec callback `x => A x` (in which * case `opts.n` is required — the dimension can't be inferred from a * function). Eigenvectors are returned as **columns** of an `n x k` matrix: * `result.eigenvectors[i][j]` is the `i`-th component of the eigenvector for * `result.eigenvalues[j]`. * * @example * eigsh([[2, 1, 0], [1, 2, 1], [0, 1, 2]], 1, { which: 'LM' }) * // => { eigenvalues: [2 + Math.SQRT2], eigenvectors: [[...]] } */ export declare function eigsh(a: EigshOperatorInput, k?: number, opts?: EigshOptions): EigshResult; //# sourceMappingURL=eigsh.d.ts.map