Revision 1109 trunk/src/df1b2separable/df1b2lp2.cpp
df1b2lp2.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 
...  ...  
34  34 
//int i,j; 
35  35 
int i; 
36  36  
37 
initial_params::set_inactive_only_random_effects();


37 
initial_params::set_inactive_only_random_effects(); 

38  38 
gradient_structure::set_NO_DERIVATIVES(); 
39  39 
initial_params::reset(x); // get current x values into the model 
40  40 
gradient_structure::set_YES_DERIVATIVES(); 
41  41  
42 
initial_params::set_active_only_random_effects();


42 
initial_params::set_active_only_random_effects(); 

43  43 
//int lmn_flag=0; 
44  44 
if (!inner_lmnflag) 
45  45 
{ 
...  ...  
81  81 
if (sparse_hessian_flag==0) 
82  82 
{ 
83  83 
for (i=1;i<=xsize;i++) 
84 
{


84 
{ 

85  85 
y(i)=x(i); 
86  86 
} 
87  87 
for (int i=1;i<=usize;i++) 
...  ...  
89  89 
y(i+xsize)=uhat(i); 
90  90 
} 
91  91 
} 
92 
else


92 
else 

93  93 
{ 
94  94 
for (i=1;i<=xsize;i++) 
95 
{


95 
{ 

96  96 
value(y(i))=x(i); 
97  97 
} 
98  98 
for (int i=1;i<=usize;i++) 
...  ...  
100  100 
value(y(i+xsize))=uhat(i); 
101  101 
} 
102  102 
} 
103 
//cout << y << endl; 

104 


103  
105  104 
for(int ii=1;ii<=num_nr_iters;ii++) 
106 
{


107 
{


105 
{ 

106 
{ 

108  107 
// test newton raphson 
109  108 
//Hess.initialize(); 
110  109 
int check=initial_params::stddev_scale(scale,uhat); 
...  ...  
112  111 
max_separable_g=0.0; 
113  112 
pmin>inner_opt_flag=1; 
114  113 
step=get_newton_raphson_info_block_diagonal(pfmin); 
115 
cout << "max separable g " << max_separable_g << endl;


114 
cout << "max separable g " << max_separable_g << endl; 

116  115 
cout << "Newton raphson " << ii << endl; 
117  116 
uhat+=step; 
118 


117  
119  118 
evaluate_function(uhat,pfmin); 
120  119 
pmin>inner_opt_flag=0; 
121  120 
} 
122 


121  
123  122 
if (sparse_hessian_flag==0) 
124  123 
{ 
125  124 
for (int i=1;i<=usize;i++) 
...  ...  
127  126 
y(i+xsize)=uhat(i); 
128  127 
} 
129  128 
} 
130 
else


129 
else 

131  130 
{ 
132  131 
for (int i=1;i<=usize;i++) 
133  132 
{ 
...  ...  
135  134 
} 
136  135 
} 
137  136 
} 
138 


137  
139  138 
cout << initial_df1b2params::cobjfun << endl; 
140  139 
xadjoint.initialize(); 
141  140 
uadjoint.initialize(); 
Also available in: Unified diff