/** * Structured and indefinite direct linear solvers. * * These exploit matrix structure (tridiagonal, banded, Toeplitz, symmetric * indefinite) to solve `Ax = b` in less than the O(n^3) a general dense LU * (`lusolve`) would cost, or — for `ldl` — to factor matrices `cholesky` * cannot handle because they are not positive-definite (e.g. KKT systems): * * - `thomasSolve` — the Thomas algorithm, O(n) for tridiagonal systems. * - `solveBanded` — banded-aware Gaussian elimination (no pivoting; touches * only the O(n(l+u)) entries inside the band), for systems with `l` lower * and `u` upper nonzero diagonals. * - `toeplitzSolve` — the Levinson–Durbin recursion, O(n^2) for a Toeplitz * system given only its first row and column. * - `ldl` — Bunch–Kaufman-pivoted LDLᵀ factorization of a symmetric * (possibly indefinite) matrix, with 1x1/2x2 diagonal blocks. * * @packageDocumentation */ /** * Thomas algorithm — O(n) solve of a tridiagonal system `Ax = d`. * * `A` is the tridiagonal matrix with subdiagonal `sub` (length n−1), * diagonal `diag` (length n), and superdiagonal `sup` (length n−1). No * pivoting is performed (as with any tridiagonal Thomas solve); the matrix * should be diagonally dominant or otherwise stable without it. * * @example * thomasSolve([-1, -1], [2, 2, 2], [-1, -1], [1, 0, 1]) // => [1, 1, 1] */ export declare function thomasSolve(sub: number[], diag: number[], sup: number[], d: number[]): number[]; /** * Banded-aware Gaussian elimination — solve `Ax = b` for a matrix with `l` * nonzero lower diagonals and `u` nonzero upper diagonals (all other entries * are assumed zero, though `A` is passed as a full dense matrix). Only the * O(n(l+u)) entries inside the band are touched during elimination and * back-substitution. No pivoting is performed — as with {@link thomasSolve}, * the matrix should be diagonally dominant or otherwise stable without it. * * @example * solveBanded(1, 1, [[2, -1, 0], [-1, 2, -1], [0, -1, 2]], [1, 0, 1]) // => [1, 1, 1] */ export declare function solveBanded(l: number, u: number, A: number[][], b: number[]): number[]; /** * Levinson–Durbin recursion — O(n²) solve of a Toeplitz system `Tx = b` * given only the first column `c` and first row `r` (`c[0]` must equal * `r[0]`, the shared diagonal value). `T[i][j] = c[i-j]` for `i >= j`, else * `r[j-i]`. * * Order-recursively builds the solution together with two auxiliary * "predictor" vectors — one for `T`, one for `Tᵀ` (mutually coupled via the * persymmetry `J T J = Tᵀ` that every Toeplitz matrix has, `J` the * reversal/exchange matrix) — which is what makes a general (non-symmetric) * Toeplitz system solvable in O(n²) rather than O(n³). * * @example * toeplitzSolve([2, 1], [2, 1], [1, 2]) // => [0, 1] */ export declare function toeplitzSolve(c: number[], r: number[], b: number[]): number[]; /** Result of {@link ldl}. */ export interface LDLResult { /** Unit lower-triangular factor. */ L: number[][]; /** Block-diagonal factor (1x1 or 2x2 blocks along the diagonal). */ D: number[][]; /** * Permutation such that `(P A Pᵀ)[i][j] = A[perm[i]][perm[j]]` and * `L D Lᵀ = P A Pᵀ`. */ perm: number[]; } /** * Bunch–Kaufman-pivoted LDLᵀ factorization of a symmetric (possibly * indefinite) matrix `A`, useful for symmetric systems `cholesky` can't * handle because they aren't positive-definite (e.g. KKT / saddle-point * systems from constrained optimization). * * Reconstruction identity: `L D Lᵀ = P A Pᵀ`, where `P` is the permutation * matrix with `P[i][perm[i]] = 1`, i.e. `(P A Pᵀ)[i][j] = A[perm[i]][perm[j]]`. * `L` is unit lower-triangular; `D` is block-diagonal with 1x1 or 2x2 blocks * (2x2 blocks appear where a pivot would otherwise be too small relative to * the rest of its column, per the standard Bunch–Kaufman pivot selection). * * @example * const { L, D, perm } = ldl([[1, 2, 3], [2, 1, 4], [3, 4, 1]]); * // L D L^T reconstructs A with rows/cols permuted by perm. */ export declare function ldl(A: number[][]): LDLResult; //# sourceMappingURL=structured-solvers.d.ts.map