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

Next: Vector properties, Previous: Vector operations, Up: Vectors [Index]

#### 8.3.9 Finding maximum and minimum elements of vectors

The following operations are only defined for real vectors.

Function: double gsl_vector_max (const gsl_vector * v)

  This function returns the maximum value in the vector v.

Function: double gsl_vector_min (const gsl_vector * v)

  This function returns the minimum value in the vector v.

Function: void gsl_vector_minmax (const gsl_vector * v, double * min_out, double * max_out)

  This function returns the minimum and maximum values in the vector v, storing them in min_out and max_out.

Function: size_t gsl_vector_max_index (const gsl_vector * v)

  This function returns the index of the maximum value in the vector v. When there are several equal maximum elements then the lowest index is returned.

Function: size_t gsl_vector_min_index (const gsl_vector * v)

  This function returns the index of the minimum value in the vector v. When there are several equal minimum elements then the lowest index is returned.

Function: void gsl_vector_minmax_index (const gsl_vector * v, size_t * imin, size_t * imax)

  This function returns the indices of the minimum and maximum values in the vector v, storing them in imin and imax. When there are several equal minimum or maximum elements then the lowest indices are returned.