本文整理汇总了C++中DistanceMatrix::getMin_LowerIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ DistanceMatrix::getMin_LowerIndex方法的具体用法?C++ DistanceMatrix::getMin_LowerIndex怎么用?C++ DistanceMatrix::getMin_LowerIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DistanceMatrix
的用法示例。
在下文中一共展示了DistanceMatrix::getMin_LowerIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mergeAll
DBL_MATRIX PeakListCollection::mergeAll(double drt, double dmz, double dz, double dint)
{
//preprocessing: delete empty PeakLists from c_
for(unsigned int i = 0; i < c_.size(); i++){
if(c_[i].size() == 0){
c_.erase(c_.begin() + i);
}
}
unsigned int oldSize = c_.size();
// initialization
//fill correspondenceMap with rt-values
correspondenceMap_.clear();
correspondenceMap_.resize(oldSize);
for(unsigned int i = 0; i < oldSize; i++){
correspondenceMap_[i].resize(c_[i].size());
for(unsigned int j = 0; j < c_[i].size(); j++){
//create map_item to write to correspondenceMap
map_item tempItem;
//origin information contains the PeakList index and rt value
originInformation o;
o.rt = c_[i][j].getRt();
o.mz = c_[i][j].getMz();
o.intensity = c_[i][j].getAbundance();
o.originPeakList = i;
o.originPeak = j;
tempItem.push_back( o );
correspondenceMap_[i][j] = tempItem;
}
}
//PeakLists are not merged in the beginning --> fill with 1
plContent_.clear();
plContent_.resize(oldSize,1);
//build distance matrix
DistanceMatrix D = buildDistanceMatrix_(drt,dmz,dz,dint);
//merge, until there is only one PeakList left
while(D.size() > 1){
//find cheapest assignment
unsigned int merge_lower = D.getMin_LowerIndex();
unsigned int merge_upper = D.getMin_HigherIndex();
//merge peaklists into a new one
mergePeakLists_(merge_lower, merge_upper, c_, drt, dmz, dz, dint);
//update distance matrix
updateDistanceMatrix_(D, merge_lower, merge_upper, drt, dmz, dz, dint);
}
return calculateRtCorrespondencesFromCorrespondenceMap_(oldSize);
}
示例2: getAlignment
DBL_MATRIX PeakListCollection::getAlignment(double drt, double dmz, double dz, double dint, AccelerationFlag flag = NORMAL, int param = 0)
{
//Create a copy of c_ to work on
std::vector<PeakList> pls = c_;
unsigned int oldSize = pls.size();
// initialization
//fill correspondenceMap with rt-values
correspondenceMap_.clear();
correspondenceMap_.resize(oldSize);
for(unsigned int i = 0; i < oldSize; i++){
correspondenceMap_[i].resize(pls[i].size());
for(unsigned int j = 0; j < pls[i].size(); j++){
//create map_item to write to correspondenceMap
map_item tempItem;
//origin information contains the PeakList index and rt value
originInformation o;
o.rt = c_[i][j].getRt();
o.mz = c_[i][j].getMz();
o.intensity = c_[i][j].getAbundance();
o.originPeakList = i;
o.originPeak = j;
tempItem.push_back( o );
correspondenceMap_[i][j] = tempItem;
}
}
//PeakLists are not merged in the beginning --> fill with 1
plContent_.clear();
plContent_.resize(oldSize,1);
DistanceMatrix D;
if(flag == NORMAL){
//build distance matrix
D = buildDistanceMatrix_(drt,dmz,dz,dint);
}
if(flag == REFERENCE){
//first, merge PeakList n with one other --> last PeakList contains PeakList n
if(param==0){
//select first two peaklists
unsigned int merge_lower = param;
unsigned int merge_upper = 1;
//merge peaklists into a new one
mergePeakLists_(merge_lower, merge_upper, pls, drt, dmz, dz, dint);
}else{
//select first and n'th PeakList
unsigned int merge_lower = 0;
unsigned int merge_upper = param;
//merge peaklists into a new one
mergePeakLists_(merge_lower, merge_upper, pls, drt, dmz, dz, dint);
}
}
//merge, until there is only one PeakList left
bool exit = false;
while(!exit){
//find cheapest assignment
unsigned int merge_lower = 0;
unsigned int merge_upper = 1;
switch(flag){
case NORMAL:
merge_lower = D.getMin_LowerIndex();
merge_upper = D.getMin_HigherIndex();
break;
case FAST:
//select last two PeakList
merge_lower = pls.size()-2;
merge_upper = pls.size()-1;
break;
case REFERENCE:
//select last two PeakList
merge_lower = pls.size()-2;
merge_upper = pls.size()-1;
break;
}
//merge peaklists into a new one
mergePeakLists_(merge_lower, merge_upper, pls, drt, dmz, dz, dint);
switch(flag){
case NORMAL:
//update distance matrix
updateDistanceMatrix_(D, merge_lower, merge_upper, drt, dmz, dz, dint);
if(D.size()==1){
exit = true;
}
break;
case FAST:
if(pls.size()==1){
//.........这里部分代码省略.........