Revision 760 branches/threaded2/tests/threaded_hessian_routine/function_minimizerhess_routine_threaded.cpp
function_minimizerhess_routine_threaded.cpp (revision 760)  

19  19  
20  20 
void function_minimizer::hess_routine_threaded(void) 
21  21 
{ 
22 
const double delta = 1.e5; 

23 
const double eps = 0.1; 

22  24  
23 
int nvar=initial_params::nvarcalc(); // get the number of active parameters 

24 
//if (adjm_ptr) set_labels_for_hess(nvar); 

25 
independent_variables x(1,nvar); 

26 
initial_params::xinit(x); // get the initial values into the x vector 

27 
double f; 

28 
double delta=1.e5; 

29 
dvector g1(1,nvar); 

30 
dvector g2(1,nvar); 

31 
dvector gbest(1,nvar); 

32 
dvector hess(1,nvar); 

33 
dvector hess1(1,nvar); 

34 
dvector hess2(1,nvar); 

35 
double eps=.1; 

36  25 
gradient_structure::set_YES_DERIVATIVES(); 
37 
gbest.fill_seqadd(1.e+50,0.); 

38  
26 
const int nvar = initial_params::nvarcalc(); 

39  27 
/* 
40  28 
adstring tmpstring="admodel.hesthreaded"; 
41  29 
if (ad_comm::wd_flag) 
...  ...  
44  32  
45  33 
ofs << nvar; 
46  34 
*/ 
47 
dvariable vf; 

35 
independent_variables x(1,nvar); 

36 
initial_params::xinit(x); 

37  
38 
dvariable vf = initial_params::reset(dvar_vector(x)); 

39 
*objective_function_value::pobjfun = 0.0; 

40 
pre_userfunction(); 

41 
vf += *objective_function_value::pobjfun; 

42 
double f = value(vf); 

43 
dvector g1(1,nvar); 

44 
gradcalc(nvar, g1); 

45 
cout << "kdjfkdj" << g1 << endl; 

48  46 
if (true) return; 
49 
{ 

50 
{ 

51 
dvariable vf=0.0; 

52 
if (true) return; 

53 
vf=initial_params::reset(dvar_vector(x)); 

54 
*objective_function_value::pobjfun=0.0; 

55 
pre_userfunction(); 

56 
vf+=*objective_function_value::pobjfun; 

57 
f=value(vf); 

58 
gradcalc(nvar,g1); 

59 
} 

47 
/* 

48 
dvector g2(1,nvar); 

49 
dvector hess(1,nvar); 

50 
dvector hess1(1,nvar); 

51 
dvector hess2(1,nvar); 

60  52 
double sdelta1; 
61  53 
double sdelta2; 
62  54 
for (int i=1;i<=nvar;i++) 
...  ...  
124  116 
hess2=(g1g2)/(sdelta1sdelta2); 
125  117 
hess=(eps2*hess1hess2) /(eps21.); 
126  118  
127 
/* 

128 
ofs << hess; 

129 
//if (adjm_ptr) ad_update_hess_stats_report(nvar,i); 

130 
*/ 

119 
//ofs << hess; 

131  120 
} 
132  121 
} 
133 
/* 

134  122 
ofs << gradient_structure::Hybrid_bounded_flag; 
135  123 
dvector tscale(1,nvar); // need to get scale from somewhere 
136  124 
initial_params::stddev_scale(tscale,x); 
Also available in: Unified diff