Next: , Previous: Accessing matrix elements, Up: Matrices


8.4.3 Initializing matrix elements

— Function: void gsl_matrix_set_all (gsl_matrix * m, double x)

This function sets all the elements of the matrix m to the value x.

— Function: void gsl_matrix_set_zero (gsl_matrix * m)

This function sets all the elements of the matrix m to zero.

— Function: void gsl_matrix_set_identity (gsl_matrix * m)

This function sets the elements of the matrix m to the corresponding elements of the identity matrix, m(i,j) = \delta(i,j), i.e. a unit diagonal with all off-diagonal elements zero. This applies to both square and rectangular matrices.