Revision 1109 trunk/src/df1b2separable/df1b2impspf.cpp
df1b2impspf.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 
...  ...  
44  44 
nvar=x.size()+u0.size()+sz; 
45  45 
independent_variables y(1,nvar); 
46  46  
47 


48  47 
// need to set random effects active together with whatever 
49  48 
// init parameters should be active in this phase 
50 
initial_params::set_inactive_only_random_effects();


51 
initial_params::set_active_random_effects();


52 
int onvar=initial_params::nvarcalc();


49 
initial_params::set_inactive_only_random_effects(); 

50 
initial_params::set_active_random_effects(); 

51 
int onvar=initial_params::nvarcalc(); 

53  52 
initial_params::xinit(y); // get the initial values into the 
54  53 
// do we need this next line? 
55  54 
y(1,xs)=x; 
...  ...  
70  69 
for (i=smin;i<=smax;i++) 
71  70 
y(ii++)=lst(i); 
72  71  
73 
dvar_vector vy=dvar_vector(y);


72 
dvar_vector vy=dvar_vector(y); 

74  73 
initial_params::stddev_vscale(d,vy); 
75  74  
76  75  
...  ...  
87  86 
dcompressed_triplet & lst = *(pmin>lapprox>sparse_triplet2); 
88  87 
int mmin=lst.indexmin(); 
89  88 
int mmax=lst.indexmax(); 
90 
dvar_compressed_triplet * vsparse_triplet =


89 
dvar_compressed_triplet * vsparse_triplet = 

91  90 
pmin>lapprox>vsparse_triplet; 
92 


91  
93  92 
if (vsparse_triplet==0) 
94  93 
{ 
95  94 
pmin>lapprox>vsparse_triplet= 
...  ...  
111  110 
(*vsparse_triplet)(1,i)=lst(1,i); 
112  111 
(*vsparse_triplet)(2,i)=lst(2,i); 
113  112 
} 
114 
}


113 
} 

115  114 
} 
116 
dcompressed_triplet * vsparse_triplet_adjoint =


115 
dcompressed_triplet * vsparse_triplet_adjoint = 

117  116 
pmin>lapprox>vsparse_triplet_adjoint; 
118 


117  
119  118 
if (vsparse_triplet_adjoint==0) 
120  119 
{ 
121  120 
pmin>lapprox>vsparse_triplet_adjoint= 
...  ...  
137  136 
(*vsparse_triplet_adjoint)(1,i)=lst(1,i); 
138  137 
(*vsparse_triplet_adjoint)(2,i)=lst(2,i); 
139  138 
} 
140 
}


139 
} 

141  140 
} 
142  141 
vsparse_triplet>get_x()=vy(ii,ii+mmaxmmin).shift(1); 
143  142  
...  ...  
148  147 
sample_value.initialize(); 
149  148 
//dvar_matrix ch=choleski_decomp(inv(vHess)); 
150  149  
151 
dvar_compressed_triplet * vsparse_triplet


150 
dvar_compressed_triplet * vsparse_triplet 

152  151 
= pmin>lapprox>vsparse_triplet; 
153  152  
154  153 
dvar_hs_smatrix * dhs= return_choleski_decomp(*vsparse_triplet); 
...  ...  
168  167 
//dvar_vector tau=ch*pmin>lapprox>epsilon(is); 
169  168 
dvar_vector tau=return_choleski_factor_solve(dhs, 
170  169 
pmin>lapprox>epsilon(is)); 
171 


170  
172  171 
vy(xs+1,xs+us).shift(1)+=tau; 
173  172 
initial_params::reset(vy); // get the values into the model 
174  173 
vy(xs+1,xs+us).shift(1)=tau; 
175 


174  
176  175 
*objective_function_value::pobjfun=0.0; 
177  176 
pmin>AD_uf_outer(); 
178 


177  
179  178 
/* 
180  179 
if (pmin>lapprox>istudent_flag==0) 
181  180 
*/ 
Also available in: Unified diff