@teakit/matrix
A TypeScript port of ml-matrix (v6.12.2): a
comprehensive, class-based matrix manipulation and computation library with
feature parity (element-wise ops, linear algebra, decompositions, views,
wrappers, statistics, special matrices). Zero runtime dependencies.
Canonical import (default also works):
API names and semantics match ml-matrix. It is class-based and
mutation-first: instance methods mutate this and return it (chainable);
static methods (e.g. Matrix.add(a, b)) return a new matrix. Views and wrappers
are zero-copy subclasses of AbstractMatrix (writing through them mutates the
underlying data). new Matrix(...) takes a 2D array, a (rows, columns) pair,
or another matrix — not a 1D array (use rowVector / columnVector /
from1DArray). Errors are native Error / TypeError / RangeError (no stable
codes).
For behavior details, open the matching reference page under
teakit-matrix/references/.
Table of Contents
- Core concept — shape, construction, get/set, mutation model, conversion.
- Operations — element-wise
arithmetic, bitwise,
Math.*. - Linear algebra — multiply, transpose, determinant, inverse, solve, pseudo-inverse.
- Decompositions — SVD, EVD, LU, QR, Cholesky, NIPALS.
- Views & wrappers — zero-copy views and array wrappers.
- Statistics — sum/mean/variance, min/max, center/scale, covariance/correlation.
- Special matrices —
SymmetricMatrix,DistanceMatrix. - Errors — what throws and when.