Added a function to check if the matrix is a square matrix.