本文整理汇总了C++中vec1类的典型用法代码示例。如果您正苦于以下问题:C++ vec1类的具体用法?C++ vec1怎么用?C++ vec1使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了vec1类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Graph
Graph(const vec1<vec1<VertexType> >& _points_in, int domain)
{
vec1<vec1<VertexType> > _points = compressGraph(_points_in);
if(_points.size() > domain)
throw GAPException("Graph too large");
edges = _points;
edges.resize(domain);
for(int i : range1(_points.size()))
{
int i_size = _points[i].size();
for(int j = 1; j <= i_size; ++j)
{
if(_points[i][j].target() <= 0 || _points[i][j].target() > domain) {
throw GAPException("Graph contains out-of-bounds vertex: " + toString(_points[i][j].target()));
}
if(_points[i][j].colour() < 0 ) {
throw GAPException(" Graph contains invalid edge colour: " + toString(_points[i][j].colour()));
}
VertexType edge(i, _points[i][j].colour());
if(directed)
{
edge = edge.flipped();
}
edges[_points[i][j].target()].push_back(edge);
}
}
for(int i : range1(edges.size()))
{
std::set<VertexType> pntset(edges[i].begin(), edges[i].end());
edges[i] = vec1<VertexType>(pntset.begin(), pntset.end());
}
}
示例2: getscc
GAPStabChainWrapper getscc(const vec1<int>& v)
{
D_ASSERT(!fixed_base);
GAP_callFunction(FunObj_ChangeStabChain, stabChain, GAP_make(v));
GAPStabChainWrapper scc(stabChain);
if(v.empty())
return scc;
// Now we have to walk down the stabilizer chain, until we find the position where v ends
int pos = 1;
while(true)
{
int orbit = scc.getOrbitStart();
while(pos <= v.size() && v[pos] != orbit)
pos++;
if(pos > v.size())
{
return scc;
}
if(!scc.hasNextLevel())
return scc;
scc = scc.getNextLevel();
if(!scc.hasOrbit())
{
// Reached bottom, so exit early. getOrbitsPartition still handles this case.
return scc;
}
}
}
示例3: print_1d
std::string print_1d(const vec1<T>& vec){
std::stringstream ss;
ss << "[ ";
for (size_t i = 0; i < vec.size()-1; ++i){
ss << vec[i] << ", ";
}
ss << vec.back() << "]";
return ss.str();
}
示例4: invertVecAsPermutation
inline vec1<int> invertVecAsPermutation(const vec1<int>& v)
{
vec1<int> ret(v.size());
for(int i : range1(v.size()))
{
ret[v[i]] = i;
}
return ret;
}
示例5: fillRBaseOrbitalsCache
const vec1<OrbitalGraph>* fillRBaseOrbitalsCache(const vec1<int>& fix)
{
vec1<OrbitalGraph> orbitals = scc.orbitals(fix, ps->domainSize());
if(original_orbitals.size() < fix.size() + 1)
original_orbitals.resize(fix.size() + 1);
original_orbitals[fix.size() + 1] = std::move(orbitals);
return &(original_orbitals[fix.size() + 1]);
}
示例6: fix_buildingRBase
SplitState fix_buildingRBase(const vec1<int>& fixed_values, bool useOrbits, bool useBlocks, bool useOrbitals, bool rootCall = false)
{
debug_out(3, "scpg", "last depth " << last_depth.get() << " new depth " << fixed_values.size());
D_ASSERT(fixed_values.size() > last_depth.get());
last_depth.set(fixed_values.size());
if(useOrbits)
{
doCacheCheck(config.useOrbits, tracking_first_found_orbits,
[this](const vec1<int>& v){ return this->fillRBaseOrbitPartitionCache(v); },
fixed_values, "orbits");
}
if(useBlocks)
{
doCacheCheck(config.useBlocks, tracking_first_found_blocks,
[this](const vec1<int>& v){ return this->fillRBaseBlocksCache(v); },
fixed_values, "blocks");
}
if(useOrbitals)
{
doCacheCheck(config.useOrbitals, tracking_first_found_orbitals,
[this](const vec1<int>& v){ return this->fillRBaseOrbitalsCache(v); },
fixed_values, "orbitals");
}
SplitState ss(true);
int fixed_size = fixed_values.size();
if(useOrbits)
{
const vec1<int>* part = 0;
if(tracking_first_found_orbits.get() >= 0)
part = this->getRBaseOrbitPartition_cached(tracking_first_found_orbits.get());
else
part = this->getRBaseOrbitPartition_cached(fixed_size);
debug_out(3, "scpg", "fix_rBase:orbits");
if(!part->empty())
ss = filterPartitionStackByFunction(ps, SquareBrackToFunction(part));
if(ss.hasFailed())
return ss;
}
if( ( StabChainConfig::doConsiderIfNonTrivial(config.useOrbitals)
&& fixed_size == tracking_first_found_orbitals.get() ) ||
( config.useOrbitals == StabChainConfig::always ) ||
( rootCall ) )
{ return signal_changed_generic(range1(ps->cellCount()), identityPermutation()); }
return ss;
}
示例7: getRBaseOrbitals_cached
const vec1<OrbitalGraph>* getRBaseOrbitals_cached(int s)
{
if(s < original_orbitals.size())
return &(original_orbitals[s+1]);
else
return 0;
}
示例8: getRBaseBlocks_cached
const vec1<std::map<int,int> >* getRBaseBlocks_cached(int s)
{
if(s < original_blocks.size())
return &(original_blocks[s+1]);
else
return 0;
}
示例9: getRBaseOrbitPartition_cached
const vec1<int>* getRBaseOrbitPartition_cached(int s)
{
if(s < original_partitions.size())
return &(original_partitions[s+1]);
else
return 0;
}
示例10: fillRBaseBlocksCache
const vec1<std::map<int,int> >* fillRBaseBlocksCache(const vec1<int>& fix)
{
vec1<vec1<vec1<int> > > blocks = scc.blocks(fix);
vec1<std::map<int,int> > block_functions;
for(int i : range1(blocks.size()))
{
block_functions.push_back(partitionToMap(blocks[i]));
}
if(original_blocks.size() < fix.size() + 1)
original_blocks.resize(fix.size() + 1);
original_blocks[fix.size() + 1] = std::move(block_functions);
return &(original_blocks[fix.size() + 1]);
}
示例11: partitionToList
inline vec1<int> partitionToList(const vec1<vec1<int> >& part, int size, MissingPoints mp)
{
vec1<int> vec(size, 0);
int covered = 1;
for(int i : range1(part.size()))
{
for(int val : part[i])
{
D_ASSERT(vec[val] == 0);
vec[val] = i;
covered++;
}
}
// Maybe the permutation is missing some values of the end. These
// should all be treated as defined by 'MissingPoints'
if(mp == MissingPoints_Fixed)
{
for(int i : range1(vec.size()))
{
if(vec[i] == 0)
vec[i] = vec.size() + 1 + i; // (is +1 required? It doesn't hurt)
}
}
return vec;
}
示例12: check_transversal
bool check_transversal(const vec1<Permutation>& trans, int start, int end)
{
for(int i : range1(trans.size()))
{
start = trans[i][start];
}
return start == end;
}
示例13: getMins
vec1<int> getMins() const
{
vec1<int> minimums;
for(int i : range1(orbit_mins.size()))
{
if(isMinimum(i))
minimums.push_back(i);
}
return minimums;
}
示例14: initalize
void initalize(const vec1<int>& order)
{
D_ASSERT(!fixed_base);
fixed_base = true;
unpacked_stabChain_depth.resize(order.size());
GAP_callFunction(FunObj_ChangeStabChain, stabChain, GAP_make(order));
debug_out(1, "SCC", "Setting up cache");
debug_out(3, "SCC", "Order " << order);
int order_pos = 1;
GAPStabChainWrapper stabChainCpy(stabChain);
do
{
StabChainLevel scl(stabChainCpy);
while(order[order_pos] != scl.base_value)
{
debug_out(3, "SCC", "Skipping depth " << order_pos);
order_pos++;
}
debug_out(3, "SCC", "Setting depth "<<order_pos<<" base point "<<scl.base_value);
levels.push_back(scl);
unpacked_stabChain_depth[order_pos] = levels.size();
stabChainCpy = stabChainCpy.getNextLevel();
}
while(stabChainCpy.hasNextLevel());
#ifndef NO_DEBUG
for(int i : range1(unpacked_stabChain_depth.size()))
{
if(unpacked_stabChain_depth[i] != 0)
{
D_ASSERT(levels[unpacked_stabChain_depth[i]].base_value == order[i]);
}
}
#endif
}
示例15: operator
HDINLINE float_X operator()(const float_X N, const float_X omega, const vec1 observer_unit_vec) const
{
/* Form Factor for CIC charge distribution of N discrete electrons:
* | \mathcal{F} |^2 = N + (N*N - N) * sinc^2(n_x * L_x * \omega) * sinc^2(n_y * L_y * \omega) * sinc^2(n_z * L_z * \omega)
*
* with observation direction (unit vector) \vec{n} = (n_x, n_y, n_z)
* and with: N = weighting
* omega = frequency
* L_d = the size of the CIC-particle / cell in dimension d
*
* the Form Factor: sqrt( | \mathcal{F} |^2 ) will be returned
*/
return sqrt(N + (N*N - N) * util::square(
math::sinc( observer_unit_vec.x() * CELL_WIDTH/(SPEED_OF_LIGHT*2) * omega) *
math::sinc( observer_unit_vec.y() * CELL_HEIGHT/(SPEED_OF_LIGHT*2) * omega) *
math::sinc( observer_unit_vec.z() * CELL_DEPTH/(SPEED_OF_LIGHT*2) * omega)
)
);
}