npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tangent.to/lina

v0.1.2

Published

Linear algebra for JavaScript (ESM): LU, QR, Cholesky, SVD, symmetric eigen, least squares. scipy.linalg-validated.

Readme

tangent/lina

Linear algebra for JavaScript (ESM). Browser-first, zero dependencies, runs in Node.js and Deno. The linear algebra leaf of the tangent suite — MIT-licensed infrastructure consumed by tangent/ds and tangent/sem.

Matrices are plain nested row-major arrays (number[][]) at the API boundary; computation runs on flat Float64Array storage internally.

What's in it

  • Factorizations: lu (partial pivoting), qr (Householder, reduced/full), cholesky, svd (one-sided Jacobi — high relative accuracy), eigSym (cyclic Jacobi, symmetric matrices)
  • Solvers: solve (vector or multi-RHS), choleskySolve, lstsq (QR-based), pinvSolve (minimum-norm, any rank)
  • SVD-derived: pinv, rank, cond
  • Utilities: matmul, transpose, identity, diag, norm (fro/1/inf), trace, det, inv, isPositiveDefinite

Install

npm install @tangent.to/lina     # npm
deno add jsr:@tangent/lina       # Deno / JSR

Usage

import { cholesky, eigSym, lstsq, solve, svd } from '@tangent.to/lina';

solve([[2, 1], [1, 3]], [3, 5]);            // [0.8, 1.4]

const { values, vectors } = eigSym(covarianceMatrix);  // PCA in two lines
const { U, s, V } = svd(dataMatrix);

const { x } = lstsq(designMatrix, y);        // OLS coefficients
const L = cholesky(spdMatrix);               // throws if not positive definite

Validation against numpy/scipy

tests_compare-to-scipy/ checks every operation against numpy.linalg/scipy.linalg on seeded random matrices — solve/det/inv, Cholesky (entrywise vs numpy), QR and SVD invariants, singular values and symmetric eigenvalues vs numpy, lstsq, pinv (including rank-deficient), rank and cond. Agreement is at machine precision (~1e-15). Requires uv and Node:

npm run test:scipy

Scope

Dense, double-precision, textbook-modern algorithms sized for the suite's workloads (covariance algebra, regression, ordination — n up to a few hundred). Deliberately out of scope: sparse matrices, complex numbers, general nonsymmetric eigenproblems (until a consumer needs them), and BLAS-style micro-optimization — wasm kernels belong in tangent/nd when it lands.

Performance

lina favors simple, unconditionally-stable algorithms (one-sided Jacobi SVD, cyclic Jacobi eigensolver) that hit machine precision on the suite's target sizes. On solve/inv it is competitive with the mature ml-matrix; on matmul and svd it is roughly 1.5–2× slower, and on symmetric eigendecomposition about 5× slower, because those Jacobi methods trade speed for simplicity. If a consumer ever profiles past this, the fix is targeted, not a rewrite: swap the symmetric eigensolver for tridiagonal QL and the SVD for Golub–Reinsch (the JAMA algorithms), and improve matmul cache locality. Until then, correctness and a zero-dependency footprint win. lina is not a general-purpose matrix library — for the rich Matrix API (elementwise arithmetic, broadcasting, views, nonsymmetric eigen), use ml-matrix; lina is the focused linear-algebra leaf the tangent suite's own packages build on.

License

MIT.