File: sf_hyperg.c

package info (click to toggle)
ruby-gsl 2.1.0.3%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,604 kB
  • sloc: ansic: 62,050; ruby: 15,845; sh: 19; makefile: 10
file content (203 lines) | stat: -rw-r--r-- 7,834 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/*
  sf_hyperg.c
  Ruby/GSL: Ruby extension library for GSL (GNU Scientific Library)
    (C) Copyright 2001-2006 by Yoshiki Tsunesada

  Ruby/GSL is free software: you can redistribute it and/or modify it
  under the terms of the GNU General Public License.
  This library is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY.
*/

#include "include/rb_gsl_sf.h"

/* Checked with Mathematica. */
static VALUE rb_gsl_sf_hyperg_0F1(VALUE obj, VALUE c, VALUE x)
{
  return rb_gsl_sf_eval_double_double(gsl_sf_hyperg_0F1, c, x);
}

static VALUE rb_gsl_sf_hyperg_0F1_e(VALUE obj, VALUE c, VALUE x)
{
  return rb_gsl_sf_eval_e_double2(gsl_sf_hyperg_0F1_e, c, x);
}

static VALUE rb_gsl_sf_hyperg_1F1_int(VALUE obj, VALUE m, VALUE n, VALUE x)
{
  return rb_gsl_sf_eval_int_int_double(gsl_sf_hyperg_1F1_int, m, n, x);
}

static VALUE rb_gsl_sf_hyperg_1F1_int_e(VALUE obj, VALUE m, VALUE n, VALUE x)
{
  gsl_sf_result *rslt = NULL;
  VALUE v;
  // local variable "status" declared and set, but never used
  //int status;
  CHECK_FIXNUM(m); CHECK_FIXNUM(n); Need_Float(x);
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
  /*status =*/ gsl_sf_hyperg_1F1_int_e(FIX2INT(m), FIX2INT(n), NUM2DBL(x), rslt);
  return v;
}

static VALUE rb_gsl_sf_hyperg_1F1(VALUE obj, VALUE a, VALUE b, VALUE x)
{
  return rb_gsl_sf_eval_double3(gsl_sf_hyperg_1F1, a, b, x);
}

static VALUE rb_gsl_sf_hyperg_1F1_e(VALUE obj, VALUE a, VALUE b, VALUE x)
{
  return rb_gsl_sf_eval_e_double3(gsl_sf_hyperg_1F1_e, a, b, x);
}

static VALUE rb_gsl_sf_hyperg_U_int(VALUE obj, VALUE m, VALUE n, VALUE x)
{
  return rb_gsl_sf_eval_int_int_double(gsl_sf_hyperg_U_int, m, n, x);
}

static VALUE rb_gsl_sf_hyperg_U_int_e(VALUE obj, VALUE m, VALUE n, VALUE x)
{
  gsl_sf_result *rslt = NULL;
  VALUE v;
  // local variable "status" declared and set, but never used
  //int status;
  CHECK_FIXNUM(m); CHECK_FIXNUM(n); Need_Float(x);
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
  /*status =*/ gsl_sf_hyperg_U_int_e(FIX2INT(m), FIX2INT(n), NUM2DBL(x), rslt);
  return v;
}

static VALUE rb_gsl_sf_hyperg_U_int_e10_e(VALUE obj, VALUE m, VALUE n, VALUE x)
{
  gsl_sf_result_e10 *rslt = NULL;
  VALUE v;
  // local variable "status" declared and set, but never used
  //int status;
  CHECK_FIXNUM(m); CHECK_FIXNUM(n); Need_Float(x);
  v = Data_Make_Struct(cgsl_sf_result_e10, gsl_sf_result_e10, 0, free, rslt);
  /*status =*/ gsl_sf_hyperg_U_int_e10_e(FIX2INT(m), FIX2INT(n), NUM2DBL(x), rslt);
  return v;
}

