Debian Codegraph @

external/gsl/gsl_roots__fsolver.c

raw symbols SCIP
1 /* roots/fsolver.c
2 *
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Reid Priedhorsky, 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_roots.h"cxx . . $ `<file>/external/gsl/gsl_roots.h`/
25
26 gsl_root_fsolvercxx . . $ gsl_root_fsolver# *
27 gsl_root_fsolver_alloccxx . . $ gsl_root_fsolver_alloc(2e3005c3f548f15). (const gsl_root_fsolver_typecxx . . $ gsl_root_fsolver_type# * T)
28 {
29 gsl_root_fsolvercxx . . $ gsl_root_fsolver# * s = (gsl_root_fsolvercxx . . $ gsl_root_fsolver# *) malloccxx . . $ malloc(bfcfa4d6b7f7ef64). (sizeof (gsl_root_fsolvercxx . . $ gsl_root_fsolver#));
30
31 if (s == 0)
32 {
33 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for root solver struct",
34 GSL_ENOMEM, 0);
35 };
36
37 s->statecxx . . $ $anonymous_type_e6d985e34a433613_1#state. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64). (T->sizecxx . . $ $anonymous_type_e6d985e34a433613_0#size.);
38
39 if (s->statecxx . . $ $anonymous_type_e6d985e34a433613_1#state. == 0)
40 {
41 freecxx . . $ free(5d22bdacc48458e8). (s); /* exception in constructor, avoid memory leak */
42
43 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for root solver state",
44 GSL_ENOMEM, 0);
45 };
46
47 s->typecxx . . $ $anonymous_type_e6d985e34a433613_1#type. = T ;
48 s->functioncxx . . $ $anonymous_type_e6d985e34a433613_1#function. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ;
49
50 return s;
51 }
52
53 int
54 gsl_root_fsolver_setcxx . . $ gsl_root_fsolver_set(593d7099895f72ac). (gsl_root_fsolvercxx . . $ gsl_root_fsolver# * s, gsl_functioncxx . . $ gsl_function# * f, double x_lower, double x_upper)
55 {
56 if (x_lower > x_upper)
57 {
58 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("invalid interval (lower > upper)", GSL_EINVAL);
59 }
60
61 s->functioncxx . . $ $anonymous_type_e6d985e34a433613_1#function. = f;
62 s->rootcxx . . $ $anonymous_type_e6d985e34a433613_1#root. = 0.5 * (x_lower + x_upper); /* initial estimate */
63 s->x_lowercxx . . $ $anonymous_type_e6d985e34a433613_1#x_lower. = x_lower;
64 s->x_uppercxx . . $ $anonymous_type_e6d985e34a433613_1#x_upper. = x_upper;
65
66 return (s->typecxx . . $ $anonymous_type_e6d985e34a433613_1#type.->setcxx . . $ $anonymous_type_e6d985e34a433613_0#set.) (s->statecxx . . $ $anonymous_type_e6d985e34a433613_1#state., s->functioncxx . . $ $anonymous_type_e6d985e34a433613_1#function., &(s->rootcxx . . $ $anonymous_type_e6d985e34a433613_1#root.), x_lower, x_upper);
67 }
68
69 int
70 gsl_root_fsolver_iteratecxx . . $ gsl_root_fsolver_iterate(7c51a73a986966c1). (gsl_root_fsolvercxx . . $ gsl_root_fsolver# * s)
71 {
72 return (s->typecxx . . $ $anonymous_type_e6d985e34a433613_1#type.->iteratecxx . . $ $anonymous_type_e6d985e34a433613_0#iterate.) (s->statecxx . . $ $anonymous_type_e6d985e34a433613_1#state.,
73 s->functioncxx . . $ $anonymous_type_e6d985e34a433613_1#function., &(s->rootcxx . . $ $anonymous_type_e6d985e34a433613_1#root.),
74 &(s->x_lowercxx . . $ $anonymous_type_e6d985e34a433613_1#x_lower.), &(s->x_uppercxx . . $ $anonymous_type_e6d985e34a433613_1#x_upper.));
75 }
76
77 void
78 gsl_root_fsolver_freecxx . . $ gsl_root_fsolver_free(937e4d5c5f520a71). (gsl_root_fsolvercxx . . $ gsl_root_fsolver# * s)
79 {
80 freecxx . . $ free(5d22bdacc48458e8). (s->statecxx . . $ $anonymous_type_e6d985e34a433613_1#state.);
81 freecxx . . $ free(5d22bdacc48458e8). (s);
82 }
83
84 const char *
85 gsl_root_fsolver_namecxx . . $ gsl_root_fsolver_name(d0109fbf98111e4a). (const gsl_root_fsolvercxx . . $ gsl_root_fsolver# * s)
86 {
87 return s->typecxx . . $ $anonymous_type_e6d985e34a433613_1#type.->namecxx . . $ $anonymous_type_e6d985e34a433613_0#name.;
88 }
89
90 double
91 gsl_root_fsolver_rootcxx . . $ gsl_root_fsolver_root(226417d0bf9e6b94). (const gsl_root_fsolvercxx . . $ gsl_root_fsolver# * s)
92 {
93 return s->rootcxx . . $ $anonymous_type_e6d985e34a433613_1#root.;
94 }
95
96 double
97 gsl_root_fsolver_x_lowercxx . . $ gsl_root_fsolver_x_lower(226417d0bf9e6b94). (const gsl_root_fsolvercxx . . $ gsl_root_fsolver# * s)
98 {
99 return s->x_lowercxx . . $ $anonymous_type_e6d985e34a433613_1#x_lower.;
100 }
101
102 double
103 gsl_root_fsolver_x_uppercxx . . $ gsl_root_fsolver_x_upper(226417d0bf9e6b94). (const gsl_root_fsolvercxx . . $ gsl_root_fsolver# * s)
104 {
105 return s->x_uppercxx . . $ $anonymous_type_e6d985e34a433613_1#x_upper.;
106 }
107