
250 Introduction to Computational Modeling
18.3.3 GSL Matrix Views
To use a submatrix of a matrix, the GSL provides matrix views. These are of
type gsl matrix view and the elements of the views can be accessed with the address
of component matrix of the view (using the & operator). In the following example,
matrix a is created with 7 rows and 5 columns. Then a matrix view suba of matrix a
is created to get a submatrix of a. The upper left element of the submatrix is on row
2 and column 2 of matrix a. The submatrix, suba, has 4 rows and 3 columns. The
third statement illustrates how to use a matrix view to add 12.4 to the elements of the
submatrix suba ...