本文整理汇总了C++中ContainerType::front方法的典型用法代码示例。如果您正苦于以下问题:C++ ContainerType::front方法的具体用法?C++ ContainerType::front怎么用?C++ ContainerType::front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContainerType
的用法示例。
在下文中一共展示了ContainerType::front方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: merge
void IsotopeDistribution::merge(double resolution, double min_prob)
{
// Sort by mass and trim the tails of the container
sortByMass();
trimLeft(min_prob);
trimRight(min_prob);
ContainerType raw = distribution_;
double mass_range = (raw.back().getMZ() - raw.front().getMZ());
UInt output_size = ceil(mass_range / resolution);
if (output_size > distribution_.size())
{
throw Exception::IllegalArgument(__FILE__,
__LINE__,
OPENMS_PRETTY_FUNCTION,
"New Isotope Distribution "
"has more points than the old one.");
}
distribution_.clear();
ContainerType distribution(output_size, Peak1D(0, 0));
double delta = mass_range / output_size;
for (auto& p : raw)
{
UInt index = round((p.getMZ() - raw.front().getMZ())/resolution);
if (index >= distribution.size()) {continue;}
double mass = raw.front().getMZ() + (index * delta);
distribution[index].setMZ(mass);
distribution[index].setIntensity(distribution[index].getIntensity() + p.getIntensity());
}
distribution_ = distribution;
trimIntensities(min_prob);
}