Go to the first, previous, next, last section, table of contents.

## Maximum and Minimum values

Statistics: double gsl_stats_max (const double data[], size_t stride, size_t n)
This function returns the maximum value in data, a dataset of length n with stride stride. The maximum value is defined as the value of the element @math{x_i} which satisfies @c{\$x_i \ge x_j\$} @math{x_i >= x_j} for all @math{j}.

If you want instead to find the element with the largest absolute magnitude you will need to apply `fabs` or `abs` to your data before calling this function.

Statistics: double gsl_stats_min (const double data[], size_t stride, size_t n)
This function returns the minimum value in data, a dataset of length n with stride stride. The minimum value is defined as the value of the element @math{x_i} which satisfies @c{\$x_i \le x_j\$} @math{x_i <= x_j} for all @math{j}.

If you want instead to find the element with the smallest absolute magnitude you will need to apply `fabs` or `abs` to your data before calling this function.

Statistics: void gsl_stats_minmax (double * min, double * max, const double data[], size_t stride, size_t n)
This function finds both the minimum and maximum values min, max in data in a single pass.

Statistics: size_t gsl_stats_max_index (const double data[], size_t stride, size_t n)
This function returns the index of the maximum value in data, a dataset of length n with stride stride. The maximum value is defined as the value of the element @math{x_i} which satisfies @math{x_i >= x_j} for all @math{j}. When there are several equal maximum elements then the first one is chosen.

Statistics: size_t gsl_stats_min_index (const double data[], size_t stride, size_t n)
This function returns the index of the minimum value in data, a dataset of length n with stride stride. The minimum value is defined as the value of the element @math{x_i} which satisfies @math{x_i >= x_j} for all @math{j}. When there are several equal minimum elements then the first one is chosen.

Statistics: void gsl_stats_minmax_index (size_t * min_index, size_t * max_index, const double data[], size_t stride, size_t n)
This function returns the indexes min_index, max_index of the minimum and maximum values in data in a single pass.

Go to the first, previous, next, last section, table of contents.