Debian Codegraph @

external/gsl/gsl_multimin__vector_bfgs.c

raw symbols SCIP
1 /* multimin/vector_bfgs.c
2 *
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000 Fabrice Rossi
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 /* vector_bfgs.c -- Limited memory Broyden-Fletcher-Goldfarb-Shanno method */
21
22 /* Modified by Brian Gough to use single iteration structure */
23
24 #include "gsl__config.h"cxx . . $ `<file>/external/gsl/gsl__config.h`/
25 #include "gsl_multimin.h"cxx . . $ `<file>/external/gsl/gsl_multimin.h`/
26 #include "gsl_blas.h"cxx . . $ `<file>/external/gsl/gsl_blas.h`/
27
28 #include "gsl_multimin__directional_minimize.c"cxx . . $ `<file>/external/gsl/gsl_multimin__directional_minimize.c`/
29
30 typedef structcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#
31 {
32 int itercxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#iter.;
33 double stepcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#step.;
34 double max_stepcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#max_step.;
35 double tolcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#tol.;
36 gsl_vectorcxx . . $ gsl_vector# *x1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x1.;
37 gsl_vectorcxx . . $ gsl_vector# *dx1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx1.;
38 gsl_vectorcxx . . $ gsl_vector# *x2cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x2.;
39 double g0normcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#g0norm.;
40 double pnormcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#pnorm.;
41 gsl_vectorcxx . . $ gsl_vector# *pcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#p.;
42 gsl_vectorcxx . . $ gsl_vector# *x0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x0.;
43 gsl_vectorcxx . . $ gsl_vector# *g0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#g0.;
44 gsl_vectorcxx . . $ gsl_vector# *dx0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx0.;
45 gsl_vectorcxx . . $ gsl_vector# *dg0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dg0.;
46 }
47 vector_bfgs_state_tcxx . . $ vector_bfgs_state_t#;
48
49 static int
50 vector_bfgs_alloccxx . . $ vector_bfgs_alloc(c0a5f96701d3f89). (void *vstate, size_tcxx . . $ size_t# n)
51 {
52 vector_bfgs_state_tcxx . . $ vector_bfgs_state_t# *state = (vector_bfgs_state_tcxx . . $ vector_bfgs_state_t# *) vstate;
53
54 state->x1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x1. = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (n);
55
56 if (state->x1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x1. == 0)
57 {
58 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for x1", GSL_ENOMEM);
59 }
60
61 state->dx1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx1. = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (n);
62
63 if (state->dx1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx1. == 0)
64 {
65 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x1.);
66 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for dx1", GSL_ENOMEM);
67 }
68
69 state->x2cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x2. = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (n);
70
71 if (state->x2cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x2. == 0)
72 {
73 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->dx1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx1.);
74 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x1.);
75 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for x2", GSL_ENOMEM);
76 }
77
78 state->pcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#p. = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (n);
79
80 if (state->pcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#p. == 0)
81 {
82 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x2cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x2.);
83 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->dx1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx1.);
84 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x1.);
85 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for p", GSL_ENOMEM);
86 }
87
88 state->x0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x0. = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (n);
89
90 if (state->x0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x0. == 0)
91 {
92 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->pcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#p.);
93 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x2cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x2.);
94 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->dx1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx1.);
95 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x1.);
96 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for g0", GSL_ENOMEM);
97 }
98
99 state->g0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#g0. = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (n);
100
101 if (state->g0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#g0. == 0)
102 {
103 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x0.);
104 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->pcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#p.);
105 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x2cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x2.);
106 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->dx1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx1.);
107 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x1.);
108 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for g0", GSL_ENOMEM);
109 }
110
111 state->dx0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx0. = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (n);
112
113 if (state->dx0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx0. == 0)
114 {
115 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->g0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#g0.);
116 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x0.);
117 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->pcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#p.);
118 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x2cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x2.);
119 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->dx1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx1.);
120 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x1.);
121 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for g0", GSL_ENOMEM);
122 }
123
124 state->dg0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dg0. = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (n);
125
126 if (state->dg0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dg0. == 0)
127 {
128 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->dx0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx0.);
129 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->g0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#g0.);
130 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x0.);
131 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->pcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#p.);
132 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x2cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x2.);
133 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->dx1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx1.);
134 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x1.);
135 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("failed to allocate space for g0", GSL_ENOMEM);
136 }
137
138 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
139 }
140
141 static int
142 vector_bfgs_setcxx . . $ vector_bfgs_set(aff3d705de048e1c). (void *vstate, gsl_multimin_function_fdfcxx . . $ gsl_multimin_function_fdf# * fdf,
143 const gsl_vectorcxx . . $ gsl_vector# * x, double *f, gsl_vectorcxx . . $ gsl_vector# * gradient,
144 double step_size, double tol)
145 {
146 vector_bfgs_state_tcxx . . $ vector_bfgs_state_t# *state = (vector_bfgs_state_tcxx . . $ vector_bfgs_state_t# *) vstate;
147
148 state->itercxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#iter. = 0;
149 state->stepcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#step. = step_size;
150 state->max_stepcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#max_step. = step_size;
151 state->tolcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#tol. = tol;
152
153 GSL_MULTIMIN_FN_EVAL_F_DFcxx . . $ `external/gsl/gsl_multimin.h:73:9`! (fdf, x, f, gradient);
154
155 /* Use the gradient as the initial direction */
156
157 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (state->x0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x0., x);
158 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (state->pcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#p., gradient);
159 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (state->g0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#g0., gradient);
160
161 {
162 double gnorm = gsl_blas_dnrm2cxx . . $ gsl_blas_dnrm2(1b712e435b5359e9). (gradient);
163 state->pnormcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#pnorm. = gnorm;
164 state->g0normcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#g0norm. = gnorm;
165 }
166
167 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
168 }
169
170 static void
171 vector_bfgs_freecxx . . $ vector_bfgs_free(5d22bdacc48458e8). (void *vstate)
172 {
173 vector_bfgs_state_tcxx . . $ vector_bfgs_state_t# *state = (vector_bfgs_state_tcxx . . $ vector_bfgs_state_t# *) vstate;
174
175 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->dg0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dg0.);
176 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->dx0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx0.);
177 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->g0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#g0.);
178 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x0.);
179 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->pcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#p.);
180 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x2cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x2.);
181 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->dx1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx1.);
182 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (state->x1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x1.);
183 }
184
185 static int
186 vector_bfgs_restartcxx . . $ vector_bfgs_restart(dedf1e9b1c614a07). (void *vstate)
187 {
188 vector_bfgs_state_tcxx . . $ vector_bfgs_state_t# *state = (vector_bfgs_state_tcxx . . $ vector_bfgs_state_t# *) vstate;
189
190 state->itercxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#iter. = 0;
191 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
192 }
193
194 static int
195 vector_bfgs_iteratecxx . . $ vector_bfgs_iterate(26454239738d3d2d). (void *vstate, gsl_multimin_function_fdfcxx . . $ gsl_multimin_function_fdf# * fdf,
196 gsl_vectorcxx . . $ gsl_vector# * x, double *f,
197 gsl_vectorcxx . . $ gsl_vector# * gradient, gsl_vectorcxx . . $ gsl_vector# * dx)
198 {
199 vector_bfgs_state_tcxx . . $ vector_bfgs_state_t# *state = (vector_bfgs_state_tcxx . . $ vector_bfgs_state_t# *) vstate;
200
201 gsl_vectorcxx . . $ gsl_vector# *x1 = state->x1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x1.;
202 gsl_vectorcxx . . $ gsl_vector# *dx1 = state->dx1cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx1.;
203 gsl_vectorcxx . . $ gsl_vector# *x2 = state->x2cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x2.;
204 gsl_vectorcxx . . $ gsl_vector# *p = state->pcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#p.;
205 gsl_vectorcxx . . $ gsl_vector# *g0 = state->g0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#g0.;
206 gsl_vectorcxx . . $ gsl_vector# *x0 = state->x0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#x0.;
207
208 double pnorm = state->pnormcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#pnorm.;
209 double g0norm = state->g0normcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#g0norm.;
210
211 double fa = *f, fb, fc;
212 double dir;
213 double stepa = 0.0, stepb, stepc = state->stepcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#step., tol = state->tolcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#tol.;
214
215 double g1norm;
216 double pg;
217
218 if (pnorm == 0.0 || g0norm == 0.0)
219 {
220 gsl_vector_set_zerocxx . . $ gsl_vector_set_zero(5d65852ca0326259). (dx);
221 return GSL_ENOPROGcxx . . $ GSL_ENOPROG.;
222 }
223
224 /* Determine which direction is downhill, +p or -p */
225
226 gsl_blas_ddotcxx . . $ gsl_blas_ddot(1ee5503a249d268f). (p, gradient, &pg);
227
228 dir = (pg >= 0.0) ? +1.0 : -1.0;
229
230 /* Compute new trial point at x_c= x - step * p, where p is the
231 current direction */
232
233 take_stepcxx . . $ take_step(e6b9d70ab3ecefb7). (x, p, stepc, dir / pnorm, x1, dx);
234
235 /* Evaluate function and gradient at new point xc */
236
237 fc = GSL_MULTIMIN_FN_EVAL_Fcxx . . $ `external/gsl/gsl_multimin.h:71:9`! (fdf, x1);
238
239 if (fc < fa)
240 {
241 /* Success, reduced the function value */
242 state->stepcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#step. = stepc * 2.0;
243 *f = fc;
244 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (x, x1);
245 GSL_MULTIMIN_FN_EVAL_DFcxx . . $ `external/gsl/gsl_multimin.h:72:9`! (fdf, x1, gradient);
246 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
247 }
248
249 #ifdef DEBUG
250 printf ("got stepc = %g fc = %g\n", stepc, fc);
251 #endif
252
253 /* Do a line minimisation in the region (xa,fa) (xc,fc) to find an
254 intermediate (xb,fb) satisifying fa > fb < fc. Choose an initial
255 xb based on parabolic interpolation */
256
257 intermediate_pointcxx . . $ intermediate_point(1451a91833ff4007). (fdf, x, p, dir / pnorm, pg,
258 stepa, stepc, fa, fc, x1, dx1, gradient, &stepb, &fb);
259
260 if (stepb == 0.0)
261 {
262 return GSL_ENOPROGcxx . . $ GSL_ENOPROG.;
263 }
264
265 minimizecxx . . $ minimize(888440c29ed85de7). (fdf, x, p, dir / pnorm,
266 stepa, stepb, stepc, fa, fb, fc, tol,
267 x1, dx1, x2, dx, gradient, &(state->stepcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#step.), f, &g1norm);
268
269 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (x, x2);
270
271 /* Choose a new direction for the next step */
272
273 state->itercxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#iter. = (state->itercxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#iter. + 1) % x->sizecxx . . $ $anonymous_type_a8c2e3e00d6867c2_0#size.;
274
275 if (state->itercxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#iter. == 0)
276 {
277 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (p, gradient);
278 state->pnormcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#pnorm. = g1norm;
279 }
280 else
281 {
282 /* This is the BFGS update: */
283 /* p' = g1 - A dx - B dg */
284 /* A = - (1+ dg.dg/dx.dg) B + dg.g/dx.dg */
285 /* B = dx.g/dx.dg */
286
287 gsl_vectorcxx . . $ gsl_vector# *dx0 = state->dx0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dx0.;
288 gsl_vectorcxx . . $ gsl_vector# *dg0 = state->dg0cxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#dg0.;
289
290 double dxg, dgg, dxdg, dgnorm, A, B;
291
292 /* dx0 = x - x0 */
293 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (dx0, x);
294 gsl_blas_daxpycxx . . $ gsl_blas_daxpy(b9b02baa1ffb1e94). (-1.0, x0, dx0);
295
296 /* dg0 = g - g0 */
297 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (dg0, gradient);
298 gsl_blas_daxpycxx . . $ gsl_blas_daxpy(b9b02baa1ffb1e94). (-1.0, g0, dg0);
299
300 gsl_blas_ddotcxx . . $ gsl_blas_ddot(1ee5503a249d268f). (dx0, gradient, &dxg);
301 gsl_blas_ddotcxx . . $ gsl_blas_ddot(1ee5503a249d268f). (dg0, gradient, &dgg);
302 gsl_blas_ddotcxx . . $ gsl_blas_ddot(1ee5503a249d268f). (dx0, dg0, &dxdg);
303
304 dgnorm = gsl_blas_dnrm2cxx . . $ gsl_blas_dnrm2(1b712e435b5359e9). (dg0);
305
306 if (dxdg != 0)
307 {
308 B = dxg / dxdg;
309 A = -(1.0 + dgnorm * dgnorm / dxdg) * B + dgg / dxdg;
310 }
311 else
312 {
313 B = 0;
314 A = 0;
315 }
316
317 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (p, gradient);
318 gsl_blas_daxpycxx . . $ gsl_blas_daxpy(b9b02baa1ffb1e94). (-A, dx0, p);
319 gsl_blas_daxpycxx . . $ gsl_blas_daxpy(b9b02baa1ffb1e94). (-B, dg0, p);
320
321 state->pnormcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#pnorm. = gsl_blas_dnrm2cxx . . $ gsl_blas_dnrm2(1b712e435b5359e9). (p);
322 }
323
324 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (g0, gradient);
325 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (x0, x);
326 state->g0normcxx . . $ $anonymous_type_7a682f7ca1bcbcc2_0#g0norm. = gsl_blas_dnrm2cxx . . $ gsl_blas_dnrm2(1b712e435b5359e9). (g0);
327
328 #ifdef DEBUG
329 printf ("updated directions\n");
330 printf ("p: ");
331 gsl_vector_fprintf (stdout, p, "%g");
332 printf ("g: ");
333 gsl_vector_fprintf (stdout, gradient, "%g");
334 #endif
335
336 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
337 }
338
339 static const gsl_multimin_fdfminimizer_typecxx . . $ gsl_multimin_fdfminimizer_type# vector_bfgs_typecxx . . $ vector_bfgs_type. = {
340 "vector_bfgs", /* name */
341 sizeof (vector_bfgs_state_tcxx . . $ vector_bfgs_state_t#),
342 &vector_bfgs_alloccxx . . $ vector_bfgs_alloc(c0a5f96701d3f89).,
343 &vector_bfgs_setcxx . . $ vector_bfgs_set(aff3d705de048e1c).,
344 &vector_bfgs_iteratecxx . . $ vector_bfgs_iterate(26454239738d3d2d).,
345 &vector_bfgs_restartcxx . . $ vector_bfgs_restart(dedf1e9b1c614a07).,
346 &vector_bfgs_freecxx . . $ vector_bfgs_free(5d22bdacc48458e8).
347 };
348
349 const gsl_multimin_fdfminimizer_typecxx . . $ gsl_multimin_fdfminimizer_type#
350 * gsl_multimin_fdfminimizer_vector_bfgscxx . . $ gsl_multimin_fdfminimizer_vector_bfgs. = &vector_bfgs_typecxx . . $ vector_bfgs_type.;