melder_sort.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef _melder_sort_h_
  2. #define _melder_sort_h_
  3. /* melder_sort.h
  4. *
  5. * Copyright (C) 1992-2018 Paul Boersma
  6. *
  7. * This code is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * This code is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. * See the GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. /********** Sorting **********/
  21. void NUMsort_integer (integer n, integer ra []);
  22. void NUMsort_str (string32vector a);
  23. void NUMsort_p (integer n, void *a [], int (*compare) (const void *, const void *));
  24. double NUMquantile (integer n, double a [], double factor);
  25. double NUMquantile (const constVEC& a, double factor) noexcept;
  26. /*
  27. An estimate of the quantile 'factor' (between 0 and 1) of the distribution
  28. from which the set 'a [1..n]' is a sorted array of random samples.
  29. For instance, if 'factor' is 0.5, this function returns an estimate of
  30. the median of the distribution underlying the sorted set a [].
  31. If your array has not been sorted, first sort it with NUMsort (n, a).
  32. */
  33. /* End of file melder_sort.h */
  34. #endif