1 /* histogram/gsl_histogram.h
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef __GSL_HISTOGRAM_H__
21 #define __GSL_HISTOGRAM_H__
29 # define __BEGIN_DECLS extern "C" {
30 # define __END_DECLS }
32 # define __BEGIN_DECLS /* empty */
33 # define __END_DECLS /* empty */
50 gsl_histogram * gsl_histogram_alloc (size_t n);
52 gsl_histogram * gsl_histogram_calloc (size_t n);
53 gsl_histogram * gsl_histogram_calloc_uniform (const size_t n, const double xmin, const double xmax);
54 void gsl_histogram_free (gsl_histogram * h);
55 int gsl_histogram_increment (gsl_histogram * h, double x);
56 int gsl_histogram_accumulate (gsl_histogram * h, double x, double weight);
57 int gsl_histogram_find (const gsl_histogram * h,
58 const double x, size_t * i);
60 double gsl_histogram_get (const gsl_histogram * h, size_t i);
61 int gsl_histogram_get_range (const gsl_histogram * h, size_t i,
62 double * lower, double * upper);
64 double gsl_histogram_max (const gsl_histogram * h);
65 double gsl_histogram_min (const gsl_histogram * h);
66 size_t gsl_histogram_bins (const gsl_histogram * h);
68 void gsl_histogram_reset (gsl_histogram * h);
70 gsl_histogram * gsl_histogram_calloc_range(size_t n, double * range);
73 gsl_histogram_set_ranges (gsl_histogram * h, const double range[], size_t size);
75 gsl_histogram_set_ranges_uniform (gsl_histogram * h, double xmin, double xmax);
80 gsl_histogram_memcpy(gsl_histogram * dest, const gsl_histogram * source);
83 gsl_histogram_clone(const gsl_histogram * source);
85 double gsl_histogram_max_val (const gsl_histogram * h);
87 size_t gsl_histogram_max_bin (const gsl_histogram * h);
89 double gsl_histogram_min_val (const gsl_histogram * h);
91 size_t gsl_histogram_min_bin (const gsl_histogram * h);
94 gsl_histogram_equal_bins_p(const gsl_histogram *h1, const gsl_histogram *h2);
97 gsl_histogram_add(gsl_histogram *h1, const gsl_histogram *h2);
100 gsl_histogram_sub(gsl_histogram *h1, const gsl_histogram *h2);
103 gsl_histogram_mul(gsl_histogram *h1, const gsl_histogram *h2);
106 gsl_histogram_div(gsl_histogram *h1, const gsl_histogram *h2);
109 gsl_histogram_scale(gsl_histogram *h, double scale);
112 gsl_histogram_shift (gsl_histogram * h, double shift);
115 double gsl_histogram_sigma (const gsl_histogram * h);
117 double gsl_histogram_mean (const gsl_histogram * h);
119 double gsl_histogram_sum (const gsl_histogram * h);
121 int gsl_histogram_fwrite (FILE * stream, const gsl_histogram * h) ;
122 int gsl_histogram_fread (FILE * stream, gsl_histogram * h);
123 int gsl_histogram_fprintf (FILE * stream, const gsl_histogram * h,
124 const char * range_format, const char * bin_format);
125 int gsl_histogram_fscanf (FILE * stream, gsl_histogram * h);
127 gsl_histogram_pdf * gsl_histogram_pdf_alloc (const size_t n);
128 int gsl_histogram_pdf_init (gsl_histogram_pdf * p, const gsl_histogram * h);
129 void gsl_histogram_pdf_free (gsl_histogram_pdf * p);
130 double gsl_histogram_pdf_sample (const gsl_histogram_pdf * p, double r);
134 #endif /* __GSL_HISTOGRAM_H__ */