Esempio n. 1
0
  mtmetis( const Space& base, const Family& tau )
    : base_( base ), tau_( tau ), nvtxs_( base_.size() )
  {
    xadj_ = new int[ nvtxs_ + 1 ];

    std::vector< Space > adjs;
    int offset = 0;
    xadj_[ 0 ] = 0;
    for ( typename Space::const_iterator it = base_.begin()
        ; it != base_.end(); ++it
        )
    { // Be care of retreaving diagonals.
      const Space& s = tau_( CPoint( it ).element );
      Space p; p.join( CPoint( it ).element );

      adjs.push_back( s / p );
      xadj_[ CPoint( it ).index + 1 ] = adjs[ offset++ ].size();
    }
    for ( int i = 0; i < nvtxs_; ++i ) xadj_[ i + 1 ] += xadj_[ i ];

    adjy_ = new int[ xadj_[ nvtxs_ ] ];
    offset = 0;
    for ( typename Space::const_iterator it = base_.begin()
        ; it != base_.end(); ++it
        )
    {
      const Space& adj = adjs[ offset++ ];
      int i = CPoint( it ).index;
      int k = 0;

      for ( typename Space::const_iterator jt = adj.begin()
          ; jt != adj.end(); ++jt
          )
      {
        int j = base_.index( CPoint( jt ).element );

        adjy_[ xadj_[ i ] + k ] = j;
        ++k;
      }
    }
    perm_ = new int[ nvtxs_ ];
    iperm_ = new int[ nvtxs_ ];

    reorder();
  }
Esempio n. 2
0
        generator( const Matrix& A ) : A_( A )
        {
            const int c = 0;
            const int *ind = A_.ind(), *col = A_.col();

            for ( int i = 0; i < A_.m(); ++i ) base_.join( Element( i, c ) );
            for ( int i = 0; i < A_.m(); ++i )
            {
                Neighbour u( i, c );

                for ( int k = ind[ i ]; k < ind[ i + 1 ]; ++k )
                {
                    int j = col[ k ];

                    u.join( j, c );
                }
                topo_.join( u );
            }
        }