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


C++ vec1::size方法代码示例

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


在下文中一共展示了vec1::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: filterGraph

 SplitState filterGraph(PartitionStack* ps, const GraphType& points,
                        const CellList& cells, int path_length)
 {
     // Would not normally go this low level, but it is important this is fast
     memset(&(mset.front()), 0, mset.size() * sizeof(mset[0]));
     edgesconsidered = 0;
     MonoSet monoset(ps->cellCount());
     debug_out(3, "EdgeGraph", "filtering: " << cells.size() << " cells out of " << ps->cellCount());
     if(path_length == 1) {
         for(int c : cells)
         {
             hashCellSimple(ps, points, monoset, c);
         }
     }
     else
     {
         MonoSet hitvertices(ps->domainSize());
         for(int c : cells)
         {
             hashRangeDeep(ps, points, monoset, hitvertices, ps->cellRange(c));
         }
         
         memset(&(msetspare.front()), 0, msetspare.size() * sizeof(msetspare[0]));
         hashRangeDeep2(ps, points, monoset, hitvertices.getMembers());
         for(int i : range1(mset.size())) {
             mset[i] += msetspare[i] * 71;
         }
     }
     debug_out(3, "EdgeGraph", "filtering " << mset << " : " << monoset);
     return filterPartitionStackByFunctionWithCells(ps, SquareBrackToFunction(&mset), monoset);
 }
开发者ID:markuspf,项目名称:ferret,代码行数:31,代码来源:edgecolouredgraph.hpp

示例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;
         }
     }
 }
开发者ID:gap-packages,项目名称:ferret,代码行数:28,代码来源:stabchain_perm_group.hpp

示例3: 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;
}
开发者ID:markuspf,项目名称:ferret,代码行数:9,代码来源:algorithms.hpp

示例4: 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;
    }
开发者ID:gap-packages,项目名称:ferret,代码行数:53,代码来源:stabchain_perm_group.hpp

示例5: addSolution

    void addSolution(const Permutation& sol)
    {
        permutations.push_back(sol);
        D_ASSERT(sol.size() == orbit_mins.size());
        debug_out(3, "SS", "Old orbit_mins:" << orbit_mins);
        for(int i : range1(sol.size()))
        {
            if(sol[i] != i)
            {
                int val1 = walkToMinimum(i);
                int val2 = walkToMinimum(sol[i]);
                int orbit_min = -1;
                if(comparison(val1, val2))
                    orbit_min = val1;
                else
                    orbit_min = val2;

                update_orbit_mins(orbit_min, val1);
                update_orbit_mins(orbit_min, val2);
                update_orbit_mins(orbit_min, i);
                update_orbit_mins(orbit_min, sol[i]);
            }
        }
        debug_out(1, "SS", "Solution found");
        debug_out(3, "SS", "Sol:" << sol);
        debug_out(3, "SS", "New orbit_mins:" << orbit_mins);
    }
开发者ID:gap-packages,项目名称:ferret,代码行数:27,代码来源:solution_store.hpp

示例6: GAPException

  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());
    }
  }
开发者ID:markuspf,项目名称:ferret,代码行数:35,代码来源:graph.hpp

示例7: 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;
}
开发者ID:markuspf,项目名称:ferret,代码行数:25,代码来源:algorithms.hpp

示例8: exists_perm_to

    bool exists_perm_to(int i)
    {
        if(transversal.size() < i)
            return false;

        return transversal[i];
    }
开发者ID:gap-packages,项目名称:ferret,代码行数:7,代码来源:stabchain_perm_group.hpp

示例9:

 const vec1<OrbitalGraph>* getRBaseOrbitals_cached(int s)
 {
     if(s < original_orbitals.size())
         return &(original_orbitals[s+1]);
     else
         return 0;
 }
开发者ID:gap-packages,项目名称:ferret,代码行数:7,代码来源:stabchain_perm_group.hpp

示例10: 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;
 }
开发者ID:gap-packages,项目名称:ferret,代码行数:8,代码来源:stabchain_perm_group.hpp

示例11: verifySolution

 virtual bool verifySolution(const Permutation& p)
 {
     for(int i : range1(points.size()))
     {
         if(p[points[i]] != points[i])
             return false;
     }
     return true;
 }
开发者ID:markuspf,项目名称:ferret,代码行数:9,代码来源:liststab.hpp

示例12:

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();
}
开发者ID:Blonck,项目名称:consus,代码行数:9,代码来源:helper.hpp

示例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;
 }
开发者ID:gap-packages,项目名称:ferret,代码行数:10,代码来源:solution_store.hpp

示例14: 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]);
    }
开发者ID:gap-packages,项目名称:ferret,代码行数:11,代码来源:stabchain_perm_group.hpp

示例15: 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
    }
开发者ID:gap-packages,项目名称:ferret,代码行数:40,代码来源:stabchain_perm_group.hpp


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