Show
Ignore:
Timestamp:
02/18/11 21:50:33 (13 years ago)
Author:
sindj
Message:

Oprava chyb pri vypoctech integralu - nedokonceno, ale blizim se. JS

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/robust/robustlib.h

    r1275 r1280  
    2121using namespace itpp; 
    2222 
    23 const double max_range = 1000.0;//numeric_limits<double>::max()/10e-10; 
     23const double max_range = 10.0;//numeric_limits<double>::max()/10e-10; 
    2424 
    2525enum actions {MERGE, SPLIT}; 
     
    435435        bool operator>(const my_ivec &second) const 
    436436        { 
     437                return max(*this)>max(second); 
     438                 
     439                /* 
    437440                int size1 = this->size(); 
    438                 int size2 = second.size(); 
     441                int size2 = second.size();               
    439442                  
    440443                int counter1 = 0; 
     
    481484 
    482485                        return false; 
    483                 } 
     486                }*/ 
    484487        } 
    485488 
     
    487490        bool operator==(const my_ivec &second) const 
    488491        { 
     492                return max(*this)==max(second); 
     493                 
     494                /* 
    489495                int size1 = this->size(); 
    490                 int size2 = second.size(); 
     496                int size2 = second.size();               
    491497                  
    492498                int counter = 0; 
     
    533539 
    534540                        return true; 
    535                 } 
     541                }*/ 
    536542        } 
    537543 
     
    796802        c_statistic statistic; 
    797803 
    798         vector<set<my_ivec>> correction_factors; 
     804        vector<multiset<my_ivec>> correction_factors; 
    799805 
    800806        int number_of_parameters; 
     
    11211127        void set_correction_factors(int order) 
    11221128                { 
    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++) 
    11301137                                {                                        
    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++)                                   { 
    11391140                                                 
    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 
    11411144                                                { 
    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                                                        }                                                        
    11431156                                                         
    1144                                                         current_template[0]+=1; 
    11451157                                                        current_template.ins(current_template.size(),i); 
    11461158 
     1159                                                        cout << "template:" << current_template << endl; 
    11471160                                                         
    1148                                                         if(current_template[0]==remaining_order) 
     1161                                                        if(current_template.size()==remaining_order+1) 
    11491162                                                        { 
    1150                                                                 final_factors.insert(current_template.right(current_template.size()-1)); 
     1163                                                                final_factors.insert(current_template); 
    11511164                                                        } 
    11521165                                                        else 
     
    11551168                                                        } 
    11561169                                                } 
     1170                                                while(fac_ref!=factor_templates.end()); 
    11571171                                        } 
    11581172                                }