carray-gsl 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1620 @@
1
+ /* ---------------------------------------------------------------------------
2
+
3
+ carray/carray_mathfunc_gsl.c
4
+
5
+ This file is part of Ruby/CArray extension library.
6
+ You can redistribute it and/or modify it under the terms of
7
+ the GNU General Public License (GPL).
8
+
9
+ Copyright (C) 2005-2008 Hiroki Motoyoshi
10
+
11
+ ---------------------------------------------------------------------------- */
12
+
13
+ #include "ruby.h"
14
+ #include "carray.h"
15
+ #include <math.h>
16
+
17
+ #include <gsl/gsl_sf_bessel.h>
18
+ #include <gsl/gsl_sf.h>
19
+ #include <gsl/gsl_rng.h>
20
+ #include <gsl/gsl_randist.h>
21
+ #include <gsl/gsl_cdf.h>
22
+
23
+ static gsl_rng *camath_gsl_rng;
24
+
25
+ /* ----------------------------------------------------------------------- */
26
+
27
+ #define rb_camath_gsl_func_d_d(grp, name) \
28
+ static void \
29
+ mathfunc_##name (void *p0, void *p1) \
30
+ { \
31
+ *(double *)p0 = gsl_##grp##_##name(*(double*)p1); \
32
+ } \
33
+ static VALUE \
34
+ rb_camath_##name (VALUE mod, VALUE rx) \
35
+ { \
36
+ return ca_call_cfunc_1_1(CA_DOUBLE, CA_DOUBLE, mathfunc_##name, rx); \
37
+ } \
38
+ static VALUE \
39
+ rb_ca_##name (VALUE rx) \
40
+ { \
41
+ return ca_call_cfunc_1_1(CA_DOUBLE, CA_DOUBLE, mathfunc_##name, rx); \
42
+ } \
43
+
44
+ #define rb_camath_gsl_func_d_i(grp, name) \
45
+ static void \
46
+ mathfunc_##name (void *p0, void *p1) \
47
+ { \
48
+ *(double *)p0 = gsl_##grp##_##name(*(int*)p1); \
49
+ } \
50
+ static VALUE \
51
+ rb_camath_##name (VALUE mod, VALUE rx) \
52
+ { \
53
+ return ca_call_cfunc_1_1(CA_DOUBLE, CA_INT, mathfunc_##name, rx); \
54
+ } \
55
+ static VALUE \
56
+ rb_ca_##name (VALUE rx) \
57
+ { \
58
+ return ca_call_cfunc_1_1(CA_DOUBLE, CA_INT, mathfunc_##name, rx); \
59
+ } \
60
+
61
+ #define rb_camath_gsl_func_d_dd(grp, name) \
62
+ static void \
63
+ mathfunc_##name (void *p0, void *p1, void *p2) \
64
+ { \
65
+ *(double *)p0 = gsl_##grp##_##name(*(double*)p1, *(double*)p2); \
66
+ } \
67
+ static VALUE \
68
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2) \
69
+ { \
70
+ return ca_call_cfunc_1_2(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, mathfunc_##name, rx1, rx2); \
71
+ } \
72
+ static VALUE \
73
+ rb_ca_##name (VALUE rx1, VALUE rx2) \
74
+ { \
75
+ return ca_call_cfunc_1_2(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, mathfunc_##name, rx1, rx2); \
76
+ } \
77
+
78
+ #define rb_camath_gsl_func_d_id(grp, name) \
79
+ static void \
80
+ mathfunc_##name (void *p0, void *p1, void *p2) \
81
+ { \
82
+ *(double *)p0 = gsl_##grp##_##name(*(int*)p1, *(double*)p2); \
83
+ } \
84
+ static VALUE \
85
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2) \
86
+ { \
87
+ return ca_call_cfunc_1_2(CA_DOUBLE, CA_INT, CA_DOUBLE, mathfunc_##name, rx1, rx2); \
88
+ } \
89
+ static VALUE \
90
+ rb_ca_##name (VALUE rx1, VALUE rx2) \
91
+ { \
92
+ return ca_call_cfunc_1_2(CA_DOUBLE, CA_INT, CA_DOUBLE, mathfunc_##name, rx1, rx2); \
93
+ } \
94
+
95
+ #define rb_camath_gsl_func_d_di(grp, name) \
96
+ static void \
97
+ mathfunc_##name (void *p0, void *p1, void *p2) \
98
+ { \
99
+ *(double *)p0 = gsl_##grp##_##name(*(double*)p1, *(int*)p2); \
100
+ } \
101
+ static VALUE \
102
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2) \
103
+ { \
104
+ return ca_call_cfunc_1_2(CA_DOUBLE, CA_DOUBLE, CA_INT, mathfunc_##name, rx1, rx2); \
105
+ } \
106
+ static VALUE \
107
+ rb_ca_##name (VALUE rx1, VALUE rx2) \
108
+ { \
109
+ return ca_call_cfunc_1_2(CA_DOUBLE, CA_DOUBLE, CA_INT, mathfunc_##name, rx1, rx2); \
110
+ } \
111
+
112
+ #define rb_camath_gsl_func_d_ii(grp, name) \
113
+ static void \
114
+ mathfunc_##name (void *p0, void *p1, void *p2) \
115
+ { \
116
+ *(double *)p0 = gsl_##grp##_##name(*(int*)p1, *(int*)p2); \
117
+ } \
118
+ static VALUE \
119
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2) \
120
+ { \
121
+ return ca_call_cfunc_1_2(CA_DOUBLE, CA_INT, CA_INT, mathfunc_##name, rx1, rx2); \
122
+ } \
123
+ static VALUE \
124
+ rb_ca_##name (VALUE rx1, VALUE rx2) \
125
+ { \
126
+ return ca_call_cfunc_1_2(CA_DOUBLE, CA_INT, CA_INT, mathfunc_##name, rx1, rx2); \
127
+ } \
128
+
129
+ #define rb_camath_gsl_func_d_ddd(grp, name) \
130
+ static void \
131
+ mathfunc_##name (void *p0, void *p1, void *p2, void *p3) \
132
+ { \
133
+ *(double *)p0 = gsl_##grp##_##name(*(double*)p1, *(double*)p2, *(double*)p3); \
134
+ } \
135
+ static VALUE \
136
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3) \
137
+ { \
138
+ return ca_call_cfunc_1_3(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, mathfunc_##name, rx1, rx2, rx3); \
139
+ } \
140
+ static VALUE \
141
+ rb_ca_##name (VALUE rx1, VALUE rx2, VALUE rx3) \
142
+ { \
143
+ return ca_call_cfunc_1_3(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, mathfunc_##name, rx1, rx2, rx3); \
144
+ } \
145
+
146
+ #define rb_camath_gsl_func_d_ddi(grp, name) \
147
+ static void \
148
+ mathfunc_##name (void *p0, void *p1, void *p2, void *p3) \
149
+ { \
150
+ *(double *)p0 = gsl_##grp##_##name(*(double*)p1, *(double*)p2, *(int*)p3); \
151
+ } \
152
+ static VALUE \
153
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3) \
154
+ { \
155
+ return ca_call_cfunc_1_3(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_INT, mathfunc_##name, rx1, rx2, rx3); \
156
+ } \
157
+
158
+
159
+ #define rb_camath_gsl_func_d_idd(grp, name) \
160
+ static void \
161
+ mathfunc_##name (void *p0, void *p1, void *p2, void *p3) \
162
+ { \
163
+ *(double *)p0 = gsl_##grp##_##name(*(int*)p1, *(double*)p2, *(double*)p3); \
164
+ } \
165
+ static VALUE \
166
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3) \
167
+ { \
168
+ return ca_call_cfunc_1_3(CA_DOUBLE, CA_INT, CA_DOUBLE, CA_DOUBLE, mathfunc_##name, rx1, rx2, rx3); \
169
+ } \
170
+ static VALUE \
171
+ rb_ca_##name (VALUE rx1, VALUE rx2, VALUE rx3) \
172
+ { \
173
+ return ca_call_cfunc_1_3(CA_DOUBLE, CA_INT, CA_DOUBLE, CA_DOUBLE, mathfunc_##name, rx1, rx2, rx3); \
174
+ } \
175
+
176
+ #define rb_camath_gsl_func_d_idi(grp, name) \
177
+ static void \
178
+ mathfunc_##name (void *p0, void *p1, void *p2, void *p3) \
179
+ { \
180
+ *(double *)p0 = gsl_##grp##_##name(*(int*)p1, *(double*)p2, *(int*)p3); \
181
+ } \
182
+ static VALUE \
183
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3) \
184
+ { \
185
+ return ca_call_cfunc_1_3(CA_DOUBLE, CA_INT, CA_DOUBLE, CA_INT, mathfunc_##name, rx1, rx2, rx3); \
186
+ } \
187
+
188
+ #define rb_camath_gsl_func_d_iid(grp, name) \
189
+ static void \
190
+ mathfunc_##name (void *p0, void *p1, void *p2, void *p3) \
191
+ { \
192
+ *(double *)p0 = gsl_##grp##_##name(*(int*)p1, *(int*)p2, *(double*)p3); \
193
+ } \
194
+ static VALUE \
195
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3) \
196
+ { \
197
+ return ca_call_cfunc_1_3(CA_DOUBLE, CA_INT, CA_INT, CA_DOUBLE, mathfunc_##name, rx1, rx2, rx3); \
198
+ } \
199
+ static VALUE \
200
+ rb_ca_##name (VALUE rx1, VALUE rx2, VALUE rx3) \
201
+ { \
202
+ return ca_call_cfunc_1_3(CA_DOUBLE, CA_INT, CA_INT, CA_DOUBLE, mathfunc_##name, rx1, rx2, rx3); \
203
+ } \
204
+
205
+ #define rb_camath_gsl_func_d_dddd(grp, name) \
206
+ static void \
207
+ mathfunc_##name (void *p0, void *p1, void *p2, void *p3, void *p4) \
208
+ { \
209
+ *(double *)p0 = gsl_##grp##_##name(*(double*)p1, *(double*)p2, *(double*)p3, *(double*)p4); \
210
+ } \
211
+ static VALUE \
212
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3, VALUE rx4) \
213
+ { \
214
+ return ca_call_cfunc_1_4(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, mathfunc_##name, rx1, rx2, rx3, rx4); \
215
+ } \
216
+ static VALUE \
217
+ rb_ca_##name (VALUE rx1, VALUE rx2, VALUE rx3, VALUE rx4) \
218
+ { \
219
+ return ca_call_cfunc_1_4(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, mathfunc_##name, rx1, rx2, rx3, rx4); \
220
+ } \
221
+
222
+ #define rb_camath_gsl_func_d_dddi(grp, name) \
223
+ static void \
224
+ mathfunc_##name (void *p0, void *p1, void *p2, void *p3, void *p4) \
225
+ { \
226
+ *(double *)p0 = gsl_##grp##_##name(*(double*)p1, *(double*)p2, *(double*)p3, *(int*)p4); \
227
+ } \
228
+ static VALUE \
229
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3, VALUE rx4) \
230
+ { \
231
+ return ca_call_cfunc_1_4(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_INT, mathfunc_##name, rx1, rx2, rx3, rx4); \
232
+ } \
233
+
234
+
235
+ #define rb_camath_gsl_func_d_iidd(grp, name) \
236
+ static void \
237
+ mathfunc_##name (void *p0, void *p1, void *p2, void *p3, void *p4) \
238
+ { \
239
+ *(double *)p0 = gsl_##grp##_##name(*(int*)p1, *(int*)p2, *(double*)p3, *(double*)p4); \
240
+ } \
241
+ static VALUE \
242
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3, VALUE rx4) \
243
+ { \
244
+ return ca_call_cfunc_1_4(CA_DOUBLE, CA_INT, CA_INT, CA_DOUBLE, CA_DOUBLE, mathfunc_##name, rx1, rx2, rx3, rx4); \
245
+ } \
246
+ static VALUE \
247
+ rb_ca_##name (VALUE rx1, VALUE rx2, VALUE rx3, VALUE rx4) \
248
+ { \
249
+ return ca_call_cfunc_1_4(CA_DOUBLE, CA_INT, CA_INT, CA_DOUBLE, CA_DOUBLE, mathfunc_##name, rx1, rx2, rx3, rx4); \
250
+ } \
251
+
252
+ #define rb_camath_gsl_func_d_iiii(grp, name) \
253
+ static void \
254
+ mathfunc_##name (void *p0, void *p1, void *p2, void *p3, void *p4) \
255
+ { \
256
+ *(double *)p0 = gsl_##grp##_##name(*(int*)p1, *(int*)p2, *(int*)p3, *(int*)p4); \
257
+ } \
258
+ static VALUE \
259
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3, VALUE rx4) \
260
+ { \
261
+ return ca_call_cfunc_1_4(CA_DOUBLE, CA_INT, CA_INT, CA_INT, CA_INT, mathfunc_##name, rx1, rx2, rx3, rx4); \
262
+ } \
263
+
264
+ #define rb_camath_gsl_func_d_ddddi(grp, name) \
265
+ static void \
266
+ mathfunc_##name (void *p0, void *p1, void *p2, void *p3, void *p4, void *p5) \
267
+ { \
268
+ *(double *)p0 = gsl_##grp##_##name(*(double*)p1, *(double*)p2, *(double*)p3, *(double*)p4, *(int*)p5); \
269
+ } \
270
+ static VALUE \
271
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3, VALUE rx4, VALUE rx5) \
272
+ { \
273
+ return ca_call_cfunc_1_5(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_INT, mathfunc_##name, rx1, rx2, rx3, rx4, rx5); \
274
+ } \
275
+
276
+
277
+ #define rb_camath_gsl_func_d_ddddd(grp, name) \
278
+ static void \
279
+ mathfunc_##name (void *p0, void *p1, void *p2, void *p3, void *p4, void *p5) \
280
+ { \
281
+ *(double *)p0 = gsl_##grp##_##name(*(double*)p1, *(double*)p2, *(double*)p3, *(double*)p4, *(double*)p5); \
282
+ } \
283
+ static VALUE \
284
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3, VALUE rx4, VALUE rx5) \
285
+ { \
286
+ return ca_call_cfunc_1_5(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, mathfunc_##name, rx1, rx2, rx3, rx4, rx5); \
287
+ } \
288
+
289
+ #define rb_camath_gsl_func_d_iiiiii(grp, name) \
290
+ static void \
291
+ mathfunc_##name (void *p0, void *p1, void *p2, void *p3, void *p4, void *p5, void *p6) \
292
+ { \
293
+ *(double *)p0 = gsl_##grp##_##name(*(int*)p1, *(int*)p2, *(int*)p3, *(int*)p4, *(int*)p5, *(int*)p6); \
294
+ } \
295
+ static VALUE \
296
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3, VALUE rx4, VALUE rx5, VALUE rx6) \
297
+ { \
298
+ return ca_call_cfunc_1_6(CA_DOUBLE, CA_INT, CA_INT, CA_INT, CA_INT, CA_INT, CA_INT, mathfunc_##name, rx1, rx2, rx3, rx4, rx5, rx6); \
299
+ } \
300
+
301
+ /* ----------------------------------------------------------------------- */
302
+
303
+ #define rb_camath_gsl_func_dd_dd(grp, name, ext) \
304
+ static void \
305
+ mathfunc_##name (void *p0, void *p1, void *p2, void *p3) \
306
+ { \
307
+ gsl_sf_result r0, r1; \
308
+ gsl_##grp##_##name##ext(*(double*)p2, *(double*)p3, &r0, &r1); \
309
+ *(double*) p0 = r0.val; *(double*) p1 = r1.val; \
310
+ } \
311
+ static VALUE \
312
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2) \
313
+ { \
314
+ return ca_call_cfunc_2_2(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, mathfunc_##name, rx1, rx2); \
315
+ } \
316
+
317
+ #define rb_camath_gsl_func_ddd_dd(grp, name, ext) \
318
+ static void \
319
+ mathfunc_##name (void *p0, void *p1, void *p2, void *p3, void *p4) \
320
+ { \
321
+ gsl_sf_result r0, r1, r2; \
322
+ gsl_##grp##_##name##ext(*(double*)p2, *(double*)p3, (double*)&r0, (double*)&r1, (double*)&r2); \
323
+ *(double*) p0 = r0.val; *(double*) p1 = r1.val; *(double*) p2 = r2.val; \
324
+ } \
325
+ static VALUE \
326
+ rb_camath_##name (VALUE mod, VALUE rx1, VALUE rx2) \
327
+ { \
328
+ return ca_call_cfunc_3_2(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, mathfunc_##name, rx1, rx2); \
329
+ } \
330
+
331
+ /* ----------------------------------------------------------------------- */
332
+
333
+ #define rb_camath_gsl_rng_d_d(name) \
334
+ static void \
335
+ mathfunc_random_##name (void *p0, void *p1) \
336
+ { \
337
+ *(double *)p0 = gsl_ran_##name(camath_gsl_rng); \
338
+ } \
339
+ static VALUE \
340
+ rb_camath_random_##name (VALUE mod, VALUE rx) \
341
+ { \
342
+ return ca_call_cfunc_1_1(CA_DOUBLE, CA_DOUBLE, mathfunc_random_##name, rx); \
343
+ } \
344
+
345
+ #define rb_camath_gsl_rng_d_dd(name) \
346
+ static void \
347
+ mathfunc_random_##name (void *p0, void *p1, void *p2) \
348
+ { \
349
+ *(double *)p0 = gsl_ran_##name(camath_gsl_rng, *(double*)p2); \
350
+ } \
351
+ static VALUE \
352
+ rb_camath_random_##name (VALUE mod, VALUE rx1, VALUE rx2) \
353
+ { \
354
+ return ca_call_cfunc_1_2(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, mathfunc_random_##name, rx1, rx2); \
355
+ } \
356
+
357
+ #define rb_camath_gsl_rng_d_ddd(name) \
358
+ static void \
359
+ mathfunc_random_##name (void *p0, void *p1, void *p2, void *p3) \
360
+ { \
361
+ *(double *)p0 = gsl_ran_##name(camath_gsl_rng, *(double*)p2, *(double*)p3); \
362
+ } \
363
+ static VALUE \
364
+ rb_camath_random_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3) \
365
+ { \
366
+ return ca_call_cfunc_1_3(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, mathfunc_random_##name, rx1, rx2, rx3); \
367
+ } \
368
+
369
+ #define rb_camath_gsl_rng_d_ddi(name) \
370
+ static void \
371
+ mathfunc_random_##name (void *p0, void *p1, void *p2, void *p3) \
372
+ { \
373
+ *(double *)p0 = gsl_ran_##name(camath_gsl_rng, *(double*)p2, *(int*)p3); \
374
+ } \
375
+ static VALUE \
376
+ rb_camath_random_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3) \
377
+ { \
378
+ return ca_call_cfunc_1_3(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_INT, mathfunc_random_##name, rx1, rx2, rx3); \
379
+ } \
380
+
381
+ #define rb_camath_gsl_rng_d_dddd(name) \
382
+ static void \
383
+ mathfunc_random_##name (void *p0, void *p1, void *p2, void *p3, void *p4) \
384
+ { \
385
+ *(double *)p0 = gsl_ran_##name(camath_gsl_rng, *(double*)p2, *(double*)p3, *(double *)p4); \
386
+ } \
387
+ static VALUE \
388
+ rb_camath_random_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3, VALUE rx4) \
389
+ { \
390
+ return ca_call_cfunc_1_4(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, mathfunc_random_##name, rx1, rx2, rx3, rx4); \
391
+ } \
392
+
393
+ #define rb_camath_gsl_rng_d_diii(name) \
394
+ static void \
395
+ mathfunc_random_##name (void *p0, void *p1, void *p2, void *p3, void *p4) \
396
+ { \
397
+ *(double *)p0 = gsl_ran_##name(camath_gsl_rng, *(int*)p2, *(int*)p3, *(int *)p4); \
398
+ } \
399
+ static VALUE \
400
+ rb_camath_random_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3, VALUE rx4) \
401
+ { \
402
+ return ca_call_cfunc_1_4(CA_DOUBLE, CA_DOUBLE, CA_INT, CA_INT, CA_INT, mathfunc_random_##name, rx1, rx2, rx3, rx4); \
403
+ } \
404
+
405
+ #define rb_camath_gsl_rng_dd_ddd(name) \
406
+ static void \
407
+ mathfunc_random_##name (void *p0, void *p1, void *p2, void *p3, void *p4) \
408
+ { \
409
+ gsl_ran_##name(camath_gsl_rng, *(double*)p2, *(double*)p3, *(double *)p4, (double*)p0, (double*)p1); \
410
+ } \
411
+ static VALUE \
412
+ rb_camath_random_##name (VALUE mod, VALUE rx1, VALUE rx2, VALUE rx3) \
413
+ { \
414
+ return ca_call_cfunc_2_3(CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, CA_DOUBLE, mathfunc_random_##name, rx1, rx2, rx3); \
415
+ } \
416
+
417
+ /* ----------------------------------------------------------------------- */
418
+
419
+ #define rb_define_camath_gsl_func(name, n) \
420
+ rb_define_module_function(rb_mCAMath, #name, rb_camath_##name, n)
421
+
422
+ #define rb_define_camath_gsl_func2(name, n) \
423
+ rb_define_module_function(rb_mCAMath, #name, rb_camath_##name, n); \
424
+ rb_define_method(rb_cCArray, #name, rb_ca_##name, n-1)
425
+
426
+ #define rb_define_camath_gsl_func2_(name, n) \
427
+ rb_define_module_function(rb_mCAMath, #name "_", rb_camath_##name, n); \
428
+ rb_define_method(rb_cCArray, #name "_", rb_ca_##name, n-1)
429
+
430
+ #define rb_define_camath_gsl_func2u(name, n) \
431
+ rb_define_module_function(rb_mCAMath, #name, rb_camath_##name, n); \
432
+ rb_define_method(rb_cCArray, #name, rb_ca_##name, n-1); \
433
+ rb_undef(rb_cCArray, rb_intern(#name)); \
434
+
435
+ /* ----------------------------------------------------------------------- */
436
+
437
+ static VALUE
438
+ rb_camath_random_dir_2d (VALUE mod, VALUE vn)
439
+ {
440
+ CArray *cx, *cy;
441
+ double *px, *py;
442
+ int32_t elements = NUM2INT(vn), i;
443
+ cx = carray_new(CA_DOUBLE, 1, &elements, 0, NULL);
444
+ cy = carray_new(CA_DOUBLE, 1, &elements, 0, NULL);
445
+ px = (double*) cx->ptr;
446
+ py = (double*) cy->ptr;
447
+ for (i=0; i<elements; i++) {
448
+ gsl_ran_dir_2d(camath_gsl_rng, px, py) ;
449
+ px++; py++;
450
+ }
451
+ if ( elements == 1 ) {
452
+ volatile VALUE out = rb_ary_new3(2, rb_float_new(*(double*)cx->ptr),
453
+ rb_float_new(*(double*)cy->ptr));
454
+ ca_free(cx);
455
+ ca_free(cy);
456
+ return out;
457
+ }
458
+ else {
459
+ return rb_ary_new3(2, ca_wrap_struct(cx), ca_wrap_struct(cy));
460
+ }
461
+ }
462
+
463
+ static VALUE
464
+ rb_camath_random_dir_3d (VALUE mod, VALUE vn)
465
+ {
466
+ CArray *cx, *cy, *cz;
467
+ double *px, *py, *pz;
468
+ int32_t elements = NUM2INT(vn), i;
469
+ cx = carray_new(CA_DOUBLE, 1, &elements, 0, NULL);
470
+ cy = carray_new(CA_DOUBLE, 1, &elements, 0, NULL);
471
+ cz = carray_new(CA_DOUBLE, 1, &elements, 0, NULL);
472
+ px = (double*) cx->ptr;
473
+ py = (double*) cy->ptr;
474
+ pz = (double*) cz->ptr;
475
+ for (i=0; i<elements; i++) {
476
+ gsl_ran_dir_3d(camath_gsl_rng, px, py, pz) ;
477
+ px++; py++; pz++;
478
+ }
479
+ if ( elements == 1 ) {
480
+ volatile VALUE out = rb_ary_new3(3, rb_float_new(*(double*)cx->ptr),
481
+ rb_float_new(*(double*)cy->ptr),
482
+ rb_float_new(*(double*)cz->ptr));
483
+ ca_free(cx);
484
+ ca_free(cy);
485
+ ca_free(cz);
486
+ return out;
487
+ }
488
+ else {
489
+ return rb_ary_new3(3, ca_wrap_struct(cx),
490
+ ca_wrap_struct(cy),
491
+ ca_wrap_struct(cz));
492
+ }
493
+ }
494
+
495
+ static VALUE
496
+ rb_camath_random_dir_nd (VALUE mod, VALUE vn, VALUE vd)
497
+ {
498
+ volatile VALUE out;
499
+ CArray **ca;
500
+ double **p;
501
+ double *pv;
502
+ int32_t d = NUM2INT(vd), elements = NUM2INT(vn), k, i;
503
+ if ( d < 0 ) {
504
+ rb_raise(rb_eArgError, "dimension should be positive number");
505
+ }
506
+ if ( elements < 0 ) {
507
+ rb_raise(rb_eArgError, "elements should be positive number");
508
+ }
509
+ ca = ALLOC_N(CArray*, d);
510
+ p = ALLOC_N(double*, d);
511
+ pv = ALLOC_N(double, d);
512
+ for (k=0; k<d; k++) {
513
+ ca[k] = carray_new(CA_DOUBLE, 1, &elements, 0, NULL);
514
+ p[k] = (double*) ca[k]->ptr;
515
+ }
516
+ for (i=0; i<elements; i++) {
517
+ gsl_ran_dir_nd(camath_gsl_rng, d, pv);
518
+ for (k=0; k<d; k++) {
519
+ *(p[k]) = pv[k];
520
+ p[k]++;
521
+ }
522
+ }
523
+ out = rb_ary_new();
524
+ if ( elements == 1 ) {
525
+ for (k=0; k<d; k++) {
526
+ rb_ary_store(out, k, rb_float_new(*(double*)ca[k]->ptr));
527
+ ca_free(ca[k]);
528
+ }
529
+ }
530
+ else {
531
+ for (k=0; k<d; k++) {
532
+ rb_ary_store(out, k, ca_wrap_struct(ca[k]));
533
+ }
534
+ }
535
+ free(ca);
536
+ free(p);
537
+ free(pv);
538
+ return out;
539
+ }
540
+
541
+ static VALUE
542
+ rb_camath_random_multinomial (VALUE mod,
543
+ VALUE vn, VALUE vm, volatile VALUE vpk)
544
+ {
545
+ volatile VALUE out;
546
+ CArray *cpk;
547
+ CArray **ca;
548
+ unsigned int **pn;
549
+ unsigned int *pv;
550
+ int32_t elements, i, k, d, m;
551
+ m = NUM2INT(vm);
552
+ if ( m <0 ) {
553
+ rb_raise(rb_eArgError, "# of tries should be positive number");
554
+ }
555
+ elements = NUM2INT(vn);
556
+ if ( elements < 0 ) {
557
+ rb_raise(rb_eArgError, "elements should be positive number");
558
+ }
559
+
560
+ cpk = ca_wrap_readonly(vpk, CA_DOUBLE);
561
+ d = cpk->elements;
562
+
563
+ ca = ALLOC_N(CArray*, d);
564
+ pn = ALLOC_N(unsigned int*, d);
565
+ pv = ALLOC_N(unsigned int, d);
566
+
567
+ for (k=0; k<d; k++) {
568
+ ca[k] = carray_new(CA_INT32, 1, &elements, 0, NULL);
569
+ pn[k] = (unsigned int*) ca[k]->ptr;
570
+ }
571
+
572
+ ca_attach(cpk);
573
+ for (i=0; i<elements; i++) {
574
+ gsl_ran_multinomial(camath_gsl_rng, d, m, (double*)cpk->ptr, pv);
575
+ for (k=0; k<d; k++) {
576
+ *(pn[k]) = pv[k];
577
+ pn[k]++;
578
+ }
579
+ }
580
+ ca_detach(cpk);
581
+
582
+ out = rb_ary_new();
583
+ if ( elements == 1 ) {
584
+ for (k=0; k<d; k++) {
585
+ rb_ary_store(out, k, INT2NUM(*(unsigned int*)ca[k]->ptr));
586
+ ca_free(ca[k]);
587
+ }
588
+ }
589
+ else {
590
+ for (k=0; k<d; k++) {
591
+ rb_ary_store(out, k, ca_wrap_struct(ca[k]));
592
+ }
593
+ }
594
+ free(ca);
595
+ free(pn);
596
+ free(pv);
597
+ return out;
598
+ }
599
+
600
+ static VALUE
601
+ rb_camath_multinomial_pdf (VALUE mod,
602
+ VALUE vnk, volatile VALUE vpk)
603
+ {
604
+ volatile VALUE out, tmp;
605
+ CArray *cpk, *cy;
606
+ CArray **ca;
607
+ unsigned int **pn;
608
+ unsigned int *pv;
609
+ double *py;
610
+ int32_t elements, i, k, d;
611
+
612
+ Check_Type(vnk, T_ARRAY);
613
+
614
+ cpk = ca_wrap_readonly(vpk, CA_DOUBLE);
615
+ d = cpk->elements;
616
+
617
+ if ( RARRAY_LEN(vnk) != d ) {
618
+ rb_raise(rb_eArgError, "# of nk should equal # of pk");
619
+ }
620
+
621
+ ca = ALLOC_N(CArray*, d);
622
+ pn = ALLOC_N(unsigned int*, d);
623
+ pv = ALLOC_N(unsigned int, d);
624
+
625
+ for (k=0; k<d; k++) {
626
+ tmp = rb_ary_entry(vnk, k);
627
+ ca[k] = ca_wrap_readonly(tmp, CA_INT32);
628
+ }
629
+
630
+ elements = ca[0]->elements;
631
+ for (k=1; k<d; k++) {
632
+ if ( elements != ca[k]->elements ) {
633
+ rb_raise(rb_eArgError, "element size mismatch in nk");
634
+ }
635
+ }
636
+
637
+ for (k=0; k<d; k++) {
638
+ ca_attach(ca[k]);
639
+ pn[k] = (unsigned int*) ca[k]->ptr;
640
+ }
641
+
642
+ cy = carray_new(CA_DOUBLE, 1, &elements, 0, NULL);
643
+ py = (double*)cy->ptr;
644
+
645
+ ca_attach(cpk);
646
+ for (i=0; i<elements; i++) {
647
+ for (k=0; k<d; k++) {
648
+ pv[k] = *(pn[k]);
649
+ pn[k]++;
650
+ }
651
+ *py = gsl_ran_multinomial_pdf(d, (double*)cpk->ptr, pv);
652
+ py++;
653
+ }
654
+ ca_detach(cpk);
655
+
656
+ if ( elements == 1 ) {
657
+ out = rb_float_new(*(double*)cy->ptr);
658
+ ca_free(cy);
659
+ }
660
+ else {
661
+ out = ca_wrap_struct(cy);
662
+ }
663
+
664
+ for (k=0; k<d; k++) {
665
+ ca_detach(ca[k]);
666
+ }
667
+
668
+ free(ca);
669
+ free(pn);
670
+ free(pv);
671
+ return out;
672
+ }
673
+
674
+ static VALUE
675
+ rb_camath_multinomial_lnpdf (VALUE mod,
676
+ VALUE vnk, volatile VALUE vpk)
677
+ {
678
+ volatile VALUE out, tmp;
679
+ CArray *cpk, *cy;
680
+ CArray **ca;
681
+ unsigned int **pn;
682
+ unsigned int *pv;
683
+ double *py;
684
+ int32_t elements, i, k, d;
685
+
686
+ Check_Type(vnk, T_ARRAY);
687
+
688
+ cpk = ca_wrap_readonly(vpk, CA_DOUBLE);
689
+ d = cpk->elements;
690
+
691
+ if ( RARRAY_LEN(vnk) != d ) {
692
+ rb_raise(rb_eArgError, "# of nk should equal # of pk");
693
+ }
694
+
695
+ ca = ALLOC_N(CArray*, d);
696
+ pn = ALLOC_N(unsigned int*, d);
697
+ pv = ALLOC_N(unsigned int, d);
698
+
699
+ for (k=0; k<d; k++) {
700
+ tmp = rb_ary_entry(vnk, k);
701
+ ca[k] = ca_wrap_readonly(tmp, CA_INT32);
702
+ }
703
+
704
+ elements = ca[0]->elements;
705
+ for (k=1; k<d; k++) {
706
+ if ( elements != ca[k]->elements ) {
707
+ rb_raise(rb_eArgError, "element size mismatch in nk");
708
+ }
709
+ }
710
+
711
+ for (k=0; k<d; k++) {
712
+ ca_attach(ca[k]);
713
+ pn[k] = (unsigned int*) ca[k]->ptr;
714
+ }
715
+
716
+ cy = carray_new(CA_DOUBLE, 1, &elements, 0, NULL);
717
+ py = (double*)cy->ptr;
718
+
719
+ ca_attach(cpk);
720
+ for (i=0; i<elements; i++) {
721
+ for (k=0; k<d; k++) {
722
+ pv[k] = *(pn[k]);
723
+ pn[k]++;
724
+ }
725
+ *py = gsl_ran_multinomial_lnpdf(d, (double*)cpk->ptr, pv);
726
+ py++;
727
+ }
728
+ ca_detach(cpk);
729
+
730
+ if ( elements == 1 ) {
731
+ out = rb_float_new(*(double*)cy->ptr);
732
+ ca_free(cy);
733
+ }
734
+ else {
735
+ out = ca_wrap_struct(cy);
736
+ }
737
+
738
+ for (k=0; k<d; k++) {
739
+ ca_detach(ca[k]);
740
+ }
741
+
742
+ free(ca);
743
+ free(pn);
744
+ free(pv);
745
+ return out;
746
+ }
747
+
748
+ /* ----------------------------------------------------------------------- */
749
+
750
+ rb_camath_gsl_func_d_di(sf, airy_Ai);
751
+ rb_camath_gsl_func_d_di(sf, airy_Bi);
752
+ rb_camath_gsl_func_d_di(sf, airy_Ai_scaled);
753
+ rb_camath_gsl_func_d_di(sf, airy_Bi_scaled);
754
+ rb_camath_gsl_func_d_di(sf, airy_Ai_deriv);
755
+ rb_camath_gsl_func_d_di(sf, airy_Bi_deriv);
756
+ rb_camath_gsl_func_d_di(sf, airy_Ai_deriv_scaled);
757
+ rb_camath_gsl_func_d_di(sf, airy_Bi_deriv_scaled);
758
+ rb_camath_gsl_func_d_i(sf, airy_zero_Ai);
759
+ rb_camath_gsl_func_d_i(sf, airy_zero_Bi);
760
+
761
+ rb_camath_gsl_func_d_d(sf, bessel_J0);
762
+ rb_camath_gsl_func_d_d(sf, bessel_J1);
763
+ rb_camath_gsl_func_d_id(sf, bessel_Jn);
764
+
765
+ rb_camath_gsl_func_d_d(sf, bessel_Y0);
766
+ rb_camath_gsl_func_d_d(sf, bessel_Y1);
767
+ rb_camath_gsl_func_d_id(sf, bessel_Yn);
768
+
769
+ rb_camath_gsl_func_d_d(sf, bessel_I0);
770
+ rb_camath_gsl_func_d_d(sf, bessel_I1);
771
+ rb_camath_gsl_func_d_id(sf, bessel_In);
772
+ rb_camath_gsl_func_d_d(sf, bessel_I0_scaled);
773
+ rb_camath_gsl_func_d_d(sf, bessel_I1_scaled);
774
+ rb_camath_gsl_func_d_id(sf, bessel_In_scaled);
775
+
776
+ rb_camath_gsl_func_d_d(sf, bessel_K0);
777
+ rb_camath_gsl_func_d_d(sf, bessel_K1);
778
+ rb_camath_gsl_func_d_id(sf, bessel_Kn);
779
+ rb_camath_gsl_func_d_d(sf, bessel_K0_scaled);
780
+ rb_camath_gsl_func_d_d(sf, bessel_K1_scaled);
781
+ rb_camath_gsl_func_d_id(sf, bessel_Kn_scaled);
782
+
783
+ rb_camath_gsl_func_d_d(sf, bessel_j0);
784
+ rb_camath_gsl_func_d_d(sf, bessel_j1);
785
+ rb_camath_gsl_func_d_d(sf, bessel_j2);
786
+ rb_camath_gsl_func_d_id(sf, bessel_jl);
787
+
788
+ rb_camath_gsl_func_d_d(sf, bessel_y0);
789
+ rb_camath_gsl_func_d_d(sf, bessel_y1);
790
+ rb_camath_gsl_func_d_d(sf, bessel_y2);
791
+ rb_camath_gsl_func_d_id(sf, bessel_yl);
792
+
793
+ rb_camath_gsl_func_d_d(sf, bessel_i0_scaled);
794
+ rb_camath_gsl_func_d_d(sf, bessel_i1_scaled);
795
+ rb_camath_gsl_func_d_d(sf, bessel_i2_scaled);
796
+ rb_camath_gsl_func_d_id(sf, bessel_il_scaled);
797
+
798
+ rb_camath_gsl_func_d_d(sf, bessel_k0_scaled);
799
+ rb_camath_gsl_func_d_d(sf, bessel_k1_scaled);
800
+ rb_camath_gsl_func_d_d(sf, bessel_k2_scaled);
801
+ rb_camath_gsl_func_d_id(sf, bessel_kl_scaled);
802
+
803
+ rb_camath_gsl_func_d_dd(sf, bessel_Jnu);
804
+ rb_camath_gsl_func_d_dd(sf, bessel_Ynu);
805
+ rb_camath_gsl_func_d_dd(sf, bessel_Inu);
806
+ rb_camath_gsl_func_d_dd(sf, bessel_Inu_scaled);
807
+ rb_camath_gsl_func_d_dd(sf, bessel_Knu);
808
+ rb_camath_gsl_func_d_dd(sf, bessel_Knu_scaled);
809
+
810
+ rb_camath_gsl_func_d_i(sf, bessel_zero_J0);
811
+ rb_camath_gsl_func_d_i(sf, bessel_zero_J1);
812
+ rb_camath_gsl_func_d_di(sf, bessel_zero_Jnu);
813
+
814
+ rb_camath_gsl_func_d_d(sf, clausen);
815
+
816
+ rb_camath_gsl_func_d_dd(sf, hydrogenicR_1);
817
+ rb_camath_gsl_func_d_iidd(sf, hydrogenicR);
818
+ /* not implemented : Coulomb Wave Functions */
819
+ /* not implemented : Coulomb Wave Function Normalization Constant */
820
+
821
+ rb_camath_gsl_func_d_iiiiii(sf, coupling_3j);
822
+ rb_camath_gsl_func_d_iiiiii(sf, coupling_6j);
823
+
824
+ /* rb_camath_gsl_func_d_iiiiiiiii(sf, coupling_9j); */
825
+
826
+ rb_camath_gsl_func_d_d(sf, dawson);
827
+
828
+ rb_camath_gsl_func_d_d(sf, debye_1);
829
+ rb_camath_gsl_func_d_d(sf, debye_2);
830
+ rb_camath_gsl_func_d_d(sf, debye_3);
831
+ rb_camath_gsl_func_d_d(sf, debye_4);
832
+ rb_camath_gsl_func_d_d(sf, debye_5);
833
+ rb_camath_gsl_func_d_d(sf, debye_6);
834
+
835
+ rb_camath_gsl_func_d_d(sf, dilog);
836
+ /* rb_camath_gsl_func_d_d(sf, complex_dilog); */
837
+
838
+ rb_camath_gsl_func_d_di(sf, ellint_Kcomp);
839
+ rb_camath_gsl_func_d_di(sf, ellint_Ecomp);
840
+ rb_camath_gsl_func_d_ddi(sf, ellint_Pcomp);
841
+ rb_camath_gsl_func_d_ddi(sf, ellint_F);
842
+ rb_camath_gsl_func_d_ddi(sf, ellint_E);
843
+ rb_camath_gsl_func_d_dddi(sf, ellint_P);
844
+ rb_camath_gsl_func_d_dddi(sf, ellint_D);
845
+ rb_camath_gsl_func_d_ddi(sf, ellint_RC);
846
+ rb_camath_gsl_func_d_dddi(sf, ellint_RD);
847
+ rb_camath_gsl_func_d_dddi(sf, ellint_RF);
848
+ rb_camath_gsl_func_d_ddddi(sf, ellint_RJ);
849
+
850
+ rb_camath_gsl_func_ddd_dd(sf, elljac, _e);
851
+
852
+ rb_camath_gsl_func_d_d(sf, erf);
853
+ rb_camath_gsl_func_d_d(sf, erf_Z);
854
+ rb_camath_gsl_func_d_d(sf, erf_Q);
855
+ rb_camath_gsl_func_d_d(sf, erfc);
856
+ rb_camath_gsl_func_d_d(sf, log_erfc);
857
+ rb_camath_gsl_func_d_d(sf, hazard);
858
+
859
+ /* rb_camath_gsl_func_d_dd(sf, exp); */
860
+ /* rb_camath_gsl_func_d_dd(sf, exp_mult); */
861
+ /* rb_camath_gsl_func_d_dd(sf, expm1); */
862
+ /* rb_camath_gsl_func_d_dd(sf, exprel); */
863
+ /* rb_camath_gsl_func_d_dd(sf, exprel_2); */
864
+ /* rb_camath_gsl_func_d_dd(sf, exprel_n); */
865
+
866
+ rb_camath_gsl_func_d_d(sf, expint_E1);
867
+ rb_camath_gsl_func_d_d(sf, expint_E2);
868
+ rb_camath_gsl_func_d_id(sf, expint_En);
869
+ rb_camath_gsl_func_d_d(sf, expint_Ei);
870
+ rb_camath_gsl_func_d_d(sf, Shi);
871
+ rb_camath_gsl_func_d_d(sf, Chi);
872
+ rb_camath_gsl_func_d_d(sf, expint_3);
873
+ rb_camath_gsl_func_d_d(sf, Si);
874
+ rb_camath_gsl_func_d_d(sf, Ci);
875
+ rb_camath_gsl_func_d_d(sf, atanint);
876
+
877
+ rb_camath_gsl_func_d_d(sf, fermi_dirac_m1);
878
+ rb_camath_gsl_func_d_d(sf, fermi_dirac_0);
879
+ rb_camath_gsl_func_d_d(sf, fermi_dirac_1);
880
+ rb_camath_gsl_func_d_d(sf, fermi_dirac_2);
881
+ rb_camath_gsl_func_d_id(sf, fermi_dirac_int);
882
+ rb_camath_gsl_func_d_d(sf, fermi_dirac_mhalf);
883
+ rb_camath_gsl_func_d_d(sf, fermi_dirac_half);
884
+ rb_camath_gsl_func_d_d(sf, fermi_dirac_3half);
885
+ rb_camath_gsl_func_d_dd(sf, fermi_dirac_inc_0);
886
+
887
+ rb_camath_gsl_func_d_d(sf, gamma);
888
+ rb_camath_gsl_func_d_d(sf, lngamma);
889
+ rb_camath_gsl_func_d_d(sf, gammastar);
890
+ rb_camath_gsl_func_d_d(sf, gammainv);
891
+
892
+ rb_camath_gsl_func_d_dd(sf, gamma_inc);
893
+ rb_camath_gsl_func_d_dd(sf, gamma_inc_Q);
894
+ rb_camath_gsl_func_d_dd(sf, gamma_inc_P);
895
+
896
+ rb_camath_gsl_func_d_i(sf, fact);
897
+ rb_camath_gsl_func_d_i(sf, doublefact);
898
+ rb_camath_gsl_func_d_i(sf, lnfact);
899
+ rb_camath_gsl_func_d_i(sf, lndoublefact);
900
+ rb_camath_gsl_func_d_ii(sf, choose);
901
+ rb_camath_gsl_func_d_ii(sf, lnchoose);
902
+ rb_camath_gsl_func_d_id(sf, taylorcoeff);
903
+
904
+ rb_camath_gsl_func_d_dd(sf, beta);
905
+ rb_camath_gsl_func_d_dd(sf, lnbeta);
906
+ rb_camath_gsl_func_d_ddd(sf, beta_inc);
907
+
908
+ rb_camath_gsl_func_d_dd(sf, gegenpoly_1);
909
+ rb_camath_gsl_func_d_dd(sf, gegenpoly_2);
910
+ rb_camath_gsl_func_d_dd(sf, gegenpoly_3);
911
+ rb_camath_gsl_func_d_idd(sf, gegenpoly_n);
912
+
913
+ rb_camath_gsl_func_d_dd(sf, hyperg_0F1);
914
+ rb_camath_gsl_func_d_iid(sf, hyperg_1F1_int);
915
+ rb_camath_gsl_func_d_ddd(sf, hyperg_1F1);
916
+ rb_camath_gsl_func_d_iid(sf, hyperg_U_int);
917
+ rb_camath_gsl_func_d_ddd(sf, hyperg_U);
918
+ rb_camath_gsl_func_d_dddd(sf, hyperg_2F1);
919
+ rb_camath_gsl_func_d_dddd(sf, hyperg_2F1_conj);
920
+ rb_camath_gsl_func_d_dddd(sf, hyperg_2F1_renorm);
921
+ rb_camath_gsl_func_d_dddd(sf, hyperg_2F1_conj_renorm);
922
+ rb_camath_gsl_func_d_ddd(sf, hyperg_2F0);
923
+
924
+ rb_camath_gsl_func_d_dd(sf, laguerre_1);
925
+ rb_camath_gsl_func_d_dd(sf, laguerre_2);
926
+ rb_camath_gsl_func_d_dd(sf, laguerre_3);
927
+ rb_camath_gsl_func_d_idd(sf, laguerre_n);
928
+
929
+ rb_camath_gsl_func_d_d(sf, lambert_W0);
930
+ rb_camath_gsl_func_d_d(sf, lambert_Wm1);
931
+
932
+ rb_camath_gsl_func_d_d(sf, legendre_P1);
933
+ rb_camath_gsl_func_d_d(sf, legendre_P2);
934
+ rb_camath_gsl_func_d_d(sf, legendre_P3);
935
+ rb_camath_gsl_func_d_id(sf, legendre_Pl);
936
+ rb_camath_gsl_func_d_d(sf, legendre_Q0);
937
+ rb_camath_gsl_func_d_d(sf, legendre_Q1);
938
+ rb_camath_gsl_func_d_id(sf, legendre_Ql);
939
+ rb_camath_gsl_func_d_iid(sf, legendre_Plm);
940
+ rb_camath_gsl_func_d_iid(sf, legendre_sphPlm);
941
+
942
+ rb_camath_gsl_func_d_dd(sf, conicalP_half);
943
+ rb_camath_gsl_func_d_dd(sf, conicalP_mhalf);
944
+ rb_camath_gsl_func_d_dd(sf, conicalP_0);
945
+ rb_camath_gsl_func_d_dd(sf, conicalP_1);
946
+ rb_camath_gsl_func_d_idd(sf, conicalP_sph_reg);
947
+ rb_camath_gsl_func_d_idd(sf, conicalP_cyl_reg);
948
+
949
+ rb_camath_gsl_func_d_dd(sf, legendre_H3d_0);
950
+ rb_camath_gsl_func_d_dd(sf, legendre_H3d_1);
951
+ rb_camath_gsl_func_d_idd(sf, legendre_H3d);
952
+
953
+ /* rb_camath_gsl_func_d_d(sf, log); */
954
+ /* rb_camath_gsl_func_d_d(sf, log_abs); */
955
+ /* rb_camath_gsl_func_dd_dd(sf, complex_log_e); */
956
+ /* rb_camath_gsl_func_dd_dd(sf, complex_log_1plusx); */
957
+ /* rb_camath_gsl_func_dd_dd(sf, complex_log_1plusx_mx); */
958
+
959
+ /* not implelmeted : Mathieu Functions */
960
+
961
+ /* rb_camath_gsl_func_d_di(sf, pow_int); */
962
+
963
+ rb_camath_gsl_func_d_d(sf, psi);
964
+ rb_camath_gsl_func_d_d(sf, psi_1piy);
965
+ rb_camath_gsl_func_d_d(sf, psi_1);
966
+ rb_camath_gsl_func_d_id(sf, psi_n);
967
+
968
+ rb_camath_gsl_func_d_d(sf, synchrotron_1);
969
+ rb_camath_gsl_func_d_d(sf, synchrotron_2);
970
+
971
+ rb_camath_gsl_func_d_d(sf, transport_2);
972
+ rb_camath_gsl_func_d_d(sf, transport_3);
973
+ rb_camath_gsl_func_d_d(sf, transport_4);
974
+ rb_camath_gsl_func_d_d(sf, transport_5);
975
+
976
+ /* rb_camath_gsl_func_d_d(sf, sin); */
977
+ /* rb_camath_gsl_func_d_d(sf, cos); */
978
+ /* rb_camath_gsl_func_d_dd(sf, hypot); */
979
+ rb_camath_gsl_func_d_d(sf, sinc);
980
+ /* rb_camath_gsl_func_dd_dd(sf, complex_sin); */
981
+ /* rb_camath_gsl_func_dd_dd(sf, complex_cos); */
982
+ /* rb_camath_gsl_func_dd_dd(sf, complex_logsin); */
983
+ /* rb_camath_gsl_func_d_d(sf, lnsinh); */
984
+ /* rb_camath_gsl_func_d_d(sf, lncosh); */
985
+ rb_camath_gsl_func_dd_dd(sf, polar_to_rect,);
986
+ rb_camath_gsl_func_dd_dd(sf, rect_to_polar,);
987
+ rb_camath_gsl_func_d_d(sf, angle_restrict_symm);
988
+ rb_camath_gsl_func_d_d(sf, angle_restrict_pos);
989
+
990
+ rb_camath_gsl_func_d_d(sf, zeta);
991
+ rb_camath_gsl_func_d_d(sf, zetam1);
992
+ rb_camath_gsl_func_d_dd(sf, hzeta);
993
+ rb_camath_gsl_func_d_d(sf, eta);
994
+
995
+ /* random distributions */
996
+
997
+ rb_camath_gsl_rng_d_dd(gaussian);
998
+ rb_camath_gsl_func_d_dd(ran, gaussian_pdf);
999
+ rb_camath_gsl_func_d_dd(cdf, gaussian_P);
1000
+ rb_camath_gsl_func_d_dd(cdf, gaussian_Q);
1001
+ rb_camath_gsl_func_d_dd(cdf, gaussian_Pinv);
1002
+ rb_camath_gsl_func_d_dd(cdf, gaussian_Qinv);
1003
+
1004
+ rb_camath_gsl_rng_d_d(ugaussian);
1005
+ rb_camath_gsl_func_d_d(ran, ugaussian_pdf);
1006
+ rb_camath_gsl_func_d_d(cdf, ugaussian_P);
1007
+ rb_camath_gsl_func_d_d(cdf, ugaussian_Q);
1008
+ rb_camath_gsl_func_d_d(cdf, ugaussian_Pinv);
1009
+ rb_camath_gsl_func_d_d(cdf, ugaussian_Qinv);
1010
+
1011
+ rb_camath_gsl_rng_d_ddd(gaussian_tail);
1012
+ rb_camath_gsl_func_d_ddd(ran, gaussian_tail_pdf);
1013
+
1014
+ rb_camath_gsl_rng_d_dd(ugaussian_tail);
1015
+ rb_camath_gsl_func_d_dd(ran, ugaussian_tail_pdf);
1016
+
1017
+ rb_camath_gsl_rng_dd_ddd(bivariate_gaussian);
1018
+ rb_camath_gsl_func_d_ddddd(ran, bivariate_gaussian_pdf);
1019
+
1020
+ rb_camath_gsl_rng_d_dd(exponential);
1021
+ rb_camath_gsl_func_d_dd(ran, exponential_pdf);
1022
+ rb_camath_gsl_func_d_dd(cdf, exponential_P);
1023
+ rb_camath_gsl_func_d_dd(cdf, exponential_Q);
1024
+ rb_camath_gsl_func_d_dd(cdf, exponential_Pinv);
1025
+ rb_camath_gsl_func_d_dd(cdf, exponential_Qinv);
1026
+
1027
+ rb_camath_gsl_rng_d_dd(laplace);
1028
+ rb_camath_gsl_func_d_dd(ran, laplace_pdf);
1029
+ rb_camath_gsl_func_d_dd(cdf, laplace_P);
1030
+ rb_camath_gsl_func_d_dd(cdf, laplace_Q);
1031
+ rb_camath_gsl_func_d_dd(cdf, laplace_Pinv);
1032
+ rb_camath_gsl_func_d_dd(cdf, laplace_Qinv);
1033
+
1034
+ rb_camath_gsl_rng_d_ddd(exppow);
1035
+ rb_camath_gsl_func_d_ddd(ran, exppow_pdf);
1036
+ rb_camath_gsl_func_d_ddd(cdf, exppow_P);
1037
+ rb_camath_gsl_func_d_ddd(cdf, exppow_Q);
1038
+
1039
+ rb_camath_gsl_rng_d_dd(cauchy);
1040
+ rb_camath_gsl_func_d_dd(ran, cauchy_pdf);
1041
+ rb_camath_gsl_func_d_dd(cdf, cauchy_P);
1042
+ rb_camath_gsl_func_d_dd(cdf, cauchy_Q);
1043
+ rb_camath_gsl_func_d_dd(cdf, cauchy_Pinv);
1044
+ rb_camath_gsl_func_d_dd(cdf, cauchy_Qinv);
1045
+
1046
+ rb_camath_gsl_rng_d_dd(rayleigh);
1047
+ rb_camath_gsl_func_d_dd(ran, rayleigh_pdf);
1048
+ rb_camath_gsl_func_d_dd(cdf, rayleigh_P);
1049
+ rb_camath_gsl_func_d_dd(cdf, rayleigh_Q);
1050
+ rb_camath_gsl_func_d_dd(cdf, rayleigh_Pinv);
1051
+ rb_camath_gsl_func_d_dd(cdf, rayleigh_Qinv);
1052
+
1053
+ rb_camath_gsl_rng_d_ddd(rayleigh_tail);
1054
+ rb_camath_gsl_func_d_ddd(ran, rayleigh_tail_pdf);
1055
+
1056
+ rb_camath_gsl_rng_d_d(landau);
1057
+ rb_camath_gsl_func_d_d(ran, landau_pdf);
1058
+
1059
+ rb_camath_gsl_rng_d_ddd(levy);
1060
+ rb_camath_gsl_rng_d_dddd(levy_skew);
1061
+
1062
+ rb_camath_gsl_rng_d_ddd(gamma);
1063
+ rb_camath_gsl_func_d_ddd(ran, gamma_pdf);
1064
+ rb_camath_gsl_func_d_ddd(cdf, gamma_P);
1065
+ rb_camath_gsl_func_d_ddd(cdf, gamma_Q);
1066
+ rb_camath_gsl_func_d_ddd(cdf, gamma_Pinv);
1067
+ rb_camath_gsl_func_d_ddd(cdf, gamma_Qinv);
1068
+
1069
+ rb_camath_gsl_rng_d_ddd(erlang);
1070
+ rb_camath_gsl_func_d_ddd(ran, erlang_pdf);
1071
+
1072
+ rb_camath_gsl_rng_d_ddd(flat);
1073
+ rb_camath_gsl_func_d_ddd(ran, flat_pdf);
1074
+ rb_camath_gsl_func_d_ddd(cdf, flat_P);
1075
+ rb_camath_gsl_func_d_ddd(cdf, flat_Q);
1076
+ rb_camath_gsl_func_d_ddd(cdf, flat_Pinv);
1077
+ rb_camath_gsl_func_d_ddd(cdf, flat_Qinv);
1078
+
1079
+ rb_camath_gsl_rng_d_ddd(lognormal);
1080
+ rb_camath_gsl_func_d_ddd(ran, lognormal_pdf);
1081
+ rb_camath_gsl_func_d_ddd(cdf, lognormal_P);
1082
+ rb_camath_gsl_func_d_ddd(cdf, lognormal_Q);
1083
+ rb_camath_gsl_func_d_ddd(cdf, lognormal_Pinv);
1084
+ rb_camath_gsl_func_d_ddd(cdf, lognormal_Qinv);
1085
+
1086
+ rb_camath_gsl_rng_d_dd(chisq);
1087
+ rb_camath_gsl_func_d_dd(ran, chisq_pdf);
1088
+ rb_camath_gsl_func_d_dd(cdf, chisq_P);
1089
+ rb_camath_gsl_func_d_dd(cdf, chisq_Q);
1090
+ rb_camath_gsl_func_d_dd(cdf, chisq_Pinv);
1091
+ rb_camath_gsl_func_d_dd(cdf, chisq_Qinv);
1092
+
1093
+ rb_camath_gsl_rng_d_ddd(fdist);
1094
+ rb_camath_gsl_func_d_ddd(ran, fdist_pdf);
1095
+ rb_camath_gsl_func_d_ddd(cdf, fdist_P);
1096
+ rb_camath_gsl_func_d_ddd(cdf, fdist_Q);
1097
+ rb_camath_gsl_func_d_ddd(cdf, fdist_Pinv);
1098
+ rb_camath_gsl_func_d_ddd(cdf, fdist_Qinv);
1099
+
1100
+ rb_camath_gsl_rng_d_dd(tdist);
1101
+ rb_camath_gsl_func_d_dd(ran, tdist_pdf);
1102
+ rb_camath_gsl_func_d_dd(cdf, tdist_P);
1103
+ rb_camath_gsl_func_d_dd(cdf, tdist_Q);
1104
+ rb_camath_gsl_func_d_dd(cdf, tdist_Pinv);
1105
+ rb_camath_gsl_func_d_dd(cdf, tdist_Qinv);
1106
+
1107
+ rb_camath_gsl_rng_d_ddd(beta);
1108
+ rb_camath_gsl_func_d_ddd(ran, beta_pdf);
1109
+ rb_camath_gsl_func_d_ddd(cdf, beta_P);
1110
+ rb_camath_gsl_func_d_ddd(cdf, beta_Q);
1111
+ rb_camath_gsl_func_d_ddd(cdf, beta_Pinv);
1112
+ rb_camath_gsl_func_d_ddd(cdf, beta_Qinv);
1113
+
1114
+ rb_camath_gsl_rng_d_dd(logistic);
1115
+ rb_camath_gsl_func_d_dd(ran, logistic_pdf);
1116
+ rb_camath_gsl_func_d_dd(cdf, logistic_P);
1117
+ rb_camath_gsl_func_d_dd(cdf, logistic_Q);
1118
+ rb_camath_gsl_func_d_dd(cdf, logistic_Pinv);
1119
+ rb_camath_gsl_func_d_dd(cdf, logistic_Qinv);
1120
+
1121
+ rb_camath_gsl_rng_d_ddd(pareto);
1122
+ rb_camath_gsl_func_d_ddd(ran, pareto_pdf);
1123
+ rb_camath_gsl_func_d_ddd(cdf, pareto_P);
1124
+ rb_camath_gsl_func_d_ddd(cdf, pareto_Q);
1125
+ rb_camath_gsl_func_d_ddd(cdf, pareto_Pinv);
1126
+ rb_camath_gsl_func_d_ddd(cdf, pareto_Qinv);
1127
+
1128
+ rb_camath_gsl_rng_d_ddd(weibull);
1129
+ rb_camath_gsl_func_d_ddd(ran, weibull_pdf);
1130
+ rb_camath_gsl_func_d_ddd(cdf, weibull_P);
1131
+ rb_camath_gsl_func_d_ddd(cdf, weibull_Q);
1132
+ rb_camath_gsl_func_d_ddd(cdf, weibull_Pinv);
1133
+ rb_camath_gsl_func_d_ddd(cdf, weibull_Qinv);
1134
+
1135
+ rb_camath_gsl_rng_d_ddd(gumbel1);
1136
+ rb_camath_gsl_func_d_ddd(ran, gumbel1_pdf);
1137
+ rb_camath_gsl_func_d_ddd(cdf, gumbel1_P);
1138
+ rb_camath_gsl_func_d_ddd(cdf, gumbel1_Q);
1139
+ rb_camath_gsl_func_d_ddd(cdf, gumbel1_Pinv);
1140
+ rb_camath_gsl_func_d_ddd(cdf, gumbel1_Qinv);
1141
+
1142
+ rb_camath_gsl_rng_d_ddd(gumbel2);
1143
+ rb_camath_gsl_func_d_ddd(ran, gumbel2_pdf);
1144
+ rb_camath_gsl_func_d_ddd(cdf, gumbel2_P);
1145
+ rb_camath_gsl_func_d_ddd(cdf, gumbel2_Q);
1146
+ rb_camath_gsl_func_d_ddd(cdf, gumbel2_Pinv);
1147
+ rb_camath_gsl_func_d_ddd(cdf, gumbel2_Qinv);
1148
+
1149
+ rb_camath_gsl_rng_d_dd(poisson);
1150
+ rb_camath_gsl_func_d_id(ran, poisson_pdf);
1151
+ rb_camath_gsl_func_d_id(cdf, poisson_P);
1152
+ rb_camath_gsl_func_d_id(cdf, poisson_Q);
1153
+
1154
+ rb_camath_gsl_rng_d_dd(bernoulli);
1155
+ rb_camath_gsl_func_d_id(ran, bernoulli_pdf);
1156
+
1157
+ rb_camath_gsl_rng_d_ddi(binomial);
1158
+ rb_camath_gsl_func_d_idi(ran, binomial_pdf);
1159
+ rb_camath_gsl_func_d_idi(cdf, binomial_P);
1160
+ rb_camath_gsl_func_d_idi(cdf, binomial_Q);
1161
+
1162
+ rb_camath_gsl_rng_d_ddd(negative_binomial);
1163
+ rb_camath_gsl_func_d_idd(ran, negative_binomial_pdf);
1164
+ rb_camath_gsl_func_d_idd(cdf, negative_binomial_P);
1165
+ rb_camath_gsl_func_d_idd(cdf, negative_binomial_Q);
1166
+
1167
+ rb_camath_gsl_rng_d_ddi(pascal);
1168
+ rb_camath_gsl_func_d_idi(ran, pascal_pdf);
1169
+ rb_camath_gsl_func_d_idi(cdf, pascal_P);
1170
+ rb_camath_gsl_func_d_idi(cdf, pascal_Q);
1171
+
1172
+ rb_camath_gsl_rng_d_dd(geometric);
1173
+ rb_camath_gsl_func_d_id(ran, geometric_pdf);
1174
+ rb_camath_gsl_func_d_id(cdf, geometric_P);
1175
+ rb_camath_gsl_func_d_id(cdf, geometric_Q);
1176
+
1177
+ rb_camath_gsl_rng_d_diii(hypergeometric);
1178
+ rb_camath_gsl_func_d_iiii(ran, hypergeometric_pdf);
1179
+ rb_camath_gsl_func_d_iiii(cdf, hypergeometric_P);
1180
+ rb_camath_gsl_func_d_iiii(cdf, hypergeometric_Q);
1181
+
1182
+ rb_camath_gsl_rng_d_dd(logarithmic);
1183
+ rb_camath_gsl_func_d_id(ran, logarithmic_pdf);
1184
+
1185
+ void
1186
+ Init_carray_mathfunc_gsl ()
1187
+ {
1188
+ uint32_t seed;
1189
+
1190
+ camath_gsl_rng = gsl_rng_alloc(gsl_rng_mt19937);
1191
+
1192
+ seed = NUM2ULONG(rb_funcall(rb_mKernel,
1193
+ rb_intern("rand"), 1, ULONG2NUM(0xffffffff)));
1194
+
1195
+ gsl_rng_set(camath_gsl_rng, seed);
1196
+
1197
+ /* special functions */
1198
+
1199
+ rb_define_camath_gsl_func2_(airy_Ai, 2);
1200
+ rb_define_camath_gsl_func2_(airy_Bi, 2);
1201
+ rb_define_camath_gsl_func2_(airy_Ai_scaled, 2);
1202
+ rb_define_camath_gsl_func2_(airy_Bi_scaled, 2);
1203
+ rb_define_camath_gsl_func2_(airy_Ai_deriv, 2);
1204
+ rb_define_camath_gsl_func2_(airy_Bi_deriv, 2);
1205
+ rb_define_camath_gsl_func2_(airy_Ai_deriv_scaled, 2);
1206
+ rb_define_camath_gsl_func2_(airy_Bi_deriv_scaled, 2);
1207
+ rb_define_camath_gsl_func2u(airy_zero_Ai, 1); /* not func2 */
1208
+ rb_define_camath_gsl_func2u(airy_zero_Bi, 1); /* not func2 */
1209
+
1210
+ rb_define_camath_gsl_func2(bessel_J0, 1);
1211
+ rb_define_camath_gsl_func2(bessel_J1, 1);
1212
+ rb_define_camath_gsl_func2(bessel_Jn, 2);
1213
+
1214
+ rb_define_camath_gsl_func2(bessel_Y0, 1);
1215
+ rb_define_camath_gsl_func2(bessel_Y1, 1);
1216
+ rb_define_camath_gsl_func2(bessel_Yn, 2);
1217
+
1218
+ rb_define_camath_gsl_func2(bessel_I0, 1);
1219
+ rb_define_camath_gsl_func2(bessel_I1, 1);
1220
+ rb_define_camath_gsl_func2(bessel_In, 2);
1221
+ rb_define_camath_gsl_func2(bessel_I0_scaled, 1);
1222
+ rb_define_camath_gsl_func2(bessel_I1_scaled, 1);
1223
+ rb_define_camath_gsl_func2(bessel_In_scaled, 2);
1224
+
1225
+ rb_define_camath_gsl_func2(bessel_K0, 1);
1226
+ rb_define_camath_gsl_func2(bessel_K1, 1);
1227
+ rb_define_camath_gsl_func2(bessel_Kn, 2);
1228
+ rb_define_camath_gsl_func2(bessel_K0_scaled, 1);
1229
+ rb_define_camath_gsl_func2(bessel_K1_scaled, 1);
1230
+ rb_define_camath_gsl_func2(bessel_Kn_scaled, 2);
1231
+
1232
+ rb_define_camath_gsl_func2(bessel_j0, 1);
1233
+ rb_define_camath_gsl_func2(bessel_j1, 1);
1234
+ rb_define_camath_gsl_func2(bessel_j2, 1);
1235
+ rb_define_camath_gsl_func2(bessel_jl, 2);
1236
+
1237
+ rb_define_camath_gsl_func2(bessel_y0, 1);
1238
+ rb_define_camath_gsl_func2(bessel_y1, 1);
1239
+ rb_define_camath_gsl_func2(bessel_y2, 1);
1240
+ rb_define_camath_gsl_func2(bessel_yl, 2);
1241
+
1242
+ rb_define_camath_gsl_func2(bessel_i0_scaled, 1);
1243
+ rb_define_camath_gsl_func2(bessel_i1_scaled, 1);
1244
+ rb_define_camath_gsl_func2(bessel_i2_scaled, 1);
1245
+ rb_define_camath_gsl_func2(bessel_il_scaled, 2);
1246
+
1247
+ rb_define_camath_gsl_func2(bessel_k0_scaled, 1);
1248
+ rb_define_camath_gsl_func2(bessel_k1_scaled, 1);
1249
+ rb_define_camath_gsl_func2(bessel_k2_scaled, 1);
1250
+ rb_define_camath_gsl_func2(bessel_kl_scaled, 2);
1251
+
1252
+ rb_define_camath_gsl_func2(bessel_Jnu, 2);
1253
+ rb_define_camath_gsl_func2(bessel_Ynu, 2);
1254
+ rb_define_camath_gsl_func2(bessel_Inu, 2);
1255
+ rb_define_camath_gsl_func2(bessel_Inu_scaled, 2);
1256
+ rb_define_camath_gsl_func2(bessel_Knu, 2);
1257
+ rb_define_camath_gsl_func2(bessel_Knu_scaled, 2);
1258
+
1259
+ rb_define_camath_gsl_func2u(bessel_zero_J0, 1); /* not func2 */
1260
+ rb_define_camath_gsl_func2u(bessel_zero_J1, 1); /* not func2 */
1261
+ rb_define_camath_gsl_func2u(bessel_zero_Jnu, 2); /* not func2 */
1262
+
1263
+ rb_define_camath_gsl_func2(gamma, 1);
1264
+ rb_define_camath_gsl_func2(lngamma, 1);
1265
+ rb_define_camath_gsl_func2(gammastar, 1);
1266
+ rb_define_camath_gsl_func2(gammainv, 1);
1267
+
1268
+ rb_define_camath_gsl_func2(gamma_inc, 2);
1269
+ rb_define_camath_gsl_func2(gamma_inc_P, 2);
1270
+ rb_define_camath_gsl_func2(gamma_inc_Q, 2);
1271
+
1272
+ rb_define_camath_gsl_func2(beta, 2);
1273
+ rb_define_camath_gsl_func2(lnbeta, 2);
1274
+ rb_define_camath_gsl_func2(beta_inc, 3);
1275
+
1276
+ rb_define_camath_gsl_func2(clausen, 1);
1277
+
1278
+ rb_define_camath_gsl_func2(hydrogenicR_1, 2);
1279
+ rb_define_camath_gsl_func2(hydrogenicR, 4);
1280
+
1281
+ rb_define_camath_gsl_func(coupling_3j, 6); /* not func2 */
1282
+ rb_define_camath_gsl_func(coupling_6j, 6); /* not func2 */
1283
+
1284
+ rb_define_camath_gsl_func2(dawson, 1);
1285
+
1286
+ rb_define_camath_gsl_func2(debye_1, 1);
1287
+ rb_define_camath_gsl_func2(debye_2, 1);
1288
+ rb_define_camath_gsl_func2(debye_3, 1);
1289
+ rb_define_camath_gsl_func2(debye_4, 1);
1290
+ rb_define_camath_gsl_func2(debye_5, 1);
1291
+ rb_define_camath_gsl_func2(debye_6, 1);
1292
+
1293
+ rb_define_camath_gsl_func2(dilog, 1);
1294
+
1295
+ rb_define_camath_gsl_func2u(ellint_Kcomp, 2); /* not func2 */
1296
+ rb_define_camath_gsl_func2u(ellint_Ecomp, 2); /* not func2 */
1297
+ rb_define_camath_gsl_func(ellint_Pcomp, 3); /* not func2 */
1298
+ rb_define_camath_gsl_func(ellint_F, 3); /* not func2 */
1299
+ rb_define_camath_gsl_func(ellint_E, 3); /* not func2 */
1300
+ rb_define_camath_gsl_func(ellint_P, 4); /* not func2 */
1301
+ rb_define_camath_gsl_func(ellint_D, 4); /* not func2 */
1302
+ rb_define_camath_gsl_func(ellint_RC, 3); /* not func2 */
1303
+ rb_define_camath_gsl_func(ellint_RD, 4); /* not func2 */
1304
+ rb_define_camath_gsl_func(ellint_RF, 4); /* not func2 */
1305
+ rb_define_camath_gsl_func(ellint_RJ, 5); /* not func2 */
1306
+
1307
+ rb_define_camath_gsl_func(elljac, 2); /* not func2 */
1308
+
1309
+ rb_define_camath_gsl_func2(fact, 1);
1310
+ rb_define_camath_gsl_func2(doublefact, 1);
1311
+ rb_define_camath_gsl_func2(lnfact, 1);
1312
+ rb_define_camath_gsl_func2(lndoublefact, 1);
1313
+ rb_define_camath_gsl_func2(choose, 2);
1314
+ rb_define_camath_gsl_func2(lnchoose, 2);
1315
+ rb_define_camath_gsl_func2(taylorcoeff, 2);
1316
+
1317
+ rb_define_camath_gsl_func2(erf, 1);
1318
+ rb_define_camath_gsl_func2(erf_Z, 1);
1319
+ rb_define_camath_gsl_func2(erf_Q, 1);
1320
+ rb_define_camath_gsl_func2(erfc, 1);
1321
+ rb_define_camath_gsl_func2(log_erfc, 1);
1322
+ rb_define_camath_gsl_func2(hazard, 1);
1323
+
1324
+ rb_define_camath_gsl_func2(expint_E1, 1);
1325
+ rb_define_camath_gsl_func2(expint_E2, 1);
1326
+ rb_define_camath_gsl_func2(expint_En, 2);
1327
+ rb_define_camath_gsl_func2(expint_Ei, 1);
1328
+ rb_define_camath_gsl_func2(Shi, 1);
1329
+ rb_define_camath_gsl_func2(Chi, 1);
1330
+ rb_define_camath_gsl_func2(expint_3, 1);
1331
+ rb_define_camath_gsl_func2(Si, 1);
1332
+ rb_define_camath_gsl_func2(Ci, 1);
1333
+ rb_define_camath_gsl_func2(atanint, 1);
1334
+
1335
+ rb_define_camath_gsl_func2(fermi_dirac_m1, 1);
1336
+ rb_define_camath_gsl_func2(fermi_dirac_0, 1);
1337
+ rb_define_camath_gsl_func2(fermi_dirac_1, 1);
1338
+ rb_define_camath_gsl_func2(fermi_dirac_2, 1);
1339
+ rb_define_camath_gsl_func2(fermi_dirac_int, 2);
1340
+ rb_define_camath_gsl_func2(fermi_dirac_mhalf, 1);
1341
+ rb_define_camath_gsl_func2(fermi_dirac_half, 1);
1342
+ rb_define_camath_gsl_func2(fermi_dirac_3half, 1);
1343
+ rb_define_camath_gsl_func2(fermi_dirac_inc_0, 2);
1344
+
1345
+ rb_define_camath_gsl_func2(gegenpoly_1, 2);
1346
+ rb_define_camath_gsl_func2(gegenpoly_2, 2);
1347
+ rb_define_camath_gsl_func2(gegenpoly_3, 2);
1348
+ rb_define_camath_gsl_func2(gegenpoly_n, 3);
1349
+
1350
+ rb_define_camath_gsl_func2(hyperg_0F1, 2);
1351
+ rb_define_camath_gsl_func2(hyperg_1F1_int, 3);
1352
+ rb_define_camath_gsl_func2(hyperg_1F1, 3);
1353
+ rb_define_camath_gsl_func2(hyperg_U_int, 3);
1354
+ rb_define_camath_gsl_func2(hyperg_U, 3);
1355
+ rb_define_camath_gsl_func2(hyperg_2F1, 4);
1356
+ rb_define_camath_gsl_func2(hyperg_2F1_conj, 4);
1357
+ rb_define_camath_gsl_func2(hyperg_2F1_renorm, 4);
1358
+ rb_define_camath_gsl_func2(hyperg_2F1_conj_renorm, 4);
1359
+ rb_define_camath_gsl_func2(hyperg_2F0, 3);
1360
+
1361
+ rb_define_camath_gsl_func2(laguerre_1, 2);
1362
+ rb_define_camath_gsl_func2(laguerre_2, 2);
1363
+ rb_define_camath_gsl_func2(laguerre_3, 2);
1364
+ rb_define_camath_gsl_func2(laguerre_n, 3);
1365
+
1366
+ rb_define_camath_gsl_func2(lambert_W0, 1);
1367
+ rb_define_camath_gsl_func2(lambert_Wm1, 1);
1368
+
1369
+ rb_define_camath_gsl_func2(legendre_P1, 1);
1370
+ rb_define_camath_gsl_func2(legendre_P2, 1);
1371
+ rb_define_camath_gsl_func2(legendre_P3, 1);
1372
+ rb_define_camath_gsl_func2(legendre_Pl, 2);
1373
+
1374
+ rb_define_camath_gsl_func2(legendre_Q0, 1);
1375
+ rb_define_camath_gsl_func2(legendre_Q1, 1);
1376
+ rb_define_camath_gsl_func2(legendre_Ql, 2);
1377
+
1378
+ rb_define_camath_gsl_func2(legendre_Plm, 3);
1379
+ rb_define_camath_gsl_func2(legendre_sphPlm, 3);
1380
+
1381
+ rb_define_camath_gsl_func2(conicalP_half, 2);
1382
+ rb_define_camath_gsl_func2(conicalP_mhalf, 2);
1383
+ rb_define_camath_gsl_func2(conicalP_0, 2);
1384
+ rb_define_camath_gsl_func2(conicalP_1, 2);
1385
+ rb_define_camath_gsl_func2(conicalP_sph_reg, 3);
1386
+ rb_define_camath_gsl_func2(conicalP_cyl_reg, 3);
1387
+
1388
+ rb_define_camath_gsl_func2(legendre_H3d_0, 2);
1389
+ rb_define_camath_gsl_func2(legendre_H3d_1, 2);
1390
+ rb_define_camath_gsl_func2(legendre_H3d, 3);
1391
+
1392
+ rb_define_camath_gsl_func2(psi, 1);
1393
+ rb_define_camath_gsl_func2(psi_1piy, 1);
1394
+ rb_define_camath_gsl_func2(psi_1, 1);
1395
+ rb_define_camath_gsl_func2(psi_n, 2);
1396
+
1397
+ rb_define_camath_gsl_func2(synchrotron_1, 1);
1398
+ rb_define_camath_gsl_func2(synchrotron_2, 1);
1399
+
1400
+ rb_define_camath_gsl_func2(transport_2, 1);
1401
+ rb_define_camath_gsl_func2(transport_3, 1);
1402
+ rb_define_camath_gsl_func2(transport_4, 1);
1403
+ rb_define_camath_gsl_func2(transport_5, 1);
1404
+
1405
+ rb_define_camath_gsl_func2(sinc, 1);
1406
+ rb_define_camath_gsl_func(polar_to_rect, 2); /* not func2 */
1407
+ rb_define_camath_gsl_func(rect_to_polar, 2); /* not func2 */
1408
+ rb_define_camath_gsl_func2(angle_restrict_symm, 1);
1409
+ rb_define_camath_gsl_func2(angle_restrict_pos, 1);
1410
+
1411
+ rb_define_camath_gsl_func2(zeta, 1);
1412
+ rb_define_camath_gsl_func2(zetam1, 1);
1413
+ rb_define_camath_gsl_func2(hzeta, 2);
1414
+ rb_define_camath_gsl_func2(eta, 1);
1415
+
1416
+ /* random distributions */
1417
+
1418
+ rb_define_camath_gsl_func(random_gaussian, 2);
1419
+ rb_define_camath_gsl_func2(gaussian_pdf, 2);
1420
+ rb_define_camath_gsl_func2(gaussian_P, 2);
1421
+ rb_define_camath_gsl_func2(gaussian_Q, 2);
1422
+ rb_define_camath_gsl_func2(gaussian_Pinv, 2);
1423
+ rb_define_camath_gsl_func2(gaussian_Qinv, 2);
1424
+
1425
+ rb_define_camath_gsl_func(random_ugaussian, 1);
1426
+ rb_define_camath_gsl_func2(ugaussian_pdf, 1);
1427
+ rb_define_camath_gsl_func2(ugaussian_P, 1);
1428
+ rb_define_camath_gsl_func2(ugaussian_Q, 1);
1429
+ rb_define_camath_gsl_func2(ugaussian_Pinv, 1);
1430
+ rb_define_camath_gsl_func2(ugaussian_Qinv, 1);
1431
+
1432
+ rb_define_camath_gsl_func(random_gaussian_tail, 3);
1433
+ rb_define_camath_gsl_func2(gaussian_tail_pdf, 3);
1434
+
1435
+ rb_define_camath_gsl_func(random_ugaussian_tail, 2);
1436
+ rb_define_camath_gsl_func2(ugaussian_tail_pdf, 2);
1437
+
1438
+ rb_define_camath_gsl_func(random_bivariate_gaussian, 3);
1439
+ rb_define_camath_gsl_func(bivariate_gaussian_pdf, 5); /* not func2 */
1440
+
1441
+ rb_define_camath_gsl_func(random_exponential, 2);
1442
+ rb_define_camath_gsl_func2(exponential_pdf, 2);
1443
+ rb_define_camath_gsl_func2(exponential_P, 2);
1444
+ rb_define_camath_gsl_func2(exponential_Q, 2);
1445
+ rb_define_camath_gsl_func2(exponential_Pinv, 2);
1446
+ rb_define_camath_gsl_func2(exponential_Qinv, 2);
1447
+
1448
+ rb_define_camath_gsl_func(random_laplace, 2);
1449
+ rb_define_camath_gsl_func2(laplace_pdf, 2);
1450
+ rb_define_camath_gsl_func2(laplace_P, 2);
1451
+ rb_define_camath_gsl_func2(laplace_Q, 2);
1452
+ rb_define_camath_gsl_func2(laplace_Pinv, 2);
1453
+ rb_define_camath_gsl_func2(laplace_Qinv, 2);
1454
+
1455
+ rb_define_camath_gsl_func(random_exppow, 3);
1456
+ rb_define_camath_gsl_func2(exppow_pdf, 3);
1457
+ rb_define_camath_gsl_func2(exppow_P, 3);
1458
+ rb_define_camath_gsl_func2(exppow_Q, 3);
1459
+
1460
+ rb_define_camath_gsl_func(random_cauchy, 2);
1461
+ rb_define_camath_gsl_func2(cauchy_pdf, 2);
1462
+ rb_define_camath_gsl_func2(cauchy_P, 2);
1463
+ rb_define_camath_gsl_func2(cauchy_Q, 2);
1464
+ rb_define_camath_gsl_func2(cauchy_Pinv, 2);
1465
+ rb_define_camath_gsl_func2(cauchy_Qinv, 2);
1466
+
1467
+ rb_define_camath_gsl_func(random_rayleigh, 2);
1468
+ rb_define_camath_gsl_func2(rayleigh_pdf, 2);
1469
+ rb_define_camath_gsl_func2(rayleigh_P, 2);
1470
+ rb_define_camath_gsl_func2(rayleigh_Q, 2);
1471
+ rb_define_camath_gsl_func2(rayleigh_Pinv, 2);
1472
+ rb_define_camath_gsl_func2(rayleigh_Qinv, 2);
1473
+
1474
+ rb_define_camath_gsl_func(random_rayleigh_tail, 3);
1475
+ rb_define_camath_gsl_func2(rayleigh_tail_pdf, 3);
1476
+
1477
+ rb_define_camath_gsl_func(random_landau, 1);
1478
+ rb_define_camath_gsl_func2(landau_pdf, 1);
1479
+
1480
+ rb_define_camath_gsl_func(random_levy, 3);
1481
+ rb_define_camath_gsl_func(random_levy_skew, 4);
1482
+
1483
+ rb_define_camath_gsl_func(random_gamma, 3);
1484
+ rb_define_camath_gsl_func2(gamma_pdf, 3);
1485
+ rb_define_camath_gsl_func2(gamma_P, 3);
1486
+ rb_define_camath_gsl_func2(gamma_Q, 3);
1487
+ rb_define_camath_gsl_func2(gamma_Pinv, 3);
1488
+ rb_define_camath_gsl_func2(gamma_Qinv, 3);
1489
+
1490
+ rb_define_camath_gsl_func(random_erlang, 3);
1491
+ rb_define_camath_gsl_func2(erlang_pdf, 3);
1492
+
1493
+ rb_define_camath_gsl_func(random_flat, 3);
1494
+ rb_define_camath_gsl_func2(flat_pdf, 3);
1495
+ rb_define_camath_gsl_func2(flat_P, 3);
1496
+ rb_define_camath_gsl_func2(flat_Q, 3);
1497
+ rb_define_camath_gsl_func2(flat_Pinv, 3);
1498
+ rb_define_camath_gsl_func2(flat_Qinv, 3);
1499
+
1500
+ rb_define_camath_gsl_func(random_lognormal, 3);
1501
+ rb_define_camath_gsl_func2(lognormal_pdf, 3);
1502
+ rb_define_camath_gsl_func2(lognormal_P, 3);
1503
+ rb_define_camath_gsl_func2(lognormal_Q, 3);
1504
+ rb_define_camath_gsl_func2(lognormal_Pinv, 3);
1505
+ rb_define_camath_gsl_func2(lognormal_Qinv, 3);
1506
+
1507
+ rb_define_camath_gsl_func(random_chisq, 2);
1508
+ rb_define_camath_gsl_func2(chisq_pdf, 2);
1509
+ rb_define_camath_gsl_func2(chisq_P, 2);
1510
+ rb_define_camath_gsl_func2(chisq_Q, 2);
1511
+ rb_define_camath_gsl_func2(chisq_Pinv, 2);
1512
+ rb_define_camath_gsl_func2(chisq_Qinv, 2);
1513
+
1514
+ rb_define_camath_gsl_func(random_fdist, 3);
1515
+ rb_define_camath_gsl_func2(fdist_pdf, 3);
1516
+ rb_define_camath_gsl_func2(fdist_P, 3);
1517
+ rb_define_camath_gsl_func2(fdist_Q, 3);
1518
+ rb_define_camath_gsl_func2(fdist_Pinv, 3);
1519
+ rb_define_camath_gsl_func2(fdist_Qinv, 3);
1520
+
1521
+ rb_define_camath_gsl_func(random_tdist, 2);
1522
+ rb_define_camath_gsl_func2(tdist_pdf, 2);
1523
+ rb_define_camath_gsl_func2(tdist_P, 2);
1524
+ rb_define_camath_gsl_func2(tdist_Q, 2);
1525
+ rb_define_camath_gsl_func2(tdist_Pinv, 2);
1526
+ rb_define_camath_gsl_func2(tdist_Qinv, 2);
1527
+
1528
+ rb_define_camath_gsl_func(random_beta, 3);
1529
+ rb_define_camath_gsl_func2(beta_pdf, 3);
1530
+ rb_define_camath_gsl_func2(beta_P, 3);
1531
+ rb_define_camath_gsl_func2(beta_Q, 3);
1532
+ rb_define_camath_gsl_func2(beta_Pinv, 3);
1533
+ rb_define_camath_gsl_func2(beta_Qinv, 3);
1534
+
1535
+ rb_define_camath_gsl_func(random_logistic, 2);
1536
+ rb_define_camath_gsl_func2(logistic_pdf, 2);
1537
+ rb_define_camath_gsl_func2(logistic_P, 2);
1538
+ rb_define_camath_gsl_func2(logistic_Q, 2);
1539
+ rb_define_camath_gsl_func2(logistic_Pinv, 2);
1540
+ rb_define_camath_gsl_func2(logistic_Qinv, 2);
1541
+
1542
+ rb_define_camath_gsl_func(random_pareto, 3);
1543
+ rb_define_camath_gsl_func2(pareto_pdf, 3);
1544
+ rb_define_camath_gsl_func2(pareto_P, 3);
1545
+ rb_define_camath_gsl_func2(pareto_Q, 3);
1546
+ rb_define_camath_gsl_func2(pareto_Pinv, 3);
1547
+ rb_define_camath_gsl_func2(pareto_Qinv, 3);
1548
+
1549
+ rb_define_camath_gsl_func(random_dir_2d, 1); /* ran */
1550
+ rb_define_camath_gsl_func(random_dir_3d, 1); /* ran */
1551
+ rb_define_camath_gsl_func(random_dir_nd, 2); /* ran */
1552
+
1553
+ rb_define_camath_gsl_func(random_weibull, 3);
1554
+ rb_define_camath_gsl_func2(weibull_pdf, 3);
1555
+ rb_define_camath_gsl_func2(weibull_P, 3);
1556
+ rb_define_camath_gsl_func2(weibull_Q, 3);
1557
+ rb_define_camath_gsl_func2(weibull_Pinv, 3);
1558
+ rb_define_camath_gsl_func2(weibull_Qinv, 3);
1559
+
1560
+ rb_define_camath_gsl_func(random_gumbel1, 3);
1561
+ rb_define_camath_gsl_func2(gumbel1_pdf, 3);
1562
+ rb_define_camath_gsl_func2(gumbel1_P, 3);
1563
+ rb_define_camath_gsl_func2(gumbel1_Q, 3);
1564
+ rb_define_camath_gsl_func2(gumbel1_Pinv, 3);
1565
+ rb_define_camath_gsl_func2(gumbel1_Qinv, 3);
1566
+
1567
+ rb_define_camath_gsl_func(random_gumbel2, 3);
1568
+ rb_define_camath_gsl_func2(gumbel2_pdf, 3);
1569
+ rb_define_camath_gsl_func2(gumbel2_P, 3);
1570
+ rb_define_camath_gsl_func2(gumbel2_Q, 3);
1571
+ rb_define_camath_gsl_func2(gumbel2_Pinv, 3);
1572
+ rb_define_camath_gsl_func2(gumbel2_Qinv, 3);
1573
+
1574
+ /*
1575
+ rb_define_camath_gsl_func(random_dirichlet, -1); */
1576
+
1577
+ /*
1578
+ rb_define_camath_gsl_func(random_discrete_preproc, -1); */
1579
+
1580
+ rb_define_camath_gsl_func(random_poisson, 2);
1581
+ rb_define_camath_gsl_func2(poisson_pdf, 2);
1582
+ rb_define_camath_gsl_func2(poisson_P, 2);
1583
+ rb_define_camath_gsl_func2(poisson_Q, 2);
1584
+
1585
+ rb_define_camath_gsl_func(random_bernoulli, 2);
1586
+ rb_define_camath_gsl_func2u(bernoulli_pdf, 2); /* not func2 */
1587
+
1588
+ rb_define_camath_gsl_func(random_binomial, 3);
1589
+ rb_define_camath_gsl_func(binomial_pdf, 3); /* not func2 */
1590
+ rb_define_camath_gsl_func(binomial_P, 3); /* not func2 */
1591
+ rb_define_camath_gsl_func(binomial_Q, 3); /* not func2 */
1592
+
1593
+ rb_define_camath_gsl_func(random_multinomial, 3);
1594
+ rb_define_camath_gsl_func(multinomial_pdf, 2);/* not func2 */
1595
+ rb_define_camath_gsl_func(multinomial_lnpdf, 2); /* not func2 */
1596
+
1597
+ rb_define_camath_gsl_func(random_negative_binomial, 3);
1598
+ rb_define_camath_gsl_func2u(negative_binomial_pdf, 3); /* not func2 */
1599
+ rb_define_camath_gsl_func2u(negative_binomial_P, 3); /* not func2 */
1600
+ rb_define_camath_gsl_func2u(negative_binomial_Q, 3); /* not func2 */
1601
+
1602
+ rb_define_camath_gsl_func(random_pascal, 3);
1603
+ rb_define_camath_gsl_func(pascal_pdf, 3); /* not func2 */
1604
+ rb_define_camath_gsl_func(pascal_P, 3); /* not func2 */
1605
+ rb_define_camath_gsl_func(pascal_Q, 3); /* not func2 */
1606
+
1607
+ rb_define_camath_gsl_func(random_geometric, 2);
1608
+ rb_define_camath_gsl_func2u(geometric_pdf, 2); /* not func2 */
1609
+ rb_define_camath_gsl_func2u(geometric_P, 2); /* not func2 */
1610
+ rb_define_camath_gsl_func2u(geometric_Q, 2); /* not func2 */
1611
+
1612
+ rb_define_camath_gsl_func(random_hypergeometric, 4);
1613
+ rb_define_camath_gsl_func(hypergeometric_pdf, 4); /* not func2 */
1614
+ rb_define_camath_gsl_func(hypergeometric_P, 4); /* not func2 */
1615
+ rb_define_camath_gsl_func(hypergeometric_Q, 4); /* not func2 */
1616
+
1617
+ rb_define_camath_gsl_func(random_logarithmic, 2);
1618
+ rb_define_camath_gsl_func2u(logarithmic_pdf, 2); /* not func2 */
1619
+
1620
+ }