Revision 1935 trunk/src/nh99/mod_mc2.cpp
mod_mc2.cpp (revision 1935)  

4  4 
* Author: David Fournier 
5  5 
* Copyright (c) 20082012 Regents of the University of California 
6  6 
*/ 
7 
#if defined(USE_LAPLACE) 

8  7 
# include <df1b2fun.h> 
9  8 
# include <adrndeff.h> 
10 
#endif 

11  9 
#include <admodel.h> 
12  10  
13  11 
double better_rand(long int&); 
...  ...  
17  15 
{ 
18  16 
//initial_params::xinit(x); 
19  17 
double f=0.0; 
20 
#if defined(USE_LAPLACE) 

21  18 
if (mcmc2_flag==0 && lapprox) 
22  19 
{ 
23  20 
dvector g=(*lapprox)(x,f,this); 
24  21 
} 
25  22 
else 
26  23 
{ 
27 
#endif 

28  24 
dvariable vf=0.0; 
29  25 
vf=initial_params::reset(dvar_vector(x)); 
30  26 
*objective_function_value::pobjfun=0.0; 
31  27 
userfunction(); 
32  28 
vf+=*objective_function_value::pobjfun; 
33  29 
f=value(vf); 
34 
#if defined(USE_LAPLACE) 

35  30 
} 
36 
#endif 

37  31 
return f; 
38  32 
} 
39  33  
...  ...  
85  79 
{ 
86  80 
//initial_params::xinit(x); 
87  81 
double f=0.0; 
88 
#if defined(USE_LAPLACE) 

89  82 
if (mcmc2_flag==0 && lapprox) 
90  83 
{ 
91  84 
g=(*lapprox)(x,f,this); 
92  85 
} 
93  86 
else 
94  87 
{ 
95 
#endif 

96  88 
dvariable vf=0.0; 
97  89 
vf=initial_params::reset(dvar_vector(x)); 
98  90 
*objective_function_value::pobjfun=0.0; 
...  ...  
100  92 
vf+=*objective_function_value::pobjfun; 
101  93 
f=value(vf); 
102  94 
gradcalc(nvar,g); 
103 
#if defined(USE_LAPLACE) 

104  95 
} 
105 
#endif 

106  96 
return f; 
107  97 
} 
Also available in: Unified diff