UNPKG

nyo

Version:

A matrix library for JavaScript with ability to calculate determinants, transpose, inverse, RREF and other simple matrix operations

16 lines (14 loc) 293 B
/** * Get the transpose of a matrix * * @param {number[[]]} mat * @returns {number[[]]} */ function getTranspose(mat) { const column = mat[0]; return column.map((_, i) => { return mat.map((row) => row[i]); }); } module.exports = getTranspose; module.exports.default = getTranspose;