| 1 | /* gsl_histogram_maxval.c |
| 2 | * Copyright (C) 2000 Simone Piccardi |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation; either version 3 of the |
| 7 | * License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public |
| 15 | * License along with this library; if not, write to the |
| 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 17 | * Boston, MA 02111-1307, USA. |
| 18 | */ |
| 19 | /*************************************************************** |
| 20 | * |
| 21 | * File gsl_histogram_maxval.c: |
| 22 | * Routine to find maximum and minumum content of a hisogram. |
| 23 | * Need GSL library and header. |
| 24 | * Contains the routines: |
| 25 | * gsl_histogram_max_val find max content values |
| 26 | * gsl_histogram_min_val find min content values |
| 27 | * gsl_histogram_bin_max find coordinates of max contents bin |
| 28 | * gsl_histogram_bin_min find coordinates of min contents bin |
| 29 | * |
| 30 | * Author: S. Piccardi |
| 31 | * Jan. 2000 |
| 32 | * |
| 33 | ***************************************************************/ |
| 34 | #include "gsl__config.h"cxx . . $ `<file>/external/gsl/gsl__config.h`/ |
| 35 | #include "gsl_errno.h"cxx . . $ `<file>/external/gsl/gsl_errno.h`/ |
| 36 | #include "gsl_histogram.h"cxx . . $ `<file>/external/gsl/gsl_histogram.h`/ |
| 37 | |
| 38 | double |
| 39 | gsl_histogram_max_valcxx . . $ gsl_histogram_max_val(2a0573667e5ff3e9). (const gsl_histogramcxx . . $ gsl_histogram# * h) |
| 40 | { |
| 41 | const size_t n = h->ncxx . . $ $anonymous_type_62a17a7d119001a7_0#n.; |
| 42 | size_t i; |
| 43 | double max = h->bincxx . . $ $anonymous_type_62a17a7d119001a7_0#bin.[0]; |
| 44 | for (i = 0; i < n; i++) |
| 45 | { |
| 46 | if (h->bincxx . . $ $anonymous_type_62a17a7d119001a7_0#bin.[i] > max) |
| 47 | { |
| 48 | max = h->bincxx . . $ $anonymous_type_62a17a7d119001a7_0#bin.[i]; |
| 49 | } |
| 50 | } |
| 51 | return max; |
| 52 | } |
| 53 | |
| 54 | size_t |
| 55 | gsl_histogram_max_bincxx . . $ gsl_histogram_max_bin(6f6be21cceacb201). (const gsl_histogramcxx . . $ gsl_histogram# * h) |
| 56 | { |
| 57 | size_t i; |
| 58 | size_t imax = 0; |
| 59 | double max = h->bincxx . . $ $anonymous_type_62a17a7d119001a7_0#bin.[0]; |
| 60 | for (i = 0; i < h->ncxx . . $ $anonymous_type_62a17a7d119001a7_0#n.; i++) |
| 61 | { |
| 62 | if (h->bincxx . . $ $anonymous_type_62a17a7d119001a7_0#bin.[i] > max) |
| 63 | { |
| 64 | max = h->bincxx . . $ $anonymous_type_62a17a7d119001a7_0#bin.[i]; |
| 65 | imax = i; |
| 66 | } |
| 67 | } |
| 68 | return imax; |
| 69 | } |
| 70 | |
| 71 | double |
| 72 | gsl_histogram_min_valcxx . . $ gsl_histogram_min_val(2a0573667e5ff3e9). (const gsl_histogramcxx . . $ gsl_histogram# * h) |
| 73 | { |
| 74 | size_t i; |
| 75 | double min = h->bincxx . . $ $anonymous_type_62a17a7d119001a7_0#bin.[0]; |
| 76 | for (i = 0; i < h->ncxx . . $ $anonymous_type_62a17a7d119001a7_0#n.; i++) |
| 77 | { |
| 78 | if (h->bincxx . . $ $anonymous_type_62a17a7d119001a7_0#bin.[i] < min) |
| 79 | { |
| 80 | min = h->bincxx . . $ $anonymous_type_62a17a7d119001a7_0#bin.[i]; |
| 81 | } |
| 82 | } |
| 83 | return min; |
| 84 | } |
| 85 | |
| 86 | size_t |
| 87 | gsl_histogram_min_bincxx . . $ gsl_histogram_min_bin(6f6be21cceacb201). (const gsl_histogramcxx . . $ gsl_histogram# * h) |
| 88 | { |
| 89 | size_t i; |
| 90 | size_t imin = 0; |
| 91 | double min = h->bincxx . . $ $anonymous_type_62a17a7d119001a7_0#bin.[0]; |
| 92 | for (i = 0; i < h->ncxx . . $ $anonymous_type_62a17a7d119001a7_0#n.; i++) |
| 93 | { |
| 94 | if (h->bincxx . . $ $anonymous_type_62a17a7d119001a7_0#bin.[i] < min) |
| 95 | { |
| 96 | min = h->bincxx . . $ $anonymous_type_62a17a7d119001a7_0#bin.[i]; |
| 97 | imin = i; |
| 98 | } |
| 99 | } |
| 100 | return imin; |
| 101 | } |