Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Linear Algebra Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

3.7 Submatrices

The Linear Algebra Module contains two mechanisms for extracting and operating on a submatrix of a matrix. These mechanisms are based on whether the original matrix is a general rectangular matrix, or some other type.

3.7.1 General Matrices

Subscripting allows you to access submatrices of a general rectangular matrix. The submatrix is a view of the original matrix's data. A complete description of subscripting and the subscripting index classes RWRange, RWSlice, and RWToEnd can be found in the SourcePro C++ API Reference Guide. A mechanism for matrices other than general rectangular matrices is described next.

3.7.2 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:

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:

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.



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.