Rows, Columns and Diagonals
You can access entire rows and columns of general matrices, and diagonals of general, banded, and tridiagonal matrices, as easily as you can access individual elements. The functions rows(), cols(), and diagonal() return vectors corresponding to a row, column, or diagonal of the matrix. The resulting vector is a new view of the matrix's data and may be used as either a left side or a right side in expressions.
Just as with val() and set(), the functions rows(), cols() and diagonal() do bounds checking only if the preprocessor symbol RWBOUNDS_CHECK is defined when the header file is read. The function bcdiagonal() does the same thing as diagonal(), but does bounds checking regardless of whether or not RWBOUNDS_CHECK is defined when the header file is read.