Changeset 1280 for applications/robust/robustlib.h
- Timestamp:
- 02/18/11 21:50:33 (13 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/robust/robustlib.h
r1275 r1280 21 21 using namespace itpp; 22 22 23 const double max_range = 10 00.0;//numeric_limits<double>::max()/10e-10;23 const double max_range = 10.0;//numeric_limits<double>::max()/10e-10; 24 24 25 25 enum actions {MERGE, SPLIT}; … … 435 435 bool operator>(const my_ivec &second) const 436 436 { 437 return max(*this)>max(second); 438 439 /* 437 440 int size1 = this->size(); 438 int size2 = second.size(); 441 int size2 = second.size(); 439 442 440 443 int counter1 = 0; … … 481 484 482 485 return false; 483 } 486 }*/ 484 487 } 485 488 … … 487 490 bool operator==(const my_ivec &second) const 488 491 { 492 return max(*this)==max(second); 493 494 /* 489 495 int size1 = this->size(); 490 int size2 = second.size(); 496 int size2 = second.size(); 491 497 492 498 int counter = 0; … … 533 539 534 540 return true; 535 } 541 }*/ 536 542 } 537 543 … … 796 802 c_statistic statistic; 797 803 798 vector< set<my_ivec>> correction_factors;804 vector<multiset<my_ivec>> correction_factors; 799 805 800 806 int number_of_parameters; … … 1121 1127 void set_correction_factors(int order) 1122 1128 { 1123 for(int remaining_order = correction_factors.size();!(remaining_order>order);remaining_order++) 1124 { 1125 set<my_ivec> factor_templates; 1126 set<my_ivec> final_factors; 1127 1128 1129 for(int i = 1;i!=number_of_parameters-order+1;i++) 1129 for(int remaining_order = correction_factors.size();remaining_order<order;remaining_order++) 1130 { 1131 multiset<my_ivec> factor_templates; 1132 multiset<my_ivec> final_factors; 1133 1134 my_ivec orig_template = my_ivec(); 1135 1136 for(int i = 1;i<number_of_parameters-remaining_order+1;i++) 1130 1137 { 1131 my_ivec new_template = my_ivec(); 1132 new_template.ins(0,1); 1133 new_template.ins(1,i); 1134 factor_templates.insert(new_template); 1135 1136 1137 for(int j = 1;j<remaining_order;j++) 1138 { 1138 bool in_cycle = false; 1139 for(int j = 0;j<=remaining_order;j++) { 1139 1140 1140 for(set<my_ivec>::iterator fac_ref = factor_templates.begin();fac_ref!=factor_templates.end();fac_ref++) 1141 multiset<my_ivec>::iterator fac_ref = factor_templates.begin(); 1142 1143 do 1141 1144 { 1142 ivec current_template = (*fac_ref); 1145 my_ivec current_template; 1146 if(!in_cycle) 1147 { 1148 current_template = orig_template; 1149 in_cycle = true; 1150 } 1151 else 1152 { 1153 current_template = (*fac_ref); 1154 fac_ref++; 1155 } 1143 1156 1144 current_template[0]+=1;1145 1157 current_template.ins(current_template.size(),i); 1146 1158 1159 cout << "template:" << current_template << endl; 1147 1160 1148 if(current_template [0]==remaining_order)1161 if(current_template.size()==remaining_order+1) 1149 1162 { 1150 final_factors.insert(current_template .right(current_template.size()-1));1163 final_factors.insert(current_template); 1151 1164 } 1152 1165 else … … 1155 1168 } 1156 1169 } 1170 while(fac_ref!=factor_templates.end()); 1157 1171 } 1158 1172 }