sussy-util
Version:
Util package made by me
32 lines (31 loc) • 1.41 kB
TypeScript
export default class MatrixOperations {
/**
* Adds two matrices element-wise.
* @param {number[][]} matrixA - The first matrix.
* @param {number[][]} matrixB - The second matrix.
* @returns {number[][]} The result of adding the two matrices.
*/
static add(matrixA: number[][], matrixB: number[][]): number[][];
/**
* Subtracts one matrix from another element-wise.
* @param {number[][]} matrixA - The first matrix.
* @param {number[][]} matrixB - The second matrix.
* @returns {number[][]} The result of subtracting the second matrix from the first matrix.
*/
static subtract(matrixA: number[][], matrixB: number[][]): number[][];
/**
* Multiplies two matrices.
* @param {number[][]} matrixA - The first matrix.
* @param {number[][]} matrixB - The second matrix.
* @returns {number[][]} The result of multiplying the two matrices.
* @throws {Error} Throws an error if the dimensions of the matrices are not valid for multiplication.
*/
static multiply(matrixA: number[][], matrixB: number[][]): number[][];
/**
* Calculates the determinant of a square matrix.
* @param {number[][]} matrix - The square matrix.
* @returns {number} The determinant of the matrix.
* @throws {Error} Throws an error if the matrix is not square.
*/
static determinant(matrix: number[][]): number;
}