sym-ildl  1.2
Incomplete LDL' factorizations of indefinite symmetric and skew-symmetric matrices.
lilc_matrix_find_root.h
1 // -*- mode: c++ -*-
2 #ifndef _LILC_MATRIX_FIND_ROOT_H_
3 #define _LILC_MATRIX_FIND_ROOT_H_
4 
5 template<class el_type>
6 inline void lilc_matrix<el_type> :: find_root(int& s) {
7  vector<bool> visited(m_n_cols, false);
8  vector<int> lvl_set;
9  int ls_max = 0, ls = 0;
10 
11  while (true) {
12  lvl_set.clear();
13  std::fill(visited.begin(), visited.end(), false);
14  ls = 0;
15 
16  lvl_set.push_back(s);
17  visited[s] = true;
18  while (find_level_set(lvl_set, visited))
19  ls++;
20 
21  if (ls > ls_max) {
22  ls_max = ls;
23  int deg, min_deg = m_n_cols;
24  for (idx_it it = lvl_set.begin(); it != lvl_set.end(); it++) {
25  deg = list[*it].size() + m_idx[*it].size();
26  if (m_idx[*it].size() > 0 && m_idx[*it][0] == *it) deg--;
27  if (deg < min_deg) { //should consider tie breaking by index later if needed.
28  min_deg = deg;
29  s = *it;
30  }
31  }
32  } else {
33  break;
34  }
35  }
36 }
37 
38 #endif
void find_root(int &s)
Returns a pseudo-peripheral root of A. This is essentially many chained breadth-first searchs across ...
Definition: lilc_matrix_find_root.h:6