@rayyamhk/matrix
Version:
A professional, comprehensive and high-performance library for you to manipulate matrices.
31 lines (26 loc) • 598 B
JavaScript
/**
* Determines whether a Matrix is square or not.<br><br>
*
* Square Matrix is a Matrix with same number of rows and columns.<br><br>
*
* The result is cached.
* @memberof Matrix
* @instance
* @returns {boolean} Returns true if the Matrix is square
*/
function isSquare() {
if (this._isSquare !== undefined) {
return this._isSquare;
}
var A = this._matrix;
if (A.length === 0) {
// 0x0 matrix
this._isSquare = true;
return true;
}
this._isSquare = A.length === A[0].length;
return this._isSquare;
}
;
module.exports = isSquare;
;