Debian Codegraph @

external/gsl/gsl_min__fsolver.c

raw symbols SCIP
1 /* min/fsolver.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 <string.h>
23 #include "gsl_errno.h"cxx . . $ `<file>/external/gsl/gsl_errno.h`/
24 #include "gsl_min.h"cxx . . $ `<file>/external/gsl/gsl_min.h`/
25
26 #include "gsl_min__min.h"cxx . . $ `<file>/external/gsl/gsl_min__min.h`/
27
28 static int
29 compute_f_valuescxx . . $ compute_f_values(68454ce7dfff5244). (gsl_functioncxx . . $ gsl_function# * f, double x_minimum, double * f_minimum,
30 double x_lower, double * f_lower,
31 double x_upper, double * f_upper);
32
33
34 static int
35 compute_f_valuescxx . . $ compute_f_values(68454ce7dfff5244). (gsl_functioncxx . . $ gsl_function# * f, double x_minimum, double * f_minimum,
36 double x_lower, double * f_lower,
37 double x_upper, double * f_upper)
38 {
39 SAFE_FUNC_CALLcxx . . $ `external/gsl/gsl_min__min.h:20:9`!(f, x_lower, f_lower);
40 SAFE_FUNC_CALLcxx . . $ `external/gsl/gsl_min__min.h:20:9`!(f, x_upper, f_upper);
41 SAFE_FUNC_CALLcxx . . $ `external/gsl/gsl_min__min.h:20:9`!(f, x_minimum, f_minimum);
42
43 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
44 }
45
46 int
47 gsl_min_fminimizer_setcxx . . $ gsl_min_fminimizer_set(7bf25571395b909d). (gsl_min_fminimizercxx . . $ gsl_min_fminimizer# * s,
48 gsl_functioncxx . . $ gsl_function# * f,
49 double x_minimum, double x_lower, double x_upper)
50 {
51 int status ;
52
53 double f_minimum, f_lower, f_upper;
54
55 status = compute_f_valuescxx . . $ compute_f_values(68454ce7dfff5244). (f, x_minimum, &f_minimum,
56 x_lower, &f_lower,
57 x_upper, &f_upper);
58
59 if (status != GSL_SUCCESScxx . . $ GSL_SUCCESS.)
60 {
61 return status ;
62 }
63
64 status = gsl_min_fminimizer_set_with_valuescxx . . $ gsl_min_fminimizer_set_with_values(cacbdb649db49b46). (s, f, x_minimum, f_minimum,
65 x_lower, f_lower,
66 x_upper, f_upper);
67 return status;
68 }
69
70 gsl_min_fminimizercxx . . $ gsl_min_fminimizer# *
71 gsl_min_fminimizer_alloccxx . . $ gsl_min_fminimizer_alloc(fc570d74b7bceec). (const gsl_min_fminimizer_typecxx . . $ gsl_min_fminimizer_type# * T)
72 {
73 gsl_min_fminimizercxx . . $ gsl_min_fminimizer# * s =
74 (gsl_min_fminimizercxx . . $ gsl_min_fminimizer# *) malloccxx . . $ malloc(bfcfa4d6b7f7ef64). (sizeof (gsl_min_fminimizercxx . . $ gsl_min_fminimizer#));
75
76 if (s == 0)
77 {
78 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for minimizer struct",
79 GSL_ENOMEM, 0);
80 };
81
82 s->statecxx . . $ $anonymous_type_cc74a02299486ef8_1#state. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64). (T->sizecxx . . $ $anonymous_type_cc74a02299486ef8_0#size.);
83
84 if (s->statecxx . . $ $anonymous_type_cc74a02299486ef8_1#state. == 0)
85 {
86 freecxx . . $ free(5d22bdacc48458e8). (s); /* exception in constructor, avoid memory leak */
87
88 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for minimizer state",
89 GSL_ENOMEM, 0);
90 };
91
92 s->typecxx . . $ $anonymous_type_cc74a02299486ef8_1#type. = T ;
93 s->functioncxx . . $ $anonymous_type_cc74a02299486ef8_1#function. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
94
95 return s;
96 }
97
98 int
99 gsl_min_fminimizer_set_with_valuescxx . . $ gsl_min_fminimizer_set_with_values(cacbdb649db49b46). (gsl_min_fminimizercxx . . $ gsl_min_fminimizer# * s, gsl_functioncxx . . $ gsl_function# * f,
100 double x_minimum, double f_minimum,
101 double x_lower, double f_lower,
102 double x_upper, double f_upper)
103 {
104 s->functioncxx . . $ $anonymous_type_cc74a02299486ef8_1#function. = f;
105 s->x_minimumcxx . . $ $anonymous_type_cc74a02299486ef8_1#x_minimum. = x_minimum;
106 s->x_lowercxx . . $ $anonymous_type_cc74a02299486ef8_1#x_lower. = x_lower;
107 s->x_uppercxx . . $ $anonymous_type_cc74a02299486ef8_1#x_upper. = x_upper;
108
109 if (x_lower > x_upper)
110 {
111 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("invalid interval (lower > upper)", GSL_EINVAL);
112 }
113
114 if (x_minimum >= x_upper || x_minimum <= x_lower)
115 {
116 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("x_minimum must lie inside interval (lower < x < upper)",
117 GSL_EINVAL);
118 }
119
120 s->f_lowercxx . . $ $anonymous_type_cc74a02299486ef8_1#f_lower. = f_lower;
121 s->f_uppercxx . . $ $anonymous_type_cc74a02299486ef8_1#f_upper. = f_upper;
122 s->f_minimumcxx . . $ $anonymous_type_cc74a02299486ef8_1#f_minimum. = f_minimum;
123
124 if (f_minimum >= f_lower || f_minimum >= f_upper)
125 {
126 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("endpoints do not enclose a minimum", GSL_EINVAL);
127 }
128
129 return (s->typecxx . . $ $anonymous_type_cc74a02299486ef8_1#type.->setcxx . . $ $anonymous_type_cc74a02299486ef8_0#set.) (s->statecxx . . $ $anonymous_type_cc74a02299486ef8_1#state., s->functioncxx . . $ $anonymous_type_cc74a02299486ef8_1#function.,
130 x_minimum, f_minimum,
131 x_lower, f_lower,
132 x_upper, f_upper);
133 }
134
135
136 int
137 gsl_min_fminimizer_iteratecxx . . $ gsl_min_fminimizer_iterate(3113653096e50c6a). (gsl_min_fminimizercxx . . $ gsl_min_fminimizer# * s)
138 {
139 return (s->typecxx . . $ $anonymous_type_cc74a02299486ef8_1#type.->iteratecxx . . $ $anonymous_type_cc74a02299486ef8_0#iterate.) (s->statecxx . . $ $anonymous_type_cc74a02299486ef8_1#state., s->functioncxx . . $ $anonymous_type_cc74a02299486ef8_1#function.,
140 &(s->x_minimumcxx . . $ $anonymous_type_cc74a02299486ef8_1#x_minimum.), &(s->f_minimumcxx . . $ $anonymous_type_cc74a02299486ef8_1#f_minimum.),
141 &(s->x_lowercxx . . $ $anonymous_type_cc74a02299486ef8_1#x_lower.), &(s->f_lowercxx . . $ $anonymous_type_cc74a02299486ef8_1#f_lower.),
142 &(s->x_uppercxx . . $ $anonymous_type_cc74a02299486ef8_1#x_upper.), &(s->f_uppercxx . . $ $anonymous_type_cc74a02299486ef8_1#f_upper.));
143 }
144
145 void
146 gsl_min_fminimizer_freecxx . . $ gsl_min_fminimizer_free(a16034741e03178f). (gsl_min_fminimizercxx . . $ gsl_min_fminimizer# * s)
147 {
148 freecxx . . $ free(5d22bdacc48458e8). (s->statecxx . . $ $anonymous_type_cc74a02299486ef8_1#state.);
149 freecxx . . $ free(5d22bdacc48458e8). (s);
150 }
151
152 const char *
153 gsl_min_fminimizer_namecxx . . $ gsl_min_fminimizer_name(6798ce9fc236abc8). (const gsl_min_fminimizercxx . . $ gsl_min_fminimizer# * s)
154 {
155 return s->typecxx . . $ $anonymous_type_cc74a02299486ef8_1#type.->namecxx . . $ $anonymous_type_cc74a02299486ef8_0#name.;
156 }
157
158 /* Deprecated, use x_minimum instead */
159 double
160 gsl_min_fminimizer_minimumcxx . . $ gsl_min_fminimizer_minimum(a5b5379153981471). (const gsl_min_fminimizercxx . . $ gsl_min_fminimizer# * s)
161 {
162 return s->x_minimumcxx . . $ $anonymous_type_cc74a02299486ef8_1#x_minimum.;
163 }
164
165 double
166 gsl_min_fminimizer_x_minimumcxx . . $ gsl_min_fminimizer_x_minimum(a5b5379153981471). (const gsl_min_fminimizercxx . . $ gsl_min_fminimizer# * s)
167 {
168 return s->x_minimumcxx . . $ $anonymous_type_cc74a02299486ef8_1#x_minimum.;
169 }
170
171 double
172 gsl_min_fminimizer_x_lowercxx . . $ gsl_min_fminimizer_x_lower(a5b5379153981471). (const gsl_min_fminimizercxx . . $ gsl_min_fminimizer# * s)
173 {
174 return s->x_lowercxx . . $ $anonymous_type_cc74a02299486ef8_1#x_lower.;
175 }
176
177 double
178 gsl_min_fminimizer_x_uppercxx . . $ gsl_min_fminimizer_x_upper(a5b5379153981471). (const gsl_min_fminimizercxx . . $ gsl_min_fminimizer# * s)
179 {
180 return s->x_uppercxx . . $ $anonymous_type_cc74a02299486ef8_1#x_upper.;
181 }
182
183 double
184 gsl_min_fminimizer_f_minimumcxx . . $ gsl_min_fminimizer_f_minimum(a5b5379153981471). (const gsl_min_fminimizercxx . . $ gsl_min_fminimizer# * s)
185 {
186 return s->f_minimumcxx . . $ $anonymous_type_cc74a02299486ef8_1#f_minimum.;
187 }
188
189 double
190 gsl_min_fminimizer_f_lowercxx . . $ gsl_min_fminimizer_f_lower(a5b5379153981471). (const gsl_min_fminimizercxx . . $ gsl_min_fminimizer# * s)
191 {
192 return s->f_lowercxx . . $ $anonymous_type_cc74a02299486ef8_1#f_lower.;
193 }
194
195 double
196 gsl_min_fminimizer_f_uppercxx . . $ gsl_min_fminimizer_f_upper(a5b5379153981471). (const gsl_min_fminimizercxx . . $ gsl_min_fminimizer# * s)
197 {
198 return s->f_uppercxx . . $ $anonymous_type_cc74a02299486ef8_1#f_upper.;
199 }
200