Debian Codegraph @

external/gsl/gsl_integration__qmomo.c

raw symbols SCIP
1 /* integration/qmomo.c
2 *
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20 #include "gsl__config.h"cxx . . $ `<file>/external/gsl/gsl__config.h`/
21 #include <stdlib.h>
22 #include "gsl_integration.h"cxx . . $ `<file>/external/gsl/gsl_integration.h`/
23 #include "gsl_errno.h"cxx . . $ `<file>/external/gsl/gsl_errno.h`/
24
25 static void
26 initialisecxx . . $ initialise(6e04e3f31e3784ff). (double * ri, double * rj, double * rg, double * rh,
27 double alpha, double beta);
28
29 gsl_integration_qaws_tablecxx . . $ gsl_integration_qaws_table# *
30 gsl_integration_qaws_table_alloccxx . . $ gsl_integration_qaws_table_alloc(f9e44e51291e67ab). (double alpha, double beta, int mu, int nu)
31 {
32 gsl_integration_qaws_tablecxx . . $ gsl_integration_qaws_table# * t;
33
34 if (alpha < -1.0)
35 {
36 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("alpha must be greater than -1.0", GSL_EINVAL, 0);
37 }
38
39 if (beta < -1.0)
40 {
41 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("beta must be greater than -1.0", GSL_EINVAL, 0);
42 }
43
44 if (mu != 0 && mu != 1)
45 {
46 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("mu must be 0 or 1", GSL_EINVAL, 0);
47 }
48
49 if (nu != 0 && nu != 1)
50 {
51 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("nu must be 0 or 1", GSL_EINVAL, 0);
52 }
53
54 t = (gsl_integration_qaws_tablecxx . . $ gsl_integration_qaws_table# *)
55 malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(gsl_integration_qaws_tablecxx . . $ gsl_integration_qaws_table#));
56
57 if (t == 0)
58 {
59 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for qaws_table struct",
60 GSL_ENOMEM, 0);
61 }
62
63 t->alphacxx . . $ $anonymous_type_447f2d6dcbace69_1#alpha. = alpha;
64 t->betacxx . . $ $anonymous_type_447f2d6dcbace69_1#beta. = beta;
65 t->mucxx . . $ $anonymous_type_447f2d6dcbace69_1#mu. = mu;
66 t->nucxx . . $ $anonymous_type_447f2d6dcbace69_1#nu. = nu;
67
68 initialisecxx . . $ initialise(6e04e3f31e3784ff). (t->ricxx . . $ $anonymous_type_447f2d6dcbace69_1#ri., t->rjcxx . . $ $anonymous_type_447f2d6dcbace69_1#rj., t->rgcxx . . $ $anonymous_type_447f2d6dcbace69_1#rg., t->rhcxx . . $ $anonymous_type_447f2d6dcbace69_1#rh., alpha, beta);
69
70 return t;
71 }
72
73
74 int
75 gsl_integration_qaws_table_setcxx . . $ gsl_integration_qaws_table_set(abdb22532ffa2a68). (gsl_integration_qaws_tablecxx . . $ gsl_integration_qaws_table# * t,
76 double alpha, double beta, int mu, int nu)
77 {
78 if (alpha < -1.0)
79 {
80 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("alpha must be greater than -1.0", GSL_EINVAL);
81 }
82
83 if (beta < -1.0)
84 {
85 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("beta must be greater than -1.0", GSL_EINVAL);
86 }
87
88 if (mu != 0 && mu != 1)
89 {
90 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("mu must be 0 or 1", GSL_EINVAL);
91 }
92
93 if (nu != 0 && nu != 1)
94 {
95 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("nu must be 0 or 1", GSL_EINVAL);
96 }
97
98 t->alphacxx . . $ $anonymous_type_447f2d6dcbace69_1#alpha. = alpha;
99 t->betacxx . . $ $anonymous_type_447f2d6dcbace69_1#beta. = beta;
100 t->mucxx . . $ $anonymous_type_447f2d6dcbace69_1#mu. = mu;
101 t->nucxx . . $ $anonymous_type_447f2d6dcbace69_1#nu. = nu;
102
103 initialisecxx . . $ initialise(6e04e3f31e3784ff). (t->ricxx . . $ $anonymous_type_447f2d6dcbace69_1#ri., t->rjcxx . . $ $anonymous_type_447f2d6dcbace69_1#rj., t->rgcxx . . $ $anonymous_type_447f2d6dcbace69_1#rg., t->rhcxx . . $ $anonymous_type_447f2d6dcbace69_1#rh., alpha, beta);
104
105 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
106 }
107
108
109 void
110 gsl_integration_qaws_table_freecxx . . $ gsl_integration_qaws_table_free(5742ec5005af8583). (gsl_integration_qaws_tablecxx . . $ gsl_integration_qaws_table# * t)
111 {
112 freecxx . . $ free(5d22bdacc48458e8). (t);
113 }
114
115 static void
116 initialisecxx . . $ initialise(6e04e3f31e3784ff). (double * ri, double * rj, double * rg, double * rh,
117 double alpha, double beta)
118 {
119 const double alpha_p1 = alpha + 1.0;
120 const double beta_p1 = beta + 1.0;
121
122 const double alpha_p2 = alpha + 2.0;
123 const double beta_p2 = beta + 2.0;
124
125 const double r_alpha = pow (2.0, alpha_p1);
126 const double r_beta = pow (2.0, beta_p1);
127
128 size_t i;
129
130 double an, anm1;
131
132 ri[0] = r_alpha / alpha_p1;
133 ri[1] = ri[0] * alpha / alpha_p2;
134
135 an = 2.0;
136 anm1 = 1.0;
137
138 for (i = 2; i < 25; i++)
139 {
140 ri[i] = -(r_alpha + an * (an - alpha_p2) * ri[i - 1])
141 / (anm1 * (an + alpha_p1));
142 anm1 = an;
143 an = an + 1.0;
144 }
145
146 rj[0] = r_beta / beta_p1;
147 rj[1] = rj[0] * beta / beta_p2;
148
149 an = 2.0;
150 anm1 = 1.0;
151
152 for (i = 2; i < 25; i++)
153 {
154 rj[i] = -(r_beta + an * (an - beta_p2) * rj[i - 1])
155 / (anm1 * (an + beta_p1));
156 anm1 = an;
157 an = an + 1.0;
158 }
159
160 rg[0] = -ri[0] / alpha_p1;
161 rg[1] = -rg[0] - 2.0 * r_alpha / (alpha_p2 * alpha_p2);
162
163 an = 2.0;
164 anm1 = 1.0;
165
166 for (i = 2; i < 25; i++)
167 {
168 rg[i] = -(an * (an - alpha_p2) * rg[i - 1] - an * ri[i - 1]
169 + anm1 * ri[i]) / (anm1 * (an + alpha_p1));
170 anm1 = an;
171 an = an + 1.0;
172 }
173
174 rh[0] = -rj[0] / beta_p1;
175 rh[1] = -rh[0] - 2.0 * r_beta / (beta_p2 * beta_p2);
176
177 an = 2.0;
178 anm1 = 1.0;
179
180 for (i = 2; i < 25; i++)
181 {
182 rh[i] = -(an * (an - beta_p2) * rh[i - 1] - an * rj[i - 1]
183 + anm1 * rj[i]) / (anm1 * (an + beta_p1));
184 anm1 = an;
185 an = an + 1.0;
186 }
187
188 for (i = 1; i < 25; i += 2)
189 {
190 rj[i] *= -1;
191 rh[i] *= -1;
192 }
193 }