Checks if a matrix is an upper triangular matrix.