mljs/matrix

Matrix manipulation and computation library

What it solves

ml-matrix is a JavaScript library designed for matrix manipulation and computation. It provides the essential mathematical foundations needed for data science and machine learning tasks in JavaScript environments, filling the gap for a robust matrix-based computation engine.

How it works

The library implements a Matrix class that allows users to create matrices from arrays or using helper methods (like zeros, ones, and eye). It supports a wide range of operations including:

  • Standard Arithmetic: Addition, subtraction, multiplication (matrix-matrix and matrix-scalar), division, and modulo.
  • Math Functions: Element-wise application of standard math operations (e.g., exp, cos, abs, sqrt).
  • Matrix Manipulation: Transposition, diagonal extraction, mean, product, and Frobenius norm calculations.
  • Advanced Linear Algebra: Implementation of matrix inversion (including pseudo-inverse via SVD), solving least squares problems, and linear dependency analysis.
  • Decompositions: Support for QR, LU, Cholesky, and Eigenvalue decompositions.

Who it’s for

Developers building machine learning models, data analysis tools, or any application requiring linear algebra operations within a Node.js or browser-based JavaScript environment.

Highlights

  • Comprehensive Linear Algebra: Includes advanced decompositions (LU, QR, Cholesky, Eigenvalue) and pseudo-inverses.
  • ** uma a single Matrix class**: Provides a cohesive API for both inplace and non-inplace operations.
  • Flexible Instantiation: Easy creation of identity, zero, and one matrices.
  • Axis-based Reductions: Ability to apply custom callbacks to rows or columns via applyAlongAxis.

Related

  • Project
  • Project
  • Project
  • Project
  • Project