本文整理汇总了C++中Subset::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Subset::size方法的具体用法?C++ Subset::size怎么用?C++ Subset::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subset
的用法示例。
在下文中一共展示了Subset::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gen_subsets
void gen_subsets(Subsets &s, const Subset &x, int n, int p, int m) {
int i;
Subset x2;
if(x.size() == m) {
s.push_back(x);
//Debug
//draw(x);
//cout << endl;
return;
}
for(i = p; i <= n; i++) {
x2 = x;
x2.push_back(i);
gen_subsets(s, x2, n, i + 1, m);
}
}
示例2: get_restraint_graph
SubsetGraph get_restraint_graph(ScoringFunctionAdaptor in,
const ParticleStatesTable *pst) {
RestraintsTemp rs =
IMP::create_decomposition(in->create_restraints());
// ScoreStatesTemp ss= get_required_score_states(rs);
SubsetGraph ret(rs.size()); // + ss.size());
IMP_LOG_TERSE("Creating restraint graph on " << rs.size() << " restraints."
<< std::endl);
boost::unordered_map<Particle *, int> map;
SubsetGraphVertexName pm = boost::get(boost::vertex_name, ret);
DependencyGraph dg = get_dependency_graph(rs[0]->get_model());
DependencyGraphVertexIndex index = IMP::get_vertex_index(dg);
/*IMP_IF_LOG(VERBOSE) {
IMP_LOG_VERBOSE( "dependency graph is \n");
IMP::internal::show_as_graphviz(dg, std::cout);
}*/
Subset ps = pst->get_subset();
for (unsigned int i = 0; i < ps.size(); ++i) {
ParticlesTemp t = get_dependent_particles(
ps[i], ParticlesTemp(ps.begin(), ps.end()), dg, index);
for (unsigned int j = 0; j < t.size(); ++j) {
IMP_USAGE_CHECK(map.find(t[j]) == map.end(),
"Currently particles which depend on more "
<< "than one particle "
<< "from the input set are not supported."
<< " Particle \"" << t[j]->get_name()
<< "\" depends on \"" << ps[i]->get_name()
<< "\" and \""
<< ps[map.find(t[j])->second]->get_name() << "\"");
map[t[j]] = i;
}
IMP_IF_LOG(VERBOSE) {
IMP_LOG_VERBOSE("Particle \"" << ps[i]->get_name() << "\" controls ");
for (unsigned int i = 0; i < t.size(); ++i) {
IMP_LOG_VERBOSE("\"" << t[i]->get_name() << "\" ");
}
IMP_LOG_VERBOSE(std::endl);
}
}
for (unsigned int i = 0; i < rs.size(); ++i) {
ParticlesTemp pl = IMP::get_input_particles(rs[i]->get_inputs());
std::sort(pl.begin(), pl.end());
pl.erase(std::unique(pl.begin(), pl.end()), pl.end());
Subset os(pl);
for (unsigned int j = 0; j < pl.size(); ++j) {
pl[j] = ps[map[pl[j]]];
}
std::sort(pl.begin(), pl.end());
pl.erase(std::unique(pl.begin(), pl.end()), pl.end());
Subset s(pl);
IMP_LOG_VERBOSE("Subset for restraint " << rs[i]->get_name() << " is " << s
<< " from " << os << std::endl);
pm[i] = s;
}
/*ScoreStatesTemp ss= get_required_score_states(rs);
for (ScoreStatesTemp::const_iterator it= ss.begin();
it != ss.end(); ++it) {
ParticlesTemp pl= (*it)->get_input_particles();
add_edges(ps, pl, map, *it, ret);
ParticlesTemp opl= (*it)->get_output_particles();
add_edges(ps, opl, map, *it, ret);
}
IMP_INTERNAL_CHECK(boost::num_vertices(ret) == ps.size(),
"Wrong number of vertices "
<< boost::num_vertices(ret)
<< " vs " << ps.size());*/
for (unsigned int i = 0; i < boost::num_vertices(ret); ++i) {
for (unsigned int j = 0; j < i; ++j) {
if (get_intersection(pm[i], pm[j]).size() > 0) {
boost::add_edge(i, j, ret);
IMP_LOG_VERBOSE("Connecting " << rs[i]->get_name() << " with "
<< rs[j]->get_name() << std::endl);
}
}
}
return ret;
}