本文整理汇总了C++中DoubleVector::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ DoubleVector::insert方法的具体用法?C++ DoubleVector::insert怎么用?C++ DoubleVector::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoubleVector
的用法示例。
在下文中一共展示了DoubleVector::insert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testSingleRateModel
void testSingleRateModel(Params ¶ms, NGSAlignment &aln, NGSTree &tree, string model,
double *freq, DoubleVector &rate_info, StrVector &rate_name,
bool write_info, const char *report_file)
{
char model_name[20];
NGSAlignment sum_aln(aln.num_states, 1, freq);
ModelsBlock *models_block = new ModelsBlock;
NGSTree sum_tree(params, &sum_aln);
sum_aln.tree = &sum_tree;
if (model == "")
sprintf(model_name, "GTR+F1");
else
sprintf(model_name, "%s+F1", model.c_str());
try {
params.model_name = model_name;
sum_tree.setModelFactory(new ModelFactory(params, &sum_tree, models_block));
sum_tree.setModel(sum_tree.getModelFactory()->model);
sum_tree.setRate(sum_tree.getModelFactory()->site_rate);
double bestTreeScore = sum_tree.getModelFactory()->optimizeParameters(false, write_info);
cout << "LogL: " << bestTreeScore;
cout << " / Rate: " << sum_tree.getRate()->getRate(0) << endl;
} catch (...) {
cout << "Skipped due to sparse matrix" << endl;
//rate_info.push_back(MIN_SITE_RATE);
rate_info.insert(rate_info.end(), rate_name.size(), MIN_SITE_RATE);
return;
}
//return sum_tree.getRate()->getRate(0);
rate_info.push_back(sum_tree.getRate()->getRate(0));
double *rate_mat = new double[aln.num_states*aln.num_states];
memset(rate_mat, 0, aln.num_states*aln.num_states*sizeof(double));
sum_tree.getModel()->getRateMatrix(rate_mat);
rate_info.insert(rate_info.end(), rate_mat, rate_mat+sum_tree.getModel()->getNumRateEntries());
if (tree.getModel()->isReversible()) {
sum_tree.getModel()->getStateFrequency(rate_mat);
rate_info.insert(rate_info.end(), rate_mat, rate_mat+aln.num_states);
}
delete [] rate_mat;
delete models_block;
if (report_file) {
DoubleMatrix tmp(1);
tmp[0] = rate_info;
reportNGSAnalysis(report_file, params, sum_aln, sum_tree, tmp, rate_name);
}
}
示例2: getRates
void RateMeyerHaeseler::getRates(DoubleVector &rates) {
rates.clear();
if (empty()) {
rates.resize(phylo_tree->aln->size(), 1.0);
} else {
rates.insert(rates.begin(), begin(), end());
}
}
示例3: computePatternRates
int RateMeyerDiscrete::computePatternRates(DoubleVector &pattern_rates, IntVector &pattern_cat) {
pattern_rates.insert(pattern_rates.begin(), begin(), end());
pattern_cat.insert(pattern_cat.begin(), ptn_cat, ptn_cat + size());
return ncategory;
}
示例4: computePatternRates
int RateMeyerHaeseler::computePatternRates(DoubleVector &pattern_rates, IntVector &pattern_cat) {
pattern_rates.insert(pattern_rates.begin(), begin(), end());
return size();
}