Show
Ignore:
Timestamp:
05/03/11 18:10:42 (13 years ago)
Author:
sindj
Message:

Oprava dalsich drobnych chyb (pridavani otcovske podminky do totalne neutralnich poly). Jeste nejake zbyva odstranit. JS

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/robust/robustlib.h

    r1346 r1349  
    2222using namespace itpp; 
    2323 
    24 const double max_range = 10;//numeric_limits<double>::max()/10e-10; 
     24const double max_range = 50;//numeric_limits<double>::max()/10e-10; 
    2525 
    2626/// An enumeration of possible actions performed on the polyhedrons. We can merge them or split them. 
     
    434434        }; 
    435435 
     436        ~c_statistic() 
     437        { 
     438                delete end_poly; 
     439                delete start_poly; 
     440        } 
     441 
    436442        void append_polyhedron(int row, polyhedron* appended_start, polyhedron* appended_end) 
    437443        { 
     
    732738        double normalization_factor; 
    733739 
     740        int condition_order; 
     741 
    734742         
    735743 
     
    948956                                                        else 
    949957                                                        { 
    950                                                                 current_parent->raise_multiplicity();                                                            
     958                                                                current_parent->raise_multiplicity(); 
     959                                                                current_parent->totally_neutral = true; 
     960                                                                current_parent->parentconditions.insert(toadd); 
    951961                                                        } 
    952962 
     
    10131023        double min_ll; 
    10141024 
     1025        double log_nc; 
     1026 
    10151027        vector<multiset<my_ivec>> correction_factors; 
    10161028 
     
    10261038 
    10271039                min_ll = numeric_limits<double>::max(); 
     1040 
     1041                condition_order = 0; 
    10281042        } 
    10291043 
    10301044        /// A constructor for creating an emlig when the user wants to create the statistic by himself. The creation of a 
    10311045        /// statistic is needed outside the constructor. Used for a user defined prior distribution on the parameters. 
    1032         emlig(c_statistic statistic) 
     1046        emlig(c_statistic statistic, int condition_order) 
    10331047        { 
    10341048                this->statistic = statistic;     
    10351049 
    10361050                min_ll = numeric_limits<double>::max(); 
    1037         } 
     1051 
     1052                this->condition_order = condition_order; 
     1053        } 
     1054 
    10381055 
    10391056        void step_me(int marker) 
     
    10571074                                */ 
    10581075 
    1059                                 cout << "Stepped." << endl; 
     1076                                // cout << "Stepped." << endl; 
     1077 
     1078                                for(set<simplex*>::iterator sim_ref = (*horiz_ref).triangulation.begin();sim_ref!=(*horiz_ref).triangulation.end();sim_ref++) 
     1079                                { 
     1080                                        if((*sim_ref)->vertices.size()!=i+1) 
     1081                                        { 
     1082                                                cout << "Something is wrong." << endl; 
     1083                                        } 
     1084                                } 
    10601085                                 
    10611086                                /* 
     
    11651190                bool should_remove = (toremove.size() != 0); 
    11661191                bool should_add    = (toadd.size() != 0); 
     1192 
     1193                if(should_remove) 
     1194                { 
     1195                        condition_order--; 
     1196                } 
     1197 
     1198                if(should_add) 
     1199                { 
     1200                        condition_order++; 
     1201                } 
    11671202 
    11681203                for_splitting.clear(); 
     
    12501285                                        local_condition = appended_coords*toadd; 
    12511286 
     1287                                        cout << "Vertex multiplicity: "<< current_vertex->get_multiplicity() << endl; 
     1288 
    12521289                                        current_vertex->set_state(local_condition,SPLIT); 
    12531290 
     
    12551292                                        if(local_condition == 0) 
    12561293                                        { 
     1294                                                cout << "Condition to add: " << toadd << endl; 
     1295                                                cout << "Vertex coords: " << appended_coords << endl; 
     1296 
    12571297                                                current_vertex->totally_neutral = true; 
    12581298 
    12591299                                                current_vertex->raise_multiplicity(); 
     1300                                                current_vertex->parentconditions.insert(condition_to_add); 
    12601301 
    12611302                                                current_vertex->negativeneutralvertices.insert(current_vertex); 
     
    12981339                } 
    12991340 
    1300                  
     1341                //step_me(1); 
    13011342                 
    13021343                if(should_remove) 
     
    13261367                                        if((*merge_ref)->get_multiplicity()>1) 
    13271368                                        { 
     1369                                                (*merge_ref)->parentconditions.erase(condition_to_remove); 
     1370 
    13281371                                                if(k==1) 
    13291372                                                { 
     
    15751618                } 
    15761619                 
    1577                 /* 
     1620                 
    15781621                vector<int> sizevector; 
    15791622                for(int s = 0;s<statistic.size();s++) 
     
    15811624                        sizevector.push_back(statistic.row_size(s)); 
    15821625                        cout << statistic.row_size(s) << ", "; 
    1583                 }*/ 
     1626                } 
    15841627                 
    15851628 
    1586                 //cout << endl; 
    1587  
    1588                 // this->step_me(2); 
     1629                cout << endl; 
     1630 
     1631                if(this->statistic.row_size(2)==62) 
     1632                { 
     1633                        this->step_me(2); 
     1634                } 
    15891635 
    15901636                if(should_add) 
     
    17431789                } 
    17441790 
     1791                /* 
    17451792                vector<int> sizevector; 
    17461793                //sizevector.clear(); 
     
    17521799                 
    17531800                cout << endl; 
    1754                  
     1801                */ 
     1802 
     1803                cout << "Normalization factor: " << normalization_factor << endl;        
     1804 
     1805                log_nc = log(normalization_factor) + logfact(condition_order-number_of_parameters-2); 
    17551806 
    17561807                /* 
     
    23082359        } 
    23092360 
     2361        int logfact(int factor) 
     2362        { 
     2363                if(factor>0) 
     2364                { 
     2365                        return factor+logfact(factor-1); 
     2366                } 
     2367                else 
     2368                { 
     2369                        return 0; 
     2370                } 
     2371        } 
    23102372protected: 
    23112373 
     
    26602722                        posterior->add_condition(yt); 
    26612723                } 
     2724 
     2725                 
    26622726                                 
    26632727        }