static VALUE rb_gsl_sf_hyperg_U(VALUE obj, VALUE a, VALUE b, VALUE x)
{
  return rb_gsl_sf_eval_double3(gsl_sf_hyperg_U, a, b, x);
}

static VALUE rb_gsl_sf_hyperg_U_e(VALUE obj, VALUE a, VALUE b, VALUE x)
{
  return rb_gsl_sf_eval_e_double3(gsl_sf_hyperg_U_e, a, b, x);
}

static VALUE rb_gsl_sf_hyperg_U_e10_e(VALUE obj, VALUE a, VALUE b, VALUE x)
{
  gsl_sf_result_e10 *rslt = NULL;
  VALUE v;
  int status;
  Need_Float(a); Need_Float(b); Need_Float(x);
  v = Data_Make_Struct(cgsl_sf_result_e10, gsl_sf_result_e10, 0, free, rslt);
  status = gsl_sf_hyperg_U_e10_e(NUM2DBL(a), NUM2DBL(b), NUM2DBL(x), rslt);
  return rb_ary_new3(2, v, INT2FIX(status));
}

static VALUE rb_gsl_sf_hyperg_2F1(VALUE obj, VALUE a, VALUE b, VALUE c, VALUE x)
{
  return rb_gsl_sf_eval_double4(gsl_sf_hyperg_2F1, a, b, c, x);
}

static VALUE rb_gsl_sf_hyperg_2F1_e(VALUE obj, VALUE a, VALUE b, VALUE c, VALUE x)
{
  gsl_sf_result *rslt = NULL;
  VALUE v;
  int status;
  Need_Float(a); Need_Float(b); Need_Float(c); Need_Float(x);
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
  status = gsl_sf_hyperg_2F1_e(NUM2DBL(a), NUM2DBL(b), NUM2DBL(c), NUM2DBL(x), rslt);
  return rb_ary_new3(2, v, INT2FIX(status));
}

static VALUE rb_gsl_sf_hyperg_2F1_conj(VALUE obj, VALUE aR, VALUE aI, VALUE c, VALUE x)
{
  return rb_gsl_sf_eval_double4(gsl_sf_hyperg_2F1_conj, aR, aI, c, x);
}

static VALUE rb_gsl_sf_hyperg_2F1_conj_e(VALUE obj, VALUE aR, VALUE aI, VALUE c, VALUE x)
{
  gsl_sf_result *rslt = NULL;
  VALUE v;
  // local variable "status" declared and set, but never used
  //int status;
  Need_Float(aR); Need_Float(aI);  Need_Float(c); Need_Float(x);
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
  /*status =*/ gsl_sf_hyperg_2F1_conj_e(NUM2DBL(aR), NUM2DBL(aI), NUM2DBL(c), NUM2DBL(x), rslt);
  return v;
}

static VALUE rb_gsl_sf_hyperg_2F1_renorm(VALUE obj, VALUE a, VALUE b, VALUE c, VALUE x)
{
  return rb_gsl_sf_eval_double4(gsl_sf_hyperg_2F1_renorm, a, b, c, x);
}

static VALUE rb_gsl_sf_hyperg_2F1_renorm_e(VALUE obj, VALUE a, VALUE b, VALUE c, VALUE x)
{
  gsl_sf_result *rslt = NULL;
  VALUE v;
  // local variable "status" declared and set, but never used
  //int status;
  Need_Float(a); Need_Float(b);  Need_Float(c); Need_Float(x);
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
  /*status =*/ gsl_sf_hyperg_2F1_renorm_e(NUM2DBL(a), NUM2DBL(b), NUM2DBL(c), NUM2DBL(x), rslt);
  return v;
}

static VALUE rb_gsl_sf_hyperg_2F1_conj_renorm(VALUE obj, VALUE aR, VALUE aI, VALUE c, VALUE x)
{
  return rb_gsl_sf_eval_double4(gsl_sf_hyperg_2F1_conj_renorm, aR, aI, c, x);
}

