30#ifndef SPARSELU_COLUMN_DFS_H
31#define SPARSELU_COLUMN_DFS_H
33template <
typename Scalar,
typename StorageIndex>
36#include "./InternalHeaderCheck.h"
42template <
typename IndexVector,
typename ScalarVector>
43struct column_dfs_traits : no_assignment_operator {
44 typedef typename ScalarVector::Scalar Scalar;
45 typedef typename IndexVector::Scalar StorageIndex;
46 column_dfs_traits(Index jcol, Index& jsuper,
typename SparseLUImpl<Scalar, StorageIndex>::GlobalLU_t& glu,
47 SparseLUImpl<Scalar, StorageIndex>& luImpl)
48 : m_jcol(jcol), m_jsuper_ref(jsuper), m_glu(glu), m_luImpl(luImpl) {}
49 bool update_segrep(Index , Index ) {
return true; }
50 void mem_expand(IndexVector& lsub, Index& nextl, Index chmark) {
51 if (nextl >= m_glu.nzlmax) m_luImpl.memXpand(lsub, m_glu.nzlmax, nextl, LSUB, m_glu.num_expansions);
52 if (chmark != (m_jcol - 1)) m_jsuper_ref = emptyIdxLU;
54 enum { ExpandMem =
true };
58 typename SparseLUImpl<Scalar, StorageIndex>::GlobalLU_t& m_glu;
59 SparseLUImpl<Scalar, StorageIndex>& m_luImpl;
89template <
typename Scalar,
typename StorageIndex>
90Index SparseLUImpl<Scalar, StorageIndex>::column_dfs(
const Index m,
const Index jcol, IndexVector& perm_r,
91 Index maxsuper, Index& nseg, BlockIndexVector lsub_col,
92 IndexVector& segrep, BlockIndexVector repfnz, IndexVector& xprune,
93 IndexVector& marker, IndexVector& parent, IndexVector& xplore,
95 Index jsuper = glu.supno(jcol);
96 Index nextl = glu.xlsub(jcol);
97 VectorBlock<IndexVector> marker2(marker, 2 * m, m);
99 column_dfs_traits<IndexVector, ScalarVector> traits(jcol, jsuper, glu, *
this);
102 for (Index k = 0; ((k < m) ? lsub_col[k] != emptyIdxLU : false); k++) {
103 Index krow = lsub_col(k);
104 lsub_col(k) = emptyIdxLU;
105 Index kmark = marker2(krow);
108 if (kmark == jcol)
continue;
110 dfs_kernel(StorageIndex(jcol), perm_r, nseg, glu.lsub, segrep, repfnz, xprune, marker2, parent, xplore, glu, nextl,
115 StorageIndex nsuper = glu.supno(jcol);
116 StorageIndex jcolp1 = StorageIndex(jcol) + 1;
117 Index jcolm1 = jcol - 1;
121 nsuper = glu.supno(0) = 0;
123 fsupc = glu.xsup(nsuper);
124 StorageIndex jptr = glu.xlsub(jcol);
125 StorageIndex jm1ptr = glu.xlsub(jcolm1);
128 if ((nextl - jptr != jptr - jm1ptr - 1)) jsuper = emptyIdxLU;
132 if ((jcol - fsupc) >= maxsuper) jsuper = emptyIdxLU;
139 if (jsuper == emptyIdxLU) {
140 if ((fsupc < jcolm1 - 1)) {
141 StorageIndex ito = glu.xlsub(fsupc + 1);
142 glu.xlsub(jcolm1) = ito;
143 StorageIndex istop = ito + jptr - jm1ptr;
144 xprune(jcolm1) = istop;
145 glu.xlsub(jcol) = istop;
147 for (StorageIndex ifrom = jm1ptr; ifrom < nextl; ++ifrom, ++ito) glu.lsub(ito) = glu.lsub(ifrom);
151 glu.supno(jcol) = nsuper;
156 glu.xsup(nsuper + 1) = jcolp1;
157 glu.supno(jcolp1) = nsuper;
158 xprune(jcol) = StorageIndex(nextl);
159 glu.xlsub(jcolp1) = StorageIndex(nextl);
Namespace containing all symbols from the Eigen library.
Definition Core:137