Changeset 1262 for applications/robust/robustlib.cpp
- Timestamp:
- 12/13/10 19:25:45 (14 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/robust/robustlib.cpp
r1254 r1262 31 31 32 32 double a_0 = base_vertex->get_coordinates()*cur_condition+as_toprow->condition[0]; 33 vecas;33 map<double,int> as; 34 34 35 35 int row_count = 0; … … 41 41 42 42 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); 45 50 46 51 row_count++; … … 48 53 49 54 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++) 51 56 { 52 vec reduced_as = (as.get(a_count)-as);57 int fac_order = ((toprow*)this)->condition_order-as.size()-1; 53 58 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; 55 65 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; 57 71 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; 59 73 60 for(int b_count = 0;b_count<reduced_as.size();b_count++) 74 75 } 76 } 77 } 78 else 61 79 { 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)"); 63 81 } 64 82 83 65 84 int_value += fac_value; 66 85 }