int uimon_out(const char *buffer) { const char *c; for(c = buffer; *c; c++) { if(*c == '\n') { write_to_terminal(&fixed, "\r", 1); } write_to_terminal(&fixed, c, 1); } return 0; }
void Verify::apply() { print_pre_info(); if(!_valid || _c == NULL) { std::cerr << "Verify not valid. Exiting" << std::endl; return; } int steps = _strides; int samples = _samples; int N = _size; if(_exp){ nr_links = stat::make_exponential_points_array( N, steps, START_POINT ); }else{ nr_links = stat::make_linear_points_array( N, steps, START_POINT ); } link_mean = (nr_links.segment(0, steps) + nr_links.segment(1, steps)) / 2; set_theoretical_values(); Eigen::ArrayXXd binned_chain = Eigen::ArrayXXd::Zero(steps,3*samples); std::vector< std::vector<PFloat> > w = std::vector< std::vector<PFloat> >(steps); for(int i = 0; i < steps; i++) { w[i] = std::vector<PFloat>(samples); } Eigen::ArrayXXd Rg_tmp = Eigen::ArrayXXd::Zero(steps,samples); for(int i = 0; i < samples; i++) { _c->build(N); // Vector containing the weight for each individual link Eigen::VectorXd w_tmp = _c->weights(); // bin values for(int j = 0; j<steps; j++) { Eigen::ArrayXXd sub_chain = _c->as_array( nr_links(j), nr_links(j+1)-nr_links(j) ).transpose(); binned_chain(j,3*i+0) = sub_chain.col(0).mean(); binned_chain(j,3*i+1) = sub_chain.col(1).mean(); binned_chain(j,3*i+2) = sub_chain.col(2).mean(); Rg_tmp(j,i) = _c->Rg(0,floor(link_mean(j))); w[j][i] = mult_weights( w_tmp.segment(0, nr_links(j+1)) ); } if(verbose) { write_to_terminal(N,i,steps); } } Eigen::ArrayXXd R_tmp = Eigen::ArrayXXd::Zero(steps,samples); R = Eigen::ArrayXd::Zero(steps); R_var = Eigen::ArrayXd::Zero(steps); Rg = Eigen::ArrayXd::Zero(steps); Rg_var = Eigen::ArrayXd::Zero(steps); for(int i = 0; i < steps; i++) { for(int j = 0; j < samples; j++) { Eigen::Vector3d pos = binned_chain.block(i,3*j,1,3).transpose(); R_tmp(i,j) = pos.norm(); } } for(int i = 0; i<steps; i++) { Eigen::Vector2d mv = stat::get_mean_and_variance(R_tmp.row(i), w[i]); R(i) = mv(0); R_var(i) = mv(1); mv = stat::get_mean_and_variance(Rg_tmp.row(i), w[i]); Rg(i) = mv(0); Rg_var(i) = mv(1); } write_to_file(); print_post_info(); }