Next: , Previous: Copying rows and columns, Up: Matrices   [Index]


8.4.9 Exchanging rows and columns

The following functions can be used to exchange the rows and columns of a matrix.

Function: int gsl_matrix_swap_rows (gsl_matrix * m, size_t i, size_t j)

This function exchanges the i-th and j-th rows of the matrix m in-place.

Function: int gsl_matrix_swap_columns (gsl_matrix * m, size_t i, size_t j)

This function exchanges the i-th and j-th columns of the matrix m in-place.

Function: int gsl_matrix_swap_rowcol (gsl_matrix * m, size_t i, size_t j)

This function exchanges the i-th row and j-th column of the matrix m in-place. The matrix must be square for this operation to be possible.

Function: int gsl_matrix_transpose_memcpy (gsl_matrix * dest, const gsl_matrix * src)

This function makes the matrix dest the transpose of the matrix src by copying the elements of src into dest. This function works for all matrices provided that the dimensions of the matrix dest match the transposed dimensions of the matrix src.

Function: int gsl_matrix_transpose (gsl_matrix * m)

This function replaces the matrix m by its transpose by copying the elements of the matrix in-place. The matrix must be square for this operation to be possible.