GNU Scientific Library – Reference Manual: Sparse Matrices Accessing Elements

Next: Sparse Matrices Initializing Elements, Previous: Sparse Matrices Allocation, Up: Sparse Matrices [Index]

### 41.3 Accessing Matrix Elements

Function: double gsl_spmatrix_get (const gsl_spmatrix * m, const size_t i, const size_t j)

  This function returns element (i,j) of the matrix m. The matrix may be in triplet or compressed format.

Function: int gsl_spmatrix_set (gsl_spmatrix * m, const size_t i, const size_t j, const double x)

  This function sets element (i,j) of the matrix m to the value x. The matrix must be in triplet representation.

Function: double * gsl_spmatrix_ptr (gsl_spmatrix * m, const size_t i, const size_t j)

  This function returns a pointer to the (i,j) element of the matrix m. If the (i,j) element is not explicitly stored in the matrix, a null pointer is returned.