GNU Scientific Library – Reference Manual: Finding maximum and minimum elements of matrices

Next: Matrix properties, Previous: Matrix operations, Up: Matrices [Index]

#### 8.4.11 Finding maximum and minimum elements of matrices

The following operations are only defined for real matrices.

Function: double gsl_matrix_max (const gsl_matrix * m)

  This function returns the maximum value in the matrix m.

Function: double gsl_matrix_min (const gsl_matrix * m)

  This function returns the minimum value in the matrix m.

Function: void gsl_matrix_minmax (const gsl_matrix * m, double * min_out, double * max_out)

  This function returns the minimum and maximum values in the matrix m, storing them in min_out and max_out.

Function: void gsl_matrix_max_index (const gsl_matrix * m, size_t * imax, size_t * jmax)

  This function returns the indices of the maximum value in the matrix m, storing them in imax and jmax. When there are several equal maximum elements then the first element found is returned, searching in row-major order.

Function: void gsl_matrix_min_index (const gsl_matrix * m, size_t * imin, size_t * jmin)

  This function returns the indices of the minimum value in the matrix m, storing them in imin and jmin. When there are several equal minimum elements then the first element found is returned, searching in row-major order.

Function: void gsl_matrix_minmax_index (const gsl_matrix * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax)

  This function returns the indices of the minimum and maximum values in the matrix m, storing them in (imin,jmin) and (imax,jmax). When there are several equal minimum or maximum elements then the first elements found are returned, searching in row-major order.