| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
8.4.6 Creating row and column views
In general there are two ways to access an object, by reference or by copying. The functions described in this section create vector views which allow access to a row or column of a matrix by reference. Modifying elements of the view is equivalent to modifying the matrix, since both the vector view and the matrix point to the same memory block.
- Function: gsl_vector_view gsl_matrix_row (gsl_matrix * m, size_t i)
- Function: gsl_vector_const_view gsl_matrix_const_row (const gsl_matrix * m, size_t i)
These functions return a vector view of the i-th row of the matrix m. The
datapointer of the new vector is set to null if i is out of range.The function
gsl_vector_const_rowis equivalent togsl_matrix_rowbut can be used for matrices which are declaredconst.
- Function: gsl_vector_view gsl_matrix_column (gsl_matrix * m, size_t j)
- Function: gsl_vector_const_view gsl_matrix_const_column (const gsl_matrix * m, size_t j)
These functions return a vector view of the j-th column of the matrix m. The
datapointer of the new vector is set to null if j is out of range.The function
gsl_vector_const_columnis equivalent togsl_matrix_columnbut can be used for matrices which are declaredconst.
- Function: gsl_vector_view gsl_matrix_subrow (gsl_matrix * m, size_t i, size_t offset, size_t n)
- Function: gsl_vector_const_view gsl_matrix_const_subrow (const gsl_matrix * m, size_t i, size_t offset, size_t n)
These functions return a vector view of the i-th row of the matrix m beginning at offset elements past the first column and containing n elements. The
datapointer of the new vector is set to null if i, offset, or n are out of range.The function
gsl_vector_const_subrowis equivalent togsl_matrix_subrowbut can be used for matrices which are declaredconst.
- Function: gsl_vector_view gsl_matrix_subcolumn (gsl_matrix * m, size_t j, size_t offset, size_t n)
- Function: gsl_vector_const_view gsl_matrix_const_subcolumn (const gsl_matrix * m, size_t j, size_t offset, size_t n)
These functions return a vector view of the j-th column of the matrix m beginning at offset elements past the first row and containing n elements. The
datapointer of the new vector is set to null if j, offset, or n are out of range.The function
gsl_vector_const_subcolumnis equivalent togsl_matrix_subcolumnbut can be used for matrices which are declaredconst.
- Function: gsl_vector_view gsl_matrix_diagonal (gsl_matrix * m)
- Function: gsl_vector_const_view gsl_matrix_const_diagonal (const gsl_matrix * m)
These functions returns a vector view of the diagonal of the matrix m. The matrix m is not required to be square. For a rectangular matrix the length of the diagonal is the same as the smaller dimension of the matrix.
The function
gsl_matrix_const_diagonalis equivalent togsl_matrix_diagonalbut can be used for matrices which are declaredconst.
- Function: gsl_vector_view gsl_matrix_subdiagonal (gsl_matrix * m, size_t k)
- Function: gsl_vector_const_view gsl_matrix_const_subdiagonal (const gsl_matrix * m, size_t k)
These functions return a vector view of the k-th subdiagonal of the matrix m. The matrix m is not required to be square. The diagonal of the matrix corresponds to k = 0.
The function
gsl_matrix_const_subdiagonalis equivalent togsl_matrix_subdiagonalbut can be used for matrices which are declaredconst.
- Function: gsl_vector_view gsl_matrix_superdiagonal (gsl_matrix * m, size_t k)
- Function: gsl_vector_const_view gsl_matrix_const_superdiagonal (const gsl_matrix * m, size_t k)
These functions return a vector view of the k-th superdiagonal of the matrix m. The matrix m is not required to be square. The diagonal of the matrix corresponds to k = 0.
The function
gsl_matrix_const_superdiagonalis equivalent togsl_matrix_superdiagonalbut can be used for matrices which are declaredconst.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
