本文整理汇总了C++中Subset::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ Subset::erase方法的具体用法?C++ Subset::erase怎么用?C++ Subset::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subset
的用法示例。
在下文中一共展示了Subset::erase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeKMMatrix
/**
* Compute the Kramer-Mesner matrix.
*
* Precondition: t < k
*/
KramerMesnerMatrix computeKMMatrix(const Group& G, unsigned int t, unsigned int k) {
std::vector<KMBuilderOutput> builderOutputs; // stores the relevant data for k = 2 onwards
Matrix A;
for (int i = 2; i <= k; i++) {
boost::scoped_ptr<KMBuilder> builder;
// Get orbit representatives of (i - 1)-subsets
std::vector<Subset> orbitReps;
if (i == 2) {
// As it is the first time, we have to compute the orbit representatives of singleton subsets...
Subset pointsRemaining = generateX(G.getNumPoints());
while (!pointsRemaining.empty()) {
typedef OrbitSet<Permutation, unsigned long>::const_iterator OrbitSetIterator;
unsigned long point = *(pointsRemaining.begin()); // A new representative...
Subset singletonSet = makeSingletonSet(point); // ...as a set
orbitReps.push_back(singletonSet);
// Compute the orbit of the point, and remove it from the remaining points
OrbitSet<Permutation, unsigned long> orbit = G.orbit(point, Transversal::TrivialAction());
for (OrbitSetIterator it = orbit.begin(); it != orbit.end(); it++) {
pointsRemaining.erase(pointsRemaining.find(*it));
}
}
builder.reset(new KMBuilder(G, i, orbitReps));
} else {
// We get them from what we computed earlier
KMBuilderOutput& input = builderOutputs[i - 3];
orbitReps = input.getNewReps();
builder.reset(new KMBuilder(G, i, orbitReps, input.getPrunerData()));
}
KMBuilderOutput builderOutput = builder->build();
builderOutputs.push_back(builderOutput);
// From the identity that A[t][k] = A[t][s] * A[s][k] / combinat(k - t, k - s) for any s
// between t and k, we get the following:
if (i == t + 1) {
assignMatrix(A, builderOutput.getNewMatrix());
} else if (i > t + 1) {
assignMatrix(A, matrixMultiply(A, builderOutput.getNewMatrix()));
scalarDivide(i - t, A);
}
}
return KramerMesnerMatrix(G, builderOutputs[t - 2].getNewReps(), builderOutputs[k - 2].getNewReps(), A);
}