当前位置: 首页>>代码示例>>C++>>正文


C++ Subset::empty方法代码示例

本文整理汇总了C++中Subset::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Subset::empty方法的具体用法?C++ Subset::empty怎么用?C++ Subset::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subset的用法示例。


在下文中一共展示了Subset::empty方法的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);
}
开发者ID:kelvSYC,项目名称:MatrixGenerator,代码行数:55,代码来源:KMCompute.cpp


注:本文中的Subset::empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。