Support for matrices in JavaScript.
const M = [
[1,2],
[3,4]
];
const determinant = Math.matrix.det(M);
// -2
-
add(A,B)
- performs addition of matrices$A$ and$B$ -
sub(A,B)
- performs subtraction of matrices$A$ and$B$ -
mul(A,B)
- performs multiplication of matrices$A$ and$B$ -
mulByScalar(M,k)
- performs multiplication of a matrix$M$ by a scalar value$k$ -
transpose(M)
- performs transposition of a matrix$M$
-
det(M)
- returns the determinant of a matrix$M$ -
order(M)
- returns the order of a matrix$M$ -
trace(M)
- returns the trace of a matrix$M$ -
cofactor(M,i,j)
- returns a cofactor for element$a_{ij}$ in a matrix$M$ -
cofactorMatrix(M)
- returns the cofactor matrix for a matrix$M$ -
adjointMatrix(M)
- returns the adjoint matrix for a matrix$M$ -
inverseMatrix(M)
- returns the inverse matrix for a matrix$M$
-
minorMatrix(M)
- returns the minor matrix for a matrix$M$ -
minor(M,i,j)
- returns a minor for element$a_{ij}$ in a matrix$M$ -
minorize(M,i,j)
- returns a matrix$M$ with i-th row and j-th column removed
-
initNullMatrix(m,n)
- creates a null matrix of order$m \times n$ -
initScalarMatrix(n,k=1)
- creates a scalar matrix of order$n \times n$ with a scalar value$k$ on the diagonal -
initIdentityMatrix(n)
- creates an identity matrix of order$n \times n$
-
removeRow(M,i)
- returns a matrix$M$ with i-th row removed -
removeColumn(M,j)
- returns a matrix$M$ with j-th column removed -
insertRow(M,i,row)
- returns a matrix$M$ with additional row inserted just before i-th row -
insertColumn(M,j,column)
- returns a matrix$M$ with additional column inserted just before j-th column -
swapRows(M,m,n)
- returns a matrix$M$ with m-th and n-th rows swapped -
swapColumns(M,m,n)
- returns a matrix$M$ with m-th and n-th columns swapped -
getRow(M,i)
- returns i-th row of a matrix$M$ -
getColumn(M,j)
- returns j-th column of a matrix$M$
-
isSquare(M)
- checks if a matrix$M$ is the square matrix -
isEqual(A,B)
- checks if a matrix$A$ is equal to a matrix$B$