61int coletree(
const MatrixType& mat, IndexVector& parent, IndexVector& firstRowElt,
typename MatrixType::Index *perm=0)
63 typedef typename MatrixType::Index Index;
64 Index nc = mat.cols();
66 Index diagSize = (std::min)(nc,m);
71 parent.resize(mat.cols());
74 firstRowElt.resize(m);
75 firstRowElt.setConstant(nc);
76 firstRowElt.segment(0, diagSize).setLinSpaced(diagSize, 0, diagSize-1);
78 for (col = 0; col < nc; col++)
81 if(perm) pcol = perm[col];
82 for (
typename MatrixType::InnerIterator it(mat, pcol); it; ++it)
85 firstRowElt(row) = (std::min)(firstRowElt(row), col);
92 Index rset, cset, rroot;
93 for (col = 0; col < nc; col++)
103 if(perm) pcol = perm[col];
104 for (
typename MatrixType::InnerIterator it(mat, pcol); it||!found_diag; ++it)
107 if(it) i = it.index();
108 if (i == col) found_diag =
true;
110 row = firstRowElt(i);
111 if (row >= col)
continue;
131void nr_etdfs (Index n, IndexVector& parent, IndexVector& first_kid, IndexVector& next_kid, IndexVector& post, Index postnum)
133 Index current = n, first, next;
137 first = first_kid(current);
143 post(current) = postnum++;
146 next = next_kid(current);
150 current = parent(current);
152 post(current) = postnum++;
155 next = next_kid(current);
158 if (postnum == n+1)
return;
180 IndexVector first_kid, next_kid;
183 first_kid.resize(n+1);
184 next_kid.setZero(n+1);
189 first_kid.setConstant(-1);
190 for (v = n-1; v >= 0; v--)
193 next_kid(v) = first_kid(dad);
void nr_etdfs(Index n, IndexVector &parent, IndexVector &first_kid, IndexVector &next_kid, IndexVector &post, Index postnum)
Definition SparseColEtree.h:131
int coletree(const MatrixType &mat, IndexVector &parent, IndexVector &firstRowElt, typename MatrixType::Index *perm=0)
Definition SparseColEtree.h:61