| 1 |
/* histogram/gsl_histogram2d.h |
| 2 |
* |
| 3 |
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough |
| 4 |
* |
| 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. |
| 9 |
* |
| 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. |
| 14 |
* |
| 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. |
| 18 |
*/ |
| 19 |
|
| 20 |
#ifndef __GSL_HISTOGRAM2D_H__ |
| 21 |
#define __GSL_HISTOGRAM2D_H__ |
| 22 |
|
| 23 |
#include <stdlib.h> |
| 24 |
#include <stdio.h> |
| 25 |
|
| 26 |
#undef __BEGIN_DECLS |
| 27 |
#undef __END_DECLS |
| 28 |
#ifdef __cplusplus |
| 29 |
# define __BEGIN_DECLS extern "C" { |
| 30 |
# define __END_DECLS } |
| 31 |
#else |
| 32 |
# define __BEGIN_DECLS /* empty */ |
| 33 |
# define __END_DECLS /* empty */ |
| 34 |
#endif |
| 35 |
|
| 36 |
__BEGIN_DECLS |
| 37 |
|
| 38 |
typedef struct { |
| 39 |
size_t nx, ny ; |
| 40 |
double * xrange ; |
| 41 |
double * yrange ; |
| 42 |
double * bin ; |
| 43 |
} gsl_histogram2d ; |
| 44 |
|
| 45 |
typedef struct { |
| 46 |
size_t nx, ny ; |
| 47 |
double * xrange ; |
| 48 |
double * yrange ; |
| 49 |
double * sum ; |
| 50 |
} gsl_histogram2d_pdf ; |
| 51 |
|
| 52 |
gsl_histogram2d * gsl_histogram2d_alloc (const size_t nx, const size_t ny); |
| 53 |
gsl_histogram2d * gsl_histogram2d_calloc (const size_t nx, const size_t ny); |
| 54 |
gsl_histogram2d * gsl_histogram2d_calloc_uniform (const size_t nx, const size_t ny, |
| 55 |
const double xmin, const double xmax, |
| 56 |
const double ymin, const double ymax); |
| 57 |
|
| 58 |
void gsl_histogram2d_free (gsl_histogram2d * h); |
| 59 |
|
| 60 |
int gsl_histogram2d_increment (gsl_histogram2d * h, double x, double y); |
| 61 |
int gsl_histogram2d_accumulate (gsl_histogram2d * h, |
| 62 |
double x, double y, double weight); |
| 63 |
int gsl_histogram2d_find (const gsl_histogram2d * h, |
| 64 |
const double x, const double y, size_t * i, size_t * j); |
| 65 |
|
| 66 |
double gsl_histogram2d_get (const gsl_histogram2d * h, const size_t i, const size_t j); |
| 67 |
int gsl_histogram2d_get_xrange (const gsl_histogram2d * h, const size_t i, |
| 68 |
double * xlower, double * xupper); |
| 69 |
int gsl_histogram2d_get_yrange (const gsl_histogram2d * h, const size_t j, |
| 70 |
double * ylower, double * yupper); |
| 71 |
|
| 72 |
|
| 73 |
double gsl_histogram2d_xmax (const gsl_histogram2d * h); |
| 74 |
double gsl_histogram2d_xmin (const gsl_histogram2d * h); |
| 75 |
size_t gsl_histogram2d_nx (const gsl_histogram2d * h); |
| 76 |
|
| 77 |
double gsl_histogram2d_ymax (const gsl_histogram2d * h); |
| 78 |
double gsl_histogram2d_ymin (const gsl_histogram2d * h); |
| 79 |
size_t gsl_histogram2d_ny (const gsl_histogram2d * h); |
| 80 |
|
| 81 |
void gsl_histogram2d_reset (gsl_histogram2d * h); |
| 82 |
|
| 83 |
gsl_histogram2d * |
| 84 |
gsl_histogram2d_calloc_range(size_t nx, size_t ny, |
| 85 |
double *xrange, double *yrange); |
| 86 |
|
| 87 |
int |
| 88 |
gsl_histogram2d_set_ranges_uniform (gsl_histogram2d * h, |
| 89 |
double xmin, double xmax, |
| 90 |
double ymin, double ymax); |
| 91 |
|
| 92 |
int |
| 93 |
gsl_histogram2d_set_ranges (gsl_histogram2d * h, |
| 94 |
const double xrange[], size_t xsize, |
| 95 |
const double yrange[], size_t ysize); |
| 96 |
|
| 97 |
int |
| 98 |
gsl_histogram2d_memcpy(gsl_histogram2d *dest, const gsl_histogram2d *source); |
| 99 |
|
| 100 |
gsl_histogram2d * |
| 101 |
gsl_histogram2d_clone(const gsl_histogram2d * source); |
| 102 |
|
| 103 |
double |
| 104 |
gsl_histogram2d_max_val(const gsl_histogram2d *h); |
| 105 |
|
| 106 |
void |
| 107 |
gsl_histogram2d_max_bin (const gsl_histogram2d *h, size_t *i, size_t *j); |
| 108 |
|
| 109 |
double |
| 110 |
gsl_histogram2d_min_val(const gsl_histogram2d *h); |
| 111 |
|
| 112 |
void |
| 113 |
gsl_histogram2d_min_bin (const gsl_histogram2d *h, size_t *i, size_t *j); |
| 114 |
|
| 115 |
double |
| 116 |
gsl_histogram2d_xmean (const gsl_histogram2d * h); |
| 117 |
|
| 118 |
double |
| 119 |
gsl_histogram2d_ymean (const gsl_histogram2d * h); |
| 120 |
|
| 121 |
double |
| 122 |
gsl_histogram2d_xsigma (const gsl_histogram2d * h); |
| 123 |
|
| 124 |
double |
| 125 |
gsl_histogram2d_ysigma (const gsl_histogram2d * h); |
| 126 |
|
| 127 |
double |
| 128 |
gsl_histogram2d_cov (const gsl_histogram2d * h); |
| 129 |
|
| 130 |
double |
| 131 |
gsl_histogram2d_sum (const gsl_histogram2d *h); |
| 132 |
|
| 133 |
int |
| 134 |
gsl_histogram2d_equal_bins_p(const gsl_histogram2d *h1, |
| 135 |
const gsl_histogram2d *h2) ; |
| 136 |
|
| 137 |
int |
| 138 |
gsl_histogram2d_add(gsl_histogram2d *h1, const gsl_histogram2d *h2); |
| 139 |
|
| 140 |
int |
| 141 |
gsl_histogram2d_sub(gsl_histogram2d *h1, const gsl_histogram2d *h2); |
| 142 |
|
| 143 |
int |
| 144 |
gsl_histogram2d_mul(gsl_histogram2d *h1, const gsl_histogram2d *h2); |
| 145 |
|
| 146 |
int |
| 147 |
gsl_histogram2d_div(gsl_histogram2d *h1, const gsl_histogram2d *h2); |
| 148 |
|
| 149 |
int |
| 150 |
gsl_histogram2d_scale(gsl_histogram2d *h, double scale); |
| 151 |
|
| 152 |
int |
| 153 |
gsl_histogram2d_shift(gsl_histogram2d *h, double shift); |
| 154 |
|
| 155 |
int gsl_histogram2d_fwrite (FILE * stream, const gsl_histogram2d * h) ; |
| 156 |
int gsl_histogram2d_fread (FILE * stream, gsl_histogram2d * h); |
| 157 |
int gsl_histogram2d_fprintf (FILE * stream, const gsl_histogram2d * h, |
| 158 |
const char * range_format, |
| 159 |
const char * bin_format); |
| 160 |
int gsl_histogram2d_fscanf (FILE * stream, gsl_histogram2d * h); |
| 161 |
|
| 162 |
gsl_histogram2d_pdf * gsl_histogram2d_pdf_alloc (const size_t nx, const size_t ny); |
| 163 |
int gsl_histogram2d_pdf_init (gsl_histogram2d_pdf * p, const gsl_histogram2d * h); |
| 164 |
void gsl_histogram2d_pdf_free (gsl_histogram2d_pdf * p); |
| 165 |
int gsl_histogram2d_pdf_sample (const gsl_histogram2d_pdf * p, |
| 166 |
double r1, double r2, |
| 167 |
double * x, double * y); |
| 168 |
|
| 169 |
__END_DECLS |
| 170 |
|
| 171 |
#endif /* __GSL_HISTOGRAM2D_H__ */ |
| 172 |
|