File indexing completed on 2025-02-21 10:03:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef __GSL_HISTOGRAM_H__
0021 #define __GSL_HISTOGRAM_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
0033 # define __END_DECLS
0034 #endif
0035
0036 __BEGIN_DECLS
0037
0038 typedef struct {
0039 size_t n ;
0040 double * range ;
0041 double * bin ;
0042 } gsl_histogram ;
0043
0044 typedef struct {
0045 size_t n ;
0046 double * range ;
0047 double * sum ;
0048 } gsl_histogram_pdf ;
0049
0050 gsl_histogram * gsl_histogram_alloc (size_t n);
0051
0052 gsl_histogram * gsl_histogram_calloc (size_t n);
0053 gsl_histogram * gsl_histogram_calloc_uniform (const size_t n, const double xmin, const double xmax);
0054 void gsl_histogram_free (gsl_histogram * h);
0055 int gsl_histogram_increment (gsl_histogram * h, double x);
0056 int gsl_histogram_accumulate (gsl_histogram * h, double x, double weight);
0057 int gsl_histogram_find (const gsl_histogram * h,
0058 const double x, size_t * i);
0059
0060 double gsl_histogram_get (const gsl_histogram * h, size_t i);
0061 int gsl_histogram_get_range (const gsl_histogram * h, size_t i,
0062 double * lower, double * upper);
0063
0064 double gsl_histogram_max (const gsl_histogram * h);
0065 double gsl_histogram_min (const gsl_histogram * h);
0066 size_t gsl_histogram_bins (const gsl_histogram * h);
0067
0068 void gsl_histogram_reset (gsl_histogram * h);
0069
0070 gsl_histogram * gsl_histogram_calloc_range(size_t n, double * range);
0071
0072 int
0073 gsl_histogram_set_ranges (gsl_histogram * h, const double range[], size_t size);
0074 int
0075 gsl_histogram_set_ranges_uniform (gsl_histogram * h, double xmin, double xmax);
0076
0077
0078
0079 int
0080 gsl_histogram_memcpy(gsl_histogram * dest, const gsl_histogram * source);
0081
0082 gsl_histogram *
0083 gsl_histogram_clone(const gsl_histogram * source);
0084
0085 double gsl_histogram_max_val (const gsl_histogram * h);
0086
0087 size_t gsl_histogram_max_bin (const gsl_histogram * h);
0088
0089 double gsl_histogram_min_val (const gsl_histogram * h);
0090
0091 size_t gsl_histogram_min_bin (const gsl_histogram * h);
0092
0093 int
0094 gsl_histogram_equal_bins_p(const gsl_histogram *h1, const gsl_histogram *h2);
0095
0096 int
0097 gsl_histogram_add(gsl_histogram *h1, const gsl_histogram *h2);
0098
0099 int
0100 gsl_histogram_sub(gsl_histogram *h1, const gsl_histogram *h2);
0101
0102 int
0103 gsl_histogram_mul(gsl_histogram *h1, const gsl_histogram *h2);
0104
0105 int
0106 gsl_histogram_div(gsl_histogram *h1, const gsl_histogram *h2);
0107
0108 int
0109 gsl_histogram_scale(gsl_histogram *h, double scale);
0110
0111 int
0112 gsl_histogram_shift (gsl_histogram * h, double shift);
0113
0114
0115 double gsl_histogram_sigma (const gsl_histogram * h);
0116
0117 double gsl_histogram_mean (const gsl_histogram * h);
0118
0119 double gsl_histogram_sum (const gsl_histogram * h);
0120
0121 int gsl_histogram_fwrite (FILE * stream, const gsl_histogram * h) ;
0122 int gsl_histogram_fread (FILE * stream, gsl_histogram * h);
0123 int gsl_histogram_fprintf (FILE * stream, const gsl_histogram * h,
0124 const char * range_format, const char * bin_format);
0125 int gsl_histogram_fscanf (FILE * stream, gsl_histogram * h);
0126
0127 gsl_histogram_pdf * gsl_histogram_pdf_alloc (const size_t n);
0128 int gsl_histogram_pdf_init (gsl_histogram_pdf * p, const gsl_histogram * h);
0129 void gsl_histogram_pdf_free (gsl_histogram_pdf * p);
0130 double gsl_histogram_pdf_sample (const gsl_histogram_pdf * p, double r);
0131
0132 __END_DECLS
0133
0134 #endif