Debian Codegraph @

external/gsl/gsl_multifit__fsolver.c

raw symbols SCIP
1 /* multifit/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_multifit_nlin.h"cxx . . $ `<file>/external/gsl/gsl_multifit_nlin.h`/
25
26 gsl_multifit_fsolvercxx . . $ gsl_multifit_fsolver# *
27 gsl_multifit_fsolver_alloccxx . . $ gsl_multifit_fsolver_alloc(4b4339c5370f07f5). (const gsl_multifit_fsolver_typecxx . . $ gsl_multifit_fsolver_type# * T,
28 size_t n, size_t p)
29 {
30 int status;
31
32 gsl_multifit_fsolvercxx . . $ gsl_multifit_fsolver# * s;
33
34 if (n < p)
35 {
36 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("insufficient data points, n < p", GSL_EINVAL, 0);
37 }
38
39 s = (gsl_multifit_fsolvercxx . . $ gsl_multifit_fsolver# *) malloccxx . . $ malloc(bfcfa4d6b7f7ef64). (sizeof (gsl_multifit_fsolvercxx . . $ gsl_multifit_fsolver#));
40
41 if (s == 0)
42 {
43 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for multifit solver struct",
44 GSL_ENOMEM, 0);
45 }
46
47 s->xcxx . . $ $anonymous_type_52a18a1d9253cc93_1#x. = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (p);
48
49 if (s->xcxx . . $ $anonymous_type_52a18a1d9253cc93_1#x. == 0)
50 {
51 freecxx . . $ free(5d22bdacc48458e8). (s);
52 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for x", GSL_ENOMEM, 0);
53 }
54
55 s->fcxx . . $ $anonymous_type_52a18a1d9253cc93_1#f. = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (n);
56
57 if (s->fcxx . . $ $anonymous_type_52a18a1d9253cc93_1#f. == 0)
58 {
59 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (s->xcxx . . $ $anonymous_type_52a18a1d9253cc93_1#x.);
60 freecxx . . $ free(5d22bdacc48458e8). (s);
61 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for f", GSL_ENOMEM, 0);
62 }
63
64 s->dxcxx . . $ $anonymous_type_52a18a1d9253cc93_1#dx. = gsl_vector_calloccxx . . $ gsl_vector_calloc(71d9e095f27e8ea9). (p);
65
66 if (s->dxcxx . . $ $anonymous_type_52a18a1d9253cc93_1#dx. == 0)
67 {
68 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (s->xcxx . . $ $anonymous_type_52a18a1d9253cc93_1#x.);
69 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (s->fcxx . . $ $anonymous_type_52a18a1d9253cc93_1#f.);
70 freecxx . . $ free(5d22bdacc48458e8). (s);
71 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for dx", GSL_ENOMEM, 0);
72 }
73
74 s->statecxx . . $ $anonymous_type_52a18a1d9253cc93_1#state. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64). (T->sizecxx . . $ $anonymous_type_52a18a1d9253cc93_0#size.);
75
76 if (s->statecxx . . $ $anonymous_type_52a18a1d9253cc93_1#state. == 0)
77 {
78 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (s->dxcxx . . $ $anonymous_type_52a18a1d9253cc93_1#dx.);
79 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (s->xcxx . . $ $anonymous_type_52a18a1d9253cc93_1#x.);
80 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (s->fcxx . . $ $anonymous_type_52a18a1d9253cc93_1#f.);
81 freecxx . . $ free(5d22bdacc48458e8). (s); /* exception in constructor, avoid memory leak */
82
83 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to allocate space for multifit solver state",
84 GSL_ENOMEM, 0);
85 }
86
87 s->typecxx . . $ $anonymous_type_52a18a1d9253cc93_1#type. = T ;
88
89 status = (s->typecxx . . $ $anonymous_type_52a18a1d9253cc93_1#type.->alloccxx . . $ $anonymous_type_52a18a1d9253cc93_0#alloc.)(s->statecxx . . $ $anonymous_type_52a18a1d9253cc93_1#state., n, p);
90
91 if (status != GSL_SUCCESScxx . . $ GSL_SUCCESS.)
92 {
93 (s->typecxx . . $ $anonymous_type_52a18a1d9253cc93_1#type.->freecxx . . $ $anonymous_type_52a18a1d9253cc93_0#free.)(s->statecxx . . $ $anonymous_type_52a18a1d9253cc93_1#state.);
94 freecxx . . $ free(5d22bdacc48458e8). (s->statecxx . . $ $anonymous_type_52a18a1d9253cc93_1#state.);
95 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (s->dxcxx . . $ $anonymous_type_52a18a1d9253cc93_1#dx.);
96 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (s->xcxx . . $ $anonymous_type_52a18a1d9253cc93_1#x.);
97 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (s->fcxx . . $ $anonymous_type_52a18a1d9253cc93_1#f.);
98 freecxx . . $ free(5d22bdacc48458e8). (s); /* exception in constructor, avoid memory leak */
99
100 GSL_ERROR_VALcxx . . $ `external/gsl/gsl_errno.h:112:9`! ("failed to set solver", status, 0);
101 }
102
103 s->functioncxx . . $ $anonymous_type_52a18a1d9253cc93_1#function. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
104
105 return s;
106 }
107
108 int
109 gsl_multifit_fsolver_setcxx . . $ gsl_multifit_fsolver_set(6f829c58bd708c1a). (gsl_multifit_fsolvercxx . . $ gsl_multifit_fsolver# * s,
110 gsl_multifit_functioncxx . . $ gsl_multifit_function# * f,
111 const gsl_vectorcxx . . $ gsl_vector# * x)
112 {
113 if (s->fcxx . . $ $anonymous_type_52a18a1d9253cc93_1#f.->sizecxx . . $ $anonymous_type_a8c2e3e00d6867c2_0#size. != f->ncxx . . $ gsl_multifit_function_struct#n.)
114 {
115 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("function size does not match solver", GSL_EBADLEN);
116 }
117
118 if (s->xcxx . . $ $anonymous_type_52a18a1d9253cc93_1#x.->sizecxx . . $ $anonymous_type_a8c2e3e00d6867c2_0#size. != x->sizecxx . . $ $anonymous_type_a8c2e3e00d6867c2_0#size.)
119 {
120 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("vector length does not match solver", GSL_EBADLEN);
121 }
122
123 s->functioncxx . . $ $anonymous_type_52a18a1d9253cc93_1#function. = f;
124 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555).(s->xcxx . . $ $anonymous_type_52a18a1d9253cc93_1#x.,x);
125
126 return (s->typecxx . . $ $anonymous_type_52a18a1d9253cc93_1#type.->setcxx . . $ $anonymous_type_52a18a1d9253cc93_0#set.) (s->statecxx . . $ $anonymous_type_52a18a1d9253cc93_1#state., s->functioncxx . . $ $anonymous_type_52a18a1d9253cc93_1#function., s->xcxx . . $ $anonymous_type_52a18a1d9253cc93_1#x., s->fcxx . . $ $anonymous_type_52a18a1d9253cc93_1#f., s->dxcxx . . $ $anonymous_type_52a18a1d9253cc93_1#dx.);
127 }
128
129 int
130 gsl_multifit_fsolver_iteratecxx . . $ gsl_multifit_fsolver_iterate(195e759814a60d8a). (gsl_multifit_fsolvercxx . . $ gsl_multifit_fsolver# * s)
131 {
132 return (s->typecxx . . $ $anonymous_type_52a18a1d9253cc93_1#type.->iteratecxx . . $ $anonymous_type_52a18a1d9253cc93_0#iterate.) (s->statecxx . . $ $anonymous_type_52a18a1d9253cc93_1#state., s->functioncxx . . $ $anonymous_type_52a18a1d9253cc93_1#function., s->xcxx . . $ $anonymous_type_52a18a1d9253cc93_1#x., s->fcxx . . $ $anonymous_type_52a18a1d9253cc93_1#f., s->dxcxx . . $ $anonymous_type_52a18a1d9253cc93_1#dx.);
133 }
134
135 void
136 gsl_multifit_fsolver_freecxx . . $ gsl_multifit_fsolver_free(6ec38b32cf1fb130). (gsl_multifit_fsolvercxx . . $ gsl_multifit_fsolver# * s)
137 {
138 (s->typecxx . . $ $anonymous_type_52a18a1d9253cc93_1#type.->freecxx . . $ $anonymous_type_52a18a1d9253cc93_0#free.) (s->statecxx . . $ $anonymous_type_52a18a1d9253cc93_1#state.);
139 freecxx . . $ free(5d22bdacc48458e8). (s->statecxx . . $ $anonymous_type_52a18a1d9253cc93_1#state.);
140 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (s->dxcxx . . $ $anonymous_type_52a18a1d9253cc93_1#dx.);
141 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (s->xcxx . . $ $anonymous_type_52a18a1d9253cc93_1#x.);
142 gsl_vector_freecxx . . $ gsl_vector_free(5d65852ca0326259). (s->fcxx . . $ $anonymous_type_52a18a1d9253cc93_1#f.);
143 freecxx . . $ free(5d22bdacc48458e8). (s);
144 }
145
146 const char *
147 gsl_multifit_fsolver_namecxx . . $ gsl_multifit_fsolver_name(c2e2f759054c9a0e). (const gsl_multifit_fsolvercxx . . $ gsl_multifit_fsolver# * s)
148 {
149 return s->typecxx . . $ $anonymous_type_52a18a1d9253cc93_1#type.->namecxx . . $ $anonymous_type_52a18a1d9253cc93_0#name.;
150 }
151
152 gsl_vectorcxx . . $ gsl_vector# *
153 gsl_multifit_fsolver_positioncxx . . $ gsl_multifit_fsolver_position(e3f3f71ceadda8a4). (const gsl_multifit_fsolvercxx . . $ gsl_multifit_fsolver# * s)
154 {
155 return s->xcxx . . $ $anonymous_type_52a18a1d9253cc93_1#x.;
156 }