本文整理汇总了C++中realvec::getSubMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ realvec::getSubMatrix方法的具体用法?C++ realvec::getSubMatrix怎么用?C++ realvec::getSubMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类realvec
的用法示例。
在下文中一共展示了realvec::getSubMatrix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
PeakViewMerge::myProcess(realvec& in, realvec& out)
{
peakView *In[kNumMatrices],
Out (out);
mrs_natural i, rowIdx = 0,
numPeaks[kNumMatrices],
outputIdx = 0;
const mrs_bool discNegGroups = ctrl_noNegativeGroups_->to<mrs_bool>();
out.setval(0.);
for (i = 0; i < kNumMatrices; i++)
{
mrs_natural numRows = (i==kMat1)? ctrl_frameMaxNumPeaks1_->to<mrs_natural>() : ctrl_frameMaxNumPeaks2_->to<mrs_natural>();
numRows *= peakView::nbPkParameters;
if (numRows == 0) // if the controls have not been set assume both matrixes to be of equal size
numRows = in.getRows ()/kNumMatrices;
peakViewIn_[i].stretch (numRows, in.getCols ());
in.getSubMatrix (rowIdx, 0, peakViewIn_[i]);
rowIdx += numRows;
In[i] = new peakView(peakViewIn_[i]);
numPeaks[i] = In[i]->getTotalNumPeaks ();
}
if (ctrl_mode_->to<mrs_string>() == "OR")
{
// write all entries of the second peakView to output
for (i = 0; i < numPeaks[1]; i++)
{
if (discNegGroups && (*In[1])(i,peakView::pkGroup) < 0)
continue;
WriteOutput (Out, In[1], i, outputIdx);
outputIdx++;
}
// write all entries of the first peakView to output except duplicates
for (i = 0; i < numPeaks[0]; i++)
{
mrs_natural Idx;
if (discNegGroups && (*In[0])(i,peakView::pkGroup) < 0)
continue;
for (mrs_natural k = 1; k < kNumMatrices; k++)
Idx = FindDuplicate (In[k], (*In[0])(i, peakView::pkFrequency), numPeaks[k]);
if (Idx < 0)
{
WriteOutput (Out, In[0], i, outputIdx);
outputIdx++;
}
}
}
else if (ctrl_mode_->to<mrs_string>() == "AND")
{
// find duplicates and write only them to output
for (i = 0; i < numPeaks[0]; i++)
{
mrs_natural Idx;
if (discNegGroups && (*In[0])(i,peakView::pkGroup) < 0)
continue;
for (mrs_natural k = 1; k < kNumMatrices; k++)
Idx = FindDuplicate (In[k], (*In[0])(i, peakView::pkFrequency), numPeaks[k]);
if (Idx >= 0)
{
if (discNegGroups && (*In[1])(Idx,peakView::pkGroup) < 0)
continue;
WriteOutput (Out, In[0], i, outputIdx);
outputIdx++;
}
}
}
else if (ctrl_mode_->to<mrs_string>() == "ANDOR")
{
// keep the input[0] peaks that are not in input[1]
for (i = 0; i < numPeaks[0]; i++)
{
mrs_natural Idx;
if (discNegGroups && (*In[0])(i,peakView::pkGroup) < 0)
continue;
for (mrs_natural k = 1; k < kNumMatrices; k++)
Idx = FindDuplicate (In[k], (*In[0])(i, peakView::pkFrequency), numPeaks[k]);
if (Idx < 0)
{
WriteOutput (Out, In[0], i, outputIdx);
outputIdx++;
}
}
}
else if (ctrl_mode_->to<mrs_string>() == "XOR")
{
// find duplicates and write only residual to output
for (i = 0; i < numPeaks[0]; i++)
{
if (discNegGroups && (*In[0])(i,peakView::pkGroup) < 0)
continue;
mrs_natural Idx = FindDuplicate (In[1], (*In[0])(i, peakView::pkFrequency), numPeaks[1]);
if (Idx < 0)
//.........这里部分代码省略.........