Revision 1109 trunk/src/df1b2separable/df1b2im5.cpp
df1b2im5.cpp (revision 1109)  

2  2 
* $Id$ 
3  3 
* 
4  4 
* Author: David Fournier 
5 
* Copyright (c) 20082012 Regents of the University of California


5 
* Copyright (c) 20082012 Regents of the University of California 

6  6 
*/ 
7  7 
/** 
8  8 
* \file 
...  ...  
35  35 
int hroom = sum(square(lrea)); 
36  36 
int nvar=x.size()+u0.size()+hroom; 
37  37 
independent_variables y(1,nvar); 
38 


38  
39  39 
// need to set random effects active together with whatever 
40  40 
// init parameters should be active in this phase 
41 
initial_params::set_inactive_only_random_effects();


42 
initial_params::set_active_random_effects();


43 
/*int onvar=*/initial_params::nvarcalc();


41 
initial_params::set_inactive_only_random_effects(); 

42 
initial_params::set_active_random_effects(); 

43 
/*int onvar=*/initial_params::nvarcalc(); 

44  44 
initial_params::xinit(y); // get the initial values into the 
45  45 
// do we need this next line? 
46  46 
y(1,xs)=x; 
...  ...  
55  55 
quadratic_prior::get_cHessian_contribution(Hess,vxs); 
56  56 
} 
57  57 
// Here need hooks for sparse matrix structures 
58 


58  
59  59 
dvar3_array & block_diagonal_vhessian= 
60  60 
*pmin>lapprox>block_diagonal_vhessian; 
61  61 
block_diagonal_vhessian.initialize(); 
...  ...  
76  76 
dvector g(1,nvar); 
77  77 
gradcalc(0,g); 
78  78 
gradient_structure::set_YES_DERIVATIVES(); 
79 
dvar_vector vy=dvar_vector(y);


79 
dvar_vector vy=dvar_vector(y); 

80  80 
//initial_params::stddev_vscale(d,vy); 
81  81 
ii=xs+us+1; 
82  82 
if (initial_df1b2params::have_bounded_random_effects) 
...  ...  
106  106 
int nsamp=pmin>lapprox>num_importance_samples; 
107  107  
108  108 
dvariable vf=0.0; 
109 


109  
110  110 
dvar_vector sample_value(1,nsamp); 
111  111 
sample_value.initialize(); 
112  112  
...  ...  
124  124 
(*pmin>lapprox>antiepsilon)(is); 
125  125 
offset+=lus; 
126  126 
} 
127 


127  
128  128 
// have to reorder the terms to match the block diagonal hessian 
129  129 
imatrix & ls=*(pmin>lapprox>block_diagonal_re_list); 
130  130 
int mmin=ls.indexmin(); 
131  131 
int mmax=ls.indexmax(); 
132 


132  
133  133 
int ii=1; 
134  134 
int i; 
135  135 
for (i=mmin;i<=mmax;i++) 
...  ...  
191  191 
nepsvalue(*objective_function_value::pobjfun); 
192  192  
193  193 
sample_value(is)=*objective_function_value::pobjfun 
194 
neps;


194 
neps; 

195  195 
} 
196  196 
} 
197  197  
...  ...  
233  233 
//double ns=lcomp.indexmax()lcomp.indexmin()+1; 
234  234 
//double min_vf=min(value(lcomp)); 
235  235 
vf= sum(lcomp); 
236 
vf=us*0.91893853320467241; 

237 


238 


236 
vf=us*0.91893853320467241; 

237  
239  238 
int sgn=0; 
240  239 
dvariable ld=0.0; 
241  240 
if (ad_comm::no_ln_det_choleski_flag) 
...  ...  
265  264 
vy(xs+1,xs+us).shift(1)=u0; 
266  265 
initial_params::reset(vy); // get the values into the model 
267  266 
gradient_structure::set_YES_DERIVATIVES(); 
268 


269 


267  
270  268 
ii=1; 
Also available in: Unified diff