Revision 1110 trunk/src/df1b2separable/df1b2chkder.cpp
df1b2chkder.cpp (revision 1110)  

20  20 
double calculate_laplace_approximation(const dvector& x,const dvector& u0, 
21  21 
const dmatrix& Hess,const dvector& _xadjoint,const dvector& _uadjoint, 
22  22 
const dmatrix& _Hessadjoint,function_minimizer * pmin); 
23 


23  
24  24 
double calculate_importance_sample(const dvector& x,const dvector& u0, 
25  25 
const dmatrix& Hess,const dvector& _xadjoint,const dvector& _uadjoint, 
26  26 
const dmatrix& _Hessadjoint,function_minimizer * pmin); 
27 


27  
28  28 
double calculate_importance_sample_funnel(const dvector& x,const dvector& u0, 
29  29 
const dmatrix& Hess,const dvector& _xadjoint,const dvector& _uadjoint, 
30  30 
const dmatrix& _Hessadjoint,function_minimizer * pmin); 
31 


31  
32  32 
dmatrix choleski_decomp_positive(const dmatrix& M,double b); 
33  33  
34  34 
/** 
...  ...  
54  54 
ADUNCONST(dvector,x) 
55  55 
int i,j; 
56  56  
57 
initial_params::set_inactive_only_random_effects();


57 
initial_params::set_inactive_only_random_effects(); 

58  58 
gradient_structure::set_NO_DERIVATIVES(); 
59  59 
initial_params::reset(x); // get current x values into the model 
60  60  
...  ...  
64  64  
65  65 
gradient_structure::set_YES_DERIVATIVES(); 
66  66  
67 
initial_params::set_active_only_random_effects();


67 
initial_params::set_active_only_random_effects(); 

68  68 
initial_params::xinit(uhat); // get current x values into the model 
69  69 
//int lmn_flag=0; 
70  70 
if (ad_comm::time_flag) 
...  ...  
77  77 
{ 
78  78 
ad_comm::ptm>get_elapsed_time_and_reset(); 
79  79 
} 
80 
}


80 
} 

81  81 
if (ad_comm::time_flag) 
82  82 
{ 
83  83 
if (ad_comm::ptm) 
...  ...  
90  90 
} 
91  91 
} 
92  92 
} 
93 


93  
94  94 
double maxg; 
95  95 
//double maxg_save; 
96  96 
dvector uhat_old(1,usize); 
...  ...  
104  104 
{ 
105  105 
y(i+xsize)=uhat(i); 
106  106 
} 
107 


107  
108  108 
int ierr=0; 
109  109 
int niters=0; 
110  110 
if (function_minimizer::first_hessian_flag) 
...  ...  
128  128 
used_flags.safe_allocate(1,nv); 
129  129 
} 
130  130 
} 
131 


131  
132  132 
for(int ii=1;ii<=niters;ii++) 
133 
{


133 
{ 

134  134 
if (quadratic_prior::get_num_quadratic_prior()>0) 
135  135 
{ 
136  136 
check_pool_size(); 
137  137 
} 
138 
{


138 
{ 

139  139 
// test newton raphson 
140  140 
Hess.initialize(); 
141  141 
cout << "Checking derivatives " << ii << endl; 
...  ...  
143  143  
144  144 
if (quadratic_prior::get_num_quadratic_prior()>0) 
145  145 
{ 
146 
laplace_approximation_calculator::where_are_we_flag=2;


146 
laplace_approximation_calculator::where_are_we_flag=2; 

147  147 
/*double maxg=*/fabs(evaluate_function_quiet(uhat,pfmin)); 
148 
laplace_approximation_calculator::where_are_we_flag=0;


148 
laplace_approximation_calculator::where_are_we_flag=0; 

149  149 
quadratic_prior::get_cHessian_contribution(Hess,xsize); 
150  150 
quadratic_prior::get_cgradient_contribution(grad,xsize); 
151  151 
} 
...  ...  
155  155 
/*double diff= */fabs(re_objective_function_value::fun_without_pen 
156  156 
objective_function_value::fun_without_pen); 
Also available in: Unified diff