Debian Codegraph @

external/gsl/gsl_multiroots__broyden.c

raw symbols SCIP
1 /* multiroots/broyden.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
22 #include <stddef.h>
23 #include <stdlib.h>
24 #include <stdio.h>
25 #include <math.h>
26 #include <float.h>
27
28 #include "gsl_math.h"cxx . . $ `<file>/external/gsl/gsl_math.h`/
29 #include "gsl_errno.h"cxx . . $ `<file>/external/gsl/gsl_errno.h`/
30 #include "gsl_multiroots.h"cxx . . $ `<file>/external/gsl/gsl_multiroots.h`/
31 #include "gsl_linalg.h"cxx . . $ `<file>/external/gsl/gsl_linalg.h`/
32
33 #include "gsl_multiroots__enorm.c"cxx . . $ `<file>/external/gsl/gsl_multiroots__enorm.c`/
34
35 /* Broyden's method. It is not an efficient or modern algorithm but
36 gives an example of a rank-1 update.
37
38 C.G. Broyden, "A Class of Methods for Solving Nonlinear
39 Simultaneous Equations", Mathematics of Computation, vol 19 (1965),
40 p 577-593
41
42 */
43
44 typedef structcxx . . $ $anonymous_type_606f10347ce3abc1_0#
45 {
46 gsl_matrixcxx . . $ gsl_matrix# *Hcxx . . $ $anonymous_type_606f10347ce3abc1_0#H.;
47 gsl_matrixcxx . . $ gsl_matrix# *lucxx . . $ $anonymous_type_606f10347ce3abc1_0#lu.;
48 gsl_permutationcxx . . $ gsl_permutation# *permutationcxx . . $ $anonymous_type_606f10347ce3abc1_0#permutation.;
49 gsl_vectorcxx . . $ gsl_vector# *vcxx . . $ $anonymous_type_606f10347ce3abc1_0#v.;
50 gsl_vectorcxx . . $ gsl_vector# *wcxx . . $ $anonymous_type_606f10347ce3abc1_0#w.;
51 gsl_vectorcxx . . $ gsl_vector# *ycxx . . $ $anonymous_type_606f10347ce3abc1_0#y.;
52 gsl_vectorcxx . . $ gsl_vector# *pcxx . . $ $anonymous_type_606f10347ce3abc1_0#p.;
53 gsl_vectorcxx . . $ gsl_vector# *fnewcxx . . $ $anonymous_type_606f10347ce3abc1_0#fnew.;
54 gsl_vectorcxx . . $ gsl_vector# *x_trialcxx . . $ $anonymous_type_606f10347ce3abc1_0#x_trial.;
55 double phicxx . . $ $anonymous_type_606f10347ce3abc1_0#phi.;
56 }
57 broyden_state_tcxx . . $ broyden_state_t#;
58
59 static int broyden_alloccxx . . $ broyden_alloc(c0a5f96701d3f89). (void *vstate, size_t n);
60 static int broyden_setcxx . . $ broyden_set(2e31e23e94e738e8). (void *vstate, gsl_multiroot_functioncxx . . $ gsl_multiroot_function# * function, gsl_vectorcxx . . $ gsl_vector# * x, gsl_vectorcxx . . $ gsl_vector# * f, gsl_vectorcxx . . $ gsl_vector# * dx);
61 static int broyden_iteratecxx . . $ broyden_iterate(2e31e23e94e738e8). (void *vstate, gsl_multiroot_functioncxx . . $ gsl_multiroot_function# * function, gsl_vectorcxx . . $ gsl_vector# * x, gsl_vectorcxx . . $ gsl_vector# * f, gsl_vectorcxx . . $ gsl_vector# * dx);
62 static void broyden_freecxx . . $ broyden_free(5d22bdacc48458e8). (void *vstate);
63
64
65 static int
66 broyden_alloccxx . . $ broyden_alloc(c0a5f96701d3f89). (void *vstate, size_t n)
67 {
68 broyden_state_tcxx . . $ broyden_state_t# *state = (broyden_state_tcxx . . $ broyden_state_t# *) vstate;
69 gsl_vectorcxx . . $ gsl_vector# *v, *w, *y, *fnew, *x_trial, *p;
70 gsl_permutationcxx . . $ gsl_permutation# *perm;
71 gsl_matrixcxx . . $ gsl_matrix# *m, *H;
72
73 m = gsl_matrix_calloccxx . . $ gsl_matrix_calloc(5a4d020b4836594). (n, n);
74
75 if (m == 0)
76 {
77 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for lu", GSL_ENOMEM);
78 }
79
80 state->lucxx . . $ $anonymous_type_606f10347ce3abc1_0#lu. = m;
81
82 perm = gsl_permutation_calloccxx . . $ gsl_permutation_calloc(311f4cfee96dd0e3). (n);
83
84 if (perm == 0)
85 {
86 gsl_matrix_freecxx . . $ gsl_matrix_free(ab29a617cccd3636). (m);
87
88 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for permutation", GSL_ENOMEM);
89 }
90
91 state->permutationcxx . . $ $anonymous_type_606f10347ce3abc1_0#permutation. = perm;
92
93 H = gsl_matrix_calloccxx . . $ gsl_matrix_calloc(5a4d020b4836594). (n, n);
94
95 if (H == 0)
96 {
97 gsl_permutation_freecxx . . $ gsl_permutation_free(bfe6c130f63679fa). (perm);
98 gsl_matrix_freecxx . . $ gsl_matrix_free(ab29a617cccd3636). (m);
99
100 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for d", GSL_ENOMEM);
101 }
102
103 state->Hcxx . . $ $anonymous_type_606f10347ce3abc1_0#H. = H;
104
105 v = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (n);
106
107 if (v == 0)
108 {
109 gsl_matrix_freecxx . . $ gsl_matrix_free(ab29a617cccd3636). (H);
110 gsl_permutation_freecxx . . $ gsl_permutation_free(bfe6c130f63679fa). (perm);
111 gsl_matrix_freecxx . . $ gsl_matrix_free(ab29a617cccd3636). (m);
112
113 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for v", GSL_ENOMEM);
114 }
115
116 state->vcxx . . $ $anonymous_type_606f10347ce3abc1_0#v. = v;
117
118 w = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (n);
119
120 if (w == 0)
121 {
122 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (v);
123 gsl_matrix_freecxx . . $ gsl_matrix_free(ab29a617cccd3636). (H);
124 gsl_permutation_freecxx . . $ gsl_permutation_free(bfe6c130f63679fa). (perm);
125 gsl_matrix_freecxx . . $ gsl_matrix_free(ab29a617cccd3636). (m);
126
127 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for w", GSL_ENOMEM);
128 }
129
130 state->wcxx . . $ $anonymous_type_606f10347ce3abc1_0#w. = w;
131
132 y = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (n);
133
134 if (y == 0)
135 {
136 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (w);
137 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (v);
138 gsl_matrix_freecxx . . $ gsl_matrix_free(ab29a617cccd3636). (H);
139 gsl_permutation_freecxx . . $ gsl_permutation_free(bfe6c130f63679fa). (perm);
140 gsl_matrix_freecxx . . $ gsl_matrix_free(ab29a617cccd3636). (m);
141
142 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for y", GSL_ENOMEM);
143 }
144
145 state->ycxx . . $ $anonymous_type_606f10347ce3abc1_0#y. = y;
146
147 fnew = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (n);
148
149 if (fnew == 0)
150 {
151 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (y);
152 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (w);
153 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (v);
154 gsl_matrix_freecxx . . $ gsl_matrix_free(ab29a617cccd3636). (H);
155 gsl_permutation_freecxx . . $ gsl_permutation_free(bfe6c130f63679fa). (perm);
156 gsl_matrix_freecxx . . $ gsl_matrix_free(ab29a617cccd3636). (m);
157
158 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for fnew", GSL_ENOMEM);
159 }
160
161 state->fnewcxx . . $ $anonymous_type_606f10347ce3abc1_0#fnew. = fnew;
162
163 x_trial = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (n);
164
165 if (x_trial == 0)
166 {
167 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (fnew);
168 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (y);
169 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (w);
170 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (v);
171 gsl_matrix_freecxx . . $ gsl_matrix_free(ab29a617cccd3636). (H);
172 gsl_permutation_freecxx . . $ gsl_permutation_free(bfe6c130f63679fa). (perm);
173 gsl_matrix_freecxx . . $ gsl_matrix_free(ab29a617cccd3636). (m);
174
175 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for x_trial", GSL_ENOMEM);
176 }
177
178 state->x_trialcxx . . $ $anonymous_type_606f10347ce3abc1_0#x_trial. = x_trial;
179
180 p = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (n);
181
182 if (p == 0)
183 {
184 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (x_trial);
185 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (fnew);
186 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (y);
187 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (w);
188 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (v);
189 gsl_matrix_freecxx . . $ gsl_matrix_free(ab29a617cccd3636). (H);
190 gsl_permutation_freecxx . . $ gsl_permutation_free(bfe6c130f63679fa). (perm);
191 gsl_matrix_freecxx . . $ gsl_matrix_free(ab29a617cccd3636). (m);
192
193 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for p", GSL_ENOMEM);
194 }
195
196 state->pcxx . . $ $anonymous_type_606f10347ce3abc1_0#p. = p;
197
198 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
199 }
200
201 static int
202 broyden_setcxx . . $ broyden_set(2e31e23e94e738e8). (void *vstate, gsl_multiroot_functioncxx . . $ gsl_multiroot_function# * function, gsl_vectorcxx . . $ gsl_vector# * x, gsl_vectorcxx . . $ gsl_vector# * f, gsl_vectorcxx . . $ gsl_vector# * dx)
203 {
204 broyden_state_tcxx . . $ broyden_state_t# *state = (broyden_state_tcxx . . $ broyden_state_t# *) vstate;
205 size_t i, j, n = function->ncxx . . $ gsl_multiroot_function_struct#n.;
206 int signum = 0;
207
208 GSL_MULTIROOT_FN_EVALcxx . . $ `external/gsl/gsl_multiroots.h:52:9`! (function, x, f);
209
210 gsl_multiroot_fdjacobiancxx . . $ gsl_multiroot_fdjacobian(626cf04f7928da7f). (function, x, f, GSL_SQRT_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:18:9`!, state->lucxx . . $ $anonymous_type_606f10347ce3abc1_0#lu.);
211 gsl_linalg_LU_decompcxx . . $ gsl_linalg_LU_decomp(e9d4741e9a7c7a22). (state->lucxx . . $ $anonymous_type_606f10347ce3abc1_0#lu., state->permutationcxx . . $ $anonymous_type_606f10347ce3abc1_0#permutation., &signum);
212 gsl_linalg_LU_invertcxx . . $ gsl_linalg_LU_invert(e8399eb943e3ddd6). (state->lucxx . . $ $anonymous_type_606f10347ce3abc1_0#lu., state->permutationcxx . . $ $anonymous_type_606f10347ce3abc1_0#permutation., state->Hcxx . . $ $anonymous_type_606f10347ce3abc1_0#H.);
213
214 for (i = 0; i < n; i++)
215 for (j = 0; j < n; j++)
216 gsl_matrix_setcxx . . $ gsl_matrix_set(b56d954874bd7b13).(state->Hcxx . . $ $anonymous_type_606f10347ce3abc1_0#H.,i,j,-gsl_matrix_getcxx . . $ gsl_matrix_get(dfa4c0641bd665a5).(state->Hcxx . . $ $anonymous_type_606f10347ce3abc1_0#H.,i,j));
217
218 for (i = 0; i < n; i++)
219 {
220 gsl_vector_setcxx . . $ gsl_vector_set(c35f863a529e8fae). (dx, i, 0.0);
221 }
222
223 state->phicxx . . $ $anonymous_type_606f10347ce3abc1_0#phi. = enormcxx . . $ enorm(1b712e435b5359e9). (f);
224
225 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
226 }
227
228 static int
229 broyden_iteratecxx . . $ broyden_iterate(2e31e23e94e738e8). (void *vstate, gsl_multiroot_functioncxx . . $ gsl_multiroot_function# * function, gsl_vectorcxx . . $ gsl_vector# * x, gsl_vectorcxx . . $ gsl_vector# * f, gsl_vectorcxx . . $ gsl_vector# * dx)
230 {
231 broyden_state_tcxx . . $ broyden_state_t# *state = (broyden_state_tcxx . . $ broyden_state_t# *) vstate;
232
233 double phi0, phi1, t, lambda;
234
235 gsl_matrixcxx . . $ gsl_matrix# *H = state->Hcxx . . $ $anonymous_type_606f10347ce3abc1_0#H.;
236 gsl_vectorcxx . . $ gsl_vector# *p = state->pcxx . . $ $anonymous_type_606f10347ce3abc1_0#p.;
237 gsl_vectorcxx . . $ gsl_vector# *y = state->ycxx . . $ $anonymous_type_606f10347ce3abc1_0#y.;
238 gsl_vectorcxx . . $ gsl_vector# *v = state->vcxx . . $ $anonymous_type_606f10347ce3abc1_0#v.;
239 gsl_vectorcxx . . $ gsl_vector# *w = state->wcxx . . $ $anonymous_type_606f10347ce3abc1_0#w.;
240 gsl_vectorcxx . . $ gsl_vector# *fnew = state->fnewcxx . . $ $anonymous_type_606f10347ce3abc1_0#fnew.;
241 gsl_vectorcxx . . $ gsl_vector# *x_trial = state->x_trialcxx . . $ $anonymous_type_606f10347ce3abc1_0#x_trial.;
242 gsl_matrixcxx . . $ gsl_matrix# *lu = state->lucxx . . $ $anonymous_type_606f10347ce3abc1_0#lu.;
243 gsl_permutationcxx . . $ gsl_permutation# *perm = state->permutationcxx . . $ $anonymous_type_606f10347ce3abc1_0#permutation.;
244
245 size_t i, j, iter;
246
247 size_t n = function->ncxx . . $ gsl_multiroot_function_struct#n.;
248
249 /* p = H f */
250
251 for (i = 0; i < n; i++)
252 {
253 double sum = 0;
254
255 for (j = 0; j < n; j++)
256 {
257 sum += gsl_matrix_getcxx . . $ gsl_matrix_get(dfa4c0641bd665a5). (H, i, j) * gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (f, j);
258 }
259 gsl_vector_setcxx . . $ gsl_vector_set(c35f863a529e8fae). (p, i, sum);
260 }
261
262 t = 1;
263 iter = 0;
264
265 phi0 = state->phicxx . . $ $anonymous_type_606f10347ce3abc1_0#phi.;
266
267 new_step:
268
269 for (i = 0; i < n; i++)
270 {
271 double pi = gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (p, i);
272 double xi = gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (x, i);
273 gsl_vector_setcxx . . $ gsl_vector_set(c35f863a529e8fae). (x_trial, i, xi + t * pi);
274 }
275
276 {
277 int status = GSL_MULTIROOT_FN_EVALcxx . . $ `external/gsl/gsl_multiroots.h:52:9`! (function, x_trial, fnew);
278
279 if (status != GSL_SUCCESScxx . . $ GSL_SUCCESS.)
280 {
281 return GSL_EBADFUNCcxx . . $ GSL_EBADFUNC.;
282 }
283 }
284
285 phi1 = enormcxx . . $ enorm(1b712e435b5359e9). (fnew);
286
287 iter++ ;
288
289 if (phi1 > phi0 && iter < 10 && t > 0.1)
290 {
291 /* full step goes uphill, take a reduced step instead */
292
293 double theta = phi1 / phi0;
294 t *= (sqrt (1.0 + 6.0 * theta) - 1.0) / (3.0 * theta);
295 goto new_step;
296 }
297
298 if (phi1 > phi0)
299 {
300 /* need to recompute Jacobian */
301 int signum = 0;
302
303 gsl_multiroot_fdjacobiancxx . . $ gsl_multiroot_fdjacobian(626cf04f7928da7f). (function, x, f, GSL_SQRT_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:18:9`!, lu);
304
305 for (i = 0; i < n; i++)
306 for (j = 0; j < n; j++)
307 gsl_matrix_setcxx . . $ gsl_matrix_set(b56d954874bd7b13).(lu,i,j,-gsl_matrix_getcxx . . $ gsl_matrix_get(dfa4c0641bd665a5).(lu,i,j));
308
309 gsl_linalg_LU_decompcxx . . $ gsl_linalg_LU_decomp(e9d4741e9a7c7a22). (lu, perm, &signum);
310 gsl_linalg_LU_invertcxx . . $ gsl_linalg_LU_invert(e8399eb943e3ddd6). (lu, perm, H);
311
312 gsl_linalg_LU_solvecxx . . $ gsl_linalg_LU_solve(58522a8301ae2475). (lu, perm, f, p);
313
314 t = 1;
315
316 for (i = 0; i < n; i++)
317 {
318 double pi = gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (p, i);
319 double xi = gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (x, i);
320 gsl_vector_setcxx . . $ gsl_vector_set(c35f863a529e8fae). (x_trial, i, xi + t * pi);
321 }
322
323 {
324 int status = GSL_MULTIROOT_FN_EVALcxx . . $ `external/gsl/gsl_multiroots.h:52:9`! (function, x_trial, fnew);
325
326 if (status != GSL_SUCCESScxx . . $ GSL_SUCCESS.)
327 {
328 return GSL_EBADFUNCcxx . . $ GSL_EBADFUNC.;
329 }
330 }
331
332 phi1 = enormcxx . . $ enorm(1b712e435b5359e9). (fnew);
333 }
334
335 /* y = f' - f */
336
337 for (i = 0; i < n; i++)
338 {
339 double yi = gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (fnew, i) - gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (f, i);
340 gsl_vector_setcxx . . $ gsl_vector_set(c35f863a529e8fae). (y, i, yi);
341 }
342
343 /* v = H y */
344
345 for (i = 0; i < n; i++)
346 {
347 double sum = 0;
348
349 for (j = 0; j < n; j++)
350 {
351 sum += gsl_matrix_getcxx . . $ gsl_matrix_get(dfa4c0641bd665a5). (H, i, j) * gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (y, j);
352 }
353
354 gsl_vector_setcxx . . $ gsl_vector_set(c35f863a529e8fae). (v, i, sum);
355 }
356
357 /* lambda = p . v */
358
359 lambda = 0;
360
361 for (i = 0; i < n; i++)
362 {
363 lambda += gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (p, i) * gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (v, i);
364 }
365
366 if (lambda == 0)
367 {
368 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("approximation to Jacobian has collapsed", GSL_EZERODIV) ;
369 }
370
371 /* v' = v + t * p */
372
373 for (i = 0; i < n; i++)
374 {
375 double vi = gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (v, i) + t * gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (p, i);
376 gsl_vector_setcxx . . $ gsl_vector_set(c35f863a529e8fae). (v, i, vi);
377 }
378
379 /* w^T = p^T H */
380
381 for (i = 0; i < n; i++)
382 {
383 double sum = 0;
384
385 for (j = 0; j < n; j++)
386 {
387 sum += gsl_matrix_getcxx . . $ gsl_matrix_get(dfa4c0641bd665a5). (H, j, i) * gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (p, j);
388 }
389
390 gsl_vector_setcxx . . $ gsl_vector_set(c35f863a529e8fae). (w, i, sum);
391 }
392
393 /* Hij -> Hij - (vi wj / lambda) */
394
395 for (i = 0; i < n; i++)
396 {
397 double vi = gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (v, i);
398
399 for (j = 0; j < n; j++)
400 {
401 double wj = gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (w, j);
402 double Hij = gsl_matrix_getcxx . . $ gsl_matrix_get(dfa4c0641bd665a5). (H, i, j) - vi * wj / lambda;
403 gsl_matrix_setcxx . . $ gsl_matrix_set(b56d954874bd7b13). (H, i, j, Hij);
404 }
405 }
406
407 /* copy fnew into f */
408
409 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (f, fnew);
410
411 /* copy x_trial into x */
412
413 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (x, x_trial);
414
415 for (i = 0; i < n; i++)
416 {
417 double pi = gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (p, i);
418 gsl_vector_setcxx . . $ gsl_vector_set(c35f863a529e8fae). (dx, i, t * pi);
419 }
420
421 state->phicxx . . $ $anonymous_type_606f10347ce3abc1_0#phi. = phi1;
422
423 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
424 }
425
426
427 static void
428 broyden_freecxx . . $ broyden_free(5d22bdacc48458e8). (void *vstate)
429 {
430 broyden_state_tcxx . . $ broyden_state_t# *state = (broyden_state_tcxx . . $ broyden_state_t# *) vstate;
431
432 gsl_matrix_freecxx . . $ gsl_matrix_free(ab29a617cccd3636). (state->Hcxx . . $ $anonymous_type_606f10347ce3abc1_0#H.);
433
434 gsl_matrix_freecxx . . $ gsl_matrix_free(ab29a617cccd3636). (state->lucxx . . $ $anonymous_type_606f10347ce3abc1_0#lu.);
435 gsl_permutation_freecxx . . $ gsl_permutation_free(bfe6c130f63679fa). (state->permutationcxx . . $ $anonymous_type_606f10347ce3abc1_0#permutation.);
436
437 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->vcxx . . $ $anonymous_type_606f10347ce3abc1_0#v.);
438 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->wcxx . . $ $anonymous_type_606f10347ce3abc1_0#w.);
439 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->ycxx . . $ $anonymous_type_606f10347ce3abc1_0#y.);
440 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->pcxx . . $ $anonymous_type_606f10347ce3abc1_0#p.);
441
442 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->fnewcxx . . $ $anonymous_type_606f10347ce3abc1_0#fnew.);
443 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x_trialcxx . . $ $anonymous_type_606f10347ce3abc1_0#x_trial.);
444
445 }
446
447
448 static const gsl_multiroot_fsolver_typecxx . . $ gsl_multiroot_fsolver_type# broyden_typecxx . . $ broyden_type. =
449 {"broyden", /* name */
450 sizeof (broyden_state_tcxx . . $ broyden_state_t#),
451 &broyden_alloccxx . . $ broyden_alloc(c0a5f96701d3f89).,
452 &broyden_setcxx . . $ broyden_set(2e31e23e94e738e8).,
453 &broyden_iteratecxx . . $ broyden_iterate(2e31e23e94e738e8).,
454 &broyden_freecxx . . $ broyden_free(5d22bdacc48458e8).};
455
456 const gsl_multiroot_fsolver_typecxx . . $ gsl_multiroot_fsolver_type# *gsl_multiroot_fsolver_broydencxx . . $ gsl_multiroot_fsolver_broyden. = &broyden_typecxx . . $ broyden_type.;