Debian Codegraph @

external/gsl/gsl_multimin__linear_wrapper.c

raw symbols SCIP
1 typedefcxx . . $ `<file>/external/gsl/gsl_multimin__linear_wrapper.c`/ structcxx . . $ $anonymous_type_806cd3f4c9f48315_0#
2 {
3 gsl_function_fdfcxx . . $ gsl_function_fdf# fdf_linearcxx . . $ $anonymous_type_806cd3f4c9f48315_0#fdf_linear.;
4 gsl_multimin_function_fdfcxx . . $ gsl_multimin_function_fdf# *fdfcxx . . $ $anonymous_type_806cd3f4c9f48315_0#fdf.;
5 /* fixed values */
6 const gsl_vectorcxx . . $ gsl_vector# *xcxx . . $ $anonymous_type_806cd3f4c9f48315_0#x.;
7 const gsl_vectorcxx . . $ gsl_vector# *gcxx . . $ $anonymous_type_806cd3f4c9f48315_0#g.;
8 const gsl_vectorcxx . . $ gsl_vector# *pcxx . . $ $anonymous_type_806cd3f4c9f48315_0#p.;
9
10 /* cached values, for x(alpha) = x + alpha * p */
11 double f_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#f_alpha.;
12 double df_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_alpha.;
13 gsl_vectorcxx . . $ gsl_vector# *x_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#x_alpha.;
14 gsl_vectorcxx . . $ gsl_vector# *g_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#g_alpha.;
15
16 /* cache "keys" */
17 double f_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#f_cache_key.;
18 double df_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_cache_key.;
19 double x_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#x_cache_key.;
20 double g_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#g_cache_key.;
21 }
22 wrapper_tcxx . . $ wrapper_t#;
23
24 static void
25 movetocxx . . $ moveto(586dfb40515389f3). (double alpha, wrapper_tcxx . . $ wrapper_t# * w)
26 {
27 if (alpha == w->x_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#x_cache_key.) /* using previously cached position */
28 {
29 return;
30 }
31
32 /* set x_alpha = x + alpha * p */
33
34 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (w->x_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#x_alpha., w->xcxx . . $ $anonymous_type_806cd3f4c9f48315_0#x.);
35 gsl_blas_daxpycxx . . $ gsl_blas_daxpy(b9b02baa1ffb1e94). (alpha, w->pcxx . . $ $anonymous_type_806cd3f4c9f48315_0#p., w->x_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#x_alpha.);
36
37 w->x_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#x_cache_key. = alpha;
38 }
39
40 static double
41 slopecxx . . $ slope(d9323592a88afa6b). (wrapper_tcxx . . $ wrapper_t# * w) /* compute gradient . direction */
42 {
43 double df;
44 gsl_blas_ddotcxx . . $ gsl_blas_ddot(1ee5503a249d268f). (w->g_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#g_alpha., w->pcxx . . $ $anonymous_type_806cd3f4c9f48315_0#p., &df);
45 return df;
46 }
47
48 static double
49 wrap_fcxx . . $ wrap_f(81b005370e6958c4). (double alpha, void *params)
50 {
51 wrapper_tcxx . . $ wrapper_t# *w = (wrapper_tcxx . . $ wrapper_t# *) params;
52 if (alpha == w->f_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#f_cache_key.) /* using previously cached f(alpha) */
53 {
54 return w->f_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#f_alpha.;
55 }
56
57 movetocxx . . $ moveto(586dfb40515389f3). (alpha, w);
58
59 w->f_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#f_alpha. = GSL_MULTIMIN_FN_EVAL_Fcxx . . $ `external/gsl/gsl_multimin.h:71:9`! (w->fdf, w->x_alpha);
60 w->f_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#f_cache_key. = alpha;
61
62 return w->f_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#f_alpha.;
63 }
64
65 static double
66 wrap_dfcxx . . $ wrap_df(81b005370e6958c4). (double alpha, void *params)
67 {
68 wrapper_tcxx . . $ wrapper_t# *w = (wrapper_tcxx . . $ wrapper_t# *) params;
69 if (alpha == w->df_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_cache_key.) /* using previously cached df(alpha) */
70 {
71 return w->df_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_alpha.;
72 }
73
74 movetocxx . . $ moveto(586dfb40515389f3). (alpha, w);
75
76 if (alpha != w->g_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#g_cache_key.)
77 {
78 GSL_MULTIMIN_FN_EVAL_DFcxx . . $ `external/gsl/gsl_multimin.h:72:9`! (w->fdf, w->x_alpha, w->g_alpha);
79 w->g_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#g_cache_key. = alpha;
80 }
81
82 w->df_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_alpha. = slopecxx . . $ slope(d9323592a88afa6b). (w);
83 w->df_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_cache_key. = alpha;
84
85 return w->df_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_alpha.;
86 }
87
88 static void
89 wrap_fdfcxx . . $ wrap_fdf(b0fc2fbe5641b925). (double alpha, void *params, double *f, double *df)
90 {
91 wrapper_tcxx . . $ wrapper_t# *w = (wrapper_tcxx . . $ wrapper_t# *) params;
92
93 /* Check for previously cached values */
94
95 if (alpha == w->f_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#f_cache_key. && alpha == w->df_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_cache_key.)
96 {
97 *f = w->f_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#f_alpha.;
98 *df = w->df_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_alpha.;
99 return;
100 }
101
102 if (alpha == w->f_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#f_cache_key. || alpha == w->df_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_cache_key.)
103 {
104 *f = wrap_fcxx . . $ wrap_f(81b005370e6958c4). (alpha, params);
105 *df = wrap_dfcxx . . $ wrap_df(81b005370e6958c4). (alpha, params);
106 return;
107 }
108
109 movetocxx . . $ moveto(586dfb40515389f3). (alpha, w);
110 GSL_MULTIMIN_FN_EVAL_F_DFcxx . . $ `external/gsl/gsl_multimin.h:73:9`! (w->fdf, w->x_alpha, &w->f_alpha, w->g_alpha);
111 w->f_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#f_cache_key. = alpha;
112 w->g_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#g_cache_key. = alpha;
113
114 w->df_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_alpha. = slopecxx . . $ slope(d9323592a88afa6b). (w);
115 w->df_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_cache_key. = alpha;
116
117 *f = w->f_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#f_alpha.;
118 *df = w->df_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_alpha.;
119 }
120
121 static void
122 prepare_wrappercxx . . $ prepare_wrapper(e72ffd5d9e31ce3e). (wrapper_tcxx . . $ wrapper_t# * w, gsl_multimin_function_fdfcxx . . $ gsl_multimin_function_fdf# * fdf,
123 const gsl_vectorcxx . . $ gsl_vector# * x, double f, const gsl_vectorcxx . . $ gsl_vector# *g,
124 const gsl_vectorcxx . . $ gsl_vector# * p,
125 gsl_vectorcxx . . $ gsl_vector# * x_alpha, gsl_vectorcxx . . $ gsl_vector# *g_alpha)
126 {
127 w->fdf_linearcxx . . $ $anonymous_type_806cd3f4c9f48315_0#fdf_linear..fcxx . . $ gsl_function_fdf_struct#f. = &wrap_fcxx . . $ wrap_f(81b005370e6958c4).;
128 w->fdf_linearcxx . . $ $anonymous_type_806cd3f4c9f48315_0#fdf_linear..dfcxx . . $ gsl_function_fdf_struct#df. = &wrap_dfcxx . . $ wrap_df(81b005370e6958c4).;
129 w->fdf_linearcxx . . $ $anonymous_type_806cd3f4c9f48315_0#fdf_linear..fdfcxx . . $ gsl_function_fdf_struct#fdf. = &wrap_fdfcxx . . $ wrap_fdf(b0fc2fbe5641b925).;
130 w->fdf_linearcxx . . $ $anonymous_type_806cd3f4c9f48315_0#fdf_linear..paramscxx . . $ gsl_function_fdf_struct#params. = (void *)w; /* pointer to "self" */
131
132 w->fdfcxx . . $ $anonymous_type_806cd3f4c9f48315_0#fdf. = fdf;
133
134 w->xcxx . . $ $anonymous_type_806cd3f4c9f48315_0#x. = x;
135 w->gcxx . . $ $anonymous_type_806cd3f4c9f48315_0#g. = g;
136 w->pcxx . . $ $anonymous_type_806cd3f4c9f48315_0#p. = p;
137
138 w->x_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#x_alpha. = x_alpha;
139 w->g_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#g_alpha. = g_alpha;
140
141 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555).(w->x_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#x_alpha., w->xcxx . . $ $anonymous_type_806cd3f4c9f48315_0#x.);
142 w->x_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#x_cache_key. = 0.0;
143
144 w->f_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#f_alpha. = f;
145 w->f_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#f_cache_key. = 0.0;
146
147 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555).(w->g_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#g_alpha., w->gcxx . . $ $anonymous_type_806cd3f4c9f48315_0#g.);
148 w->g_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#g_cache_key. = 0.0;
149
150 w->df_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_alpha. = slopecxx . . $ slope(d9323592a88afa6b).(w);
151 w->df_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_cache_key. = 0.0;
152 }
153
154 static void
155 update_positioncxx . . $ update_position(78db51f6bd632ed1). (wrapper_tcxx . . $ wrapper_t# * w, double alpha, gsl_vectorcxx . . $ gsl_vector# *x, double *f, gsl_vectorcxx . . $ gsl_vector# *g)
156 {
157 /* ensure that everything is fully cached */
158 { double f_alpha, df_alpha; wrap_fdfcxx . . $ wrap_fdf(b0fc2fbe5641b925). (alpha, w, &f_alpha, &df_alpha); } ;
159
160 *f = w->f_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#f_alpha.;
161 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555).(x, w->x_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#x_alpha.);
162 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555).(g, w->g_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#g_alpha.);
163 }
164
165 static void
166 change_directioncxx . . $ change_direction(6d12d22b16f81afd). (wrapper_tcxx . . $ wrapper_t# * w)
167 {
168 /* Convert the cache values from the end of the current minimisation
169 to those needed for the start of the next minimisation, alpha=0 */
170
171 /* The new x_alpha for alpha=0 is the current position */
172 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (w->x_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#x_alpha., w->xcxx . . $ $anonymous_type_806cd3f4c9f48315_0#x.);
173 w->x_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#x_cache_key. = 0.0;
174
175 /* The function value does not change */
176 w->f_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#f_cache_key. = 0.0;
177
178 /* The new g_alpha for alpha=0 is the current gradient at the endpoint */
179 gsl_vector_memcpycxx . . $ gsl_vector_memcpy(950c164c4e50c555). (w->g_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#g_alpha., w->gcxx . . $ $anonymous_type_806cd3f4c9f48315_0#g.);
180 w->g_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#g_cache_key. = 0.0;
181
182 /* Calculate the slope along the new direction vector, p */
183 w->df_alphacxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_alpha. = slopecxx . . $ slope(d9323592a88afa6b). (w);
184 w->df_cache_keycxx . . $ $anonymous_type_806cd3f4c9f48315_0#df_cache_key. = 0.0;
185 }