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.cpp

    r1276 r1280  
    3535                // cout << ((toprow*)this)->condition << endl; 
    3636                 
    37                 int condition_order = ((toprow*)this)->condition_order+1; // -2 by bylo, pokud chceme uniformni apriorno 
     37                int condition_order = ((toprow*)this)->condition_order-2; // -2 by bylo, pokud chceme uniformni apriorno 
     38 
     39                int sigma_order = condition_order-my_emlig->number_of_parameters; 
    3840 
    3941                // cout << "C:" << condition_order << "  N:" << my_emlig->number_of_parameters << "  C+N:" << condition_order-my_emlig->number_of_parameters << endl; 
    4042                // pause(0.1); 
    4143 
    42                 if(condition_order-my_emlig->number_of_parameters > 0) 
     44                if(sigma_order >= 0) 
    4345                { 
    4446 
    4547                        cout << endl; 
    4648                        cout << ((toprow*)this)->condition << endl; 
    47                         cout << "C:" << condition_order << "  N:" << my_emlig->number_of_parameters << "  C+N:" << condition_order-my_emlig->number_of_parameters << endl; 
     49                        cout << "C:" << condition_order+2 << "  N:" << my_emlig->number_of_parameters << "  C+N:" << condition_order-my_emlig->number_of_parameters+2 << endl; 
    4850 
    4951                        emlig* current_emlig; 
     
    111113                                                } 
    112114                                                 
    113                                                 // cout << "Absolute coords:(V"  << row_count << ")" << (*vert_ref)->get_coordinates() << endl; 
    114                                                 cout << "Relative coords:(V"  << row_count << ")" << relative_coords << endl; 
     115                                                cout << "Absolute coords:(V"  << row_count << ")" << (*vert_ref)->get_coordinates() << endl; 
     116                                                //cout << "Relative coords:(V"  << row_count << ")" << relative_coords << endl; 
    115117 
    116118                                                pair<map<double,int>::iterator,bool> returned = as.insert(pair<double,int>(new_a,1)); 
     
    147149                                int as1_order = (*as_ref).second; 
    148150                                 
    149                                 correction_term /= -pow((*as_ref).first,as1_order);                                      
     151                                correction_term /= pow(-(*as_ref).first,as1_order);                                      
    150152                                 
    151153                                current_emlig->set_correction_factors(as1_order); 
     
    174176                                        } 
    175177                                         
    176                                 }                                        
    177  
    178                                 double bracket = fact(condition_order-my_emlig->number_of_parameters)/fact(as1_order-1)/pow(a_0-(*as_ref).first,condition_order-my_emlig->number_of_parameters+2); 
     178                                }        
     179 
     180                                 
     181 
     182                                double bracket = fact(sigma_order)/fact(as1_order-1)/pow(a_0-(*as_ref).first,sigma_order+2); 
    179183                                for(int k = 0;k < as1_order-1;k++) 
    180184                                { 
    181                                         double bracket_factor = pow((double)-1,k+1)*fact(condition_order-my_emlig->number_of_parameters-k)/fact(as1_order-1-k)/pow(a_0-(*as_ref).first,condition_order-my_emlig->number_of_parameters+1-k); 
    182                                          
    183                                         // TODO TADY NEKDE JE CHYBA, NEDOJDE KE SPRAVNEMU NAPLNENI CORRECTION FAKTORU!!! 
    184                                         for(set<my_ivec>::iterator combi_ref = this->my_emlig->correction_factors[k].begin();combi_ref!=this->my_emlig->correction_factors[k].end();combi_ref++) 
     185                                        double bracket_factor = pow((double)-1,k+1)*fact(sigma_order-k)/fact(as1_order-1-k)/pow(a_0-(*as_ref).first,sigma_order+2-k); 
     186                                         
     187                                        ivec control_vec = ivec(); 
     188                                        control_vec.ins(0,my_emlig->number_of_parameters-as1_order+1);           
     189                                         
     190                                         
     191                                        for(multiset<my_ivec>::iterator combi_ref = this->my_emlig->correction_factors[k].begin();combi_ref!=this->my_emlig->correction_factors[k].upper_bound(my_ivec(control_vec));combi_ref++) 
    185192                                        { 
    186193                                                double bracket_combination = 1; 
    187                                                 for(int j = 0;j<=(*combi_ref).size();j++) 
    188                                                 { 
    189                                                         bracket_combination /= factors[(*combi_ref)[j]]; 
     194                                                for(int j = 0;j<(*combi_ref).size();j++) 
     195                                                { 
     196                                                        cout << "Factor vector:" << (*combi_ref) << endl; 
     197                                                         
     198                                                        bracket_combination /= factors[(*combi_ref)[j]-1]; 
    190199                                                } 
    191200 
     
    201210 
    202211                         
    203                         correction_term *= fact(condition_order-my_emlig->number_of_parameters)/pow(a_0,condition_order-my_emlig->number_of_parameters+2); 
     212                        correction_term *= fact(sigma_order)/pow(a_0,sigma_order+2); 
    204213 
    205214                        // cout << c << int_value << endl;