mathjs
Version:
Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif
26 lines (25 loc) • 449 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports._switch = _switch;
/**
* Transpose a matrix
* @param {Array} mat
* @returns {Array} ret
* @private
*/
function _switch(mat) {
const I = mat.length;
const J = mat[0].length;
let i, j;
const ret = [];
for (j = 0; j < J; j++) {
const tmp = [];
for (i = 0; i < I; i++) {
tmp.push(mat[i][j]);
}
ret.push(tmp);
}
return ret;
}
;