isSquareMatrix method

bool isSquareMatrix()

Check if the matrix is a square matrix (n rows, n columns).

Example:

  Matrix A = Matrix([
    [1, 2],
    [3, 4]
  ]);
  print(A.isSquareMatrix()); // Output: true

Implementation

bool isSquareMatrix() {
  return rowCount == columnCount;
}