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