Leading Submatrices
In general, it is not possible to access arbitrary submatrices with matrix shapes other than general. However, the special case of accessing the upper-left corner of a matrix, called the leading submatrix, occurs so frequently that the Linear Algebra Module includes a member function for this purpose. The leadingSubmatrix() function is implemented for all matrix types except general rectangular, RWGenMat, which has the more general subscripting feature. For example, if A is the skew symmetric matrix:
then the line of code:
 
A.leadingSubMatrix(2);
yields this 2 x 2 skew symmetric matrix:
Like a matrix created by subscripting, a leading submatrix views the same data as the matrix from which it was extracted. The code:
 
RWSkewMat<double> Atopleft = A.leadingSubmatrix(2);
sets the matrix Atopleft to be a reference to the data in the matrix A. It is a view of just the upper-left corner 2 x 2 matrix. If you subsequently change Atopleft, A also changes.