Next: Initializing matrix elements, Previous: Matrix allocation, Up: Matrices [Index]
The functions for accessing the elements of a matrix use the same range
checking system as vectors. You can 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.
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. An inline version of this function is used when HAVE_INLINE
is defined.
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. An inline version of this function is used when HAVE_INLINE
is defined.
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. Inline versions of these functions are used when HAVE_INLINE
is defined.
Next: Initializing matrix elements, Previous: Matrix allocation, Up: Matrices [Index]