Changeset 1030 for library/bdm/estim/arx.cpp
- Timestamp:
- 06/02/10 13:53:29 (14 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/estim/arx.cpp
r1025 r1030 299 299 int dimV = est._V().cols(); 300 300 int nparams = dimV - 1; // number of parameters 301 int nalternatives = pow(2, nparams); // number of alternatives 302 301 //kamil: int nalternatives = pow(2, nparams); // number of alternatives 302 int nalternatives = 1 << nparams; // number of alternatives 303 303 304 // Permutation matrix 304 305 mat perm_matrix = ones(nalternatives, nparams); 305 306 int i, j, period, idx_from, idx_to, start, end; 306 307 for(i = 0; i < nparams; i++) { 307 idx_from = pow(2, i); 308 idx_to = 2 * pow(2, i) - 1; 309 period = pow(2, i+1); 310 j = 0; 308 // kamil: idx_from = pow(2, i); 309 // kamil: idx_to = 2 * pow(2, i) - 1; 310 // kamil: period = pow(2, i+1); 311 // jp: what about this? 312 idx_from = 1 << i; 313 period = ( idx_from << 1 ); 314 idx_to = period - 1; 315 // end:jp 316 j = 0; 311 317 start = idx_from; 312 318 end = idx_to; 313 while(start < pow(2, nparams)) { 319 // kamil: while(start < pow(2, nparams)) { 320 while ( start < nalternatives ) { 314 321 perm_matrix.set_submatrix(start, end, i, i, 0); 315 322 j++; … … 337 344 } 338 345 339 nalternatives_cond = sum(vec_alt) + 1; 346 // kamil: nalternatives_cond = sum(vec_alt) + 1; 347 nalternatives_cond = (int) sum(vec_alt) + 1; 340 348 ivec vec_perm(0); // permutation vector 341 349