Revision 1109 trunk/src/df1b2separable/df1b2lp1.cpp
df1b2lp1.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 
...  ...  
22  22 
double calculate_laplace_approximation(const dvector& x,const dvector& u0, 
23  23 
const dmatrix& Hess,const dvector& _xadjoint,const dvector& _uadjoint, 
24  24 
const dmatrix& _Hessadjoint,function_minimizer * pmin); 
25 


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


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


33  
34  34 
dmatrix choleski_decomp_positive(const dmatrix& M,double b); 
35  35  
36  36 
/** 
...  ...  
45  45 
ADUNCONST(double,f) 
46  46 
int i,j; 
47  47  
48 
initial_params::set_inactive_only_random_effects();


48 
initial_params::set_inactive_only_random_effects(); 

49  49 
gradient_structure::set_NO_DERIVATIVES(); 
50  50 
initial_params::reset(x); // get current x values into the model 
51  51 
gradient_structure::set_YES_DERIVATIVES(); 
52  52  
53 
initial_params::set_active_only_random_effects();


53 
initial_params::set_active_only_random_effects(); 

54  54 
//int lmn_flag=0; 
55  55 
if (ad_comm::time_flag) 
56  56 
{ 
...  ...  
62  62 
{ 
63  63 
ad_comm::ptm>get_elapsed_time_and_reset(); 
64  64 
} 
65 
}


65 
} 

66  66 
if (ad_comm::time_flag) 
67  67 
{ 
68  68 
if (ad_comm::ptm) 
...  ...  
75  75 
} 
76  76 
} 
77  77 
} 
78 


78  
79  79 
double maxg=1.e+200; 
80  80 
//double maxg_save; 
81  81 
dvector uhat_old(1,usize); 
...  ...  
97  97 
{ 
98  98 
uhat=get_uhat_lm_newton(x,pfmin); 
99  99 
} 
100 


100  
101  101 
if (ad_comm::time_flag) 
102  102 
{ 
103  103 
if (ad_comm::ptm) 
...  ...  
120  120 
{ 
121  121 
y(i+xsize)=uhat(i); 
122  122 
} 
123 


123  
124  124 
int ierr=0; 
125  125 
int niters=0; 
126  126 
if (function_minimizer::first_hessian_flag) 
...  ...  
144  144 
used_flags.safe_allocate(1,nv); 
145  145 
} 
146  146 
} 
147 


147  
148  148 
for(int ii=1;ii<=niters;ii++) 
149 
{


149 
{ 

150  150 
if (quadratic_prior::get_num_quadratic_prior()>0) 
151  151 
{ 
152  152 
check_pool_size(); 
153  153 
} 
154 
{


154 
{ 

155  155 
// test newton raphson 
156  156 
Hess.initialize(); 
157  157 
cout << "Newton raphson " << ii << endl; 
Also available in: Unified diff