The functions for accessing the elements of a matrix use the same range
checking system as vectors. You turn off range checking by recompiling
your program with the preprocessor definition
`GSL_RANGE_CHECK_OFF`

.

The elements of the matrix are stored in "C-order", where the second
index moves continuously through memory. More precisely, the element
accessed by the function `gsl_matrix_get(m,i,j)`

and
`gsl_matrix_set(m,i,j,x)`

is

m->data[i * m->tda + j]

where `tda` is the physical row-length of the matrix.

__Function:__double**gsl_matrix_get***(const gsl_matrix **`m`, size_t`i`, size_t`j`)-
This function returns the (
`i`,`j`)th element of a matrix`m`. If`i`or`j`lie outside the allowed range of 0 to`n1-1`and 0 to`n2-1`then the error handler is invoked and 0 is returned.

__Function:__void**gsl_matrix_set***(gsl_matrix **`m`, size_t`i`, size_t`j`, double`x`)-
This function sets the value of the (
`i`,`j`)th element of a matrix`m`to`x`. If`i`or`j`lies outside the allowed range of 0 to`n1-1`and 0 to`n2-1`then the error handler is invoked.

__Function:__double ***gsl_matrix_ptr***(gsl_matrix **`m`, size_t`i`, size_t`j`)__Function:__const double ***gsl_matrix_ptr***(const gsl_matrix **`m`, size_t`i`, size_t`j`)-
These functions return a pointer to the (
`i`,`j`)th element of a matrix`m`. If`i`or`j`lie outside the allowed range of 0 to`n1-1`and 0 to`n2-1`then the error handler is invoked and a null pointer is returned.

Go to the first, previous, next, last section, table of contents.