gsl 1.12.108
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +29 -0
- data/Rakefile +54 -0
- data/VERSION +2 -0
- data/ext/MANIFEST +119 -0
- data/ext/alf.c +206 -0
- data/ext/array.c +666 -0
- data/ext/array_complex.c +247 -0
- data/ext/blas.c +29 -0
- data/ext/blas1.c +731 -0
- data/ext/blas2.c +1093 -0
- data/ext/blas3.c +881 -0
- data/ext/block.c +44 -0
- data/ext/block_source.c +886 -0
- data/ext/bspline.c +130 -0
- data/ext/bundle.c +3 -0
- data/ext/cdf.c +754 -0
- data/ext/cheb.c +542 -0
- data/ext/combination.c +283 -0
- data/ext/common.c +325 -0
- data/ext/complex.c +1004 -0
- data/ext/const.c +673 -0
- data/ext/const_additional.c +120 -0
- data/ext/cqp.c +283 -0
- data/ext/deriv.c +195 -0
- data/ext/dht.c +361 -0
- data/ext/diff.c +166 -0
- data/ext/dirac.c +395 -0
- data/ext/eigen.c +2373 -0
- data/ext/error.c +194 -0
- data/ext/extconf.rb +281 -0
- data/ext/fcmp.c +66 -0
- data/ext/fft.c +1092 -0
- data/ext/fit.c +205 -0
- data/ext/fresnel.c +312 -0
- data/ext/function.c +524 -0
- data/ext/geometry.c +139 -0
- data/ext/graph.c +1638 -0
- data/ext/gsl.c +271 -0
- data/ext/gsl_narray.c +653 -0
- data/ext/histogram.c +1995 -0
- data/ext/histogram2d.c +1068 -0
- data/ext/histogram3d.c +884 -0
- data/ext/histogram3d_source.c +750 -0
- data/ext/histogram_find.c +101 -0
- data/ext/histogram_oper.c +159 -0
- data/ext/ieee.c +98 -0
- data/ext/integration.c +1138 -0
- data/ext/interp.c +512 -0
- data/ext/jacobi.c +739 -0
- data/ext/linalg.c +4047 -0
- data/ext/linalg_complex.c +741 -0
- data/ext/math.c +725 -0
- data/ext/matrix.c +39 -0
- data/ext/matrix_complex.c +1732 -0
- data/ext/matrix_double.c +560 -0
- data/ext/matrix_int.c +256 -0
- data/ext/matrix_source.c +2733 -0
- data/ext/min.c +250 -0
- data/ext/monte.c +992 -0
- data/ext/multifit.c +1879 -0
- data/ext/multimin.c +808 -0
- data/ext/multimin_fsdf.c +156 -0
- data/ext/multiroots.c +955 -0
- data/ext/ndlinear.c +321 -0
- data/ext/nmf.c +167 -0
- data/ext/nmf_wrap.c +72 -0
- data/ext/ntuple.c +469 -0
- data/ext/odeiv.c +959 -0
- data/ext/ool.c +879 -0
- data/ext/oper_complex_source.c +253 -0
- data/ext/permutation.c +596 -0
- data/ext/poly.c +42 -0
- data/ext/poly2.c +265 -0
- data/ext/poly_source.c +1885 -0
- data/ext/qrng.c +171 -0
- data/ext/randist.c +1873 -0
- data/ext/rational.c +480 -0
- data/ext/rng.c +612 -0
- data/ext/root.c +408 -0
- data/ext/sf.c +1494 -0
- data/ext/sf_airy.c +200 -0
- data/ext/sf_bessel.c +867 -0
- data/ext/sf_clausen.c +28 -0
- data/ext/sf_coulomb.c +206 -0
- data/ext/sf_coupling.c +118 -0
- data/ext/sf_dawson.c +29 -0
- data/ext/sf_debye.c +157 -0
- data/ext/sf_dilog.c +42 -0
- data/ext/sf_elementary.c +44 -0
- data/ext/sf_ellint.c +206 -0
- data/ext/sf_elljac.c +29 -0
- data/ext/sf_erfc.c +93 -0
- data/ext/sf_exp.c +164 -0
- data/ext/sf_expint.c +211 -0
- data/ext/sf_fermi_dirac.c +148 -0
- data/ext/sf_gamma.c +344 -0
- data/ext/sf_gegenbauer.c +96 -0
- data/ext/sf_hyperg.c +197 -0
- data/ext/sf_laguerre.c +112 -0
- data/ext/sf_lambert.c +47 -0
- data/ext/sf_legendre.c +367 -0
- data/ext/sf_log.c +104 -0
- data/ext/sf_mathieu.c +238 -0
- data/ext/sf_power.c +46 -0
- data/ext/sf_psi.c +98 -0
- data/ext/sf_synchrotron.c +48 -0
- data/ext/sf_transport.c +76 -0
- data/ext/sf_trigonometric.c +207 -0
- data/ext/sf_zeta.c +119 -0
- data/ext/signal.c +310 -0
- data/ext/siman.c +718 -0
- data/ext/sort.c +208 -0
- data/ext/spline.c +395 -0
- data/ext/stats.c +799 -0
- data/ext/sum.c +168 -0
- data/ext/tamu_anova.c +56 -0
- data/ext/tensor.c +38 -0
- data/ext/tensor_source.c +1123 -0
- data/ext/vector.c +38 -0
- data/ext/vector_complex.c +2236 -0
- data/ext/vector_double.c +1433 -0
- data/ext/vector_int.c +204 -0
- data/ext/vector_source.c +3329 -0
- data/ext/wavelet.c +937 -0
- data/include/rb_gsl.h +151 -0
- data/include/rb_gsl_array.h +238 -0
- data/include/rb_gsl_cheb.h +21 -0
- data/include/rb_gsl_common.h +343 -0
- data/include/rb_gsl_complex.h +25 -0
- data/include/rb_gsl_const.h +29 -0
- data/include/rb_gsl_dirac.h +13 -0
- data/include/rb_gsl_eigen.h +17 -0
- data/include/rb_gsl_fft.h +62 -0
- data/include/rb_gsl_fit.h +25 -0
- data/include/rb_gsl_function.h +27 -0
- data/include/rb_gsl_graph.h +70 -0
- data/include/rb_gsl_histogram.h +63 -0
- data/include/rb_gsl_histogram3d.h +97 -0
- data/include/rb_gsl_integration.h +17 -0
- data/include/rb_gsl_interp.h +46 -0
- data/include/rb_gsl_linalg.h +25 -0
- data/include/rb_gsl_math.h +26 -0
- data/include/rb_gsl_odeiv.h +21 -0
- data/include/rb_gsl_poly.h +71 -0
- data/include/rb_gsl_rational.h +37 -0
- data/include/rb_gsl_rng.h +21 -0
- data/include/rb_gsl_root.h +22 -0
- data/include/rb_gsl_sf.h +119 -0
- data/include/rb_gsl_statistics.h +17 -0
- data/include/rb_gsl_tensor.h +45 -0
- data/include/rb_gsl_with_narray.h +22 -0
- data/include/templates_off.h +87 -0
- data/include/templates_on.h +241 -0
- data/lib/gsl/gnuplot.rb +41 -0
- data/lib/gsl/oper.rb +68 -0
- data/lib/ool.rb +22 -0
- data/lib/ool/conmin.rb +30 -0
- metadata +224 -0
data/ext/sf_expint.c
ADDED
@@ -0,0 +1,211 @@
|
|
1
|
+
/*
|
2
|
+
sf_expint.c
|
3
|
+
Ruby/GSL: Ruby extension library for GSL (GNU Scientific Library)
|
4
|
+
(C) Copyright 2001-2006 by Yoshiki Tsunesada
|
5
|
+
|
6
|
+
Ruby/GSL is free software: you can redistribute it and/or modify it
|
7
|
+
under the terms of the GNU General Public License.
|
8
|
+
This library is distributed in the hope that it will be useful, but
|
9
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
11
|
+
*/
|
12
|
+
|
13
|
+
#include "rb_gsl_sf.h"
|
14
|
+
|
15
|
+
static VALUE rb_gsl_sf_expint_E1(VALUE obj, VALUE x)
|
16
|
+
{
|
17
|
+
return rb_gsl_sf_eval1(gsl_sf_expint_E1, x);
|
18
|
+
}
|
19
|
+
|
20
|
+
static VALUE rb_gsl_sf_expint_E1_e(VALUE obj, VALUE x)
|
21
|
+
{
|
22
|
+
return rb_gsl_sf_eval_e(gsl_sf_expint_E1_e, x);
|
23
|
+
}
|
24
|
+
|
25
|
+
static VALUE rb_gsl_sf_expint_E2(VALUE obj, VALUE x)
|
26
|
+
{
|
27
|
+
return rb_gsl_sf_eval1(gsl_sf_expint_E2, x);
|
28
|
+
}
|
29
|
+
|
30
|
+
static VALUE rb_gsl_sf_expint_E2_e(VALUE obj, VALUE x)
|
31
|
+
{
|
32
|
+
return rb_gsl_sf_eval_e(gsl_sf_expint_E2_e, x);
|
33
|
+
}
|
34
|
+
|
35
|
+
static VALUE rb_gsl_sf_expint_Ei(VALUE obj, VALUE x)
|
36
|
+
{
|
37
|
+
return rb_gsl_sf_eval1(gsl_sf_expint_Ei, x);
|
38
|
+
}
|
39
|
+
|
40
|
+
static VALUE rb_gsl_sf_expint_Ei_e(VALUE obj, VALUE x)
|
41
|
+
{
|
42
|
+
return rb_gsl_sf_eval_e(gsl_sf_expint_Ei_e, x);
|
43
|
+
}
|
44
|
+
|
45
|
+
static VALUE rb_gsl_sf_Shi(VALUE obj, VALUE x)
|
46
|
+
{
|
47
|
+
return rb_gsl_sf_eval1(gsl_sf_Shi, x);
|
48
|
+
}
|
49
|
+
|
50
|
+
static VALUE rb_gsl_sf_Shi_e(VALUE obj, VALUE x)
|
51
|
+
{
|
52
|
+
return rb_gsl_sf_eval_e(gsl_sf_Shi_e, x);
|
53
|
+
}
|
54
|
+
|
55
|
+
static VALUE rb_gsl_sf_Chi(VALUE obj, VALUE x)
|
56
|
+
{
|
57
|
+
return rb_gsl_sf_eval1(gsl_sf_Chi, x);
|
58
|
+
}
|
59
|
+
|
60
|
+
static VALUE rb_gsl_sf_Chi_e(VALUE obj, VALUE x)
|
61
|
+
{
|
62
|
+
return rb_gsl_sf_eval_e(gsl_sf_Chi_e, x);
|
63
|
+
}
|
64
|
+
|
65
|
+
static VALUE rb_gsl_sf_expint_3(VALUE obj, VALUE x)
|
66
|
+
{
|
67
|
+
return rb_gsl_sf_eval1(gsl_sf_expint_3, x);
|
68
|
+
}
|
69
|
+
|
70
|
+
static VALUE rb_gsl_sf_expint_3_e(VALUE obj, VALUE x)
|
71
|
+
{
|
72
|
+
return rb_gsl_sf_eval_e(gsl_sf_expint_3_e, x);
|
73
|
+
}
|
74
|
+
|
75
|
+
static VALUE rb_gsl_sf_Si(VALUE obj, VALUE x)
|
76
|
+
{
|
77
|
+
return rb_gsl_sf_eval1(gsl_sf_Si, x);
|
78
|
+
}
|
79
|
+
|
80
|
+
static VALUE rb_gsl_sf_Si_e(VALUE obj, VALUE x)
|
81
|
+
{
|
82
|
+
return rb_gsl_sf_eval_e(gsl_sf_Si_e, x);
|
83
|
+
}
|
84
|
+
|
85
|
+
static VALUE rb_gsl_sf_Ci(VALUE obj, VALUE x)
|
86
|
+
{
|
87
|
+
return rb_gsl_sf_eval1(gsl_sf_Ci, x);
|
88
|
+
}
|
89
|
+
|
90
|
+
static VALUE rb_gsl_sf_Ci_e(VALUE obj, VALUE x)
|
91
|
+
{
|
92
|
+
return rb_gsl_sf_eval_e(gsl_sf_Ci_e, x);
|
93
|
+
}
|
94
|
+
|
95
|
+
static VALUE rb_gsl_sf_atanint(VALUE obj, VALUE x)
|
96
|
+
{
|
97
|
+
return rb_gsl_sf_eval1(gsl_sf_atanint, x);
|
98
|
+
}
|
99
|
+
|
100
|
+
static VALUE rb_gsl_sf_atanint_e(VALUE obj, VALUE x)
|
101
|
+
{
|
102
|
+
return rb_gsl_sf_eval_e(gsl_sf_atanint_e, x);
|
103
|
+
}
|
104
|
+
|
105
|
+
#ifdef GSL_1_3_LATER
|
106
|
+
static VALUE rb_gsl_sf_expint_E1_scaled(VALUE obj, VALUE x)
|
107
|
+
{
|
108
|
+
return rb_gsl_sf_eval1(gsl_sf_expint_E1_scaled, x);
|
109
|
+
}
|
110
|
+
|
111
|
+
static VALUE rb_gsl_sf_expint_E1_scaled_e(VALUE obj, VALUE x)
|
112
|
+
{
|
113
|
+
return rb_gsl_sf_eval_e(gsl_sf_expint_E1_scaled_e, x);
|
114
|
+
}
|
115
|
+
|
116
|
+
static VALUE rb_gsl_sf_expint_E2_scaled(VALUE obj, VALUE x)
|
117
|
+
{
|
118
|
+
return rb_gsl_sf_eval1(gsl_sf_expint_E2_scaled, x);
|
119
|
+
}
|
120
|
+
|
121
|
+
static VALUE rb_gsl_sf_expint_E2_scaled_e(VALUE obj, VALUE x)
|
122
|
+
{
|
123
|
+
return rb_gsl_sf_eval_e(gsl_sf_expint_E2_scaled_e, x);
|
124
|
+
}
|
125
|
+
|
126
|
+
static VALUE rb_gsl_sf_expint_Ei_scaled(VALUE obj, VALUE x)
|
127
|
+
{
|
128
|
+
return rb_gsl_sf_eval1(gsl_sf_expint_Ei_scaled, x);
|
129
|
+
}
|
130
|
+
|
131
|
+
static VALUE rb_gsl_sf_expint_Ei_scaled_e(VALUE obj, VALUE x)
|
132
|
+
{
|
133
|
+
return rb_gsl_sf_eval_e(gsl_sf_expint_Ei_scaled_e, x);
|
134
|
+
}
|
135
|
+
#endif
|
136
|
+
|
137
|
+
#ifdef GSL_1_10_LATER
|
138
|
+
static VALUE rb_gsl_sf_expint_En(VALUE obj, VALUE n, VALUE x)
|
139
|
+
{
|
140
|
+
return rb_gsl_sf_eval_int_double(gsl_sf_expint_En, n, x);
|
141
|
+
}
|
142
|
+
static VALUE rb_gsl_sf_expint_En_e(VALUE obj, VALUE n, VALUE x)
|
143
|
+
{
|
144
|
+
gsl_sf_result *rslt = NULL;
|
145
|
+
VALUE val;
|
146
|
+
val = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
|
147
|
+
gsl_sf_expint_En_e(FIX2INT(n), NUM2DBL(x), rslt);
|
148
|
+
return val;
|
149
|
+
}
|
150
|
+
|
151
|
+
#endif
|
152
|
+
|
153
|
+
void Init_gsl_sf_expint(VALUE module)
|
154
|
+
{
|
155
|
+
VALUE mgsl_sf_expint;
|
156
|
+
|
157
|
+
rb_define_module_function(module, "expint_E1", rb_gsl_sf_expint_E1, 1);
|
158
|
+
rb_define_module_function(module, "expint_E1_e", rb_gsl_sf_expint_E1_e, 1);
|
159
|
+
rb_define_module_function(module, "expint_E2", rb_gsl_sf_expint_E2, 1);
|
160
|
+
rb_define_module_function(module, "expint_E2_e", rb_gsl_sf_expint_E2_e, 1);
|
161
|
+
rb_define_module_function(module, "expint_Ei", rb_gsl_sf_expint_Ei, 1);
|
162
|
+
rb_define_module_function(module, "expint_Ei_e", rb_gsl_sf_expint_Ei_e, 1);
|
163
|
+
|
164
|
+
rb_define_module_function(module, "Shi", rb_gsl_sf_Shi, 1);
|
165
|
+
rb_define_module_function(module, "Shi_e", rb_gsl_sf_Shi_e, 1);
|
166
|
+
rb_define_module_function(module, "Chi", rb_gsl_sf_Chi, 1);
|
167
|
+
rb_define_module_function(module, "Chi_e", rb_gsl_sf_Chi_e, 1);
|
168
|
+
rb_define_module_function(module, "expint_3", rb_gsl_sf_expint_3, 1);
|
169
|
+
rb_define_module_function(module, "expint_3_e", rb_gsl_sf_expint_3_e, 1);
|
170
|
+
rb_define_module_function(module, "Si", rb_gsl_sf_Si, 1);
|
171
|
+
rb_define_module_function(module, "Si_e", rb_gsl_sf_Si_e, 1);
|
172
|
+
rb_define_module_function(module, "Ci", rb_gsl_sf_Ci, 1);
|
173
|
+
rb_define_module_function(module, "Ci_e", rb_gsl_sf_Ci_e, 1);
|
174
|
+
rb_define_module_function(module, "atanint", rb_gsl_sf_atanint, 1);
|
175
|
+
rb_define_module_function(module, "atanint_e", rb_gsl_sf_atanint_e, 1);
|
176
|
+
|
177
|
+
|
178
|
+
mgsl_sf_expint = rb_define_module_under(module, "Expint");
|
179
|
+
rb_define_module_function(mgsl_sf_expint, "E1", rb_gsl_sf_expint_E1, 1);
|
180
|
+
rb_define_module_function(mgsl_sf_expint, "E1_e", rb_gsl_sf_expint_E1_e, 1);
|
181
|
+
rb_define_module_function(mgsl_sf_expint, "E2", rb_gsl_sf_expint_E2, 1);
|
182
|
+
rb_define_module_function(mgsl_sf_expint, "E2_e", rb_gsl_sf_expint_E2_e, 1);
|
183
|
+
rb_define_module_function(mgsl_sf_expint, "Ei", rb_gsl_sf_expint_Ei, 1);
|
184
|
+
rb_define_module_function(mgsl_sf_expint, "Ei_e", rb_gsl_sf_expint_Ei_e, 1);
|
185
|
+
rb_define_module_function(mgsl_sf_expint, "three", rb_gsl_sf_expint_3, 1);
|
186
|
+
rb_define_module_function(mgsl_sf_expint, "three_e", rb_gsl_sf_expint_3_e, 1);
|
187
|
+
|
188
|
+
#ifdef GSL_1_3_LATER
|
189
|
+
rb_define_module_function(module, "expint_E1_scaled", rb_gsl_sf_expint_E1_scaled, 1);
|
190
|
+
rb_define_module_function(module, "expint_E1_scaled_e", rb_gsl_sf_expint_E1_scaled_e, 1);
|
191
|
+
rb_define_module_function(module, "expint_E2_scaled", rb_gsl_sf_expint_E2_scaled, 1);
|
192
|
+
rb_define_module_function(module, "expint_E2_scaled_e", rb_gsl_sf_expint_E2_scaled_e, 1);
|
193
|
+
rb_define_module_function(module, "expint_Ei_scaled", rb_gsl_sf_expint_Ei_scaled, 1);
|
194
|
+
rb_define_module_function(module, "expint_Ei_scaled_e", rb_gsl_sf_expint_Ei_scaled_e, 1);
|
195
|
+
|
196
|
+
rb_define_module_function(mgsl_sf_expint, "E1_scaled", rb_gsl_sf_expint_E1_scaled, 1);
|
197
|
+
rb_define_module_function(mgsl_sf_expint, "E1_scaled_e", rb_gsl_sf_expint_E1_scaled_e, 1);
|
198
|
+
rb_define_module_function(mgsl_sf_expint, "E2_scaled", rb_gsl_sf_expint_E2_scaled, 1);
|
199
|
+
rb_define_module_function(mgsl_sf_expint, "E2_scaled_e", rb_gsl_sf_expint_E2_scaled_e, 1);
|
200
|
+
rb_define_module_function(mgsl_sf_expint, "Ei_scaled", rb_gsl_sf_expint_Ei_scaled, 1);
|
201
|
+
rb_define_module_function(mgsl_sf_expint, "Ei_scaled_e", rb_gsl_sf_expint_Ei_scaled_e, 1);
|
202
|
+
#endif
|
203
|
+
|
204
|
+
#ifdef GSL_1_10_LATER
|
205
|
+
rb_define_module_function(module, "expint_En", rb_gsl_sf_expint_En, 2);
|
206
|
+
rb_define_module_function(mgsl_sf_expint, "En", rb_gsl_sf_expint_En, 2);
|
207
|
+
rb_define_module_function(module, "expint_En_e", rb_gsl_sf_expint_En_e, 2);
|
208
|
+
rb_define_module_function(mgsl_sf_expint, "En_e", rb_gsl_sf_expint_En_e, 2);
|
209
|
+
#endif
|
210
|
+
|
211
|
+
}
|
@@ -0,0 +1,148 @@
|
|
1
|
+
/*
|
2
|
+
sf_fermi_dirac.c
|
3
|
+
Ruby/GSL: Ruby extension library for GSL (GNU Scientific Library)
|
4
|
+
(C) Copyright 2001-2006 by Yoshiki Tsunesada
|
5
|
+
|
6
|
+
Ruby/GSL is free software: you can redistribute it and/or modify it
|
7
|
+
under the terms of the GNU General Public License.
|
8
|
+
This library is distributed in the hope that it will be useful, but
|
9
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
11
|
+
*/
|
12
|
+
|
13
|
+
#include "rb_gsl_sf.h"
|
14
|
+
|
15
|
+
static VALUE rb_gsl_sf_fermi_dirac_m1(VALUE obj, VALUE x)
|
16
|
+
{
|
17
|
+
return rb_gsl_sf_eval1(gsl_sf_fermi_dirac_m1, x);
|
18
|
+
}
|
19
|
+
|
20
|
+
static VALUE rb_gsl_sf_fermi_dirac_m1_e(VALUE obj, VALUE x)
|
21
|
+
{
|
22
|
+
return rb_gsl_sf_eval_e(gsl_sf_fermi_dirac_m1_e, x);
|
23
|
+
}
|
24
|
+
|
25
|
+
static VALUE rb_gsl_sf_fermi_dirac_0(VALUE obj, VALUE x)
|
26
|
+
{
|
27
|
+
return rb_gsl_sf_eval1(gsl_sf_fermi_dirac_0, x);
|
28
|
+
}
|
29
|
+
|
30
|
+
static VALUE rb_gsl_sf_fermi_dirac_0_e(VALUE obj, VALUE x)
|
31
|
+
{
|
32
|
+
return rb_gsl_sf_eval_e(gsl_sf_fermi_dirac_0_e, x);
|
33
|
+
}
|
34
|
+
|
35
|
+
static VALUE rb_gsl_sf_fermi_dirac_1(VALUE obj, VALUE x)
|
36
|
+
{
|
37
|
+
return rb_gsl_sf_eval1(gsl_sf_fermi_dirac_1, x);
|
38
|
+
}
|
39
|
+
|
40
|
+
static VALUE rb_gsl_sf_fermi_dirac_1_e(VALUE obj, VALUE x)
|
41
|
+
{
|
42
|
+
return rb_gsl_sf_eval_e(gsl_sf_fermi_dirac_1_e, x);
|
43
|
+
}
|
44
|
+
|
45
|
+
static VALUE rb_gsl_sf_fermi_dirac_2(VALUE obj, VALUE x)
|
46
|
+
{
|
47
|
+
return rb_gsl_sf_eval1(gsl_sf_fermi_dirac_2, x);
|
48
|
+
}
|
49
|
+
|
50
|
+
static VALUE rb_gsl_sf_fermi_dirac_2_e(VALUE obj, VALUE x)
|
51
|
+
{
|
52
|
+
return rb_gsl_sf_eval_e(gsl_sf_fermi_dirac_2_e, x);
|
53
|
+
}
|
54
|
+
|
55
|
+
static VALUE rb_gsl_sf_fermi_dirac_int(VALUE obj, VALUE j, VALUE x)
|
56
|
+
{
|
57
|
+
return rb_gsl_sf_eval_int_double(gsl_sf_fermi_dirac_int, j, x);
|
58
|
+
}
|
59
|
+
|
60
|
+
static VALUE rb_gsl_sf_fermi_dirac_int_e(VALUE obj, VALUE j, VALUE x)
|
61
|
+
{
|
62
|
+
return rb_gsl_sf_eval_e_int_double(gsl_sf_fermi_dirac_int_e, j, x);
|
63
|
+
}
|
64
|
+
|
65
|
+
static VALUE rb_gsl_sf_fermi_dirac_mhalf(VALUE obj, VALUE x)
|
66
|
+
{
|
67
|
+
return rb_gsl_sf_eval1(gsl_sf_fermi_dirac_mhalf, x);
|
68
|
+
}
|
69
|
+
|
70
|
+
static VALUE rb_gsl_sf_fermi_dirac_mhalf_e(VALUE obj, VALUE x)
|
71
|
+
{
|
72
|
+
return rb_gsl_sf_eval_e(gsl_sf_fermi_dirac_mhalf_e, x);
|
73
|
+
}
|
74
|
+
|
75
|
+
static VALUE rb_gsl_sf_fermi_dirac_half(VALUE obj, VALUE x)
|
76
|
+
{
|
77
|
+
return rb_gsl_sf_eval1(gsl_sf_fermi_dirac_half, x);
|
78
|
+
}
|
79
|
+
|
80
|
+
static VALUE rb_gsl_sf_fermi_dirac_half_e(VALUE obj, VALUE x)
|
81
|
+
{
|
82
|
+
return rb_gsl_sf_eval_e(gsl_sf_fermi_dirac_half_e, x);
|
83
|
+
}
|
84
|
+
|
85
|
+
static VALUE rb_gsl_sf_fermi_dirac_3half(VALUE obj, VALUE x)
|
86
|
+
{
|
87
|
+
return rb_gsl_sf_eval1(gsl_sf_fermi_dirac_3half, x);
|
88
|
+
}
|
89
|
+
|
90
|
+
static VALUE rb_gsl_sf_fermi_dirac_3half_e(VALUE obj, VALUE x)
|
91
|
+
{
|
92
|
+
return rb_gsl_sf_eval_e(gsl_sf_fermi_dirac_3half_e, x);
|
93
|
+
}
|
94
|
+
|
95
|
+
static VALUE rb_gsl_sf_fermi_dirac_inc_0(VALUE obj, VALUE x, VALUE b)
|
96
|
+
{
|
97
|
+
return rb_float_new(gsl_sf_fermi_dirac_inc_0(NUM2DBL(x), NUM2DBL(b)));
|
98
|
+
}
|
99
|
+
|
100
|
+
static VALUE rb_gsl_sf_fermi_dirac_inc_0_e(VALUE obj, VALUE x, VALUE b)
|
101
|
+
{
|
102
|
+
return rb_gsl_sf_eval_e_double2(gsl_sf_fermi_dirac_inc_0_e, x, b);
|
103
|
+
}
|
104
|
+
|
105
|
+
void Init_gsl_sf_fermi_dirac(VALUE module)
|
106
|
+
{
|
107
|
+
VALUE mgsl_sf_fermi;
|
108
|
+
|
109
|
+
rb_define_module_function(module, "fermi_dirac_m1", rb_gsl_sf_fermi_dirac_m1, 1);
|
110
|
+
rb_define_module_function(module, "fermi_dirac_m1_e", rb_gsl_sf_fermi_dirac_m1_e, 1);
|
111
|
+
rb_define_module_function(module, "fermi_dirac_0", rb_gsl_sf_fermi_dirac_0, 1);
|
112
|
+
rb_define_module_function(module, "fermi_dirac_0_e", rb_gsl_sf_fermi_dirac_0_e, 1);
|
113
|
+
rb_define_module_function(module, "fermi_dirac_1", rb_gsl_sf_fermi_dirac_1, 1);
|
114
|
+
rb_define_module_function(module, "fermi_dirac_1_e", rb_gsl_sf_fermi_dirac_1_e, 1);
|
115
|
+
rb_define_module_function(module, "fermi_dirac_2", rb_gsl_sf_fermi_dirac_2, 1);
|
116
|
+
rb_define_module_function(module, "fermi_dirac_2_e", rb_gsl_sf_fermi_dirac_2_e, 1);
|
117
|
+
rb_define_module_function(module, "fermi_dirac_int", rb_gsl_sf_fermi_dirac_int, 2);
|
118
|
+
rb_define_module_function(module, "fermi_dirac_int_e", rb_gsl_sf_fermi_dirac_int_e, 2);
|
119
|
+
rb_define_module_function(module, "fermi_dirac_mhalf", rb_gsl_sf_fermi_dirac_mhalf, 1);
|
120
|
+
rb_define_module_function(module, "fermi_dirac_mhalf_e", rb_gsl_sf_fermi_dirac_mhalf_e, 1);
|
121
|
+
rb_define_module_function(module, "fermi_dirac_half", rb_gsl_sf_fermi_dirac_half, 1);
|
122
|
+
rb_define_module_function(module, "fermi_dirac_half_e", rb_gsl_sf_fermi_dirac_half_e, 1);
|
123
|
+
rb_define_module_function(module, "fermi_dirac_3half", rb_gsl_sf_fermi_dirac_3half, 1);
|
124
|
+
rb_define_module_function(module, "fermi_dirac_3half_e", rb_gsl_sf_fermi_dirac_3half_e, 1);
|
125
|
+
rb_define_module_function(module, "fermi_dirac_inc_0", rb_gsl_sf_fermi_dirac_inc_0, 2);
|
126
|
+
rb_define_module_function(module, "fermi_dirac_inc_0_e", rb_gsl_sf_fermi_dirac_inc_0_e, 2);
|
127
|
+
|
128
|
+
mgsl_sf_fermi = rb_define_module_under(module, "Fermi_Dirac");
|
129
|
+
rb_define_module_function(mgsl_sf_fermi, "m1", rb_gsl_sf_fermi_dirac_m1, 1);
|
130
|
+
rb_define_module_function(mgsl_sf_fermi, "m1_e", rb_gsl_sf_fermi_dirac_m1_e, 1);
|
131
|
+
rb_define_module_function(mgsl_sf_fermi, "zero", rb_gsl_sf_fermi_dirac_0, 1);
|
132
|
+
rb_define_module_function(mgsl_sf_fermi, "zero_e", rb_gsl_sf_fermi_dirac_0_e, 1);
|
133
|
+
rb_define_module_function(mgsl_sf_fermi, "one", rb_gsl_sf_fermi_dirac_1, 1);
|
134
|
+
rb_define_module_function(mgsl_sf_fermi, "one_e", rb_gsl_sf_fermi_dirac_1_e, 1);
|
135
|
+
rb_define_module_function(mgsl_sf_fermi, "two", rb_gsl_sf_fermi_dirac_2, 1);
|
136
|
+
rb_define_module_function(mgsl_sf_fermi, "two_e", rb_gsl_sf_fermi_dirac_2_e, 1);
|
137
|
+
rb_define_module_function(mgsl_sf_fermi, "int", rb_gsl_sf_fermi_dirac_int, 2);
|
138
|
+
rb_define_module_function(mgsl_sf_fermi, "int_e", rb_gsl_sf_fermi_dirac_int_e, 2);
|
139
|
+
rb_define_module_function(mgsl_sf_fermi, "mhalf", rb_gsl_sf_fermi_dirac_mhalf, 1);
|
140
|
+
rb_define_module_function(mgsl_sf_fermi, "mhalf_e", rb_gsl_sf_fermi_dirac_mhalf_e, 1);
|
141
|
+
rb_define_module_function(mgsl_sf_fermi, "half", rb_gsl_sf_fermi_dirac_half, 1);
|
142
|
+
rb_define_module_function(mgsl_sf_fermi, "half_e", rb_gsl_sf_fermi_dirac_half_e, 1);
|
143
|
+
rb_define_module_function(mgsl_sf_fermi, "threehalf", rb_gsl_sf_fermi_dirac_3half, 1);
|
144
|
+
rb_define_module_function(mgsl_sf_fermi, "threehalf_e", rb_gsl_sf_fermi_dirac_3half_e, 1);
|
145
|
+
rb_define_module_function(mgsl_sf_fermi, "inc_0", rb_gsl_sf_fermi_dirac_inc_0, 2);
|
146
|
+
rb_define_module_function(mgsl_sf_fermi, "inc_0_e", rb_gsl_sf_fermi_dirac_inc_0_e, 2);
|
147
|
+
|
148
|
+
}
|
data/ext/sf_gamma.c
ADDED
@@ -0,0 +1,344 @@
|
|
1
|
+
/*
|
2
|
+
sf_gamma.c
|
3
|
+
Ruby/GSL: Ruby extension library for GSL (GNU Scientific Library)
|
4
|
+
(C) Copyright 2001-2006 by Yoshiki Tsunesada
|
5
|
+
|
6
|
+
Ruby/GSL is free software: you can redistribute it and/or modify it
|
7
|
+
under the terms of the GNU General Public License.
|
8
|
+
This library is distributed in the hope that it will be useful, but
|
9
|
+
WITHOUT ANY WARRANTY.
|
10
|
+
*/
|
11
|
+
|
12
|
+
#include "rb_gsl_sf.h"
|
13
|
+
|
14
|
+
static VALUE rb_gsl_sf_gamma(VALUE obj, VALUE x)
|
15
|
+
{
|
16
|
+
return rb_gsl_sf_eval1(gsl_sf_gamma, x);
|
17
|
+
}
|
18
|
+
|
19
|
+
static VALUE rb_gsl_sf_gamma_e(VALUE obj, VALUE x)
|
20
|
+
{
|
21
|
+
return rb_gsl_sf_eval_e(gsl_sf_gamma_e, x);
|
22
|
+
}
|
23
|
+
|
24
|
+
static VALUE rb_gsl_sf_lngamma(VALUE obj, VALUE x)
|
25
|
+
{
|
26
|
+
return rb_gsl_sf_eval1(gsl_sf_lngamma, x);
|
27
|
+
}
|
28
|
+
|
29
|
+
static VALUE rb_gsl_sf_lngamma_e(VALUE obj, VALUE x)
|
30
|
+
{
|
31
|
+
return rb_gsl_sf_eval_e(gsl_sf_lngamma_e, x);
|
32
|
+
}
|
33
|
+
|
34
|
+
static VALUE rb_gsl_sf_lngamma_sgn_e(VALUE obj, VALUE x)
|
35
|
+
{
|
36
|
+
gsl_sf_result *rslt = NULL;
|
37
|
+
VALUE v;
|
38
|
+
int status;
|
39
|
+
double sgn;
|
40
|
+
Need_Float(x);
|
41
|
+
v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
|
42
|
+
status = gsl_sf_lngamma_sgn_e(NUM2DBL(x), rslt, &sgn);
|
43
|
+
return rb_ary_new3(2, v, rb_float_new(sgn));
|
44
|
+
}
|
45
|
+
|
46
|
+
static VALUE rb_gsl_sf_gammastar(VALUE obj, VALUE x)
|
47
|
+
{
|
48
|
+
return rb_gsl_sf_eval1(gsl_sf_gammastar, x);
|
49
|
+
}
|
50
|
+
|
51
|
+
static VALUE rb_gsl_sf_gammastar_e(VALUE obj, VALUE x)
|
52
|
+
{
|
53
|
+
return rb_gsl_sf_eval_e(gsl_sf_gammastar_e, x);
|
54
|
+
}
|
55
|
+
|
56
|
+
static VALUE rb_gsl_sf_gammainv(VALUE obj, VALUE x)
|
57
|
+
{
|
58
|
+
return rb_gsl_sf_eval1(gsl_sf_gammainv, x);
|
59
|
+
}
|
60
|
+
|
61
|
+
static VALUE rb_gsl_sf_gammainv_e(VALUE obj, VALUE x)
|
62
|
+
{
|
63
|
+
return rb_gsl_sf_eval_e(gsl_sf_gammainv_e, x);
|
64
|
+
}
|
65
|
+
|
66
|
+
static VALUE rb_gsl_sf_lngamma_complex_e(int argc, VALUE *argv, VALUE obj)
|
67
|
+
{
|
68
|
+
gsl_sf_result *lnr, *arg;
|
69
|
+
gsl_complex *z;
|
70
|
+
double re, im;
|
71
|
+
VALUE vlnr, varg;
|
72
|
+
int status;
|
73
|
+
switch (argc) {
|
74
|
+
case 1:
|
75
|
+
CHECK_COMPLEX(argv[0]);
|
76
|
+
Data_Get_Struct(argv[0], gsl_complex, z);
|
77
|
+
re = GSL_REAL(*z);
|
78
|
+
im = GSL_IMAG(*z);
|
79
|
+
break;
|
80
|
+
case 2:
|
81
|
+
Need_Float(argv[0]); Need_Float(argv[1]);
|
82
|
+
re = NUM2DBL(argv[0]);
|
83
|
+
im = NUM2DBL(argv[1]);
|
84
|
+
default:
|
85
|
+
rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
|
86
|
+
}
|
87
|
+
vlnr = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, lnr);
|
88
|
+
varg = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, arg);
|
89
|
+
status = gsl_sf_lngamma_complex_e(re, im, lnr, arg);
|
90
|
+
return rb_ary_new3(3, vlnr, varg, INT2FIX(status));
|
91
|
+
}
|
92
|
+
|
93
|
+
static VALUE rb_gsl_sf_taylorcoeff(VALUE obj, VALUE n, VALUE x)
|
94
|
+
{
|
95
|
+
return rb_gsl_sf_eval_int_double(gsl_sf_taylorcoeff, n, x);
|
96
|
+
}
|
97
|
+
|
98
|
+
static VALUE rb_gsl_sf_taylorcoeff_e(VALUE obj, VALUE n, VALUE x)
|
99
|
+
{
|
100
|
+
return rb_gsl_sf_eval_e_int_double(gsl_sf_taylorcoeff_e, n, x);
|
101
|
+
}
|
102
|
+
|
103
|
+
static VALUE rb_gsl_sf_fact(VALUE obj, VALUE n)
|
104
|
+
{
|
105
|
+
return rb_gsl_sf_eval1_uint(gsl_sf_fact, n);
|
106
|
+
}
|
107
|
+
|
108
|
+
static VALUE rb_gsl_sf_fact_e(VALUE obj, VALUE n)
|
109
|
+
{
|
110
|
+
return rb_gsl_sf_eval_e_uint(gsl_sf_fact_e, n);
|
111
|
+
}
|
112
|
+
|
113
|
+
static VALUE rb_gsl_sf_doublefact(VALUE obj, VALUE n)
|
114
|
+
{
|
115
|
+
return rb_gsl_sf_eval1_uint(gsl_sf_doublefact, n);
|
116
|
+
}
|
117
|
+
|
118
|
+
static VALUE rb_gsl_sf_doublefact_e(VALUE obj, VALUE n)
|
119
|
+
{
|
120
|
+
return rb_gsl_sf_eval_e_uint(gsl_sf_doublefact_e, n);
|
121
|
+
}
|
122
|
+
|
123
|
+
static VALUE rb_gsl_sf_lnfact(VALUE obj, VALUE n)
|
124
|
+
{
|
125
|
+
return rb_gsl_sf_eval1_uint(gsl_sf_lnfact, n);
|
126
|
+
}
|
127
|
+
|
128
|
+
static VALUE rb_gsl_sf_lnfact_e(VALUE obj, VALUE n)
|
129
|
+
{
|
130
|
+
return rb_gsl_sf_eval_e_uint(gsl_sf_lnfact_e, n);
|
131
|
+
}
|
132
|
+
|
133
|
+
static VALUE rb_gsl_sf_lndoublefact(VALUE obj, VALUE n)
|
134
|
+
{
|
135
|
+
return rb_gsl_sf_eval1_uint(gsl_sf_lndoublefact, n);
|
136
|
+
}
|
137
|
+
|
138
|
+
static VALUE rb_gsl_sf_lndoublefact_e(VALUE obj, VALUE n)
|
139
|
+
{
|
140
|
+
return rb_gsl_sf_eval_e_uint(gsl_sf_lndoublefact_e, n);
|
141
|
+
}
|
142
|
+
|
143
|
+
static VALUE rb_gsl_sf_choose(VALUE obj, VALUE n, VALUE m)
|
144
|
+
{
|
145
|
+
return rb_float_new(gsl_sf_choose(FIX2INT(n), FIX2INT(m)));
|
146
|
+
}
|
147
|
+
|
148
|
+
static VALUE rb_gsl_sf_choose_e(VALUE obj, VALUE n, VALUE m)
|
149
|
+
{
|
150
|
+
gsl_sf_result *rslt = NULL;
|
151
|
+
VALUE v;
|
152
|
+
CHECK_FIXNUM(n); CHECK_FIXNUM(m);
|
153
|
+
v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
|
154
|
+
gsl_sf_choose_e(FIX2INT(n), FIX2INT(m), rslt);
|
155
|
+
return v;
|
156
|
+
}
|
157
|
+
|
158
|
+
static VALUE rb_gsl_sf_lnchoose(VALUE obj, VALUE n, VALUE m)
|
159
|
+
{
|
160
|
+
CHECK_FIXNUM(n); CHECK_FIXNUM(m);
|
161
|
+
return rb_float_new(gsl_sf_lnchoose(FIX2INT(n), FIX2INT(m)));
|
162
|
+
}
|
163
|
+
|
164
|
+
static VALUE rb_gsl_sf_lnchoose_e(VALUE obj, VALUE n, VALUE m)
|
165
|
+
{
|
166
|
+
gsl_sf_result *rslt = NULL;
|
167
|
+
VALUE v;
|
168
|
+
int status;
|
169
|
+
CHECK_FIXNUM(n); CHECK_FIXNUM(m);
|
170
|
+
v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
|
171
|
+
status = gsl_sf_lnchoose_e(FIX2INT(n), FIX2INT(m), rslt);
|
172
|
+
return v;
|
173
|
+
}
|
174
|
+
|
175
|
+
static VALUE rb_gsl_sf_poch(VALUE obj, VALUE a, VALUE x)
|
176
|
+
{
|
177
|
+
return rb_gsl_sf_eval_double_double(gsl_sf_poch, a, x);
|
178
|
+
}
|
179
|
+
|
180
|
+
static VALUE rb_gsl_sf_poch_e(VALUE obj, VALUE a, VALUE x)
|
181
|
+
{
|
182
|
+
return rb_gsl_sf_eval_e_double2(gsl_sf_poch_e, a, x);
|
183
|
+
}
|
184
|
+
|
185
|
+
static VALUE rb_gsl_sf_lnpoch(VALUE obj, VALUE a, VALUE x)
|
186
|
+
{
|
187
|
+
return rb_gsl_sf_eval_double_double(gsl_sf_lnpoch, a, x);
|
188
|
+
}
|
189
|
+
|
190
|
+
static VALUE rb_gsl_sf_lnpoch_e(VALUE obj, VALUE a, VALUE x)
|
191
|
+
{
|
192
|
+
return rb_gsl_sf_eval_e_double2(gsl_sf_lnpoch_e, a, x);
|
193
|
+
}
|
194
|
+
|
195
|
+
static VALUE rb_gsl_sf_lnpoch_sgn_e(VALUE obj, VALUE a, VALUE x)
|
196
|
+
{
|
197
|
+
gsl_sf_result *rslt = NULL;
|
198
|
+
VALUE v;
|
199
|
+
double sgn;
|
200
|
+
int status;
|
201
|
+
Need_Float(a); Need_Float(x);
|
202
|
+
v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
|
203
|
+
status = gsl_sf_lnpoch_sgn_e(NUM2DBL(a), NUM2DBL(x), rslt, &sgn);
|
204
|
+
return rb_ary_new3(2, v, rb_float_new(sgn));
|
205
|
+
}
|
206
|
+
|
207
|
+
static VALUE rb_gsl_sf_pochrel(VALUE obj, VALUE a, VALUE x)
|
208
|
+
{
|
209
|
+
return rb_gsl_sf_eval_double_double(gsl_sf_pochrel, a, x);
|
210
|
+
}
|
211
|
+
|
212
|
+
static VALUE rb_gsl_sf_pochrel_e(VALUE obj, VALUE a, VALUE x)
|
213
|
+
{
|
214
|
+
return rb_gsl_sf_eval_e_double2(gsl_sf_pochrel_e, a, x);
|
215
|
+
}
|
216
|
+
|
217
|
+
static VALUE rb_gsl_sf_gamma_inc_Q(VALUE obj, VALUE a, VALUE x)
|
218
|
+
{
|
219
|
+
return rb_gsl_sf_eval_double_double(gsl_sf_gamma_inc_Q, a, x);
|
220
|
+
}
|
221
|
+
|
222
|
+
static VALUE rb_gsl_sf_gamma_inc_Q_e(VALUE obj, VALUE a, VALUE x)
|
223
|
+
{
|
224
|
+
return rb_gsl_sf_eval_e_double2(gsl_sf_gamma_inc_Q_e, a, x);
|
225
|
+
}
|
226
|
+
|
227
|
+
static VALUE rb_gsl_sf_gamma_inc_P(VALUE obj, VALUE a, VALUE x)
|
228
|
+
{
|
229
|
+
return rb_gsl_sf_eval_double_double(gsl_sf_gamma_inc_P, a, x);
|
230
|
+
}
|
231
|
+
|
232
|
+
static VALUE rb_gsl_sf_gamma_inc_P_e(VALUE obj, VALUE a, VALUE x)
|
233
|
+
{
|
234
|
+
return rb_gsl_sf_eval_e_double2(gsl_sf_gamma_inc_P_e, a, x);
|
235
|
+
}
|
236
|
+
|
237
|
+
static VALUE rb_gsl_sf_gamma_inc(VALUE obj, VALUE a, VALUE x)
|
238
|
+
{
|
239
|
+
return rb_gsl_sf_eval_double_double(gsl_sf_gamma_inc_P, a, x);
|
240
|
+
}
|
241
|
+
|
242
|
+
#ifdef GSL_1_4_LATER
|
243
|
+
static VALUE rb_gsl_sf_gamma_inc_e(VALUE obj, VALUE a, VALUE x)
|
244
|
+
{
|
245
|
+
return rb_gsl_sf_eval_e_double2(gsl_sf_gamma_inc_e, a, x);
|
246
|
+
}
|
247
|
+
#endif
|
248
|
+
|
249
|
+
static VALUE rb_gsl_sf_beta(VALUE obj, VALUE a, VALUE b)
|
250
|
+
{
|
251
|
+
return rb_float_new(gsl_sf_beta(NUM2DBL(a), NUM2DBL(b)));
|
252
|
+
}
|
253
|
+
|
254
|
+
static VALUE rb_gsl_sf_beta_e(VALUE obj, VALUE a, VALUE b)
|
255
|
+
{
|
256
|
+
return rb_gsl_sf_eval_e_double2(gsl_sf_beta_e, a, b);
|
257
|
+
}
|
258
|
+
|
259
|
+
static VALUE rb_gsl_sf_lnbeta(VALUE obj, VALUE a, VALUE b)
|
260
|
+
{
|
261
|
+
Need_Float(a); Need_Float(b);
|
262
|
+
return rb_float_new(gsl_sf_lnbeta(NUM2DBL(a), NUM2DBL(b)));
|
263
|
+
}
|
264
|
+
|
265
|
+
static VALUE rb_gsl_sf_lnbeta_e(VALUE obj, VALUE a, VALUE b)
|
266
|
+
{
|
267
|
+
return rb_gsl_sf_eval_e_double2(gsl_sf_lnbeta_e, a, b);
|
268
|
+
}
|
269
|
+
|
270
|
+
static VALUE rb_gsl_sf_beta_inc(VALUE obj, VALUE a, VALUE b, VALUE x)
|
271
|
+
{
|
272
|
+
Need_Float(a); Need_Float(b);
|
273
|
+
return rb_gsl_sf_eval_double3(gsl_sf_beta_inc, a, b, x);
|
274
|
+
}
|
275
|
+
|
276
|
+
static VALUE rb_gsl_sf_beta_inc_e(VALUE obj, VALUE a, VALUE b, VALUE x)
|
277
|
+
{
|
278
|
+
return rb_gsl_sf_eval_e_double3(gsl_sf_beta_inc_e, a, b, x);
|
279
|
+
}
|
280
|
+
|
281
|
+
double mygsl_binomial_coef(unsigned int n, unsigned int k);
|
282
|
+
double mygsl_binomial_coef(unsigned int n, unsigned int k)
|
283
|
+
{
|
284
|
+
return floor(0.5 + exp(gsl_sf_lnfact(n) - gsl_sf_lnfact(k) - gsl_sf_lnfact(n-k)));
|
285
|
+
}
|
286
|
+
|
287
|
+
static VALUE rb_gsl_sf_bincoef(VALUE obj, VALUE n, VALUE k)
|
288
|
+
{
|
289
|
+
CHECK_FIXNUM(n); CHECK_FIXNUM(k);
|
290
|
+
return rb_float_new(mygsl_binomial_coef(FIX2UINT(n), FIX2UINT(k)));
|
291
|
+
}
|
292
|
+
|
293
|
+
void Init_gsl_sf_gamma(VALUE module)
|
294
|
+
{
|
295
|
+
rb_define_const(module, "GAMMA_XMAX", NUM2DBL(GSL_SF_GAMMA_XMAX));
|
296
|
+
rb_define_module_function(module, "gamma", rb_gsl_sf_gamma, 1);
|
297
|
+
rb_define_module_function(module, "gamma_e", rb_gsl_sf_gamma_e, 1);
|
298
|
+
rb_define_module_function(module, "lngamma", rb_gsl_sf_lngamma, 1);
|
299
|
+
rb_define_module_function(module, "lngamma_e", rb_gsl_sf_lngamma_e, 1);
|
300
|
+
rb_define_module_function(module, "lngamma_sgn_e", rb_gsl_sf_lngamma_sgn_e, 1);
|
301
|
+
rb_define_module_function(module, "gammastar", rb_gsl_sf_gammastar, 1);
|
302
|
+
rb_define_module_function(module, "gammastar_e", rb_gsl_sf_gammastar_e, 1);
|
303
|
+
rb_define_module_function(module, "gammainv", rb_gsl_sf_gammainv, 1);
|
304
|
+
rb_define_module_function(module, "gammainv_e", rb_gsl_sf_gammainv_e, 1);
|
305
|
+
rb_define_module_function(module, "lngamma_complex_e", rb_gsl_sf_lngamma_complex_e, -1);
|
306
|
+
rb_define_module_function(module, "taylorcoeff", rb_gsl_sf_taylorcoeff, 2);
|
307
|
+
rb_define_module_function(module, "taylorcoeff_e", rb_gsl_sf_taylorcoeff_e, 2);
|
308
|
+
rb_define_module_function(module, "fact", rb_gsl_sf_fact, 1);
|
309
|
+
rb_define_module_function(module, "fact_e", rb_gsl_sf_fact_e, 1);
|
310
|
+
rb_define_module_function(module, "doublefact", rb_gsl_sf_doublefact, 1);
|
311
|
+
rb_define_module_function(module, "doublefact_e", rb_gsl_sf_doublefact_e, 1);
|
312
|
+
rb_define_module_function(module, "lnfact", rb_gsl_sf_lnfact, 1);
|
313
|
+
rb_define_module_function(module, "lnfact_e", rb_gsl_sf_lnfact_e, 1);
|
314
|
+
rb_define_module_function(module, "lndoublefact", rb_gsl_sf_lndoublefact, 1);
|
315
|
+
rb_define_module_function(module, "lndoublefact_e", rb_gsl_sf_lndoublefact_e, 1);
|
316
|
+
rb_define_module_function(module, "choose", rb_gsl_sf_choose, 2);
|
317
|
+
rb_define_module_function(module, "choose_e", rb_gsl_sf_choose_e, 2);
|
318
|
+
rb_define_module_function(module, "lnchoose", rb_gsl_sf_lnchoose, 2);
|
319
|
+
rb_define_module_function(module, "lnchoose_e", rb_gsl_sf_lnchoose_e, 2);
|
320
|
+
rb_define_module_function(module, "poch", rb_gsl_sf_poch, 2);
|
321
|
+
rb_define_module_function(module, "poch_e", rb_gsl_sf_poch_e, 2);
|
322
|
+
rb_define_module_function(module, "lnpoch", rb_gsl_sf_lnpoch, 2);
|
323
|
+
rb_define_module_function(module, "lnpoch_e", rb_gsl_sf_lnpoch_e, 2);
|
324
|
+
rb_define_module_function(module, "lnpoch_sgn_e", rb_gsl_sf_lnpoch_sgn_e, 2);
|
325
|
+
rb_define_module_function(module, "pochrel", rb_gsl_sf_pochrel, 2);
|
326
|
+
rb_define_module_function(module, "pochrel_e", rb_gsl_sf_pochrel_e, 2);
|
327
|
+
rb_define_module_function(module, "gamma_inc_P", rb_gsl_sf_gamma_inc_P, 2);
|
328
|
+
rb_define_module_function(module, "gamma_inc_P_e", rb_gsl_sf_gamma_inc_P_e, 2);
|
329
|
+
rb_define_module_function(module, "gamma_inc_Q", rb_gsl_sf_gamma_inc_Q, 2);
|
330
|
+
rb_define_module_function(module, "gamma_inc_Q_e", rb_gsl_sf_gamma_inc_Q_e, 2);
|
331
|
+
rb_define_module_function(module, "gamma_inc", rb_gsl_sf_gamma_inc, 2);
|
332
|
+
|
333
|
+
#ifdef GSL_1_4_LATER
|
334
|
+
rb_define_module_function(module, "gamma_inc_e", rb_gsl_sf_gamma_inc_e, 2);
|
335
|
+
#endif
|
336
|
+
rb_define_module_function(module, "beta", rb_gsl_sf_beta, 2);
|
337
|
+
rb_define_module_function(module, "beta_e", rb_gsl_sf_beta_e, 2);
|
338
|
+
rb_define_module_function(module, "lnbeta", rb_gsl_sf_lnbeta, 2);
|
339
|
+
rb_define_module_function(module, "lnbeta_e", rb_gsl_sf_lnbeta_e, 2);
|
340
|
+
rb_define_module_function(module, "beta_inc", rb_gsl_sf_beta_inc, 3);
|
341
|
+
rb_define_module_function(module, "beta_inc_e", rb_gsl_sf_beta_inc_e, 3);
|
342
|
+
|
343
|
+
rb_define_module_function(module, "bincoef", rb_gsl_sf_bincoef, 2);
|
344
|
+
}
|