Revision 1107 trunk/src/df1b2separable/mod_rhes.cpp
mod_rhes.cpp (revision 1107)  

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 minsave=M.indexmin(); 
35  35 
M.shift(1); 
36  36 
int n=M.indexmax(); 
37 


37  
38  38 
int bw=M.bandwidth(); 
39  39 
banded_lower_triangular_dmatrix L(1,n,bw); 
40  40 
#ifndef SAFE_INITIALIZE 
...  ...  
144  144 
gradient_structure::set_YES_DERIVATIVES(); 
145  145 
gbest.fill_seqadd(1.e+50,0.); 
146  146  
147 


148  147 
dvector ddd(1,nvar); 
149  148 
gradcalc(0,ddd); 
150  149 
adstring tmpstring; 
...  ...  
157  156 
} 
158  157 
// modify so thaqt we have l_uu and dux for delta method 
159  158 
// DF feb 15 05 
160 
//if (lapprox>hesstype==2  lapprox>hesstype==3)


161 
if (lapprox>hesstype==2 )


159 
//if (lapprox>hesstype==2  lapprox>hesstype==3) 

160 
if (lapprox>hesstype==2 ) 

162  161 
{ 
163  162 
if (lapprox>block_diagonal_hessian) 
164  163 
{ 
...  ...  
183  182 
{ 
184  183 
//if (ii<=u.indexmax()) 
185  184 
{ 
186 
ofs << setprecision(5) << setscientific()


185 
ofs << setprecision(5) << setscientific() 

187  186 
<< setw(14) << u(ii++) << " " << d(j) << endl;; 
188  187 
} 
189  188 
} 
...  ...  
205  204 
dvector e(mmin,mmax); 
206  205 
//choleski_decomp(*lapprox>bHess); 
207  206 
int ierr; 
208 


207  
209  208 
banded_lower_triangular_dmatrix tmp=choleski_decomp(*lapprox>bHess, 
210  209 
ierr); 
211  210 
e.initialize(); 
...  ...  
214  213 
e(i)=1.0; 
215  214 
dvector v=solve(tmp,e); 
216  215 
e(i)=0; 
217 


216  
218  217 
double d=sqrt(v*v); 
219 
ofs << setprecision(5) << setscientific()


218 
ofs << setprecision(5) << setscientific() 

220  219 
<< setw(14) << u(i) << " " << d << endl;; 
221  220 
} 
222  221 
} 
...  ...  
242  241 
int mmax=m.indexmax(); 
243  242 
for (i=mmin;i<=mmax;i++) 
244  243 
{ 
245 
ofs << setprecision(5) << setscientific()


244 
ofs << setprecision(5) << setscientific() 

246  245 
<< setw(14) << u(i) << " " << sqrt(m(i,i)) << endl;; 
247  246 
} 
248  247 
// save l_uu and l_xu for covariance calculations 
...  ...  
277  276 
if (i>1) e(i1)=0; 
278  277 
e(i)=1; 
279  278 
dvector w=solve_trans(C,solve(C,e)); 
280 
ofs << setprecision(5) << setscientific()


279 
ofs << setprecision(5) << setscientific() 

281  280 
<< setw(14) << u(i) << " " << sqrt(w(i)) << endl;; 
282  281 
ofs1 << w; 
283  282 
} 
...  ...  
319  318 
cerr << "Usage hpts option needs nonnegative integer  ignored" << endl; 
320  319 
} 
321  320 
else 
322 
{


321 
{ 

323  322 
npts=atoi(ad_comm::argv[on+1]); 
324  323 
} 
325  324 
} 
...  ...  
333  332 
cerr << "Usage hsize option needs number  ignored" << endl; 
334  333 
} 
Also available in: Unified diff