Changeset 1267 for applications/robust
- Timestamp:
- 12/21/10 18:28:55 (14 years ago)
- Location:
- applications/robust
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/robust/main.cpp
r1266 r1267 15 15 int main ( int argc, char* argv[] ) { 16 16 17 emlig* emlig1 = new emlig( 3);17 emlig* emlig1 = new emlig(4); 18 18 19 emlig1->set_correction_factors(3); 19 /* 20 emlig1->set_correction_factors(4); 21 22 for(int j = 0;j<emlig1->correction_factors.size();j++) 23 { 24 for(set<my_ivec>::iterator vec_ref = emlig1->correction_factors[j].begin();vec_ref!=emlig1->correction_factors[j].end();vec_ref++) 25 { 26 for(int i=0;i<(*vec_ref).size();i++) 27 { 28 cout << (*vec_ref)[i]; 29 } 30 31 cout << endl; 32 } 33 } 34 */ 20 35 21 36 //emlig1->step_me(0); -
applications/robust/robustlib.h
r1266 r1267 251 251 }; 252 252 253 253 254 class condition 254 255 { … … 265 266 }; 266 267 268 269 270 267 271 class c_statistic 268 272 { … … 410 414 } 411 415 }; 416 417 418 class my_ivec : public ivec 419 { 420 public: 421 my_ivec():ivec(){}; 422 423 my_ivec(ivec origin):ivec() 424 { 425 this->ins(0,origin); 426 } 427 428 bool operator>(const my_ivec &second) const 429 { 430 int size1 = this->size(); 431 int size2 = second.size(); 432 433 int counter1 = 0; 434 while(0==0) 435 { 436 if((*this)[counter1]==0) 437 { 438 size1--; 439 } 440 441 if((*this)[counter1]!=0) 442 break; 443 444 counter1++; 445 } 446 447 int counter2 = 0; 448 while(0==0) 449 { 450 if(second[counter2]==0) 451 { 452 size2--; 453 } 454 455 if(second[counter2]!=0) 456 break; 457 458 counter2++; 459 } 460 461 if(size1!=size2) 462 { 463 return size1>size2; 464 } 465 else 466 { 467 for(int i = 0;i<size1;i++) 468 { 469 if((*this)[counter1+i]!=second[counter2+i]) 470 { 471 return (*this)[counter1+i]>second[counter2+i]; 472 } 473 } 474 475 return false; 476 } 477 } 478 479 480 bool operator==(const my_ivec &second) const 481 { 482 int size1 = this->size(); 483 int size2 = second.size(); 484 485 int counter = 0; 486 while(0==0) 487 { 488 if((*this)[counter]==0) 489 { 490 size1--; 491 } 492 493 if((*this)[counter]!=0) 494 break; 495 496 counter++; 497 } 498 499 counter = 0; 500 while(0==0) 501 { 502 if(second[counter]==0) 503 { 504 size2--; 505 } 506 507 if(second[counter]!=0) 508 break; 509 510 counter++; 511 } 512 513 if(size1!=size2) 514 { 515 return false; 516 } 517 else 518 { 519 for(int i=0;i<size1;i++) 520 { 521 if((*this)[size()-1-i]!=second[second.size()-1-i]) 522 { 523 return false; 524 } 525 } 526 527 return true; 528 } 529 } 530 531 bool operator<(const my_ivec &second) const 532 { 533 return !(((*this)>second)||((*this)==second)); 534 } 535 536 bool operator!=(const my_ivec &second) const 537 { 538 return !((*this)==second); 539 } 540 541 bool operator<=(const my_ivec &second) const 542 { 543 return !((*this)>second); 544 } 545 546 bool operator>=(const my_ivec &second) const 547 { 548 return !((*this)<second); 549 } 550 551 my_ivec right(my_ivec original) 552 { 553 554 } 555 }; 556 412 557 413 558 … … 628 773 public: 629 774 630 vector<set< ivec>> correction_factors;775 vector<set<my_ivec>> correction_factors; 631 776 632 777 int number_of_parameters; … … 929 1074 void set_correction_factors(int order) 930 1075 { 931 for(int remaining_order = correction_factors.size(); remaining_order>order;remaining_order++)932 { 933 set< ivec> factor_templates;934 set< ivec> final_factors;1076 for(int remaining_order = correction_factors.size();!(remaining_order>order);remaining_order++) 1077 { 1078 set<my_ivec> factor_templates; 1079 set<my_ivec> final_factors; 935 1080 936 1081 937 for(int i = 1;i ==number_of_parameters-order+1;i++)1082 for(int i = 1;i!=number_of_parameters-order+1;i++) 938 1083 { 939 ivec new_template = vec_2(1,i);940 //new_template[0]=1;941 //new_template[1]=i;942 //factor_templates.insert(new_template);1084 my_ivec new_template = my_ivec(); 1085 new_template.ins(0,1); 1086 new_template.ins(1,i); 1087 factor_templates.insert(new_template); 943 1088 944 1089 945 for(int j = 1;j ==remaining_order-1;j++)1090 for(int j = 1;j<remaining_order;j++) 946 1091 { 947 1092 948 for(set< ivec>::iterator fac_ref = factor_templates.begin();fac_ref!=factor_templates.end();fac_ref++)1093 for(set<my_ivec>::iterator fac_ref = factor_templates.begin();fac_ref!=factor_templates.end();fac_ref++) 949 1094 { 950 1095 ivec current_template = (*fac_ref); … … 1286 1431 };*/ 1287 1432 1288 bool ivec::operator>(const ivec &first, const ivec &second) 1289 { 1290 int size1 = first.size(); 1291 int size2 = second.size(); 1292 1293 int counter1 = 0; 1294 while(0==0) 1295 { 1296 if(first[counter1]==0) 1297 { 1298 size1--; 1299 } 1300 1301 if(first[counter1]!=0) 1302 break; 1303 } 1304 1305 int counter2 = 0; 1306 while(0==0) 1307 { 1308 if(second[counter2]==0) 1309 { 1310 size2--; 1311 } 1312 1313 if(second[counter2]!=0) 1314 break; 1315 } 1316 1317 if(size1!=size2) 1318 { 1319 return size1>size2; 1320 } 1321 else 1322 { 1323 for(int i = 0;i<size1;i++) 1324 { 1325 if(first[counter1+i]!=second[counter2+i]) 1326 { 1327 return first[counter1+i]>second[counter2+i] 1328 } 1329 } 1330 1331 return false; 1332 } 1333 } 1433 1434 1435 1436 1437 1438 1334 1439 1335 1440