JSMatrix project

JavaScript matrix and vector implementation

JSMatrix is an easy way how to incorporate matrices and vectors into web (JavaScript) applications. Just download the jsmatrix.js file and place it into your HTML document. The natural array-like syntax is inspired by Numerical Python and the operations are written in standard object-oriented way. For example, solving a system of linear equations with matrix A and vector of right hand sides b can be easily calculated with linSolve function (or equivalently with matrix member method linSolve):
A = JSMatrix.mat([[1,2,9],[8,3,2],[3,7,3]]);
b = JSMatrix.vec([32,20,26]);
x1 = JSMatrix.linSolve(A,b);
x2 = A.linSolve(b);
alert('A = '+A);
alert('b = '+b);
alert('x1 = '+x1);
alert('x2 = '+x2);
alert('A*x1 = '+A.mul(x1));
Try it
JSMatrix is a free software distributed under GNU LGPL license.

Currently implemented vector methods are:
  • basic mathematical operations (+,-,+=,-=, *, *=);
  • dot-, cross-, dyadic-product with other vectors;
  • matrix multiplication from left and right, norm(alization);
  • subvectors operations (get, set, increase)
  • testing functions (canMultiplyMat, isSameSizeAs, isEqualTo ...)
  • and others ...
Currently implemented matrix methods are:
  • basic mathematical operations (+,-,+=,-=, *, *=);
  • matrix and vector multiplication;
  • submatrix operations (get, set, increase)
  • testing functions (canMultiplyMat, isSquare, isSameSizeAs, isEqualTo, isLowerTriangular, isUpperTriangular, isSymmetric, isSingular, isOrthogonal, isPositiveDefinite, ...)
  • matrix decompositions (LU, LDU, Cholesky, QR, SVD, Schur, spectral)
  • solving linear system(s) of equations with right hand side(s) - Gaussian elimination, Gauss-Jordan elimination, using LU, LDU, Cholsky or QR decompositions)
  • solving eigenvalues and eigenvectors (inverse iteration, subspace iteration, QR algorithm)
  • and others ...

See documentation and/or examples for more information.
Contact: e-mail
Last update: 4th September 2022
© 2011 - 2022   Jan Stránský
All rights reserved
Valid XHTML 1.1
Valid CSS