本文整理汇总了C++中ModelType::getMW方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelType::getMW方法的具体用法?C++ ModelType::getMW怎么用?C++ ModelType::getMW使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelType
的用法示例。
在下文中一共展示了ModelType::getMW方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sample_theta_vectors_from_count_vectors
void sample_theta_vectors_from_count_vectors() {
ModelType model;
model.read(modelF);
calcExpectedEffectiveLengths<ModelType>(model);
int num_threads = min(nThreads, nCV);
buffer = new Buffer(nMB, nSamples, cvlen, tmpF);
paramsArray = new Params[num_threads];
threads = new pthread_t[num_threads];
char inpF[STRLEN];
for (int i = 0; i < num_threads; i++) {
paramsArray[i].no = i;
sprintf(inpF, "%s%d", cvsF, i);
paramsArray[i].fi = fopen(inpF, "r");
paramsArray[i].engine = engineFactory::new_engine();
paramsArray[i].mw = model.getMW();
}
/* set thread attribute to be joinable */
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
for (int i = 0; i < num_threads; i++) {
rc = pthread_create(&threads[i], &attr, &sample_theta_from_c, (void*)(¶msArray[i]));
pthread_assert(rc, "pthread_create", "Cannot create thread " + itos(i) + " (numbered from 0) in sample_theta_vectors_from_count_vectors!");
}
for (int i = 0; i < num_threads; i++) {
rc = pthread_join(threads[i], &status);
pthread_assert(rc, "pthread_join", "Cannot join thread " + itos(i) + " (numbered from 0) in sample_theta_vectors_from_count_vectors!");
}
/* destroy attribute */
pthread_attr_destroy(&attr);
delete[] threads;
for (int i = 0; i < num_threads; i++) {
fclose(paramsArray[i].fi);
delete paramsArray[i].engine;
}
delete[] paramsArray;
delete buffer; // Must delete here, force the content left in the buffer be written into the disk
if (verbose) { printf("Sampling is finished!\n"); }
}