Very frequently, we will work with a matrix that is a submatrix of a larger matrix. Consider Figure 1.2.2.

What we depict there is a matrix that is embedded in a larger matrix. The larger matrix consists of ldA (the leading dimension) rows and some number of columns. If column-major order is used to store the larger matrix, then addressing the elements in the submatrix requires knowledge of the leading dimension of the larger matrix. In the C programming language, if the top-left element of the submatrix is stored at address A, then one can address the $(i,j)$ element as A[ j*ldA + i ]. In our implementations, we define a macro that makes addressing the elements more natural:

#define alpha(i,j) A[ (j)*ldA + (i) ]


where we assume that the variable or constant ldA holds the leading dimension parameter.

###### Homework1.2.2.1.

Consider the matrix

\begin{equation*} \left( \begin{array}{r r r r r} 0.0 \amp 0.1 \amp 0.2 \amp 0.3 \\ 1.0 \amp {\Large \mathbf {1.1}} \amp {\Large \mathbf {1.2}} \amp {\Large \mathbf {1.3}} \\ 2.0 \amp {\Large \mathbf {2.1}} \amp {\Large \mathbf{2.2}} \amp {\Large \mathbf {2.3}} \\ 3.0 \amp 3.1 \amp 3.2 \amp 3.3 \\ 4.0 \amp 4.1 \amp 4.2 \amp 4.3 \\ \end{array} \right) \end{equation*}

If this matrix is stored in column-major order in a linear array A,

1. The highlighted submatrix starts at A[...].

2. The number of rows (height) of the highlighted submatrix equals ....

3. The number of columns (width) of the highlighted submatrix equals ....

4. The leading dimension of the highlighted submatrix is ....

Solution
1. The highlighted submatrix starts at A[ 6 ].

2. The number of rows of the boxed submatrix is 2.

3. The number of columns of the boxed submatrix is 3.

4. The leading dimension of the boxed submatrix is 5.