本文整理汇总了C++中Progress::increment方法的典型用法代码示例。如果您正苦于以下问题:C++ Progress::increment方法的具体用法?C++ Progress::increment怎么用?C++ Progress::increment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Progress
的用法示例。
在下文中一共展示了Progress::increment方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: determineSubStability
// Prevents agglomeration in a single cluster.
void HDCluster::determineSubStability(const unsigned int& minPts, Progress& p) {
#ifdef DEBUG
if (sz < minPts && parent != nullptr) throw Rcpp::exception("Condense failed.");
#endif
stability = sum_lambda_p - (lambda_birth * fallenPoints.size());
if (left != nullptr) {
const double childStabilities = left->determineStability(minPts, p) +
right->determineStability(minPts, p);
if (childStabilities > stability) stability = childStabilities;
} else {
p.increment(sz);
}
}
示例2: thread
void thread(Progress& progress, const uword& batchSize) {
coordinatetype * const holder = new coordinatetype[D * 2];
while (rho >= 0) {
const double localRho = rho;
innerLoop(localRho, batchSize, holder);
#ifdef _OPENMP
#pragma omp atomic
#endif
rho -= (rhoIncrement * batchSize);
if (!progress.increment()) break;
}
delete[] holder;
}
示例3: extract
void HDCluster::extract( int* clusters,
double* lambdas,
int& selectedClusterCnt,
int currentSelectedCluster,
Progress& p) const {
if (selected) currentSelectedCluster = selectedClusterCnt++;
std::for_each(fallenPoints.begin(), fallenPoints.end(),
[&clusters, &lambdas, ¤tSelectedCluster](const std::pair<arma::uword, double>& it) {
clusters[it.first] = (currentSelectedCluster == 0) ? NA_INTEGER : currentSelectedCluster;
lambdas[it.first] = it.second;
});
if (left != nullptr) {
left->extract(clusters, lambdas, selectedClusterCnt, currentSelectedCluster, p);
right->extract(clusters, lambdas, selectedClusterCnt, currentSelectedCluster, p);
} else {
p.increment(sz);
}
}
示例4: determineStability
double HDCluster::determineStability(const unsigned int& minPts, Progress& p) {
#ifdef DEBUG
if (sz < minPts && parent != nullptr) throw Rcpp::exception("Condense failed.");
#endif
stability = sum_lambda_p - (lambda_birth * fallenPoints.size());
if (left == nullptr) { // leaf node
if (sz >= minPts) selected = true; // Otherwise, this is a parent singleton smaller than minPts.
p.increment();
} else {
const double childStabilities = left->determineStability(minPts, p) +
right->determineStability(minPts, p);
stability += lambda_death * (left->sz + right->sz);
if (stability > childStabilities) {
selected = true;
left->deselect();
right->deselect();
} else stability = childStabilities;
}
return stability;
}
示例5:
/*
* Converts the specified registry file. The specified file is
* removed if the conversion is successful. If conversion_count
* is not NULL, the total number of Articles converted will be
* passed back.
*/
int
wsreg_convert_registry(const char *filename, int *conversion_count,
Progress_function progress_callback)
{
File_util *futil = _wsreg_fileutil_initialize();
if (initialized == WSREG_NOT_INITIALIZED) {
return (WSREG_NOT_INITIALIZED);
}
if (!futil->exists(filename)) {
/*
* Bad filename.
*/
return (WSREG_FILE_NOT_FOUND);
}
if (futil->can_read(filename) && futil->can_write(filename)) {
/*
* The registry file can be read and removed.
*/
if (wsreg_can_access_registry(O_RDWR)) {
/*
* The conversion permissions are appropriate.
* Perform the conversion.
*/
int result;
int article_count = 0;
Progress *progress =
_wsreg_progress_create(
(Progress_callback)*progress_callback);
int count = 0;
Unz_article_input_stream *ain = NULL;
Conversion *c = NULL;
/*
* The first progress section represents the
* unzipping of the data file.
*/
progress->set_section_bounds(progress, 5, 1);
ain = _wsreg_uzais_open(filename, &result);
progress->finish_section(progress);
if (result != WSREG_SUCCESS) {
/*
* The open failed. Clean up and
* return the error code.
*/
if (ain != NULL) {
ain->close(ain);
}
progress->free(progress);
return (result);
}
c = _wsreg_conversion_create(progress);
/*
* The second progress section represents
* the reading of articles.
*/
article_count = ain->get_article_count(ain);
progress->set_section_bounds(progress, 8,
article_count);
while (ain->has_more_articles(ain)) {
Article *a = ain->get_next_article(ain);
if (a != NULL) {
c->add_article(c, a);
}
progress->increment(progress);
}
progress->finish_section(progress);
ain->close(ain);
/*
* The third progress section represents
* the conversion and registration of the
* resulting components.
*/
progress->set_section_bounds(progress, 100,
article_count);
count = c->register_components(c, NULL, FALSE);
progress->finish_section(progress);
/*
* Pass the count back to the caller.
*/
if (conversion_count != NULL) {
*conversion_count = count;
}
/*
* Remove the old registry file.
*/
futil->remove(filename);
//.........这里部分代码省略.........
示例6: clmm
SEXP clmm(SEXP yR, SEXP XR, SEXP par_XR, SEXP list_of_design_matricesR, SEXP par_design_matricesR, SEXP par_mcmcR, SEXP verboseR, SEXP threadsR, SEXP use_BLAS){
int threads = as<int>(threadsR);
int verbose = as<int>(verboseR);
bool BLAS = Rcpp::as<bool>(use_BLAS);
Rcpp::List list_of_phenotypes(yR);
Rcpp::List list_of_par_design_matrices(par_design_matricesR);
Rcpp::List list_of_par_mcmc(par_mcmcR);
int p = list_of_phenotypes.size();
//omp_set_dynamic(0);
omp_set_num_threads(threads);
Eigen::setNbThreads(1);
Eigen::initParallel();
int max = p / threads;
if(max < 1) max = 1;
//printer prog(max);
Rcpp::List summary_out;
mcmc_st vec_mcmc_st;
MCMC_abstract * single_mcmc;
Rcpp::List Summary;
bool multiple_phenos = false;
// CV
if(p > 1) {
multiple_phenos = true;
// fill the container with mcmc_objects
for(int i=0;i<p;i++) {
vec_mcmc_st.push_back(MCMC<base_methods_st>(list_of_phenotypes[i], XR, par_XR, list_of_design_matricesR ,list_of_par_design_matrices[i], list_of_par_mcmc[i],i));
}
for(mcmc_st::iterator it = vec_mcmc_st.begin(); it != vec_mcmc_st.end(); it++) {
it->initialize();
}
// if ((p > 1) & verbose) { prog.initialize(); }
// this looks easy - the work was to allow this step to be parallelized
// verbose
Progress * prog = new Progress(vec_mcmc_st.size(), verbose);
#pragma omp parallel for
for(unsigned int i=0;i<vec_mcmc_st.size();i++){
if ( ! Progress::check_abort() ) {
vec_mcmc_st.at(i).gibbs();
prog->increment();
}
}
for(mcmc_st::iterator it = vec_mcmc_st.begin(); it != vec_mcmc_st.end(); it++) {
it->summary();
Summary[it->get_name()] = it->get_summary();
}
delete prog;
summary_out = Summary;
} else {
// Dont know whether it is possible to control threads for OMP and BLAS seperately
// Single Model Run
if (threads==1 & !BLAS) {
single_mcmc = new MCMC<base_methods_st>(list_of_phenotypes[0], XR, par_XR, list_of_design_matricesR,
list_of_par_design_matrices[0], list_of_par_mcmc[0],0);
}
if (threads>1 & !BLAS) {
single_mcmc = new MCMC<base_methods_mp>(list_of_phenotypes[0], XR, par_XR, list_of_design_matricesR,
list_of_par_design_matrices[0], list_of_par_mcmc[0],0);
}
if (BLAS) {
single_mcmc = new MCMC<base_methods_BLAS>(list_of_phenotypes[0], XR, par_XR, list_of_design_matricesR,
//.........这里部分代码省略.........