OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/hostdependX86MAC64.git] / util / X86MAC64 / include / gsl / gsl_interp2d.h
1 /* interpolation/gsl_interp2d.h
2  * 
3  * Copyright 2012 David Zaslavsky
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_INTERP2D_H__
21 #define __GSL_INTERP2D_H__
22
23 #include <gsl/gsl_interp.h>
24
25 #undef __BEGIN_DECLS
26 #undef __END_DECLS
27 #ifdef __cplusplus
28 # define __BEGIN_DECLS extern "C" {
29 # define __END_DECLS }
30 #else
31 # define __BEGIN_DECLS /* empty */
32 # define __END_DECLS /* empty */
33 #endif
34
35 __BEGIN_DECLS
36
37 typedef struct {
38     const char* name;
39     unsigned int min_size;
40     void * (*alloc)(size_t xsize, size_t ysize);
41     int    (*init)(void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize);
42     int    (*eval)(const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z);
43     int    (*eval_deriv_x) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_p);
44     int    (*eval_deriv_y) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_p);
45     int    (*eval_deriv_xx) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_pp);
46     int    (*eval_deriv_xy) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_pp);
47     int    (*eval_deriv_yy) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_pp);
48     void   (*free)(void *);
49 } gsl_interp2d_type;
50
51 typedef struct {
52     const gsl_interp2d_type * type; /* interpolation type */
53     double xmin;                    /* minimum value of x for which data have been provided */
54     double xmax;                    /* maximum value of x for which data have been provided */
55     double ymin;                    /* minimum value of y for which data have been provided */
56     double ymax;                    /* maximum value of y for which data have been provided */
57     size_t xsize;                   /* number of x values provided */
58     size_t ysize;                   /* number of y values provided */
59     void * state;                   /* internal state object specific to the interpolation type */
60 } gsl_interp2d;
61
62 /* available types */
63 GSL_VAR const gsl_interp2d_type * gsl_interp2d_bilinear;
64 GSL_VAR const gsl_interp2d_type * gsl_interp2d_bicubic;
65
66 gsl_interp2d * gsl_interp2d_alloc(const gsl_interp2d_type * T, const size_t xsize,
67                                   const size_t ysize);
68
69 const char * gsl_interp2d_name(const gsl_interp2d * interp);
70 size_t gsl_interp2d_min_size(const gsl_interp2d * interp);
71 size_t gsl_interp2d_type_min_size(const gsl_interp2d_type * T);
72 int gsl_interp2d_set(const gsl_interp2d * interp, double zarr[],
73                      const size_t i, const size_t j, const double z);
74 double gsl_interp2d_get(const gsl_interp2d * interp, const double zarr[],
75                         const size_t i, const size_t j);
76 size_t gsl_interp2d_idx(const gsl_interp2d * interp,
77                         const size_t i, const size_t j);
78 int gsl_interp2d_init(gsl_interp2d * interp, const double xa[], const double ya[],
79                       const double za[], const size_t xsize, const size_t ysize);
80 void gsl_interp2d_free(gsl_interp2d * interp);
81
82 double gsl_interp2d_eval(const gsl_interp2d * interp, const double xarr[],
83                          const double yarr[], const double zarr[], const double x,
84                          const double y, gsl_interp_accel * xa, gsl_interp_accel * ya);
85
86 double gsl_interp2d_eval_extrap(const gsl_interp2d * interp,
87                                 const double xarr[], const double yarr[],
88                                 const double zarr[], const double x,
89                                 const double y, gsl_interp_accel * xa,
90                                 gsl_interp_accel * ya);
91
92 int gsl_interp2d_eval_e(const gsl_interp2d * interp, const double xarr[],
93                         const double yarr[], const double zarr[],
94                         const double x, const double y, gsl_interp_accel* xa,
95                         gsl_interp_accel* ya, double * z);
96
97 #ifndef GSL_DISABLE_DEPRECATED
98
99 int gsl_interp2d_eval_e_extrap(const gsl_interp2d * interp,
100                                const double xarr[],
101                                const double yarr[],
102                                const double zarr[],
103                                const double x,
104                                const double y,
105                                gsl_interp_accel * xa,
106                                gsl_interp_accel * ya,
107                                double * z);
108
109 #endif /* !GSL_DISABLE_DEPRECATED */
110
111 int gsl_interp2d_eval_extrap_e(const gsl_interp2d * interp,
112                                const double xarr[],
113                                const double yarr[],
114                                const double zarr[],
115                                const double x,
116                                const double y,
117                                gsl_interp_accel * xa,
118                                gsl_interp_accel * ya,
119                                double * z);
120
121 double gsl_interp2d_eval_deriv_x(const gsl_interp2d * interp, const double xarr[],
122                                  const double yarr[], const double zarr[],
123                                  const double x, const double y, gsl_interp_accel * xa,
124                                  gsl_interp_accel * ya);
125
126 int gsl_interp2d_eval_deriv_x_e(const gsl_interp2d * interp, const double xarr[],
127                                 const double yarr[], const double zarr[],
128                                 const double x, const double y,
129                                 gsl_interp_accel * xa, gsl_interp_accel * ya, double * z);
130
131 double gsl_interp2d_eval_deriv_y(const gsl_interp2d * interp, const double xarr[],
132                                  const double yarr[], const double zarr[],
133                                  const double x, const double y,
134                                  gsl_interp_accel* xa, gsl_interp_accel* ya);
135
136 int gsl_interp2d_eval_deriv_y_e(const gsl_interp2d * interp, const double xarr[],
137                                 const double yarr[], const double zarr[],
138                                 const double x, const double y,
139                                 gsl_interp_accel * xa, gsl_interp_accel * ya, double * z);
140
141 double gsl_interp2d_eval_deriv_xx(const gsl_interp2d * interp, const double xarr[],
142                                   const double yarr[], const double zarr[],
143                                   const double x, const double y,
144                                   gsl_interp_accel * xa, gsl_interp_accel * ya);
145
146 int gsl_interp2d_eval_deriv_xx_e(const gsl_interp2d * interp, const double xarr[],
147                                  const double yarr[], const double zarr[],
148                                  const double x, const double y,
149                                  gsl_interp_accel * xa, gsl_interp_accel * ya, double * z);
150
151 double gsl_interp2d_eval_deriv_yy(const gsl_interp2d * interp, const double xarr[],
152                                   const double yarr[], const double zarr[],
153                                   const double x, const double y,
154                                   gsl_interp_accel * xa, gsl_interp_accel * ya);
155
156 int gsl_interp2d_eval_deriv_yy_e(const gsl_interp2d * interp, const double xarr[],
157                                  const double yarr[], const double zarr[],
158                                  const double x, const double y,
159                                  gsl_interp_accel * xa, gsl_interp_accel * ya, double * z);
160
161 double gsl_interp2d_eval_deriv_xy(const gsl_interp2d * interp, const double xarr[],
162                                   const double yarr[], const double zarr[],
163                                   const double x, const double y,
164                                   gsl_interp_accel * xa, gsl_interp_accel * ya);
165
166 int gsl_interp2d_eval_deriv_xy_e(const gsl_interp2d * interp, const double xarr[],
167                                  const double yarr[], const double zarr[],
168                                  const double x, const double y,
169                                  gsl_interp_accel * xa, gsl_interp_accel * ya, double * z);
170
171
172 __END_DECLS
173
174 #endif /* __GSL_INTERP2D_H__ */