GNU Scientific Library – Reference Manual: Sparse Matrices Exchanging Rows and Columns

Next: Sparse Matrices Operations, Previous: Sparse Matrices Copying, Up: Sparse Matrices [Index]

### 41.7 Exchanging Rows and Columns

Function: int gsl_spmatrix_transpose_memcpy (gsl_spmatrix * dest, const gsl_spmatrix * src)

  This function copies the transpose of the sparse matrix src into dest. The dimensions of dest must match the transpose of the matrix src. Also, both matrices must use the same sparse storage format.

Function: int gsl_spmatrix_transpose (gsl_spmatrix * m)

  This function replaces the matrix m by its transpose, preserving the storage format of the input matrix. Currently, only triplet matrix inputs are supported.

Function: int gsl_spmatrix_transpose2 (gsl_spmatrix * m)

  This function replaces the matrix m by its transpose, but changes the storage format for compressed matrix inputs. Since compressed column storage is the transpose of compressed row storage, this function simply converts a CCS matrix to CRS and vice versa. This is the most efficient way to transpose a compressed storage matrix, but the user should note that the storage format of their compressed matrix will change on output. For triplet matrices, the output matrix is also in triplet storage.