GNU Scientific Library – Reference Manual: Sparse Matrices Initializing Elements

Next: Sparse Matrices Reading and Writing, Previous: Sparse Matrices Accessing Elements, Up: Sparse Matrices [Index]

### 41.4 Initializing Matrix Elements

Since the sparse matrix format only stores the non-zero elements, it is automatically initialized to zero upon allocation. The function `gsl_spmatrix_set_zero` may be used to re-initialize a matrix to zero after elements have been added to it.

Function: int gsl_spmatrix_set_zero (gsl_spmatrix * m)

  This function sets (or resets) all the elements of the matrix m to zero.