Debian Codegraph @

external/gsl/gsl_multimin__diff.c

raw symbols SCIP
1 /* multimin/diff.c
2 *
3 * Copyright (C) 2000 David Morrison
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 "gsl_multimin.h"cxx . . $ `<file>/external/gsl/gsl_multimin.h`/
22
23 int
24 gsl_multimin_diffcxx . . $ gsl_multimin_diff(ad5c730df16ccb6d). (const gsl_multimin_functioncxx . . $ gsl_multimin_function# * f,
25 const gsl_vectorcxx . . $ gsl_vector# * x, gsl_vectorcxx . . $ gsl_vector# * g)
26 {
27 size_t i, n = f->ncxx . . $ gsl_multimin_function_struct#n.;
28
29 double h = GSL_SQRT_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:18:9`!;
30
31
32 gsl_vectorcxx . . $ gsl_vector# * x1 = gsl_vector_alloccxx . . $ gsl_vector_alloc(71d9e095f27e8ea9). (n); /* FIXME: pass as argument */
33
34 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (x1, x);
35
36 for (i = 0; i < n; i++)
37 {
38 double fl, fh;
39
40 double xi = gsl_vector_getcxx . . $ gsl_vector_get(bd1f20df78adc7a). (x, i);
41 double dx = fabscxx . . $ fabs(447c67c6676f75c3).(xi) * h;
42
43 if (dx == 0.0) dx = h;
44
45 gsl_vector_setcxx . . $ gsl_vector_set(c35f863a529e8fae). (x1, i, xi + dx);
46 fh = GSL_MULTIMIN_FN_EVALcxx . . $ `external/gsl/gsl_multimin.h:56:9`!(f, x1);
47
48 gsl_vector_setcxx . . $ gsl_vector_set(c35f863a529e8fae). (x1, i, xi - dx);
49 fl = GSL_MULTIMIN_FN_EVALcxx . . $ `external/gsl/gsl_multimin.h:56:9`!(f, x1);
50
51 gsl_vector_setcxx . . $ gsl_vector_set(c35f863a529e8fae). (x1, i, xi);
52 gsl_vector_setcxx . . $ gsl_vector_set(c35f863a529e8fae). (g, i, (fh - fl) / (2.0 * dx));
53 }
54
55 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (x1);
56
57 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
58 }