40 ivector lfe_index(1, (
int)funnel_init_var::num_active_parameters);
42 for (
int i=1;i<=(int)funnel_init_var::num_active_parameters;i++)
57 int* plfe_indexi = lfe_index.
get_v() + 1;
58 double* plocal_xadjointi = local_xadjoint.
get_v() + 1;
59 for (
int i=1;i<=xs;i++)
61 int ii = *plfe_indexi;
62 *plocal_xadjointi = (*grad_x_u)(list(ii,1));
67 int* plre_indexi = lre_index.
get_v() + 1;
68 double* plocal_uadjointi = local_xadjoint.
get_v() + 1;
69 for (
int i=1;i<=us;i++)
72 *plocal_uadjointi = (*grad_x_u)(list(ii,1));
85 dvector* plocal_Hessi = &local_Hess(1);
86 plre_indexi = lre_index.
get_v() + 1;
87 for (
int i=1;i<=us;i++)
89 int i2=list(*plre_indexi, 2);
91 double* plocal_Hessij = plocal_Hessi->
get_v() + 1;
92 int* plre_indexj = lre_index.
get_v() + 1;
93 for (
int j=1;j<=us;j++)
95 int j2=list(*plre_indexj, 2);
96 *plocal_Hessij += locy(i2).u_bar[j2-1];
105 dvector* plocal_Duxi = &local_Dux(1);
106 plre_indexi = lre_index.
get_v() + 1;
107 for (
int i=1;i<=us;i++)
109 int i2=list(*plre_indexi, 2);
111 double* plocal_Duxij = plocal_Duxi->
get_v() + 1;
112 int* plfe_indexj = lfe_index.
get_v() + 1;
113 for (
int j=1;j<=xs;j++)
115 int j2=list(*plfe_indexj, 2);
116 *plocal_Duxij = locy(i2).u_bar[j2-1];
125 tmp=
solve(local_Hess,local_uadjoint)*local_Dux;
128 plfe_indexi = lfe_index.
get_v() + 1;
129 double* ptmpi = tmp.
get_v() + 1;
130 for (
int i=1;i<=xs;i++)
132 int ii = *plfe_indexi;
133 (*grad_x)(list(ii,1)) += *ptmpi;
146 funnel_init_var::num_active_parameters=0;
175 ivector lfe_index(1, (
int)funnel_init_var::num_active_parameters);
178 for (
int i=1;i<=(int)funnel_init_var::num_active_parameters;i++)
184 else if (list(i,1)>0)
191 double* plocal_xadjointj = local_xadjoint.
get_v() + 1;
192 int* plfe_indexj = lfe_index.
get_v() + 1;
193 for (
int j=1;j<=xs;j++)
195 int j2=list(*plfe_indexj, 2);
196 local_xadjoint(j)=ff.
u_dot[j2-1];
211 dvector* plocal_Hessi = &local_Hess(1);
212 int* plre_indexi = lre_index.
get_v() + 1;
213 for (
int i=1;i<=us;i++)
215 int i2 = list(*plre_indexi, 2);
217 double* plocal_Hessij = plocal_Hessi->
get_v() + 1;
218 int* plre_indexj = lre_index.
get_v() + 1;
219 for (
int j=1;j<=us;j++)
221 int j2=list(*plre_indexj, 2);
222 *plocal_Hessij += locy(i2).u_bar[j2-1];
232 plre_indexi = lre_index.
get_v() + 1;
233 double* plocal_uadjointi = local_uadjoint.
get_v() + 1;
234 for (
int i=1;i<=us;i++)
236 int i2=list(*plre_indexi, 2);
237 *plocal_uadjointi = ff.
u_dot[i2-1];
244 dvector* plocal_Duxi = &local_Dux(1);
245 plre_indexi = lre_index.
get_v() + 1;
246 for (
int i=1;i<=us;i++)
248 int i2=list(*plre_indexi,2);
250 int* plfe_indexj = lfe_index.
get_v() + 1;
251 double* plocal_Duxij = plocal_Duxi->
get_v() + 1;
252 for (
int j=1;j<=xs;j++)
254 int j2=list(*plfe_indexj, 2);
255 *plocal_Duxij = locy(i2).u_bar[j2-1];
274 plre_indexi = lre_index.
get_v() + 1;
275 for (
int i=1;i<=us;i++)
277 int i2=list(*plre_indexi, 2);
279 double* pHessadjointij = pHessadjointi->
get_v() + 1;
280 int* plre_indexj = lre_index.
get_v() + 1;
281 for (
int j=1;j<=us;j++)
283 int j2=list(*plre_indexj, 2);
284 locy(i2).get_u_bar_tilde()[j2-1] = *pHessadjointij;
302 int* plfe_indexi = lfe_index.
get_v() + 1;
303 double* pxtmpi = xtmp.
get_v() + 1;
304 double* plocal_xadjointi = local_xadjoint.
get_v() + 1;
305 for (
int i=1;i<=xs;i++)
307 int i2=list(*plfe_indexi, 2);
308 *pxtmpi += locy[i2].u_tilde[0];
309 *plocal_xadjointi += locy[i2].u_tilde[0];
319 int* plre_indexi = lre_index.
get_v() + 1;
320 double* putmpi = utmp.
get_v() + 1;
321 double* plocal_uadjointi = local_uadjoint.
get_v() + 1;
322 for (
int i=1;i<=us;i++)
324 int i2=list(*plre_indexi, 2);
325 *putmpi += locy[i2].u_tilde[0];
326 *plocal_uadjointi += locy[i2].u_tilde[0];
333 local_xadjoint -= local_uadjoint*
inv(local_Hess)*local_Dux;
336 int* plfe_indexi = lfe_index.
get_v() + 1;
337 double* plocal_xadjointi = local_xadjoint.
get_v() + 1;
338 for (
int i=1;i<=xs;i++)
340 int ii = *plfe_indexi;
342 xadjoint(list(ii,1)) += *plocal_xadjointi;
355 funnel_init_var::num_active_parameters=0;
371 double* pcyii = cy.
get_v() + 1;
372 const dvector* plocal_Hessi = &local_Hess(1);
373 for (
int i=1;i<=us;i++)
375 double* plocal_Hessij = plocal_Hessi->
get_v() + 1;
376 for (
int j=1;j<=us;j++)
378 *pcyii = *plocal_Hessij;
391 for (
int i=1;i<=us;i++)
393 for (
int j=1;j<=us;j++)
395 (*pvHessi)(j) = vy(ii++);
402 if (pmin->multinomial_weights==0)
404 vf+=0.5*
ln_det(vHess,sgn);
408 dvector &
w= *(pmin->multinomial_weights);
409 double w_i=w[separable_calls_counter];
411 vf+=w_i*(0.5*
ln_det(vHess,sgn)-0.5*d*
log(w_i));
412 vf-=w_i*d*.91893853320467241;
418 dmatrix hessadjoint(1,us,1,us);
420 dvector* phessadjointi = &hessadjoint(1);
421 double* pgii = g.
get_v() + 1;
422 for (
int i=1;i<=us;i++)
424 double* phessadjointij = phessadjointi->
get_v() + 1;
425 for (
int j=1;j<=us;j++)
427 *phessadjointij = *pgii;
void initialize(void)
Description not yet available.
df1b2_gradlist * f1b2gradlist
void set_dependent_variable(const df1b2variable &_x)
Description not yet available.
static void set_no_derivatives(void)
Description not yet available.
Description not yet available.
Vector of double precision numbers.
static int num_inactive_vars
void initialize(void)
Description not yet available.
Description not yet available.
void gradcalc(int nvar, const dvector &g)
ivector sgn(const dvector &v)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
void initialize(void)
Description not yet available.
dvector solve(const dmatrix &aa, const dvector &z)
Solve a linear system using LU decomposition.
Description not yet available.
Array of integers(int) with indexes from index_min to indexmax.
static unsigned int num_active_parameters
Description not yet available.
Description not yet available.
void initialize(void)
Initialze all elements of dvector to zero.
double ln_det(const dmatrix &m1, int &sgn)
Compute log determinant of a constant matrix.
Description not yet available.
Class definition of matrix with derivitive information .
void do_separable_stuff_x_u_block_diagonal(df1b2variable &ff)
Description not yet available.
dvector value(const df1_one_vector &v)
static unsigned int num_vars
static init_df1b2vector * py
void initialize(void)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
void do_separable_stuff_laplace_approximation_block_diagonal(df1b2variable &)
Calculates the Laplace approximation for a single separable function in the "block diagonal"...
void reset(void)
Description not yet available.
Fundamental data type for reverse mode automatic differentiation.
df1_one_variable inv(const df1_one_variable &x)
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
void df1b2_gradcalc1(void)
Description not yet available.
dmatrix get_gradient_for_hessian_calcs(const dmatrix &local_Hess, double &f)
Description not yet available.