Skip to main content
Results are the same bits in every browser; a decomposition takes steps from the budget in proportion to its work (about n³). Eigenvectors and right singular vectors have their largest entry positive, so they don’t flip between bars.

linalg

(rows: number, cols: number, values?: readonly number[] | readonly (readonly number[])[]): Mat
A matrix of zeros, or of values given row by row (flat, or as a list of rows). At most 512 rows or columns.
(n: number): Mat
(a: Mat, b: Mat): Mat
(a: Mat, x: readonly number[]): readonly number[]
A matrix times a vector.
(a: Mat): Mat
(a: Mat, b: Mat): Mat
(a: Mat, b: Mat): Mat
(a: Mat, k: number): Mat
(a: Mat, b: Mat): Mat
x with a·x = b, by LU with pivoting; na throughout when a is singular.
(a: Mat, b: readonly number[]): readonly number[]
(a: Mat): Mat
The inverse; na throughout when a is singular.
(a: Mat): Mat
The lower factor L of a = L·Lᵀ; na throughout when a is not positive definite.
(a: Mat): { readonly q: Mat; readonly r: Mat }
Reduced QR: q is rows × k and r is k × cols, k the smaller of the two, with a non-negative diagonal in r.
(a: Mat): { readonly values: readonly number[]; readonly vectors: Mat }
Symmetric matrices only: eigenvalues largest first, unit eigenvectors as the columns of vectors.
(a: Mat): { readonly u: Mat; readonly s: readonly number[]; readonly v: Mat }
Reduced SVD, a = u · diag(s) · vᵀ, singular values largest first.

Mat

A matrix: rows × columns of numbers.
number
number
(row: number, col: number): number
(row: number, col: number, value: number): void
(index: number): readonly number[]
(index: number): readonly number[]
(): number[][]

StateMat

A matrix kept across bars (state.mat).
(source: Mat): void
Copy every entry of a matrix of the same shape.
(value: number): void

Next step

Continue with Plots.
Last modified on October 25, 2026