本文整理汇总了C++中Pairs::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Pairs::begin方法的具体用法?C++ Pairs::begin怎么用?C++ Pairs::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pairs
的用法示例。
在下文中一共展示了Pairs::begin方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gb
// complete algorithm to compute a Groebner basis F
void gb( IntermediateBasis &F, int n) {
int nextIndex = F.size();
rearrangeBasis(F, -1);
interreduction(F);
Pairs B = makeList(F, n);
//unsigned int countAddPoly = 0;
//unsigned int numSPoly= 0;
int interreductionCounter = 0;
while (!B.empty()) {
Pair pair = *(B.begin());
B.erase(B.begin());
if (isGoodPair(pair,F,B,n)) {
//numSPoly++;
BRP S = sPolynomial(pair,F,n);
reduce(S,F);
if ( ! S.isZero() ) {
//countAddPoly++;
F[nextIndex] = S;
if(interreductionCounter == 5) {
interreductionCounter = 0;
interreduction(F);
B = makeList(F, n);
} else {
interreductionCounter++;
Pairs newList = makeNewPairs(nextIndex, F, n);
B.insert(newList.begin(), newList.end());
}
nextIndex++;
}
}
}
interreduction(F);
//cout << "we computed " << numSPoly << " S Polynomials and added " << countAddPoly << " of them to the intermediate basis." << endl;
}
示例2: onMeta
void WebLoadManager::onMeta() {
QNetworkReply *reply = qobject_cast<QNetworkReply*>(QObject::sender());
if (!reply) return;
Replies::iterator j = _replies.find(reply);
if (j == _replies.cend()) { // handled already
return;
}
webFileLoaderPrivate *loader = j.value();
typedef QList<QNetworkReply::RawHeaderPair> Pairs;
Pairs pairs = reply->rawHeaderPairs();
for (Pairs::iterator i = pairs.begin(), e = pairs.end(); i != e; ++i) {
if (QString::fromUtf8(i->first).toLower() == "content-range") {
QRegularExpressionMatch m = QRegularExpression(qsl("/(\\d+)([^\\d]|$)")).match(QString::fromUtf8(i->second));
if (m.hasMatch()) {
loader->setProgress(qMax(qint64(loader->data().size()), loader->already()), m.captured(1).toLongLong());
if (!handleReplyResult(loader, WebReplyProcessProgress)) {
_replies.erase(j);
_loaders.remove(loader);
delete loader;
reply->abort();
reply->deleteLater();
}
}
}
}
}
示例3: partMetaGot
void PsUpdateDownloader::partMetaGot() {
typedef QList<QNetworkReply::RawHeaderPair> Pairs;
Pairs pairs = reply->rawHeaderPairs();
for (Pairs::iterator i = pairs.begin(), e = pairs.end(); i != e; ++i) {
if (QString::fromUtf8(i->first).toLower() == "content-range") {
QRegularExpressionMatch m = QRegularExpression(qsl("/(\\d+)([^\\d]|$)")).match(QString::fromUtf8(i->second));
if (m.hasMatch()) {
{
QMutexLocker lock(&mutex);
full = m.captured(1).toInt();
}
emit App::app()->updateDownloading(already, full);
}
}
}
}
示例4: makeNewPairs
// generate list of index pairs for a new index and an intermediate basis
Pairs makeNewPairs(int newIndex, const IntermediateBasis &F, int n) {
Pairs B;
Pairs::iterator position = B.begin();
for(int i=-n; i<0; i++) {
Pair pair = Pair(i, newIndex, F);
position = B.insert(position, pair);
}
IntermediateBasis::const_iterator end = F.end();
end--;
for(IntermediateBasis::const_iterator iter = F.begin(); iter != end; ++iter) {
int j = iter->first;
Pair pair = Pair(newIndex, j, F);
if (pair.good) {
position = B.insert(position, pair);
}
}
return B;
}
示例5: makeList
// generate list of index pairs for given intermediate basis
// first insert all pairs with FPs, then insert pairs of all other polynomials
// the list of indeces was ordered by increasingly
Pairs makeList(const IntermediateBasis &F, int n) {
Pairs B;
Pairs::iterator position = B.begin();
IntermediateBasis::const_iterator end = F.end();
for(IntermediateBasis::const_iterator iter = F.begin(); iter != end; ++iter) {
int j = iter->first;
for(int i=-n; i<0; i++) {
Pair pair = Pair(i, j, F);
position = B.insert(position, pair);
}
for(int i=0; i<j; i++) {
Pair pair = Pair(i, j, F);
if (pair.good) {
position = B.insert(position, pair);
}
}
}
return B;
}
示例6: accumulate_pairs
inline void accumulate_pairs(AssocDest &table,Pairs const &source,AccumF accum_f)
{
accumulate_pairs(table,source.begin(),source.end(),accum_f);
}
示例7: accumulate_at_pairs
template <class Vector,class Pairs,class AccumF> inline
void accumulate_at_pairs(Vector &table,Pairs const &source,AccumF accum_f)
{
accumulate_at_pairs(table,source.begin(),source.end(),accum_f);
}
示例8: estimateDistance
/** Estimate the distance between two contigs.
* @param numPairs [out] the number of pairs that agree with the
* expected distribution
* @return the estimated distance
*/
static int estimateDistance(unsigned len0, unsigned len1,
const Pairs& pairs, const PMF& pmf,
unsigned& numPairs)
{
// The provisional fragment sizes are calculated as if the contigs
// were perfectly adjacent with no overlap or gap.
typedef vector<pair<int, int> > Fragments;
Fragments fragments;
fragments.reserve(pairs.size());
for (Pairs::const_iterator it = pairs.begin();
it != pairs.end(); ++it) {
int a0 = it->targetAtQueryStart();
int a1 = it->mateTargetAtQueryStart();
if (it->isReverse())
a0 = len0 - a0;
if (!it->isMateReverse())
a1 = len1 - a1;
fragments.push_back(opt::rf
? make_pair(a1, len1 + a0)
: make_pair(a0, len0 + a1));
}
// Remove duplicate fragments.
unsigned orig = fragments.size();
sort(fragments.begin(), fragments.end());
fragments.erase(unique(fragments.begin(), fragments.end()),
fragments.end());
numPairs = fragments.size();
assert((int)orig - (int)numPairs >= 0);
stats.total_frags += orig;
stats.dup_frags += orig - numPairs;
if (numPairs < opt::npairs)
return INT_MIN;
vector<int> fragmentSizes;
fragmentSizes.reserve(fragments.size());
unsigned ma = opt::minAlign;
for (Fragments::const_iterator it = fragments.begin();
it != fragments.end(); ++it) {
int x = it->second - it->first;
if (!opt::rf && opt::method == MLE
&& x <= 2 * int(ma - 1)) {
unsigned align = x / 2;
if (opt::verbose > 0)
#pragma omp critical(cerr)
cerr << PROGRAM ": warning: The observed fragment of "
"size " << x << " bp is shorter than 2*l "
"(l=" << opt::minAlign << ").\n";
ma = min(ma, align);
}
fragmentSizes.push_back(x);
}
#pragma omp critical(g_recMA)
g_recMA = min(g_recMA, ma);
switch (opt::method) {
case MLE:
// Use the maximum likelihood estimator.
return maximumLikelihoodEstimate(ma,
opt::minDist, opt::maxDist,
fragmentSizes, pmf, len0, len1, opt::rf, numPairs);
case MEAN:
// Use the difference of the population mean
// and the sample mean.
return estimateDistanceUsingMean(
fragmentSizes, pmf, numPairs);
default:
assert(false);
abort();
}
}