Debian Codegraph @

external/gsl/gsl_integration__qc25s.c

raw symbols SCIP
1 /* integration/qc25s.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 struct fn_qaws_paramscxx . . $ fn_qaws_params#
21 {
22 gsl_functioncxx . . $ gsl_function# *functioncxx . . $ fn_qaws_params#function.;
23 double acxx . . $ fn_qaws_params#a.;
24 double bcxx . . $ fn_qaws_params#b.;
25 gsl_integration_qaws_tablecxx . . $ gsl_integration_qaws_table# *tablecxx . . $ fn_qaws_params#table.;
26 };
27
28 static double fn_qawscxx . . $ fn_qaws(81b005370e6958c4). (double t, void *params);
29 static double fn_qaws_Lcxx . . $ fn_qaws_L(81b005370e6958c4). (double x, void *params);
30 static double fn_qaws_Rcxx . . $ fn_qaws_R(81b005370e6958c4). (double x, void *params);
31
32 static void
33 compute_resultcxx . . $ compute_result(a28bbea62be3e17e). (const double * r, const double * cheb12, const double * cheb24,
34 double * result12, double * result24);
35
36
37 static void
38 qc25scxx . . $ qc25s(8a22c3dcc2660c82). (gsl_functioncxx . . $ gsl_function# * f, double a, double b, double a1, double b1,
39 gsl_integration_qaws_tablecxx . . $ gsl_integration_qaws_table# * t,
40 double *result, double *abserr, int *err_reliable);
41
42 static void
43 qc25scxx . . $ qc25s(8a22c3dcc2660c82). (gsl_functioncxx . . $ gsl_function# * f, double a, double b, double a1, double b1,
44 gsl_integration_qaws_tablecxx . . $ gsl_integration_qaws_table# * t,
45 double *result, double *abserr, int *err_reliable)
46 {
47 gsl_functioncxx . . $ gsl_function# weighted_function;
48 struct fn_qaws_paramscxx . . $ fn_qaws_params# fn_params;
49
50 fn_params.functioncxx . . $ fn_qaws_params#function. = f;
51 fn_params.acxx . . $ fn_qaws_params#a. = a;
52 fn_params.bcxx . . $ fn_qaws_params#b. = b;
53 fn_params.tablecxx . . $ fn_qaws_params#table. = t;
54
55 weighted_function.paramscxx . . $ gsl_function_struct#params. = &fn_params;
56
57 if (a1 == a && (t->alphacxx . . $ $anonymous_type_447f2d6dcbace69_1#alpha. != 0.0 || t->mucxx . . $ $anonymous_type_447f2d6dcbace69_1#mu. != 0))
58 {
59 double cheb12[13], cheb24[25];
60
61 double factor = pow(0.5 * (b1 - a1), t->alphacxx . . $ $anonymous_type_447f2d6dcbace69_1#alpha. + 1.0);
62
63 weighted_function.functioncxx . . $ gsl_function_struct#function. = &fn_qaws_Rcxx . . $ fn_qaws_R(81b005370e6958c4).;
64
65 gsl_integration_qchebcxx . . $ gsl_integration_qcheb(91b1536d7a6432e6). (&weighted_function, a1, b1, cheb12, cheb24);
66
67 if (t->mucxx . . $ $anonymous_type_447f2d6dcbace69_1#mu. == 0)
68 {
69 double res12 = 0, res24 = 0;
70 double u = factor;
71
72 compute_resultcxx . . $ compute_result(a28bbea62be3e17e). (t->ricxx . . $ $anonymous_type_447f2d6dcbace69_1#ri., cheb12, cheb24, &res12, &res24);
73
74 *result = u * res24;
75 *abserr = fabs(u * (res24 - res12));
76 }
77 else
78 {
79 double res12a = 0, res24a = 0;
80 double res12b = 0, res24b = 0;
81
82 double u = factor * log(b1 - a1);
83 double v = factor;
84
85 compute_resultcxx . . $ compute_result(a28bbea62be3e17e). (t->ricxx . . $ $anonymous_type_447f2d6dcbace69_1#ri., cheb12, cheb24, &res12a, &res24a);
86 compute_resultcxx . . $ compute_result(a28bbea62be3e17e). (t->rgcxx . . $ $anonymous_type_447f2d6dcbace69_1#rg., cheb12, cheb24, &res12b, &res24b);
87
88 *result = u * res24a + v * res24b;
89 *abserr = fabs(u * (res24a - res12a)) + fabs(v * (res24b - res12b));
90 }
91
92 *err_reliable = 0;
93
94 return;
95 }
96 else if (b1 == b && (t->betacxx . . $ $anonymous_type_447f2d6dcbace69_1#beta. != 0.0 || t->nucxx . . $ $anonymous_type_447f2d6dcbace69_1#nu. != 0))
97 {
98 double cheb12[13], cheb24[25];
99 double factor = pow(0.5 * (b1 - a1), t->betacxx . . $ $anonymous_type_447f2d6dcbace69_1#beta. + 1.0);
100
101 weighted_function.functioncxx . . $ gsl_function_struct#function. = &fn_qaws_Lcxx . . $ fn_qaws_L(81b005370e6958c4).;
102
103 gsl_integration_qchebcxx . . $ gsl_integration_qcheb(91b1536d7a6432e6). (&weighted_function, a1, b1, cheb12, cheb24);
104
105 if (t->nucxx . . $ $anonymous_type_447f2d6dcbace69_1#nu. == 0)
106 {
107 double res12 = 0, res24 = 0;
108 double u = factor;
109
110 compute_resultcxx . . $ compute_result(a28bbea62be3e17e). (t->rjcxx . . $ $anonymous_type_447f2d6dcbace69_1#rj., cheb12, cheb24, &res12, &res24);
111
112 *result = u * res24;
113 *abserr = fabs(u * (res24 - res12));
114 }
115 else
116 {
117 double res12a = 0, res24a = 0;
118 double res12b = 0, res24b = 0;
119
120 double u = factor * log(b1 - a1);
121 double v = factor;
122
123 compute_resultcxx . . $ compute_result(a28bbea62be3e17e). (t->rjcxx . . $ $anonymous_type_447f2d6dcbace69_1#rj., cheb12, cheb24, &res12a, &res24a);
124 compute_resultcxx . . $ compute_result(a28bbea62be3e17e). (t->rhcxx . . $ $anonymous_type_447f2d6dcbace69_1#rh., cheb12, cheb24, &res12b, &res24b);
125
126 *result = u * res24a + v * res24b;
127 *abserr = fabs(u * (res24a - res12a)) + fabs(v * (res24b - res12b));
128 }
129
130 *err_reliable = 0;
131
132 return;
133 }
134 else
135 {
136 double resabs, resasc;
137
138 weighted_function.functioncxx . . $ gsl_function_struct#function. = &fn_qawscxx . . $ fn_qaws(81b005370e6958c4).;
139
140 gsl_integration_qk15cxx . . $ gsl_integration_qk15(52a0a7df46a4ffe4). (&weighted_function, a1, b1, result, abserr,
141 &resabs, &resasc);
142
143 if (*abserr == resasc)
144 {
145 *err_reliable = 0;
146 }
147 else
148 {
149 *err_reliable = 1;
150 }
151
152 return;
153 }
154
155 }
156
157 static double
158 fn_qawscxx . . $ fn_qaws(81b005370e6958c4). (double x, void *params)
159 {
160 struct fn_qaws_paramscxx . . $ fn_qaws_params# *p = (struct fn_qaws_paramscxx . . $ fn_qaws_params# *) params;
161 gsl_functioncxx . . $ gsl_function# *f = p->functioncxx . . $ fn_qaws_params#function.;
162 gsl_integration_qaws_tablecxx . . $ gsl_integration_qaws_table# *t = p->tablecxx . . $ fn_qaws_params#table.;
163
164 double factor = 1.0;
165
166 if (t->alphacxx . . $ $anonymous_type_447f2d6dcbace69_1#alpha. != 0.0)
167 factor *= pow(x - p->acxx . . $ fn_qaws_params#a., t->alphacxx . . $ $anonymous_type_447f2d6dcbace69_1#alpha.);
168
169 if (t->betacxx . . $ $anonymous_type_447f2d6dcbace69_1#beta. != 0.0)
170 factor *= pow(p->bcxx . . $ fn_qaws_params#b. - x, t->betacxx . . $ $anonymous_type_447f2d6dcbace69_1#beta.);
171
172 if (t->mucxx . . $ $anonymous_type_447f2d6dcbace69_1#mu. == 1)
173 factor *= log(x - p->acxx . . $ fn_qaws_params#a.);
174
175 if (t->nucxx . . $ $anonymous_type_447f2d6dcbace69_1#nu. == 1)
176 factor *= log(p->bcxx . . $ fn_qaws_params#b. - x);
177
178 return factor * GSL_FN_EVALcxx . . $ `external/gsl/gsl_math.h:193:9`! (f, x);
179 }
180
181 static double
182 fn_qaws_Lcxx . . $ fn_qaws_L(81b005370e6958c4). (double x, void *params)
183 {
184 struct fn_qaws_paramscxx . . $ fn_qaws_params# *p = (struct fn_qaws_paramscxx . . $ fn_qaws_params# *) params;
185 gsl_functioncxx . . $ gsl_function# *f = p->functioncxx . . $ fn_qaws_params#function.;
186 gsl_integration_qaws_tablecxx . . $ gsl_integration_qaws_table# *t = p->tablecxx . . $ fn_qaws_params#table.;
187
188 double factor = 1.0;
189
190 if (t->alphacxx . . $ $anonymous_type_447f2d6dcbace69_1#alpha. != 0.0)
191 factor *= pow(x - p->acxx . . $ fn_qaws_params#a., t->alphacxx . . $ $anonymous_type_447f2d6dcbace69_1#alpha.);
192
193 if (t->mucxx . . $ $anonymous_type_447f2d6dcbace69_1#mu. == 1)
194 factor *= log(x - p->acxx . . $ fn_qaws_params#a.);
195
196 return factor * GSL_FN_EVALcxx . . $ `external/gsl/gsl_math.h:193:9`! (f, x);
197 }
198
199 static double
200 fn_qaws_Rcxx . . $ fn_qaws_R(81b005370e6958c4). (double x, void *params)
201 {
202 struct fn_qaws_paramscxx . . $ fn_qaws_params# *p = (struct fn_qaws_paramscxx . . $ fn_qaws_params# *) params;
203 gsl_functioncxx . . $ gsl_function# *f = p->functioncxx . . $ fn_qaws_params#function.;
204 gsl_integration_qaws_tablecxx . . $ gsl_integration_qaws_table# *t = p->tablecxx . . $ fn_qaws_params#table.;
205
206 double factor = 1.0;
207
208 if (t->betacxx . . $ $anonymous_type_447f2d6dcbace69_1#beta. != 0.0)
209 factor *= pow(p->bcxx . . $ fn_qaws_params#b. - x, t->betacxx . . $ $anonymous_type_447f2d6dcbace69_1#beta.);
210
211 if (t->nucxx . . $ $anonymous_type_447f2d6dcbace69_1#nu. == 1)
212 factor *= log(p->bcxx . . $ fn_qaws_params#b. - x);
213
214 return factor * GSL_FN_EVALcxx . . $ `external/gsl/gsl_math.h:193:9`! (f, x);
215 }
216
217
218 static void
219 compute_resultcxx . . $ compute_result(a28bbea62be3e17e). (const double * r, const double * cheb12, const double * cheb24,
220 double * result12, double * result24)
221 {
222 size_tcxx . . $ size_t# i;
223 double res12 = 0;
224 double res24 = 0;
225
226 for (i = 0; i < 13; i++)
227 {
228 res12 += r[i] * cheb12[i];
229 }
230
231 for (i = 0; i < 25; i++)
232 {
233 res24 += r[i] * cheb24[i];
234 }
235
236 *result12 = res12;
237 *result24 = res24;
238 }