2 #ifndef _LILC_MATRIX_SYM_RCM_H_ 3 #define _LILC_MATRIX_SYM_RCM_H_ 9 template <
class el_type>
13 bool operator()(
int const &a,
int const &b)
const {
14 int deg_a = A->
list[a].size() + A->
m_idx[a].size();
15 int deg_b = A->
list[b].size() + A->
m_idx[b].size();
17 if (A->
m_idx[a].size() > 0 && A->
m_idx[a][0] == a) deg_a--;
18 if (A->
m_idx[b].size() > 0 && A->
m_idx[b][0] == b) deg_b--;
20 if (deg_a == deg_b)
return a > b;
26 template<
class el_type>
29 vector<bool> visited(m_n_cols,
false);
31 for (i = 0; i < m_n_cols; i++) {
32 if (visited[i])
continue;
40 by_degree<el_type> sorter(
this);
43 while (find_level_set(lvl_set, visited)) {
44 sort(lvl_set.begin(), lvl_set.end(), sorter);
45 perm.insert( perm.end(), lvl_set.begin(), lvl_set.end() );
49 reverse(perm.begin(), perm.end());
vector< idx_vector_type > m_idx
The row/col indices. The way m_idx is used depends on whether the matrix is in LIL-C or LIL-R...
Definition: lil_sparse_matrix.h:35
A list-of-lists (LIL) matrix in column oriented format.
Definition: lilc_matrix.h:9
void sym_rcm(vector< int > &perm)
Returns a Reverse Cuthill-McKee ordering of the matrix A (stored in perm).
Definition: lilc_matrix_sym_rcm.h:27
std::vector< std::vector< int > > list
A list of linked lists that gives the non-zero elements in each row of A. Since at any time we may sw...
Definition: lilc_matrix_declarations.h:44