Revision 1109 trunk/src/df1b2separable/df1b2im4.cpp
df1b2im4.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 = int(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>epsilon(is)(offset+1,offset+lus).shift(1); 
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++) 
...  ...  
189  189 
nepsvalue(*objective_function_value::pobjfun); 
190  190  
191  191 
sample_value(is)=*objective_function_value::pobjfun 
192 
neps;


192 
neps; 

193  193 
} 
194  194 
} 
195  195  
...  ...  
228  228 
//double ns=lcomp.indexmax()lcomp.indexmin()+1; 
229  229 
//double min_vf=min(value(lcomp)); 
230  230 
vf= sum(lcomp); 
231 
vf=us*0.91893853320467241; 

232 


233 


231 
vf=us*0.91893853320467241; 

232  
234  233 
int sgn=0; 
235  234 
dvariable ld=0.0; 
236  235 
if (ad_comm::no_ln_det_choleski_flag) 
...  ...  
261  260 
vy(xs+1,xs+us).shift(1)=u0; 
262  261 
initial_params::reset(vy); // get the values into the model 
263  262 
gradient_structure::set_YES_DERIVATIVES(); 
264 


265 


263  
266  264 
ii=1; 
Also available in: Unified diff