static VALUE rb_gsl_sf_hyperg_2F1_conj_renorm_e(VALUE obj, VALUE aR, VALUE aI, VALUE c, VALUE x)
{
  gsl_sf_result *rslt = NULL;
  VALUE v;
  // local variable "status" declared and set, but never used
  //int status;
  Need_Float(aR); Need_Float(aI);  Need_Float(c); Need_Float(x);
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
  /*status =*/ gsl_sf_hyperg_2F1_conj_renorm_e(NUM2DBL(aR), NUM2DBL(aI), NUM2DBL(c), NUM2DBL(x), rslt);
  return v;
}

static VALUE rb_gsl_sf_hyperg_2F0(VALUE obj, VALUE a, VALUE b,  VALUE x)
{
  return rb_gsl_sf_eval_double3(gsl_sf_hyperg_2F0, a, b, x);
}

static VALUE rb_gsl_sf_hyperg_2F0_e(VALUE obj, VALUE a, VALUE b, VALUE x)
{
  return rb_gsl_sf_eval_e_double3(gsl_sf_hyperg_2F0_e, a, b, x);
}

void Init_gsl_sf_hyperg(VALUE module)
{
  rb_define_module_function(module, "hyperg_0F1",  rb_gsl_sf_hyperg_0F1, 2);
  rb_define_module_function(module, "hyperg_0F1_e",  rb_gsl_sf_hyperg_0F1_e, 2);
  rb_define_module_function(module, "hyperg_1F1_int",  rb_gsl_sf_hyperg_1F1_int, 3);
  rb_define_module_function(module, "hyperg_1F1_int_e",  rb_gsl_sf_hyperg_1F1_int_e, 3);
  rb_define_module_function(module, "hyperg_1F1",  rb_gsl_sf_hyperg_1F1, 3);
  rb_define_module_function(module, "hyperg_1F1_e",  rb_gsl_sf_hyperg_1F1_e, 3);
  rb_define_module_function(module, "hyperg_U_int",  rb_gsl_sf_hyperg_U_int, 3);
  rb_define_module_function(module, "hyperg_U_int_e",  rb_gsl_sf_hyperg_U_int_e, 3);
  rb_define_module_function(module, "hyperg_U_int_e10_e",  rb_gsl_sf_hyperg_U_int_e10_e, 3);
  rb_define_module_function(module, "hyperg_U",  rb_gsl_sf_hyperg_U, 3);
  rb_define_module_function(module, "hyperg_U_e",  rb_gsl_sf_hyperg_U_e, 3);
  rb_define_module_function(module, "hyperg_U_e10_e",  rb_gsl_sf_hyperg_U_e10_e, 3);
  rb_define_module_function(module, "hyperg_2F1",  rb_gsl_sf_hyperg_2F1, 4);
  rb_define_module_function(module, "hyperg_2F1_e",  rb_gsl_sf_hyperg_2F1_e, 4);
  rb_define_module_function(module, "hyperg_2F1_conj",  rb_gsl_sf_hyperg_2F1_conj, 4);
  rb_define_module_function(module, "hyperg_2F1_conj_e",  rb_gsl_sf_hyperg_2F1_conj_e, 4);
  rb_define_module_function(module, "hyperg_2F1_renorm",  rb_gsl_sf_hyperg_2F1_renorm, 4);
  rb_define_module_function(module, "hyperg_2F1_renorm_e",  rb_gsl_sf_hyperg_2F1_renorm_e, 4);
  rb_define_module_function(module, "hyperg_2F1_conj_renorm",  rb_gsl_sf_hyperg_2F1_conj_renorm, 4);
  rb_define_module_function(module, "hyperg_2F1_conj_renorm_e",  rb_gsl_sf_hyperg_2F1_conj_renorm_e, 4);
  rb_define_module_function(module, "hyperg_2F0",  rb_gsl_sf_hyperg_2F0, 3);
  rb_define_module_function(module, "hyperg_2F0_e",  rb_gsl_sf_hyperg_2F0_e, 3);
}