| 1 | #ifndef _melder_sort_h_ |
| 2 | #define _melder_sort_h_ |
| 3 | /* melder_sort.h |
| 4 | * |
| 5 | * Copyright (C) 1992-2019,2021 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 | |
| 21 | double NUMquantile (constVECVU const& a, double factor) noexcept; |
| 22 | /* |
| 23 | An estimate of the quantile 'factor' (between 0 and 1) of the distribution |
| 24 | from which the set 'a [1..n]' is a sorted array of random samples. |
| 25 | For instance, if 'factor' is 0.5, this function returns an estimate of |
| 26 | the median of the distribution underlying the sorted set a []. |
| 27 | If your array has not been sorted, first sort it with sort_VEC_inout (). |
| 28 | */ |
| 29 | |
| 30 | inline bool NUMisSorted3 (integer a, integer b, integer c) { |
| 31 | return a <= b && b <= c; |
| 32 | } |
| 33 | |
| 34 | inline bool NUMisSorted4 (integer a, integer b, integer c, integer d) { |
| 35 | return a <= b && b <= c && c <= d; |
| 36 | } |
| 37 | |
| 38 | /* End of file melder_sort.h */ |
| 39 | #endif |