Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:03:48

0001 /* histogram/gsl_histogram2d.h
0002  * 
0003  * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
0004  * 
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 3 of the License, or (at
0008  * your option) any later version.
0009  * 
0010  * This program is distributed in the hope that it will be useful, but
0011  * WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * General Public License for more details.
0014  * 
0015  * You should have received a copy of the GNU General Public License
0016  * along with this program; if not, write to the Free Software
0017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef __GSL_HISTOGRAM2D_H__
0021 #define __GSL_HISTOGRAM2D_H__
0022 
0023 #include <stdlib.h>
0024 #include <stdio.h>
0025 
0026 #undef __BEGIN_DECLS
0027 #undef __END_DECLS
0028 #ifdef __cplusplus
0029 # define __BEGIN_DECLS extern "C" {
0030 # define __END_DECLS }
0031 #else
0032 # define __BEGIN_DECLS /* empty */
0033 # define __END_DECLS /* empty */
0034 #endif
0035 
0036 __BEGIN_DECLS
0037 
0038 typedef struct {
0039   size_t nx, ny ;
0040   double * xrange ;
0041   double * yrange ;
0042   double * bin ;
0043 } gsl_histogram2d ;
0044 
0045 typedef struct {
0046   size_t nx, ny ;
0047   double * xrange ;
0048   double * yrange ;
0049   double * sum ;
0050 } gsl_histogram2d_pdf ;
0051 
0052 gsl_histogram2d * gsl_histogram2d_alloc (const size_t nx, const size_t ny);
0053 gsl_histogram2d * gsl_histogram2d_calloc (const size_t nx, const size_t ny);
0054 gsl_histogram2d * gsl_histogram2d_calloc_uniform (const size_t nx, const size_t ny,
0055                                              const double xmin, const double xmax,
0056                                              const double ymin, const double ymax);
0057 
0058 void gsl_histogram2d_free (gsl_histogram2d * h);
0059 
0060 int gsl_histogram2d_increment (gsl_histogram2d * h, double x, double y);
0061 int gsl_histogram2d_accumulate (gsl_histogram2d * h, 
0062                                 double x, double y, double weight);
0063 int gsl_histogram2d_find (const gsl_histogram2d * h, 
0064                           const double x, const double y, size_t * i, size_t * j);
0065 
0066 double gsl_histogram2d_get (const gsl_histogram2d * h, const size_t i, const size_t j);
0067 int gsl_histogram2d_get_xrange (const gsl_histogram2d * h, const size_t i,
0068                                 double * xlower, double * xupper);
0069 int gsl_histogram2d_get_yrange (const gsl_histogram2d * h, const size_t j,
0070                                 double * ylower, double * yupper);
0071 
0072                                      
0073 double gsl_histogram2d_xmax (const gsl_histogram2d * h);
0074 double gsl_histogram2d_xmin (const gsl_histogram2d * h);
0075 size_t gsl_histogram2d_nx (const gsl_histogram2d * h);
0076 
0077 double gsl_histogram2d_ymax (const gsl_histogram2d * h);
0078 double gsl_histogram2d_ymin (const gsl_histogram2d * h);
0079 size_t gsl_histogram2d_ny (const gsl_histogram2d * h);
0080 
0081 void gsl_histogram2d_reset (gsl_histogram2d * h);
0082 
0083 gsl_histogram2d * 
0084 gsl_histogram2d_calloc_range(size_t nx, size_t ny, 
0085                              double *xrange, double *yrange);
0086 
0087 int 
0088 gsl_histogram2d_set_ranges_uniform (gsl_histogram2d * h, 
0089                                     double xmin, double xmax,
0090                                     double ymin, double ymax);
0091 
0092 int 
0093 gsl_histogram2d_set_ranges (gsl_histogram2d * h, 
0094                             const double xrange[], size_t xsize,
0095                             const double yrange[], size_t ysize);
0096 
0097 int 
0098 gsl_histogram2d_memcpy(gsl_histogram2d *dest, const gsl_histogram2d *source);
0099 
0100 gsl_histogram2d *
0101 gsl_histogram2d_clone(const gsl_histogram2d * source);
0102 
0103 double
0104 gsl_histogram2d_max_val(const gsl_histogram2d *h);
0105 
0106 void
0107 gsl_histogram2d_max_bin (const gsl_histogram2d *h, size_t *i, size_t *j);
0108 
0109 double
0110 gsl_histogram2d_min_val(const gsl_histogram2d *h);
0111 
0112 void
0113 gsl_histogram2d_min_bin (const gsl_histogram2d *h, size_t *i, size_t *j);
0114 
0115 double
0116 gsl_histogram2d_xmean (const gsl_histogram2d * h);
0117 
0118 double
0119 gsl_histogram2d_ymean (const gsl_histogram2d * h);
0120 
0121 double
0122 gsl_histogram2d_xsigma (const gsl_histogram2d * h);
0123 
0124 double
0125 gsl_histogram2d_ysigma (const gsl_histogram2d * h);
0126 
0127 double
0128 gsl_histogram2d_cov (const gsl_histogram2d * h);
0129 
0130 double
0131 gsl_histogram2d_sum (const gsl_histogram2d *h);
0132 
0133 int 
0134 gsl_histogram2d_equal_bins_p(const gsl_histogram2d *h1,
0135                              const gsl_histogram2d *h2) ;
0136 
0137 int
0138 gsl_histogram2d_add(gsl_histogram2d *h1, const gsl_histogram2d *h2);
0139 
0140 int
0141 gsl_histogram2d_sub(gsl_histogram2d *h1, const gsl_histogram2d *h2);
0142 
0143 int
0144 gsl_histogram2d_mul(gsl_histogram2d *h1, const gsl_histogram2d *h2);
0145 
0146 int
0147 gsl_histogram2d_div(gsl_histogram2d *h1, const gsl_histogram2d *h2);
0148 
0149 int
0150 gsl_histogram2d_scale(gsl_histogram2d *h, double scale);
0151 
0152 int
0153 gsl_histogram2d_shift(gsl_histogram2d *h, double shift);
0154 
0155 int gsl_histogram2d_fwrite (FILE * stream, const gsl_histogram2d * h) ;
0156 int gsl_histogram2d_fread (FILE * stream, gsl_histogram2d * h);
0157 int gsl_histogram2d_fprintf (FILE * stream, const gsl_histogram2d * h, 
0158                              const char * range_format,
0159                              const char * bin_format);
0160 int gsl_histogram2d_fscanf (FILE * stream, gsl_histogram2d * h);
0161 
0162 gsl_histogram2d_pdf * gsl_histogram2d_pdf_alloc (const size_t nx, const size_t ny);
0163 int gsl_histogram2d_pdf_init (gsl_histogram2d_pdf * p, const gsl_histogram2d * h);
0164 void gsl_histogram2d_pdf_free (gsl_histogram2d_pdf * p);
0165 int gsl_histogram2d_pdf_sample (const gsl_histogram2d_pdf * p, 
0166                                    double r1, double r2, 
0167                                    double * x, double * y);
0168 
0169 __END_DECLS
0170 
0171 #endif /* __GSL_HISTOGRAM2D_H__ */
0172