Show
Ignore:
Timestamp:
12/13/10 19:25:45 (14 years ago)
Author:
sindj
Message:

Dodelavani korekcnich faktoru pri stjene hodnote funkce ve dvou bodech polyhedronu. Rozdelano. JS

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/robust/robustlib.cpp

    r1254 r1262  
    3131 
    3232                                                double a_0 = base_vertex->get_coordinates()*cur_condition+as_toprow->condition[0]; 
    33                                                 vec as; 
     33                                                map<double,int> as; 
    3434 
    3535                                                int row_count = 0; 
     
    4141 
    4242                                                        double new_a = relative_coords*cur_condition;                                                    
    43                                                                                                                  
    44                                                         as.ins(as.size(),new_a);                                                         
     43                                                         
     44                                                        pair<map<double,int>::iterator,bool> returned = as.insert(pair<double,int>(new_a,1)); 
     45                                                        if(returned.second == false) 
     46                                                        { 
     47                                                                (*returned.first).second++; 
     48                                                        } 
     49                                                        //as.ins(as.size(),new_a);                                                       
    4550                                                         
    4651                                                        row_count++; 
     
    4853 
    4954                                                double int_value = 0; 
    50                                                 for(int a_count = 0;a_count<as.size();a_count++) 
     55                                                for(map<double,int>::iterator as_ref = as.begin();as_ref!=as.end();as_ref++) 
    5156                                                { 
    52                                                         vec reduced_as = (as.get(a_count)-as); 
     57                                                        int fac_order = ((toprow*)this)->condition_order-as.size()-1; 
    5358 
    54                                                         reduced_as.del(a_count); 
     59                                                        double fac_value = 1; 
     60                                                        if(a_0!=(*as_ref).first) 
     61                                                        { 
     62                                                                //fac_value = ((double)tgamma(fac_order)*det(jacobian))/(*as_ref).first/pow((*as_ref).first-a_0,fac_order);  
     63                                                                 
     64                                                                fac_value /= (*as_ref).first; 
    5565 
    56                                                         int fac_order = ((toprow*)this)->condition_order-reduced_as.size()-1; 
     66                                                                for(map<double,int>::iterator as2_ref = as.begin();as2_ref!=as.end();as2_ref++) 
     67                                                                { 
     68                                                                        if(as2_ref!=as_ref) 
     69                                                                        { 
     70                                                                                double current_factor = (*as_ref).first-(*as2_ref).first; 
    5771 
    58                                                         double fac_value = ((double)tgamma(fac_order)*det(jacobian))/as[a_count]/pow(as[a_count]-a_0,fac_order);  
     72                                                                                fac_value /= current_factor; 
    5973 
    60                                                         for(int b_count = 0;b_count<reduced_as.size();b_count++) 
     74                                                                                                                                                                 
     75                                                                        } 
     76                                                                } 
     77                                                        } 
     78                                                        else 
    6179                                                        { 
    62                                                                 fac_value /= reduced_as[b_count];                                                                
     80                                                                throw new exception("Should this happen? a_i=a_0 in the formula for integrating over a simplex! I think it can happen with 0 probability(when phi*2*v_0=phi*v_i)"); 
    6381                                                        } 
    6482 
     83                                                         
    6584                                                        int_value += fac_value;                                                  
    6685                                                }